/* ------------------------------------------------------------------
   himal · हिमाल — companion site design system
   The language is borrowed from the game's own interface (drawn from
   Newar sources: a paubha's madder, ink, gold and cloth; a temple
   cornice's pendant fringe) softened by the Himal design-harness
   direction: cream, lowercase, quiet rounded list cards.
   ------------------------------------------------------------------ */

/* ---------- fonts ---------- */
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-stretch: normal;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+2190-21BB, U+2212;
}
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces-italic-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+2212;
}
@font-face {
  font-family: 'Noto Serif Devanagari';
  src: url('../fonts/noto-serif-devanagari.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0900-097F, U+1CD0-1CFF, U+A8E0-A8FF;
}

/* ---------- tokens ---------- */
:root {
  /* cloth — the page is aged cotton, not white paper */
  --cloth:        #f0e5c9;
  --cloth-deep:   #e6d7ae;
  --parchment:    #f7efdc;

  /* ink and its fades */
  --ink:          #2b2014;
  --ink-soft:     #5f4e38;
  --ink-faint:    #8a7a60;

  /* the paubha reds */
  --madder:       #8e2f1f;
  --madder-deep:  #661d0f;
  --brick:        #a34a2c;

  /* metals and minerals */
  --gold:         #b88d3c;
  --gold-soft:    #cfae6a;
  --lapis:        #35516e;
  --valley:       #5a7d43;

  /* night — the one inverted ground */
  --night:        #121a2b;
  --night-soft:   #1c2739;
  --lamp:         #eec27a;
  --moon:         #aebdd3;

  /* type */
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --dev: 'Noto Serif Devanagari', 'Fraunces', serif;
  --mono: ui-monospace, 'Cascadia Mono', 'JetBrains Mono', Consolas, monospace;

  /* rhythm */
  --radius: 10px;      /* quiet list cards (Himal) */
  --radius-s: 6px;     /* buttons, tags */
  --measure: 34rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --section-gap: clamp(4.5rem, 10vh, 8rem);

  /* the card sandwich: ink line, madder band, gold rule, cloth fill */
  --card-border: 2px solid var(--madder);
  --card-shadow: 0 1px 0 var(--gold), 0 0 0 1px rgba(43, 32, 20, 0.35),
                 0 14px 34px -18px rgba(43, 32, 20, 0.45);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--cloth);
  /* faint woven-cloth tooth, two crossed line rasters */
  background-image:
    repeating-linear-gradient(0deg, rgba(43,32,20,0.020) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(43,32,20,0.014) 0 1px, transparent 1px 3px);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: clamp(1.02rem, 0.95rem + 0.3vw, 1.15rem);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--madder); color: var(--parchment); }

h1, h2, h3 { font-weight: 560; line-height: 1.08; margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 1.1em; max-width: var(--measure); }
a { color: var(--lapis); text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--madder); }
img, video { max-width: 100%; height: auto; display: block; }

.dev { font-family: var(--dev); }
.mono {
  font-family: var(--mono);
  font-size: 0.82em;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

/* ---------- the paubha card ---------- */
.card {
  background: var(--parchment);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 1.4rem 1.6rem;
}

/* title card: heavier, with the double frame the game uses */
.card--title {
  border-width: 3px;
  box-shadow: inset 0 0 0 2px var(--parchment), inset 0 0 0 3.5px var(--gold),
              var(--card-shadow);
  text-align: center;
  padding: 1.6rem 3rem 1.7rem;
}

/* cornice fringe: pendant drops hung beneath a title card */
.fringe {
  display: block;
  width: min(100%, 20rem);
  margin: -2px auto 0;
  color: var(--madder-deep);
}

/* framed imagery: madder border, gold corner ornaments */
.frame {
  position: relative;
  border: 2px solid var(--madder);
  box-shadow: 0 0 0 1px rgba(43,32,20,0.4), 0 18px 40px -20px rgba(43,32,20,0.55);
  background: var(--night);
}
.frame > img, .frame > video { width: 100%; }
.frame::before, .frame::after,
.frame .corner::before, .frame .corner::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid var(--gold-soft);
  pointer-events: none;
  z-index: 2;
}
.frame::before        { top: 6px; left: 6px;   border-width: 2px 0 0 2px; }
.frame::after         { top: 6px; right: 6px;  border-width: 2px 2px 0 0; }
.frame .corner::before{ bottom: 6px; left: 6px; border-width: 0 0 2px 2px; }
.frame .corner::after { bottom: 6px; right: 6px;border-width: 0 2px 2px 0; }

.caption {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 0.65rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  max-width: none;
}
.caption .mono { font-size: 0.78rem; }

/* ---------- section anatomy ---------- */
.section {
  padding: var(--section-gap) var(--gutter);
  max-width: 72rem;
  margin: 0 auto;
}

.kicker {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 2.2rem;
}
.kicker .num {
  font-family: var(--dev);
  font-size: 1.05rem;
  color: var(--madder);
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  width: 2rem; height: 2rem;
  display: inline-flex;
  align-items: center; justify-content: center;
  flex: none;
  background: var(--parchment);
}
.kicker h2 {
  font-size: clamp(1.7rem, 1.35rem + 1.6vw, 2.6rem);
  text-transform: lowercase;
}
.kicker .dev-label {
  font-family: var(--dev);
  color: var(--gold);
  font-size: 1rem;
  margin-left: auto;
  white-space: nowrap;
}
.kicker::after { display: none; }
.rule {
  border: 0;
  border-top: 1.5px solid var(--gold);
  margin: 0 0 2rem;
  position: relative;
}

.lede {
  font-size: 1.14em;
  color: var(--ink);
}
.aside {
  font-size: 0.92em;
  color: var(--ink-soft);
  font-style: italic;
}

/* ---------- the place-card stat ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 2px;
  background: var(--madder);
  border: 2px solid var(--madder);
  box-shadow: var(--card-shadow);
  max-width: 56rem;
}
.stat {
  background: var(--parchment);
  padding: 1.1rem 1.2rem 1rem;
}
.stat b {
  display: block;
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.2rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat span {
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.stat .dev-hint { color: var(--gold); font-family: var(--dev); font-size: 0.8rem; }

/* ---------- archetype grid ---------- */
.grammar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 1.1rem;
}
.grammar .card {
  padding: 1.05rem 1.15rem 1.1rem;
  border-radius: var(--radius);
  border-color: rgba(142, 47, 31, 0.35);
  box-shadow: 0 1px 0 rgba(184, 141, 60, 0.45), 0 10px 24px -16px rgba(43, 32, 20, 0.4);
}
.grammar h3 {
  font-size: 1.12rem;
  text-transform: lowercase;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.grammar h3 .where {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  text-align: right;
}
.grammar p {
  font-size: 0.875rem;
  color: var(--ink-soft);
  margin: 0.5rem 0 0;
  line-height: 1.5;
}
.grammar .layout-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--madder);
  border-bottom: 1px solid var(--gold);
  margin-top: 0.7rem;
  padding-bottom: 1px;
}

/* ---------- mood/season strips ---------- */
.strip { position: relative; }
.strip .frame { aspect-ratio: 16 / 9; overflow: hidden; }
.strip .frame img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.strip .frame img.on { opacity: 1; }
.strip-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.8rem;
}
.strip-tabs button {
  font-family: var(--serif);
  font-size: 0.88rem;
  text-transform: lowercase;
  color: var(--ink-soft);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 0.28rem 0.9rem;
  cursor: pointer;
  transition: color 120ms, border-color 120ms, background 120ms;
}
.strip-tabs button:hover { color: var(--madder); border-color: var(--gold-soft); }
.strip-tabs button[aria-selected="true"] {
  color: var(--parchment);
  background: var(--madder);
  border-color: var(--madder-deep);
}
.strip-tabs button:focus-visible {
  outline: 2px solid var(--lapis);
  outline-offset: 2px;
}

/* ---------- the night section ---------- */
.night {
  background: var(--night);
  color: #d8d3c4;
  background-image: radial-gradient(ellipse at 20% -10%, rgba(174,189,211,0.08), transparent 55%);
}
.night .section { color: inherit; }
.night h2, .night h3 { color: #efe9d8; }
.night .kicker .num { background: var(--night-soft); color: var(--lamp); border-color: var(--gold); }
.night .kicker .dev-label { color: var(--gold-soft); }
.night p { color: #c5bfae; }
.night .lede { color: #e6e0cf; }
.night .mono { color: var(--moon); }
.night a { color: var(--lamp); }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--serif);
  font-size: 0.95rem;
  text-transform: lowercase;
  text-decoration: none;
  color: var(--parchment);
  background: var(--madder);
  border: 2px solid var(--madder-deep);
  border-radius: var(--radius-s);
  box-shadow: 0 1px 0 var(--gold), 0 6px 16px -8px rgba(102,29,15,0.7);
  padding: 0.55rem 1.5rem 0.6rem;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms;
}
.btn:hover { background: var(--madder-deep); color: var(--parchment); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: 0 1px 0 var(--gold); }

/* a placeholder button carries no href - it must not answer like a live one */
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: default;
  box-shadow: 0 1px 0 var(--gold);
}
.btn[aria-disabled="true"]:hover {
  background: var(--madder);
  color: var(--parchment);
  transform: none;
}
.btn--ghost {
  color: var(--madder);
  background: transparent;
  border-color: var(--gold);
  box-shadow: none;
}
.btn--ghost:hover { background: rgba(184,141,60,0.12); color: var(--madder-deep); }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 700ms ease, transform 700ms ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .strip .frame img { transition: none; }
}
