@font-face {
  font-family: "Noto Sans Brahmi";
  src: url("../fonts/NotoSansBrahmi-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ink: #101820;
  --ink-soft: #2c3a48;
  --fog: #e6ecef;
  --mist: #c5d2db;
  --navy: #1a3350;
  --navy-deep: #0d1a2b;
  --copper: #c17a2e;
  --copper-soft: #e2b46a;
  --glacier: #7ea3b0;
  --bone: #edf1f3;
  --line: rgba(16, 24, 32, 0.12);
  --glow: rgba(193, 122, 46, 0.2);
  --font-display: "Cormorant Infant", "Palatino Linotype", serif;
  --font-body: "Sora", "Segoe UI", sans-serif;
  --font-script: "Noto Sans Brahmi", "Noto Sans", sans-serif;
  --radius: 3px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.55;
  background:
    radial-gradient(110% 70% at 0% -5%, #dbe6ec 0%, transparent 50%),
    radial-gradient(80% 55% at 100% 5%, #e8dcc8 0%, transparent 42%),
    radial-gradient(60% 45% at 60% 100%, #c9d8e0 0%, transparent 50%),
    linear-gradient(168deg, #eef3f5 0%, #e4ebef 45%, #d8e2e8 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image:
    repeating-linear-gradient(
      18deg,
      transparent,
      transparent 13px,
      rgba(26, 51, 80, 0.028) 13px,
      rgba(26, 51, 80, 0.028) 14px
    );
  z-index: 0;
}

a {
  color: var(--navy);
}

button,
input {
  font: inherit;
}

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

/* —— Hero —— */
.hero {
  min-height: 100svh;
  display: grid;
  align-items: stretch;
  position: relative;
  padding: 0;
  isolation: isolate;
}

.hero-stack {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100svh;
  padding: 1.25rem 0 3.5rem;
}

.hero-plane {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    linear-gradient(125deg, rgba(13, 26, 43, 0.96) 0%, rgba(26, 51, 80, 0.92) 52%, rgba(42, 32, 22, 0.9) 100%);
}

.aurora {
  position: absolute;
  inset: -20% -10%;
  background:
    radial-gradient(40% 35% at 70% 25%, rgba(126, 163, 176, 0.35), transparent 70%),
    radial-gradient(35% 40% at 20% 70%, rgba(193, 122, 46, 0.28), transparent 65%);
  animation: aurora-shift 14s ease-in-out infinite alternate;
}

@keyframes aurora-shift {
  from { transform: translate3d(-2%, 0, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.05); }
}

.script-wash {
  position: absolute;
  inset: auto 0 6% 0;
  display: flex;
  gap: 0.35rem;
  align-items: flex-end;
  opacity: 0.22;
  filter: brightness(1.8) contrast(0.9);
  white-space: nowrap;
  user-select: none;
  animation: drift 32s linear infinite;
  padding-inline: 1rem;
  pointer-events: none;
}

.script-wash img {
  width: clamp(2.2rem, 6vw, 3.6rem);
  height: clamp(2.2rem, 6vw, 3.6rem);
  object-fit: contain;
}

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(-6%); }
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: auto;
  padding-top: 0.5rem;
}

.nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.nav-pills a {
  color: rgba(237, 241, 243, 0.88);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(237, 241, 243, 0.22);
  border-radius: var(--radius);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.nav-pills a:hover,
.nav-pills a:focus-visible {
  background: rgba(237, 241, 243, 0.1);
  border-color: rgba(226, 180, 106, 0.55);
  outline: none;
}

.hero-copy {
  max-width: 38rem;
  color: var(--bone);
  animation: rise-in 0.9s var(--ease) both;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(3.1rem, 9vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  color: #f5f0e8;
}

.brand span {
  display: block;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--copper-soft);
  margin-bottom: 0.65rem;
}

.lede {
  margin: 0 0 1.6rem;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  color: rgba(237, 241, 243, 0.82);
  max-width: 34rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--copper);
  color: #1a1208;
  border-color: var(--copper-soft);
}

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

.btn-ghost {
  background: transparent;
  color: var(--bone);
  border-color: rgba(237, 241, 243, 0.35);
}

.btn-ghost:hover {
  border-color: var(--copper-soft);
  color: #fff;
}

.btn-solid {
  background: var(--navy);
  color: var(--bone);
  border-color: var(--navy-deep);
}

.btn-solid:hover {
  background: #243f5e;
}

.btn-quiet {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}

.btn-quiet:hover {
  border-color: var(--navy);
  color: var(--navy);
}

/* —— Sections —— */
main section {
  padding: 4.5rem 0;
  position: relative;
  z-index: 1;
}

#alistirma {
  background:
    linear-gradient(180deg, rgba(26, 51, 80, 0.04), transparent 30%),
    rgba(255, 255, 255, 0.28);
}

.section-head {
  margin-bottom: 1.6rem;
  max-width: 40rem;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  margin: 0 0 0.45rem;
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  color: var(--ink-soft);
}

/* —— Progress —— */
.progress-banner {
  margin-top: -1.5rem;
  margin-bottom: 0.5rem;
}

.progress-banner-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-left: 3px solid var(--copper);
  backdrop-filter: blur(6px);
}

.progress-banner p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.progress-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.mastery-strip {
  margin-bottom: 1rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.mastery-strip p {
  margin: 0;
  padding: 0.7rem 0.95rem;
  background: rgba(26, 51, 80, 0.06);
  border: 1px solid var(--line);
}

/* —— Path / filters —— */
.path-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}

.path-step {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  text-align: left;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  min-height: 44px;
}

.path-step:hover,
.path-step[aria-current="step"] {
  border-color: var(--navy);
  box-shadow: inset 0 0 0 1px rgba(26, 51, 80, 0.15);
}

.path-step[aria-current="step"] {
  background: rgba(26, 51, 80, 0.08);
}

.path-num {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--copper);
  line-height: 1;
}

.path-body {
  display: grid;
  gap: 0.15rem;
}

.path-body strong {
  font-size: 0.95rem;
}

.path-body small {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.filters,
.practice-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.chip {
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink-soft);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.88rem;
}

.chip[aria-pressed="true"] {
  background: var(--navy);
  color: var(--bone);
  border-color: var(--navy-deep);
}

.path-hint {
  min-height: 1.4em;
  margin: 0 0 1.1rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* —— Learn layout —— */
.learn-layout {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.letter-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  max-height: 70vh;
  overflow: auto;
  padding-right: 0.2rem;
}

.letter-cell {
  display: grid;
  gap: 0.2rem;
  place-items: center;
  min-height: 68px;
  padding: 0.45rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  border-radius: var(--radius);
}

.letter-cell .glyph,
.letter-cell .glyph-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.glyph-img {
  image-rendering: auto;
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 2px;
}

.glyph-img-lg {
  width: 120px;
  height: 120px;
}

.glyph-img-xl {
  width: 150px;
  height: 150px;
}

.letter-cell .meta {
  font-size: 0.7rem;
  color: var(--ink-soft);
}

.letter-cell[aria-current="true"] {
  border-color: var(--copper);
  box-shadow: inset 0 0 0 1px var(--glow);
}

.letter-cell.is-learned {
  background: rgba(126, 163, 176, 0.18);
}

.letter-cell.is-weak {
  border-color: rgba(193, 122, 46, 0.55);
}

.letter-stage {
  padding: 1.35rem 1.5rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 320px;
  animation: stage-fade 0.35s var(--ease);
}

@keyframes stage-fade {
  from { opacity: 0.4; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.stage-glyph-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}

.stage-glyph {
  line-height: 1;
  color: var(--navy-deep);
  display: flex;
  align-items: center;
  min-height: 150px;
}

.stage-glyph.is-gap {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--copper);
  font-size: 3rem;
}

.stage-alt {
  display: grid;
  gap: 0.2rem;
  font-family: var(--font-script);
  font-size: 2rem;
  color: var(--ink-soft);
}

.stage-alt small {
  font-family: var(--font-body);
  font-size: 0.75rem;
}

.stage-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: baseline;
  margin-bottom: 0.25rem;
}

.stage-title {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0;
  font-weight: 600;
}

.mastery-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.mastery-badge.is-on {
  background: rgba(126, 163, 176, 0.25);
  border-color: var(--glacier);
  color: var(--navy-deep);
}

.stage-latin {
  margin: 0 0 1rem;
  color: var(--ink-soft);
}

.stage-grid {
  display: grid;
  gap: 0.85rem;
  margin: 0 0 1.2rem;
}

.stage-grid dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--copper);
  margin-bottom: 0.2rem;
}

.stage-grid dd {
  margin: 0;
  color: var(--ink-soft);
}

.gap-flag {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  padding: 0.2rem 0.45rem;
  background: rgba(193, 122, 46, 0.12);
  border: 1px solid rgba(193, 122, 46, 0.35);
  color: #6b4318;
}

.stage-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* —— Practice —— */
.panel {
  display: none;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel.active {
  display: block;
}

.prompt-block {
  display: grid;
  gap: 0.85rem;
}

.prompt-glyph {
  line-height: 1;
  text-align: center;
  color: var(--navy-deep);
  padding: 0.5rem 0;
  display: flex;
  justify-content: center;
}

.prompt-glyph.is-gap {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--copper);
  font-size: 3rem;
}

.prompt-label {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0;
  text-align: center;
  font-weight: 600;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.choice {
  min-height: 52px;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  border-radius: var(--radius);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.choice:hover {
  border-color: var(--navy);
}

.choice.correct {
  background: rgba(126, 163, 176, 0.25);
  border-color: var(--glacier);
}

.choice.wrong {
  background: rgba(193, 122, 46, 0.12);
  border-color: var(--copper);
}

.choice-glyph,
.choice .glyph-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.choice-glyph.is-gap {
  font-family: var(--font-display);
  font-style: italic;
}

.feedback {
  margin: 0;
  min-height: 1.4em;
  font-weight: 500;
  color: var(--navy);
}

.feedback.is-wrong {
  color: #8a4b12;
}

.score-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.match-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.match-col h3 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
}

.match-list {
  display: grid;
  gap: 0.45rem;
}

.match-item {
  min-height: 48px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
}

.match-item .g,
.match-item .glyph-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.match-item.selected {
  border-color: var(--navy);
  box-shadow: inset 0 0 0 1px rgba(26, 51, 80, 0.2);
}

.match-item.matched {
  opacity: 0.45;
  pointer-events: none;
  background: rgba(126, 163, 176, 0.15);
}

/* —— About —— */
.aside-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.aside-strip > div {
  padding: 1.1rem 1.15rem;
  border-top: 2px solid var(--copper);
  background: rgba(255, 255, 255, 0.5);
}

.aside-strip h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 0.45rem;
  font-weight: 600;
}

.aside-strip p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.mini-glyphs {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.mini-glyphs .glyph-img {
  width: 44px;
  height: 44px;
}

footer {
  padding: 2rem 0 3rem;
  position: relative;
  z-index: 1;
}

footer p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  max-width: 48rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 860px) {
  .path-rail {
    grid-template-columns: 1fr;
  }

  .learn-layout {
    grid-template-columns: 1fr;
  }

  .letter-rail {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-height: none;
  }

  .aside-strip {
    grid-template-columns: 1fr;
  }

  .match-board {
    grid-template-columns: 1fr;
  }
}

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

  .letter-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .brand {
    font-size: clamp(2.6rem, 12vw, 3.4rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .script-wash,
  .aurora,
  .hero-copy,
  .letter-stage {
    animation: none !important;
  }
}
