/* ============================================================
   Śilpa — Indian temple architecture
   Palette taken from the buildings: sandstone, lamp-black, brass.
   ============================================================ */

:root {
  --ink:      #0f0b0a;
  --ink-2:    #171110;
  --ink-3:    #221917;
  --stone:    #c8a882;
  --sand:     #e9cfa8;
  --brass:    #e0a03c;
  --brass-lo: #a4741f;
  --vermil:   #c2482e;
  --text:     #f0e5d7;
  --muted:    #ab9784;
  --line:     rgba(233, 207, 168, 0.14);
  --line-2:   rgba(233, 207, 168, 0.28);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 1180px;
  --r: 14px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
a { color: var(--brass); }

.wrap { width: min(var(--wrap), calc(100% - 3rem)); margin-inline: auto; }

/* ------------------------------------------------------------ loader */
#loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--ink);
  transition: opacity .7s ease, visibility .7s;
}
#loader.is-done { opacity: 0; visibility: hidden; }
#loader .mark { width: 74px; height: 74px; opacity: .9; animation: breathe 2.6s ease-in-out infinite; }
#loader p { color: var(--muted); font-size: .82rem; letter-spacing: .22em; text-transform: uppercase; margin-top: 1.4rem; }
@keyframes breathe { 0%,100% { transform: scale(1); opacity: .55 } 50% { transform: scale(1.07); opacity: 1 } }

/* ------------------------------------------------------------ top bar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .9rem clamp(1rem, 4vw, 2.4rem);
  backdrop-filter: blur(14px);
  background: linear-gradient(to bottom, rgba(15,11,10,.82), rgba(15,11,10,.4) 70%, transparent);
  border-bottom: 1px solid transparent;
  transition: background .3s, border-color .3s;
}
.topbar.is-stuck { background: rgba(15,11,10,.93); border-bottom-color: var(--line); }
.brand { font-family: var(--serif); font-size: 1.12rem; letter-spacing: .04em; text-decoration: none; color: var(--text); white-space: nowrap; }
.brand span { color: var(--brass); }
.nav { display: flex; gap: 1.35rem; margin-left: auto; }
.nav-link {
  color: var(--muted); text-decoration: none; font-size: .82rem;
  letter-spacing: .13em; text-transform: uppercase; padding-bottom: 2px;
  border-bottom: 1px solid transparent; transition: color .2s, border-color .2s;
}
.nav-link:hover, .nav-link.is-on { color: var(--sand); border-bottom-color: var(--brass); }
.nav-link:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 2px; }
@media (max-width: 860px) { .nav { display: none; } }

/* ------------------------------------------------------------ hero */
.hero { position: relative; height: 100svh; min-height: 620px; }
/* Scrim: the lit courtyard is bright, and the copy has to stay readable over it. */
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(100deg, rgba(12,8,8,.92) 0%, rgba(12,8,8,.72) 24%, rgba(12,8,8,.18) 46%, transparent 62%),
    linear-gradient(to top, rgba(12,8,8,.95) 0%, rgba(12,8,8,.5) 12%, transparent 30%),
    linear-gradient(to bottom, rgba(12,8,8,.7) 0%, transparent 14%);
}
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#stage:active { cursor: grabbing; }

.hero-copy {
  position: absolute; left: clamp(1.2rem, 5vw, 4rem); bottom: clamp(6rem, 12vh, 9rem);
  max-width: 58ch; z-index: 5; pointer-events: none;
  text-shadow: 0 2px 30px rgba(0,0,0,.85);
}
.eyebrow { font-size: .74rem; letter-spacing: .34em; text-transform: uppercase; color: var(--brass); margin: 0 0 1rem; }
.hero-copy h1 { font-size: clamp(2.7rem, 7vw, 4.9rem); line-height: .98; }
.hero-copy h1 em { display: block; font-style: normal; color: var(--stone); font-size: .42em; letter-spacing: .3em; text-transform: uppercase; margin-top: 1rem; }
/* Narrower than the heading's own measure: a display headline reads fine wide
   and wraps to an ugly ladder if held to body-copy width, but the blurb below
   it wants the shorter line length. */
.hero-copy p { color: var(--muted); margin-top: 1.3rem; font-size: 1rem; max-width: 33ch; }

.hero-tools {
  position: absolute; left: clamp(1.2rem, 5vw, 4rem); bottom: clamp(2rem, 5vh, 3.2rem);
  z-index: 6; display: flex; gap: .7rem; align-items: center; flex-wrap: wrap;
}
.btn {
  font: inherit; font-size: .82rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--sand); background: rgba(233,207,168,.07);
  border: 1px solid var(--line-2); border-radius: 999px;
  padding: .62rem 1.25rem; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .12s;
}
.btn:hover { background: rgba(224,160,60,.18); border-color: var(--brass); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.btn.is-off { color: var(--muted); opacity: .7; }
.hint { color: var(--muted); font-size: .8rem; letter-spacing: .04em; }
.hint kbd {
  font-family: var(--mono); font-size: .74rem; background: rgba(233,207,168,.1);
  border: 1px solid var(--line); border-radius: 5px; padding: .1rem .38rem;
}

/* scene labels + tooltip ------------------------------------------------ */
/* clip: a label projected past the edge would otherwise widen the document */
#labels { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.scene-label {
  position: absolute; top: 0; left: 0;
  font-size: .68rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--sand); text-align: center; white-space: nowrap;
  transition: opacity .35s ease;
  text-shadow: 0 2px 12px #000;
}
.scene-label b { display: block; font-size: .84rem; letter-spacing: .2em; color: #fff; }
.scene-label span { color: var(--muted); font-size: .62rem; letter-spacing: .08em; text-transform: none; }
.scene-label::after {
  content: ""; display: block; width: 1px; height: 16px; margin: 6px auto 0;
  background: linear-gradient(var(--brass), transparent);
}

#tooltip {
  position: fixed; top: 0; left: 0; z-index: 30; pointer-events: none;
  background: rgba(15,11,10,.92); border: 1px solid var(--line-2);
  border-radius: 10px; padding: .45rem .75rem;
  font-size: .8rem; opacity: 0; transition: opacity .18s;
  display: flex; gap: .5rem; align-items: baseline; white-space: nowrap;
}
#tooltip.is-visible { opacity: 1; }
#tooltip b { font-family: var(--serif); font-size: 1rem; color: var(--brass); }
#tooltip span { color: var(--text); }
#tooltip em { color: var(--muted); font-style: normal; font-family: var(--mono); font-size: .72rem; }

.svara-strip {
  position: absolute; right: clamp(1.2rem, 5vw, 4rem); bottom: clamp(2rem, 5vh, 3.2rem);
  z-index: 6; display: flex; gap: .3rem;
}
.svara-strip button {
  width: 2.15rem; height: 2.15rem; border-radius: 50%; cursor: pointer;
  font: inherit; font-size: .72rem; font-family: var(--serif);
  color: var(--muted); background: rgba(233,207,168,.05);
  border: 1px solid var(--line); transition: all .18s;
}
.svara-strip button:hover, .svara-strip button.is-lit {
  color: var(--ink); background: var(--brass); border-color: var(--brass);
  box-shadow: 0 0 18px rgba(224,160,60,.5);
}
.svara-strip button:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
@media (max-width: 720px) {
  .svara-strip { display: none; }
  /* Portrait: the copy sits in the lower third, on a scrim that goes full width. */
  .hero::after {
    background:
      linear-gradient(to top, rgba(12,8,8,.95) 0%, rgba(12,8,8,.82) 24%, rgba(12,8,8,.2) 44%, transparent 60%),
      linear-gradient(to bottom, rgba(12,8,8,.8) 0%, transparent 16%);
  }
  /* three labels will not fit side by side on a phone; the article names them anyway */
  .scene-label { display: none; }
  .hero-copy { bottom: 9.5rem; right: clamp(1.2rem, 5vw, 4rem); max-width: none; }
  .hero-copy h1 { font-size: clamp(2.2rem, 11vw, 3.2rem); }
  .hero-copy h1 em { font-size: .38em; letter-spacing: .22em; margin-top: .7rem; }
  .hero-copy p { font-size: .94rem; margin-top: 1rem; }
  .hero-tools { gap: .55rem; }
  .hint { flex-basis: 100%; }
}

/* ------------------------------------------------------------ sections */
section { padding: clamp(4.5rem, 11vh, 8rem) 0; position: relative; }
#anatomy { background: linear-gradient(var(--ink), var(--ink-2)); }
#making { background: var(--ink-2); }
#styles { background: linear-gradient(var(--ink-2), var(--ink)); }
#compare { background: var(--ink); }

.sec-head { max-width: 62ch; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.sec-head .eyebrow { color: var(--stone); }
.sec-head h2 { font-size: clamp(1.9rem, 4vw, 2.9rem); }
.sec-head p { color: var(--muted); margin-top: 1.1rem; }
.rule { height: 1px; background: linear-gradient(90deg, var(--brass), transparent); width: 90px; margin-bottom: 1.6rem; }

/* anatomy + mandala layout */
.split { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.panel {
  background: rgba(233,207,168,.035);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: clamp(1.2rem, 3vw, 2rem);
}
.panel h3 { font-size: 1.35rem; margin-bottom: .7rem; }
.panel p { color: var(--muted); }
.notes { display: grid; gap: 1.4rem; }
.note h3 { font-size: 1.02rem; color: var(--sand); margin-bottom: .25rem; }
.note p { margin: 0; color: var(--muted); font-size: .95rem; }
.note-key { font-family: var(--mono); font-size: .72rem; color: var(--brass); letter-spacing: .1em; }

/* build sequence */
#sequence { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: s; }
#sequence li {
  display: grid; grid-template-columns: 4.5rem 1fr; gap: 1.5rem;
  padding: 1.5rem 0; border-top: 1px solid var(--line);
}
#sequence li:last-child { border-bottom: 1px solid var(--line); }
.seq-n { font-family: var(--mono); color: var(--brass); font-size: .85rem; padding-top: .35rem; letter-spacing: .1em; }
/* h3 and p both belong in the second track: without this, grid auto-placement
   wraps the p into row 2 of the FIRST (4.5rem) column instead of under the
   heading, collapsing the body copy to one word per line. */
#sequence h3, #sequence p { grid-column: 2; }
#sequence h3 { font-size: 1.18rem; margin-bottom: .3rem; }
#sequence p { margin: 0; color: var(--muted); font-size: .96rem; max-width: 68ch; }
@media (max-width: 620px) { #sequence li { grid-template-columns: 1fr; gap: .35rem; } #sequence h3, #sequence p { grid-column: 1; } }

/* filters + style cards */
#filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2.2rem; }
.chip {
  font: inherit; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); background: transparent; border: 1px solid var(--line);
  border-radius: 999px; padding: .4rem 1rem; cursor: pointer; transition: all .18s;
}
.chip:hover { color: var(--sand); border-color: var(--line-2); }
.chip.is-on { color: var(--ink); background: var(--sand); border-color: var(--sand); }
.chip:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

#style-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 1.6rem; }
@media (max-width: 560px) { #style-grid { grid-template-columns: minmax(0, 1fr); } }

.style-card {
  display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 1.5rem;
  background: linear-gradient(160deg, rgba(233,207,168,.055), rgba(233,207,168,.02));
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 1.5rem; transition: border-color .3s, transform .3s, box-shadow .3s;
}
.style-card:hover {
  border-color: var(--line-2); transform: translateY(-3px);
  box-shadow: 0 22px 50px -28px rgba(0,0,0,.9);
}
.style-dia { align-self: start; position: sticky; top: 5.5rem; }
.style-card h3 { font-size: 1.55rem; }
.style-meta { color: var(--muted); font-size: .84rem; margin: .35rem 0 0; display: flex; align-items: center; gap: .55rem; }
.pill {
  font-size: .66rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--brass); border: 1px solid rgba(224,160,60,.35);
  border-radius: 999px; padding: .12rem .55rem;
}
.style-rule {
  margin: 1.1rem 0; padding: .85rem 1rem; font-size: .93rem; color: var(--sand);
  border-left: 2px solid var(--brass); background: rgba(224,160,60,.06);
  border-radius: 0 8px 8px 0;
}
.style-rule span { display: block; font-family: var(--mono); font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--brass); margin-bottom: .3rem; }
.style-facts { margin: 0 0 1.1rem; display: grid; gap: .45rem; }
.style-facts div { display: grid; grid-template-columns: 5.6rem 1fr; gap: .8rem; font-size: .88rem; }
.style-facts dt { color: var(--brass); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; padding-top: .25rem; }
.style-facts dd { margin: 0; color: var(--muted); }
.style-marks { margin: 0 0 1.2rem; padding: 0; list-style: none; display: grid; gap: .5rem; }
.style-marks li { position: relative; padding-left: 1.15rem; font-size: .93rem; color: var(--text); }
.style-marks li::before { content: "◆"; position: absolute; left: 0; top: -.05em; color: var(--brass-lo); font-size: .62rem; }
/* display:block + overflow-x lets the table shrink its column (or the viewport)
   below its own min-content width by scrolling locally, instead of forcing the
   surrounding grid track wider and overflowing the page. Harmless when the
   table already fits: no visible scrollbar, no layout change. */
.style-exemplars { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-collapse: collapse; font-size: .85rem; }
.style-exemplars tbody { display: table; width: 100%; }
.style-exemplars caption { text-align: left; font-family: var(--mono); font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--brass); padding-bottom: .45rem; }
.style-exemplars tr { border-top: 1px solid var(--line); }
.style-exemplars th { text-align: left; font-weight: 500; color: var(--text); padding: .42rem .6rem .42rem 0; }
.style-exemplars td { color: var(--muted); padding: .42rem .6rem .42rem 0; }
.style-exemplars td:last-child { text-align: right; font-family: var(--mono); font-size: .78rem; white-space: nowrap; }
@media (max-width: 760px) { .style-card { grid-template-columns: minmax(0, 1fr); } .style-dia { position: static; max-width: 200px; } }

/* compare */
.compare-wrap { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (max-width: 900px) { .compare-wrap { grid-template-columns: 1fr; } }

footer {
  border-top: 1px solid var(--line); padding: 3.5rem 0 4rem;
  color: var(--muted); font-size: .88rem; background: var(--ink);
}
footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2.5rem; }
@media (max-width: 760px) { footer .cols { grid-template-columns: 1fr; } }
footer h4 { color: var(--sand); font-size: .95rem; margin-bottom: .6rem; }
footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.colophon { margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--line); font-size: .78rem; color: #8a7a6c; }

/* Reveal on scroll. Scoped to .js so that if the module never runs — old
   browser, blocked script — the article is still fully visible. */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s cubic-bezier(.2,.7,.3,1), transform .8s cubic-bezier(.2,.7,.3,1); }
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } }

/* ============================================================
   Generated SVG diagrams
   ============================================================ */
.dia { width: 100%; height: auto; display: block; overflow: visible; }
.dia-wide { max-width: 100%; }

.d-fill        { fill: #b8946b; }
.d-fill-soft   { fill: #8f7150; }
.d-dark        { fill: #6b5238; }
.d-void        { fill: #241a15; }
.d-accent      { fill: var(--brass); }
.d-brahma      { fill: rgba(224,160,60,.13); }
.d-accent-stroke { stroke: var(--brass); stroke-width: 2; fill: none; stroke-linecap: round; }
.d-nofill      { fill: none; }
.d-line        { stroke: rgba(36,26,21,.45); stroke-width: 1; fill: none; }
.d-line-strong { stroke: rgba(36,26,21,.75); stroke-width: 1.6; fill: none; }
.d-outline     { fill: none; stroke: var(--line-2); stroke-width: 1.6; }
.d-outline-accent { fill: none; stroke: var(--brass); stroke-width: 2; }
.d-lead        { stroke: rgba(233,207,168,.35); stroke-width: 1; stroke-dasharray: 2 3; }
.d-dot         { fill: var(--brass); }
.d-label       { fill: var(--sand); font-family: var(--sans); font-size: 9px; letter-spacing: .06em; }
.d-dim         { fill: var(--muted); font-size: 7.5px; }
.d-center      { text-anchor: middle; fill: var(--brass); font-size: 8px; letter-spacing: .1em; }
.d-arrow       { stroke: var(--vermil); stroke-width: 1.6; fill: none; stroke-linecap: round; }

.dia-mandala .d-line { stroke: rgba(233,207,168,.22); }

.curve { fill: none; stroke-width: 2.2; stroke-linecap: round; }
.c-nagara  { stroke: var(--brass); }
.c-dravida { stroke: #6fa8c9; }
.c-kalinga { stroke: var(--vermil); }
.key.c-nagara  { fill: var(--brass);  stroke: none; }
.key.c-dravida { fill: #6fa8c9; stroke: none; }
.key.c-kalinga { fill: var(--vermil); stroke: none; }

/* the diagrams gain a little life on card hover */
.style-card:hover .d-accent { filter: drop-shadow(0 0 6px rgba(224,160,60,.55)); }
