*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #eeedfb;
  --bg-card:      #ffffff;
  --bg-input:     #e6e3f8;
  --text:         #0A0618;
  --text-muted:   #4a4270;
  --text-light:   #9690c0;
  --accent:       #6C31E5;
  --accent-hover: #5822cc;
  --accent-soft:  #C4BDFE;
  --accent-blue:  #2421FE;
  --accent-green: #DAE9DF;
  --border:       #d3cefc;
  --border-strong:#b0a8f0;
  --tag-bg:       #e2defa;
  --shadow:       0 1px 4px rgba(108,49,229,0.10), 0 8px 32px rgba(108,49,229,0.10);
  --radius:       6px;
  --font-ui:      'DM Sans', sans-serif;
  --font-display: 'DM Serif Display', serif;
}

[data-theme="dark"] {
  --bg:           #0A0618;
  --bg-card:      #110d24;
  --bg-input:     #0e0b1e;
  --text:         #C4BDFE;
  --text-muted:   #8880b8;
  --text-light:   #4a4470;
  --accent:       #6C31E5;
  --accent-hover: #7c42f0;
  --accent-soft:  #C4BDFE;
  --accent-blue:  #2421FE;
  --accent-green: #DAE9DF;
  --border:       #1e1a3a;
  --border-strong:#2e2858;
  --tag-bg:       #150f2e;
  --shadow:       0 1px 4px rgba(0,0,0,0.4), 0 8px 32px rgba(0,0,0,0.3);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
}

/* colour strip */
.swatch-strip { display: flex; height: 4px; }
.swatch-strip span { flex: 1; }

/* NAV */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 clamp(1.5rem, 5vw, 4rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  backdrop-filter: blur(10px);
  transition: background 0.3s, border-color 0.3s;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
}

[data-theme="dark"] .nav-logo { color: #fff; }

.nav-logo-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 3px 3px;
}

.nav-right { display: flex; align-items: center; gap: 0.5rem; }

.nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover { color: var(--accent); background: var(--tag-bg); }

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.theme-toggle:hover { border-color: var(--accent-soft); color: var(--accent); }

/* HERO */
.hero {
  padding: clamp(3rem, 8vw, 7rem) clamp(1.5rem, 5vw, 4rem) clamp(2.5rem, 6vw, 5rem);
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(196,189,254,0.4) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -60px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(36,33,254,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hero > * { position: relative; z-index: 1; }

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--tag-bg);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.875rem;
  border-radius: 100px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 14ch;
  margin-bottom: 1.5rem;
  color: var(--text);
}

[data-theme="dark"] .hero h1 { color: #ffffff; }

.hero h1 em { font-style: italic; color: var(--accent); }

.hero-desc {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 52ch;
  line-height: 1.75;
  margin-bottom: 2.5rem;
}

.hero-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.hero-cta:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(108,49,229,0.35);
}

.hero-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.hero-secondary:hover { border-color: var(--accent-soft); color: var(--accent); }

/* SECTIONS */
section {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) clamp(1.5rem, 5vw, 4rem);
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

/* ABOUT */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.25rem;
  margin-top: 2rem;
}

@media (max-width: 768px) { .about-grid { grid-template-columns: 1fr; } }

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.75rem;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.about-card:hover {
  border-color: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.about-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.about-card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

[data-theme="dark"] .about-card h3 { color: var(--accent-soft); }

.about-card p { font-size: 0.875rem; color: var(--text-muted); line-height: 1.7; }

/* DIVIDER */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 clamp(1.5rem, 5vw, 4rem);
}

/* GENERATOR */
.gen-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) clamp(1.5rem, 5vw, 4rem);
}

.gen-wrapper h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.02em;
  margin: 0.25rem 0 1.5rem;
}

[data-theme="dark"] .gen-wrapper h2 { color: #ffffff; }

.gen-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.gen-controls {
  padding: 1.5rem 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-end;
  border-bottom: 1px solid var(--border);
  background: var(--bg-input);
}

.control-group { display: flex; flex-direction: column; gap: 0.4rem; }

.control-group label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.seg-control {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.seg-control button {
  padding: 0.5rem 1.1rem;
  font-size: 0.875rem;
  font-family: var(--font-ui);
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.seg-control button.active { background: var(--accent); color: #fff; }
.seg-control button:not(.active):hover { background: var(--tag-bg); color: var(--text); }

.num-input {
  width: 80px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  font-family: var(--font-ui);
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.num-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,49,229,0.15); }

.lang-select {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font-ui);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  cursor: pointer;
  min-width: 180px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.lang-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,49,229,0.15); }

.checkbox-group { display: flex; align-items: center; gap: 0.5rem; padding-bottom: 0.1rem; }

.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.checkbox-group label {
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  cursor: pointer;
}

.gen-btn {
  padding: 0.55rem 1.5rem;
  font-size: 0.9375rem;
  font-family: var(--font-ui);
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.gen-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(108,49,229,0.35);
}

.gen-btn:active { transform: translateY(0); box-shadow: none; }

.gen-output { padding: 2rem; min-height: 220px; }

.output-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.output-meta { font-size: 0.8125rem; color: var(--text-light); font-variant-numeric: tabular-nums; }

.output-actions { display: flex; gap: 0.5rem; }

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-family: var(--font-ui);
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover { color: var(--accent); border-color: var(--accent-soft); background: var(--bg-card); }

.action-btn.copied {
  background: rgba(218,233,223,0.4);
  color: #1a6640;
  border-color: rgba(26,102,64,0.3);
}

[data-theme="dark"] .action-btn.copied {
  background: rgba(218,233,223,0.1);
  color: var(--accent-green);
  border-color: rgba(218,233,223,0.25);
}

.output-text {
  font-size: 1.0625rem;
  line-height: 1.9;
  color: var(--text);
  font-family: var(--font-display);
  letter-spacing: 0.005em;
}

.output-text.script-ja { font-family: 'Noto Serif JP', serif; font-size: 1rem; line-height: 2.1; letter-spacing: 0.05em; }
.output-text.script-ko { font-family: 'Noto Serif KR', serif; font-size: 1rem; line-height: 2.0; letter-spacing: 0.03em; }
.output-text.script-hi { font-family: 'Noto Serif Devanagari', serif; font-size: 1.0625rem; line-height: 2.1; letter-spacing: 0.01em; }
.output-text.script-ml { font-family: 'Noto Serif Malayalam', serif; font-size: 1.0625rem; line-height: 2.2; letter-spacing: 0.01em; }

[data-theme="dark"] .output-text { color: var(--accent-soft); }

.output-text p + p { margin-top: 1.25em; }

.output-placeholder {
  color: var(--text-light);
  font-size: 0.9375rem;
  font-style: italic;
  text-align: center;
  padding: 4rem 0;
  opacity: 0.7;
}

/* ORIGIN */
.origin-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
  margin-top: 2rem;
}

@media (max-width: 768px) { .origin-layout { grid-template-columns: 1fr; gap: 2rem; } }

.origin-text h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

[data-theme="dark"] .origin-text h2 { color: #ffffff; }

.origin-text p { font-size: 0.9375rem; color: var(--text-muted); line-height: 1.8; margin-bottom: 1rem; }

.origin-quote {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.7;
  margin-top: 1.5rem;
}

[data-theme="dark"] .origin-quote { color: var(--accent-soft); }

.origin-quote cite {
  display: block;
  font-style: normal;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-top: 0.75rem;
}

/* TIMELINE */
.timeline { display: flex; flex-direction: column; }

.timeline-item {
  display: flex;
  gap: 1.25rem;
  padding-bottom: 1.75rem;
  position: relative;
}

.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 19px;
  top: 40px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--tag-bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.timeline-content h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  padding-top: 0.55rem;
  letter-spacing: -0.01em;
}

[data-theme="dark"] .timeline-content h4 { color: var(--accent-soft); }

.timeline-content p { font-size: 0.8375rem; color: var(--text-muted); line-height: 1.65; }

/* FOOTER */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem clamp(1.5rem, 5vw, 4rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  max-width: 1200px;
  margin: 2rem auto 0;
}

footer p { font-size: 0.8125rem; color: var(--text-light); }
footer a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
footer a:hover { color: var(--accent); }

/* ANIMATION */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.output-text { animation: fadeIn 0.28s ease; }
