/* ————————————————————————————————————————————————
   Teach us the Runes — shared stylesheet
   Light: parchment stone, ink text, inlaid-gold accent.
   Dark : deep ink-blue night, parchment-white text.
   ———————————————————————————————————————————————— */

:root {
  --bg:        #f2ede3;
  --bg-raised: #ece5d7;
  --ink:       #26221c;
  --ink-soft:  #6b6357;
  --hair:      #d9cfbd;
  --gold:      #9a7b3f;
  --gold-soft: #b89a5e;
  --glyph:     #2b2620;
  --shadow:    rgba(40,34,26,.10);
  --nav-bg:    rgba(242,237,227,.86);
  /* Write the Rune: a dark cut into pale stone */
  --etch-floor: #5d5345;
  --etch-shade: rgba(48,36,20,.62);
  --etch-light: rgba(255,253,247,.95);
  --etch-grain: rgba(36,28,16,.38);
}
[data-theme="dark"] {
  --bg:        #14181f;
  --bg-raised: #1b212b;
  --ink:       #eee7d7;
  --ink-soft:  #9aa1ac;
  --hair:      #2c3542;
  --gold:      #c9a860;
  --gold-soft: #d8bd80;
  --glyph:     #f2ecdd;
  --shadow:    rgba(0,0,0,.35);
  --nav-bg:    rgba(20,24,31,.86);
  /* Write the Rune: a pale scratch into dark slate */
  --etch-floor: rgba(214,204,184,.80);
  --etch-shade: rgba(0,0,0,.80);
  --etch-light: rgba(236,226,204,.20);
  --etch-grain: rgba(20,24,31,.55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  line-height: 1.75;
  letter-spacing: .1px;
  transition: background .5s ease, color .5s ease;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 3px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--bg-raised); color: var(--ink);
  padding: .8rem 1.2rem; z-index: 100; border: 1px solid var(--gold);
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ————————————————————————— HEADER ————————————————————————— */
header.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(1rem, 4vw, 3rem);
  height: 64px;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hair);
  transition: background .5s ease, border-color .5s ease;
}
.brand {
  display: flex; align-items: baseline; gap: .6rem;
  cursor: pointer; user-select: none;
  background: none; border: none; color: inherit; font: inherit;
  padding: 0; text-decoration: none;
}
.brand-glyph { font-size: 1.4rem; color: var(--gold); }
.brand-name {
  font-size: .82rem; letter-spacing: .28em; text-transform: uppercase;
  color: var(--ink-soft);
}
.brand-name.runic { letter-spacing: .18em; text-transform: none; font-size: .95rem; white-space: nowrap; }

.topbar-right { display: flex; align-items: center; gap: 1.4rem; }

/* hover-reveal rune menu */
.menu-wrap { position: relative; }
.menu-trigger {
  background: none; border: none; color: var(--ink-soft);
  font: inherit; font-size: .82rem; letter-spacing: .22em;
  text-transform: uppercase; cursor: pointer; padding: .4rem 0;
}
.menu-trigger:hover { color: var(--gold); }

.rune-menu {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: min(92vw, 720px);
  background: var(--bg-raised);
  border: 1px solid var(--hair);
  border-radius: 14px;
  box-shadow: 0 18px 50px var(--shadow);
  padding: 1.25rem 1.25rem 1.5rem;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .28s ease, transform .28s ease, visibility .28s;
}
.menu-wrap:hover .rune-menu,
.menu-wrap:focus-within .rune-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.menu-aett-label {
  font-size: .68rem; letter-spacing: .24em; text-transform: uppercase;
  color: var(--gold); margin: .8rem 0 .1rem;
}
.menu-aett-label:first-child { margin-top: 0; }
.rune-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: .35rem; }
.menu-item {
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  padding: .5rem .2rem; border-radius: 9px;
  text-decoration: none; color: var(--ink);
  transition: background .18s ease, color .18s ease;
}
.menu-item:hover { background: var(--bg); color: var(--gold); }
.mi-glyph { font-size: 1.5rem; line-height: 1; color: var(--glyph); }
.menu-item:hover .mi-glyph { color: var(--gold); }
.mi-name { font-size: .62rem; letter-spacing: .06em; color: var(--ink-soft); text-align: center; }

/* theme toggle */
.toggle {
  background: none; border: 1px solid var(--hair); color: var(--ink-soft);
  border-radius: 999px; width: 40px; height: 40px; cursor: pointer;
  display: grid; place-items: center; padding: 0;
  transition: border-color .3s, color .3s, transform .3s;
}
.toggle:hover { color: var(--gold); border-color: var(--gold-soft); transform: rotate(12deg); }
.toggle svg { width: 18px; height: 18px; }

/* ————————————————————————— RUNE MEDITATION ————————————————————————— */
main { max-width: 720px; margin: 0 auto; padding: 0 clamp(1.1rem, 5vw, 2rem); }

.hero {
  min-height: calc(100vh - 64px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 3rem 0 4rem;
  position: relative;
}
.eyebrow {
  font-size: .74rem; letter-spacing: .32em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 2.2rem;
}
.hero-glyph {
  font-size: clamp(9rem, 34vw, 17rem);
  line-height: .9; color: var(--glyph);
  margin: 0; font-weight: 400;
  animation: riseIn 1.1s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-name {
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  margin: 1.6rem 0 .4rem; font-weight: 400; letter-spacing: .01em;
}
.hero-pron { font-size: 1.05rem; color: var(--ink-soft); font-style: italic; margin: 0 0 1.4rem; }
.hero-pron .sound { font-style: normal; letter-spacing: .04em; }
.hero-represents { font-size: 1.15rem; color: var(--ink); max-width: 30ch; margin: 0 auto; line-height: 1.6; }

.scroll-cue {
  position: absolute; bottom: 1.6rem; left: 50%; transform: translateX(-50%);
  color: var(--ink-soft); font-size: .7rem; letter-spacing: .2em;
  text-transform: uppercase; display: flex; flex-direction: column;
  align-items: center; gap: .5rem; opacity: .8;
}
.scroll-cue .arrow { animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge {
  0%,100% { transform: translateY(0); opacity: .5; }
  50%     { transform: translateY(5px); opacity: 1; }
}

.poem {
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  padding: 3.4rem 0; margin: 1rem 0 0;
  text-align: center;
}
.section-label {
  font-size: .7rem; letter-spacing: .28em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 1.4rem;
}
.poem blockquote {
  margin: 0; font-size: clamp(1.3rem, 3.4vw, 1.7rem);
  line-height: 1.6; font-style: italic; color: var(--ink);
}
.poem .attr {
  margin-top: 1.4rem; font-size: .82rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-soft); font-style: normal;
}

.reflections { padding: 3.2rem 0 1rem; }
.reflections .section-label { margin-bottom: 2rem; text-align: center; }
.reflect {
  font-size: 1.18rem; line-height: 1.85; margin: 0 0 2.4rem;
  color: var(--ink);
  opacity: 0; transform: translateY(26px);
  transition: opacity 1s ease, transform 1s ease;
}
.reflect.in { opacity: 1; transform: translateY(0); }
.reflect:first-of-type::first-letter {
  font-size: 3.1rem; line-height: .8; float: left;
  padding: .18rem .5rem .1rem 0; color: var(--gold); font-weight: 400;
}

.aett-close {
  margin: 1.5rem 0 0; padding: 2.6rem 2rem; border-radius: 16px;
  background: var(--bg-raised); border: 1px solid var(--hair);
  opacity: 0; transform: translateY(26px);
  transition: opacity 1s ease, transform 1s ease;
}
.aett-close.in { opacity: 1; transform: translateY(0); }
.aett-close .section-label { margin-bottom: 1rem; }
.aett-close p { margin: 0; font-size: 1.08rem; line-height: 1.8; }

.continue {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 4.5rem 0 5.5rem; gap: .7rem;
}
.next-label { font-size: .72rem; letter-spacing: .26em; text-transform: uppercase; color: var(--ink-soft); }
.continue a {
  text-decoration: none; color: var(--ink);
  display: inline-flex; align-items: baseline; gap: .8rem;
  transition: color .3s ease;
}
.continue a:hover { color: var(--gold); }
.next-glyph { font-size: 2.6rem; color: var(--glyph); transition: color .3s; }
.continue a:hover .next-glyph { color: var(--gold); }
.next-name { font-size: 1.7rem; border-bottom: 1px solid transparent; transition: border-color .3s; }
.continue a:hover .next-name { border-color: var(--gold-soft); }
.position { font-size: .72rem; letter-spacing: .18em; color: var(--ink-soft); margin-top: .4rem; }

/* ————————————————————————— WRITE THE RUNE ————————————————————————— */
.write {
  text-align: center;
  padding-top: clamp(2rem, 6vw, 3.5rem);
  padding-bottom: clamp(2.5rem, 7vw, 4rem);
}
.write .eyebrow { margin-bottom: 1.1rem; }
.write-name {
  font-size: clamp(2.4rem, 8vw, 3.4rem); font-weight: 400;
  margin: 0 0 .3rem; line-height: 1.15; letter-spacing: .01em;
}
.write-meaning { font-size: 1.12rem; max-width: 30ch; margin: 0 auto; line-height: 1.6; }
.write-sound { font-size: .95rem; color: var(--ink-soft); font-style: italic; margin: .3rem 0 0; }

/* the pad starts full width; on Check it shrinks to sit beside the answer */
.write-stage {
  display: flex; justify-content: center; align-items: flex-start;
  gap: clamp(.75rem, 3vw, 1.5rem);
  margin: clamp(1.5rem, 5vw, 2.3rem) 0 1.4rem;
}
.pane-wrap {
  margin: 0; flex: 0 1 auto;
  width: min(100%, 420px);
  transition: width .55s cubic-bezier(.2,.7,.2,1);
}
.write-stage.checked .pane-wrap { width: min(48%, 340px); }
.answer-wrap[hidden] { display: none; }
.answer-wrap { animation: fadeIn .6s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* a slab of stone: grain over the raised colour, faintly recessed */
.pane {
  position: relative; aspect-ratio: 1;
  background: var(--bg-raised);
  border: 1px solid var(--hair); border-radius: 16px;
  box-shadow: inset 0 2px 6px var(--shadow);
  overflow: hidden;
  transition: background .5s ease, border-color .5s ease;
}
.pane::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: url("stone.svg") repeat;
  opacity: .2;
}
[data-theme="dark"] .pane::before { filter: invert(1); opacity: .1; }
.write-stage { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pane canvas {
  position: relative; display: block; width: 100%; height: 100%;
  touch-action: none; cursor: crosshair;
  -webkit-tap-highlight-color: transparent;
}
.write-stage.checked .pane canvas { cursor: default; }
.pad-hint {
  position: absolute; inset: 0; z-index: 1; display: grid; place-items: center;
  font-size: .7rem; letter-spacing: .28em; text-transform: uppercase;
  color: var(--ink-soft); opacity: .6; pointer-events: none;
  transition: opacity .3s ease;
}
.pad-hint.gone { opacity: 0; }

/* the answer, cut into the stone the same way, at the home page's size */
.answer-pane { display: grid; place-items: center; container-type: size; }
.answer-glyph {
  position: relative;
  font-size: clamp(9rem, 34vw, 17rem);
  font-size: min(clamp(9rem, 34vw, 17rem), 90cqh);
  line-height: .9; color: var(--etch-floor);
  text-shadow: -.008em -.008em 0 var(--etch-shade), .01em .01em 0 var(--etch-light);
  animation: riseIn .9s cubic-bezier(.2,.7,.2,1) both;
}

.pane-label {
  font-size: .68rem; letter-spacing: .26em; text-transform: uppercase;
  color: var(--gold); margin-top: .8rem; line-height: 1;
}
.write-stage:not(.checked) .pane-label { display: none; }

.write-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; }
.pill-btn {
  background: none; border: 1px solid var(--hair); color: var(--ink-soft);
  font: inherit; font-size: .74rem; letter-spacing: .2em; text-transform: uppercase;
  min-height: 44px; padding: .65rem 1.5rem; border-radius: 999px; cursor: pointer;
  transition: border-color .3s, color .3s, background .3s;
}
.pill-btn:hover { color: var(--gold); border-color: var(--gold-soft); }
.pill-btn.primary { color: var(--gold); border-color: var(--gold-soft); }
.pill-btn.primary:hover { background: var(--bg-raised); border-color: var(--gold); }
.pill-btn[hidden] { display: none; }

/* ————————————————————————— PROSE PAGES ————————————————————————— */
.prose { padding-top: clamp(3rem, 9vw, 5.5rem); padding-bottom: 2rem; }
.prose-head { text-align: center; margin-bottom: clamp(2.5rem, 7vw, 4rem); }
.prose-title {
  font-size: clamp(2rem, 6.5vw, 3rem); font-weight: 400;
  margin: .6rem 0 .8rem; line-height: 1.25;
}
.prose-title.runic { letter-spacing: .06em; }
.prose-standfirst { color: var(--ink-soft); font-size: 1.05rem; margin: 0; font-style: italic; }
.prose-standfirst.runic { font-style: normal; letter-spacing: .04em; }

.prose-rule {
  width: 60px; height: 1px; background: var(--gold-soft);
  border: 0; margin: 2.6rem auto;
}

.prose h2 {
  font-size: 1.32rem; font-weight: 400; margin: 3rem 0 .9rem;
  color: var(--ink); line-height: 1.4;
}
.prose h2.runic { letter-spacing: .05em; font-size: 1.4rem; }
.prose h2::before {
  content: ""; display: block; width: 26px; height: 1px;
  background: var(--gold-soft); margin-bottom: 1.1rem;
}
.prose p { font-size: 1.1rem; line-height: 1.85; margin: 0 0 1.4rem; }

/* runic body text needs a little more air to stay legible */
.runic-body p, .runic-body li {
  letter-spacing: .055em; word-spacing: .16em;
  font-size: 1.16rem; line-height: 2.05;
}
.runic-body h2 { letter-spacing: .05em; }

.english-block {
  margin-top: clamp(3.5rem, 9vw, 5.5rem);
  padding-top: clamp(2.5rem, 6vw, 3.5rem);
  border-top: 1px solid var(--hair);
}
.english-block .section-label { text-align: center; margin-bottom: 2.2rem; }
.key-note {
  background: var(--bg-raised); border: 1px solid var(--hair);
  border-radius: 14px; padding: 1.5rem 1.6rem;
  font-size: .96rem; line-height: 1.75; color: var(--ink-soft);
  margin: 0 0 2.8rem;
}

/* ————————————————————————— RUNES ⇄ ENGLISH ————————————————————————— */
/* top-bar switch: the lit half is the script you are reading */
.lang-toggle {
  display: inline-flex; align-items: center; gap: 2px;
  height: 40px; padding: 3px; cursor: pointer;
  background: none; border: 1px solid var(--hair); border-radius: 999px;
  color: var(--ink-soft); font: inherit;
  transition: border-color .3s;
}
.lang-toggle[hidden] { display: none; }
.lang-toggle:hover { border-color: var(--gold-soft); }
.lang-toggle span {
  display: grid; place-items: center;
  min-width: 32px; height: 32px; padding: 0 .4rem; border-radius: 999px;
  font-size: .74rem; letter-spacing: .12em; line-height: 1;
  transition: background .3s, color .3s;
}
.lang-toggle .lt-runes { font-size: 1.05rem; letter-spacing: 0; }
.lang-toggle[aria-pressed="false"] .lt-runes,
.lang-toggle[aria-pressed="true"] .lt-en {
  background: var(--bg-raised); color: var(--gold);
}

/* the way in, under the title */
.lang-cue { margin-top: 1.8rem; }
.lang-link {
  font-size: .72rem; letter-spacing: .24em; text-transform: uppercase;
  color: var(--gold); text-decoration: none;
  border-bottom: 1px solid var(--gold-soft); padding-bottom: 3px;
  transition: color .25s, border-color .25s;
}
.lang-link:hover { color: var(--ink); border-color: var(--gold); }
.lang-hint {
  margin-top: .7rem; font-size: .86rem; font-style: italic; color: var(--ink-soft);
}
.lang-hint[hidden] { display: none; }

/* the leading edge of the decoding wave */
.lang-spark { color: var(--gold); }

/* every passage answers a tap */
.lang-ready [data-en] {
  -webkit-tap-highlight-color: transparent;
  transition: letter-spacing .7s ease, word-spacing .7s ease;
}
.lang-ready .runic-body p[data-en],
.lang-ready .runic-body h1[data-en],
.lang-ready .runic-body h2[data-en],
.lang-ready .runic-body .prose-standfirst[data-en],
.lang-ready .runic-body .section-label[data-en] {
  cursor: pointer;
  text-decoration: underline dotted transparent;
  text-underline-offset: .4em; text-decoration-thickness: 1px;
}
@media (hover: hover) {
  .lang-ready .runic-body [data-en]:hover { text-decoration-color: var(--gold-soft); }
}

/* once decoded, the letters drop the extra air the runes needed */
.prose .runic-body .is-en,
.foot-links a.runic.is-en,
.copyright.runic.is-en { letter-spacing: normal; word-spacing: normal; }
.brand-name.runic.is-en { letter-spacing: .04em; }
.prose .runic-body .section-label.is-en { letter-spacing: .28em; }

/* ————————————————————————— FOOTER ————————————————————————— */
footer.foot {
  border-top: 1px solid var(--hair);
  text-align: center; padding: 2.6rem 1rem 3.2rem;
  font-size: .82rem; color: var(--ink-soft); line-height: 1.7;
}
.today-btn {
  background: none; border: 1px solid var(--hair); color: var(--ink-soft);
  font: inherit; font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
  padding: .6rem 1.3rem; border-radius: 999px; cursor: pointer; margin-bottom: 1.6rem;
  transition: border-color .3s, color .3s;
}
.today-btn:hover { color: var(--gold); border-color: var(--gold-soft); }

.foot-links {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: .6rem 1.4rem; margin-bottom: 1.5rem; padding: 0; list-style: none;
}
.foot-links a {
  color: var(--ink-soft); text-decoration: none;
  border-bottom: 1px solid transparent; padding-bottom: 2px;
  transition: color .25s, border-color .25s;
}
.foot-links a:hover { color: var(--gold); border-color: var(--gold-soft); }
.foot-links a.runic { letter-spacing: .07em; font-size: .95rem; }

.foot-tagline { margin-bottom: .55rem; }
.foot-note { opacity: .82; max-width: 52ch; margin: 0 auto .9rem; }
.copyright { letter-spacing: .1em; }
.copyright.runic { letter-spacing: .07em; font-size: .95rem; }

/* ————————————————————————— 404 ————————————————————————— */
.notfound {
  min-height: calc(100vh - 220px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 1.2rem; padding: 4rem 0;
}
.notfound .nf-glyph { font-size: clamp(6rem, 22vw, 10rem); color: var(--glyph); line-height: 1; }
.notfound h1 { font-weight: 400; font-size: clamp(1.6rem, 5vw, 2.2rem); margin: 0; }
.notfound p { color: var(--ink-soft); max-width: 40ch; margin: 0; }
.notfound a { color: var(--gold); text-decoration: none; border-bottom: 1px solid var(--gold-soft); }

/* ————————————————————————— RESPONSIVE ————————————————————————— */
@media (max-width: 620px) {
  .rune-grid { grid-template-columns: repeat(4, 1fr); }
  .rune-menu { width: min(94vw, 420px); }
  .topbar-right { gap: .9rem; }
  .menu-trigger { font-size: .72rem; letter-spacing: .16em; }
  .runic-body p { font-size: 1.08rem; line-height: 1.95; }
  .foot-links { gap: .5rem 1rem; }
}
@media (max-width: 440px) {
  /* room for both switches beside the runic wordmark */
  .brand-name.runic { letter-spacing: .06em; font-size: .86rem; }
  .lang-toggle { height: 36px; padding: 2px; }
  .lang-toggle span { min-width: 28px; height: 30px; padding: 0 .3rem; }
  .toggle { width: 36px; height: 36px; }
}
