@font-face {
  font-family: 'AtelierSerif';
  src: url('assets/fonts/CormorantGaramond.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Onest';
  src: url('assets/fonts/Onest.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #FAF7F0;
  --bg-alt: #F3EFE4;
  --surface: #FFFDF8;
  --ink: #42352D;
  --muted: #7A6A5F;
  --border: rgba(66, 53, 45, 0.14);
  --border-strong: rgba(66, 53, 45, 0.24);
  --sage: #D6DFC3;
  --sky: #D2DDE7;
  --berry: #D5A0A8;
  --berry-soft: rgba(213, 160, 168, 0.22);
  --sunrise: #EE9F80;
  --sunrise-hover: #E68F6D;
  --sunrise-ink: #42352D;
  --card-espresso: #42352D;
  --shadow: 0 12px 28px rgba(66, 53, 45, 0.08);
  --shadow-lg: 0 18px 40px rgba(66, 53, 45, 0.12);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
}

:root[data-theme="dark"] {
  --bg: #261F1B;
  --bg-alt: #2C241F;
  --surface: #312823;
  --ink: #F5EFE6;
  --muted: #BCAEA2;
  --border: rgba(245, 239, 230, 0.15);
  --border-strong: rgba(245, 239, 230, 0.28);
  --sage: #3D4735;
  --sky: #33414D;
  --berry: #5E3E45;
  --berry-soft: rgba(213, 160, 168, 0.16);
  --sunrise: #EE9F80;
  --sunrise-hover: #F3AF94;
  --sunrise-ink: #261F1B;
  --card-espresso: #42352D;
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 22px 44px rgba(0, 0, 0, 0.44);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Onest', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.88em;
}

[hidden] {
  display: none !important;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.serif-title {
  font-family: 'AtelierSerif', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.mono-label {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  width: 32px;
  height: 34px;
  border-radius: 10px;
  background: #D6DFC3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.brand-mark-n {
  font-family: 'AtelierSerif', Georgia, serif;
  font-style: italic;
  font-size: 27px;
  font-weight: 500;
  line-height: 1;
  color: #42352D;
  transform: translate(-2px, -1px);
}

.brand-mark-dot {
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: #EE9F80;
  position: absolute;
  right: 5px;
  bottom: 7px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.brand-sub {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.24em;
  color: var(--muted);
  margin-top: 2px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.site-nav a {
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s ease;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--ink);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.share-header-btn:hover {
  background: var(--bg-alt);
  border-color: var(--border-strong);
}

.share-header-btn.is-copied {
  background: var(--sage);
}

.lang-switch,
.theme-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.lang-btn,
.theme-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-btn[aria-pressed="true"],
.theme-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

/* Hero */
.hero {
  padding: 56px 0 72px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 48px;
  align-items: center;
}

.release-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 20px;
}

.release-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #EE9F80;
  flex-shrink: 0;
}

.hero-copy h1 {
  font-family: 'AtelierSerif', Georgia, serif;
  font-size: clamp(38px, 5vw, 56px);
  line-height: 1.03;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  font-weight: 600;
}

.hero-subtitle {
  font-size: 17px;
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 560px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active {
  transform: scale(0.985);
}

.btn-primary {
  background: var(--sunrise);
  color: var(--sunrise-ink);
}

.btn-primary:hover {
  background: var(--sunrise-hover);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--bg-alt);
}

.hero-meta {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

/* Interactive Hero 3D Flip Stack */
.hero-visual {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.demo-card-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.demo-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.demo-chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.flip-stack-wrap {
  position: relative;
  padding: 10px 8px 10px 0;
}

.flip-stack-back {
  position: absolute;
  inset: 10px 0 10px 6px;
  border-radius: var(--radius-lg);
  background: #D2DDE7;
  transform: rotate(2.1deg);
  pointer-events: none;
}

:root[data-theme="dark"] .flip-stack-back {
  background: #33414D;
}

.flip-card-btn {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  perspective: 1100px;
  text-align: left;
  font: inherit;
  display: block;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  min-height: 292px;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.flip-card-btn.is-flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
}

.flip-front {
  background: #D6DFC3;
  color: #42352D;
}

.flip-back {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  transform: rotateY(180deg);
}

.flip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.flip-front .mono-label {
  color: rgba(66, 53, 45, 0.72);
}

.flip-word {
  font-family: 'AtelierSerif', Georgia, serif;
  font-size: clamp(32px, 4vw, 40px);
  line-height: 1.05;
  margin: 14px 0 6px;
  font-weight: 600;
}

.flip-ipa {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12.5px;
  opacity: 0.78;
}

.flip-forms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.form-pill {
  background: rgba(250, 247, 240, 0.72);
  color: #42352D;
  padding: 4px 10px;
  border-radius: 10px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
}

:root[data-theme="dark"] .flip-back .form-pill {
  background: var(--sky);
  color: var(--ink);
}

.flip-example {
  font-style: italic;
  font-size: 14.5px;
  margin: 12px 0 0;
  opacity: 0.9;
}

.flip-translation {
  font-family: 'AtelierSerif', Georgia, serif;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 600;
  margin: 12px 0 8px;
}

.flip-nuance {
  background: var(--berry-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin: 8px 0;
}

.flip-footer {
  border-top: 1px solid rgba(66, 53, 45, 0.2);
  padding-top: 12px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}

.flip-back .flip-footer {
  border-top-color: var(--border);
}

/* Sections */
.section {
  padding: 72px 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-head {
  max-width: 680px;
  margin-bottom: 36px;
}

.section-head h2 {
  font-family: 'AtelierSerif', Georgia, serif;
  font-size: clamp(30px, 3.6vw, 40px);
  line-height: 1.08;
  margin: 8px 0 12px;
}

.section-head p {
  color: var(--muted);
  margin: 0;
  font-size: 16px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--sage);
  color: var(--ink);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
}

:root:not([data-theme="dark"]) .card-badge {
  color: #42352D;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

/* Modules */
.module-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.module-tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 16px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.module-tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.module-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}

.module-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 28px;
  align-items: center;
}

.module-info h3 {
  font-family: 'AtelierSerif', Georgia, serif;
  font-size: 28px;
  line-height: 1.12;
  margin: 0 0 10px;
}

.module-lead {
  color: var(--muted);
  margin: 0 0 16px;
}

.feature-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  font-size: 14.5px;
}

.module-mockup {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.mockup-bar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.mockup-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sunrise);
}

.mockup-body {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.mock-kv {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}

.mock-pill {
  background: var(--sage);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Topics catalog strip */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.topic-card strong {
  display: block;
  font-size: 16px;
  margin-bottom: 4px;
}

.topic-card span {
  font-size: 13.5px;
  color: var(--muted);
}

.stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 24px;
}

.stat-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.stat-chip strong {
  font-family: 'AtelierSerif', Georgia, serif;
  font-size: 32px;
  line-height: 1;
}

.stat-chip span {
  font-size: 13.5px;
  color: var(--muted);
}

/* Download & Releases */
.download-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.download-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow);
}

.download-card.featured {
  background: var(--sage);
  color: #42352D;
}

:root[data-theme="dark"] .download-card.featured {
  color: var(--ink);
}

.download-card h3 {
  font-family: 'AtelierSerif', Georgia, serif;
  font-size: 26px;
  line-height: 1.1;
  margin: 6px 0 8px;
}

.download-card p {
  margin: 0;
  font-size: 14px;
  opacity: 0.85;
}

.download-meta {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  opacity: 0.78;
}

.sha-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11.5px;
}

.sha-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-mini {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.release-notes-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.release-notes-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.release-notes-content h4 {
  margin: 12px 0 6px;
  font-size: 15px;
}

.release-notes-content ul {
  margin: 6px 0;
  padding-left: 18px;
  color: var(--muted);
}

.release-notes-content p {
  margin: 6px 0;
  color: var(--muted);
}

/* FAQ */
.faq-list {
  display: grid;
  gap: 12px;
  max-width: 820px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
}

.faq-item summary {
  font-weight: 600;
  font-size: 15.5px;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-item summary::after {
  content: '+';
  font-size: 20px;
  color: var(--muted);
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14.5px;
}

/* Footer & Toast */
.site-footer {
  padding: 36px 0 48px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13.5px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 16px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 960px) {
  .site-nav {
    display: none;
  }
  .hero-grid,
  .module-grid,
  .cards-grid,
  .topics-grid,
  .download-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .header-inner {
    flex-wrap: wrap;
    padding: 10px 0;
  }
  .share-header-btn span {
    display: none;
  }
  .flip-card-inner {
    min-height: 318px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flip-card-inner {
    transition: none;
  }
}
