/* Finsnovai site styles
   Dark mode is the default. Light mode is set with data-theme="light" on <html>.
   The zari (gold) borders are SVG tiles used as masks, so they always take the
   theme's gold colour and keep a transparent background. */

:root,
:root[data-theme="dark"] {
  --bg: #1A0E11;          /* arakku night: deep lac-maroon, almost black */
  --bg-2: #241418;        /* raised surfaces */
  --bg-3: #2F1B20;
  --text: #EFE4CE;        /* lamp ivory */
  --muted: #B8A48A;
  --faint: #8C7864;
  --zari: #CDA053;        /* zari gold */
  --zari-strong: #E2BC72;
  --zari-faint: rgba(205, 160, 83, 0.22);
  --rule: rgba(205, 160, 83, 0.28);
  --peacock: #6FB3A9;     /* used only for focus rings */
  --glow: rgba(226, 150, 70, 0.10);
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #F4EEDF;          /* kora silk */
  --bg-2: #EBE1CB;
  --bg-3: #E2D4B6;
  --text: #2A1614;
  --muted: #6B5243;
  --faint: #8D7563;
  --zari: #8C6420;
  --zari-strong: #6F4D12;
  --zari-faint: rgba(140, 100, 32, 0.18);
  --rule: rgba(140, 100, 32, 0.30);
  --peacock: #1F6F66;
  --glow: rgba(180, 120, 40, 0.10);
  --shadow: 0 30px 60px -34px rgba(60, 30, 10, 0.35);
  color-scheme: light;
}

:root {
  --serif: "Spectral", "Iowan Old Style", Georgia, serif;
  --display: "Marcellus", "Spectral", Georgia, serif;
  --deva: "Tiro Devanagari Sanskrit", "Noto Serif Devanagari", serif;
  --measure: 38rem;
  --wide: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

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

html {
  font-size: 106.25%; /* 17px */
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.7;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--zari-strong); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--peacock); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--bg-2); padding: .5rem 1rem; }

::selection { background: var(--zari); color: var(--bg); }

/* ---------- Zari ornaments ---------- */

.zari {
  display: block;
  width: 100%;
  background-color: var(--zari);
  -webkit-mask-repeat: repeat-x;
          mask-repeat: repeat-x;
  -webkit-mask-position: center;
          mask-position: center;
}
.zari--temple {
  height: 30px;
  -webkit-mask-image: url("ornaments/temple-border.svg");
          mask-image: url("ornaments/temple-border.svg");
  -webkit-mask-size: 32px 30px;
          mask-size: 32px 30px;
}
.zari--temple.is-flipped { transform: scaleY(-1); }
.zari--mango {
  height: 40px;
  -webkit-mask-image: url("ornaments/mango-border.svg");
          mask-image: url("ornaments/mango-border.svg");
  -webkit-mask-size: 56px 40px;
          mask-size: 56px 40px;
}
.zari--line { height: 1px; background: var(--rule); -webkit-mask: none; mask: none; }

/* The full saree border: double line, temple row, mango row, inverted temple row. */
.pallu {
  display: grid;
  gap: 10px;
  padding: 18px 0;
  color: var(--zari);
}
.pallu .zari--mango { opacity: .8; }

.lotus {
  width: 240px;
  height: 36px;
  margin: 3.5rem auto;
  background-color: var(--zari);
  -webkit-mask: url("ornaments/lotus-divider.svg") center / contain no-repeat;
          mask: url("ornaments/lotus-divider.svg") center / contain no-repeat;
  opacity: .9;
}

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  padding: 1rem var(--gutter) 2.2rem;
  /* The header fades into the page instead of ending on a hard edge. */
  background: linear-gradient(to bottom, var(--bg) 0%, var(--bg) 45%, transparent 100%);
  pointer-events: none;
}
.site-header__inner {
  max-width: var(--wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  pointer-events: auto;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: .55rem;
  color: var(--text);
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.25rem;
  letter-spacing: .02em;
}
.brand__mark {
  width: 1.4rem;
  height: 1.4rem;
  align-self: center;
  color: var(--zari);
}
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 1.4rem; }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .95rem;
  padding: .25rem 0;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--zari); }

.theme-toggle {
  width: 2.2rem;
  height: 2.2rem;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--zari);
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.theme-toggle:hover { border-color: var(--zari); background: var(--zari-faint); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

@media (max-width: 560px) {
  .site-nav { gap: 1rem; }
  .site-nav a { font-size: .9rem; }
  .brand__word { display: none; }
}

/* ---------- Layout ---------- */

main { display: block; }
.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.measure { max-width: var(--measure); }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: .005em;
  margin: 0;
  text-wrap: balance;
}
h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1.1em; }

.section { padding: clamp(4.5rem, 10vw, 7.5rem) 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 2.4rem; }
.section__head p { color: var(--muted); margin: 0; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-content: end;
  padding: 6.5rem 0 0;
  overflow: hidden;
}
.hero::before {
  /* A soft lamp glow behind the headline. */
  content: "";
  position: absolute;
  inset: -20% -10% auto auto;
  width: 70vmax;
  height: 70vmax;
  background: radial-gradient(closest-side, var(--glow), transparent 70%);
  pointer-events: none;
}
.hero__inner { position: relative; width: 100%; padding-bottom: clamp(2.5rem, 6vh, 4rem); will-change: opacity, transform; }
.hero__sloka {
  font-family: var(--deva);
  color: var(--zari);
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  margin: 0 0 .3rem;
}
.hero__gloss { color: var(--faint); font-size: .92rem; font-style: italic; margin: 0 0 1.8rem; }
.hero h1 {
  font-size: clamp(2.5rem, 6.2vw, 4.9rem);
  line-height: 1.05;
  max-width: 16ch;
  letter-spacing: -.005em;
}
.hero__lede {
  max-width: 34rem;
  margin: 1.5rem 0 2rem;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  color: var(--muted);
}
.actions { display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .8rem 1.4rem;
  border-radius: 999px;
  background: var(--zari);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  transition: background-color .2s, transform .2s;
}
.btn:hover { background: var(--zari-strong); color: var(--bg); }
.btn:active { transform: translateY(1px); }
.link-quiet { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--rule); padding-bottom: .1rem; }
.link-quiet:hover { border-bottom-color: var(--zari); }

/* The saree border weaves itself in once, from the centre outward. */
.js .pallu[data-weave] .zari { clip-path: inset(0 50% 0 50%); transition: clip-path 1.6s var(--ease); }
.js .pallu[data-weave] .zari:nth-child(2) { transition-delay: .12s; }
.js .pallu[data-weave] .zari:nth-child(3) { transition-delay: .24s; }
.js .pallu[data-weave].is-in .zari { clip-path: inset(0 0 0 0); }

/* ---------- Reveal on scroll ---------- */

.js [data-reveal] {
  opacity: 0;
  filter: blur(8px);
  transform: translateY(14px);
  transition: opacity 1.1s var(--ease), filter 1.1s var(--ease), transform 1.1s var(--ease);
}
.js [data-reveal].is-in { opacity: 1; filter: blur(0); transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; filter: none; transform: none; transition: none; }
  .js .pallu[data-weave] .zari { clip-path: none; transition: none; }
  .hero__inner { transform: none !important; opacity: 1 !important; }
}

/* ---------- Writing list ---------- */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.feature__media {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.feature__media img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; transition: transform 1.2s var(--ease); }
.feature:hover .feature__media img { transform: scale(1.03); }
.feature__media::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(239, 228, 206, .35);
  border-radius: 3px;
  pointer-events: none;
}
.feature h3 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); line-height: 1.1; margin: .6rem 0 1rem; }
.feature p { color: var(--muted); }
.feature:hover h3 { color: var(--zari-strong); }

.meta { color: var(--faint); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; }

.entries { list-style: none; margin: 3.5rem 0 0; padding: 0; border-top: 1px solid var(--rule); }
.entry a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .4rem 2rem;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--rule);
  color: inherit;
  text-decoration: none;
}
.entry h3 { font-size: clamp(1.3rem, 2.4vw, 1.6rem); transition: color .2s; }
.entry p { grid-column: 1; margin: 0; color: var(--muted); max-width: 42rem; }
.entry .meta { grid-column: 2; grid-row: 1 / span 2; align-self: start; text-align: right; display: block; white-space: nowrap; }
.entry a:hover h3 { color: var(--zari-strong); }
.entry--soon a { pointer-events: none; }
.entry--soon h3 { color: var(--muted); }

@media (max-width: 760px) {
  .feature { grid-template-columns: 1fr; }
  .entry a { grid-template-columns: 1fr; }
  .entry .meta { grid-column: 1; grid-row: auto; text-align: left; }
}

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
.portrait {
  position: relative;
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.portrait__frame {
  aspect-ratio: 4 / 5;
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg-2);
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: .9rem;
  text-align: center;
}
.portrait__frame img { width: 100%; height: 100%; object-fit: cover; }
.portrait .zari--temple { position: absolute; left: 0; right: 0; height: 15px; -webkit-mask-size: 16px 15px; mask-size: 16px 15px; }
.portrait .zari--temple.top { top: -8px; }
.portrait .zari--temple.bottom { bottom: -8px; transform: scaleY(-1); }
.about__body { font-size: 1.08rem; }
.about__body h2 { margin-bottom: 1.6rem; }
.about__body p:first-of-type::first-letter {
  font-family: var(--display);
  float: left;
  font-size: 3.6em;
  line-height: .85;
  padding: .08em .12em 0 0;
  color: var(--zari);
}
.facts { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .7rem; color: var(--muted); }
.facts li { padding-left: 1.4rem; position: relative; }
.facts li::before { content: ""; position: absolute; left: 0; top: .72em; width: .5rem; height: .5rem; transform: rotate(45deg); background: var(--zari); opacity: .8; }

@media (max-width: 760px) {
  .about { grid-template-columns: 1fr; }
  .portrait { max-width: 18rem; }
}

/* ---------- Studio ---------- */

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.studio p { color: var(--muted); }
.declension {
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.4rem 1.6rem;
  background: var(--bg-2);
}
.declension table { width: 100%; border-collapse: collapse; font-family: var(--deva); font-size: 1.15rem; }
.declension th { font-family: var(--serif); font-weight: 400; color: var(--faint); font-size: .85rem; text-align: left; padding: 0 0 .6rem; }
.declension td { padding: .45rem 0; border-top: 1px solid var(--rule); }
.declension td:first-child { color: var(--muted); font-size: 1rem; }
.declension caption { caption-side: bottom; text-align: left; color: var(--zari); font-family: var(--deva); padding-top: .8rem; }

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

/* ---------- Footer ---------- */

.site-footer { padding: 0 0 3rem; color: var(--muted); }
.site-footer .pallu { margin-bottom: 3rem; }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; align-items: baseline; }
.site-footer h2 { font-size: clamp(1.5rem, 3vw, 2rem); color: var(--text); margin-bottom: .6rem; }
.site-footer small { color: var(--faint); font-size: .85rem; }

/* ---------- Article ---------- */

.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 60;
  background: var(--zari);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.article-head { padding: 9rem 0 2.5rem; }
.article-head .wrap { max-width: 50rem; }
.crumb { color: var(--faint); font-size: .92rem; text-decoration: none; display: inline-block; margin-bottom: 2rem; }
.crumb:hover { color: var(--zari-strong); }
.article-head h1 { font-size: clamp(2.5rem, 6.4vw, 4.6rem); line-height: 1.04; }
.dek { font-size: clamp(1.15rem, 2vw, 1.35rem); color: var(--muted); margin: 1.4rem 0 1.8rem; max-width: 38rem; font-style: italic; }
.byline { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; color: var(--faint); font-size: .92rem; }
.byline strong { color: var(--text); font-weight: 600; }

.hero-figure { max-width: 64rem; margin: 0 auto 1rem; padding: 0 var(--gutter); }
.hero-figure img { border-radius: 6px; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; box-shadow: var(--shadow); }
.hero-figure figcaption { max-width: var(--measure); }

.prose { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); font-size: 1.12rem; line-height: 1.78; }
.prose > p:first-of-type::first-letter {
  font-family: var(--display);
  float: left;
  font-size: 3.7em;
  line-height: .82;
  padding: .1em .12em 0 0;
  color: var(--zari);
}
.prose h2 { font-size: clamp(1.55rem, 3vw, 1.95rem); margin: 3.2rem 0 1.1rem; }
.prose em { font-style: italic; }
.prose blockquote { margin: 2rem 0; padding-left: 1.4rem; border-left: 2px solid var(--zari); color: var(--muted); font-style: italic; }

.prose figure, .figure { margin: 2.6rem 0; }
.prose figure.wide { margin-left: calc(50% - min(32rem, 50vw - var(--gutter))); margin-right: calc(50% - min(32rem, 50vw - var(--gutter))); }
.prose figure img { width: 100%; border-radius: 4px; }
.prose figure.diagram img { background: #F4EEDF; padding: 1rem; }
figcaption { margin-top: .8rem; font-size: .95rem; color: var(--muted); line-height: 1.55; }
figcaption .credit { display: block; margin-top: .25rem; font-size: .8rem; color: var(--faint); }

.endmatter { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); font-size: .95rem; }
.endmatter h2 { font-size: 1.4rem; margin: 0 0 1.2rem; }
.endmatter ol, .endmatter ul { padding: 0; margin: 0 0 3rem; list-style: none; }
.endmatter li { padding-left: 1.6rem; text-indent: -1.6rem; margin-bottom: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.endmatter li em { color: var(--text); }

.next {
  max-width: var(--measure);
  margin: 2rem auto 0;
  padding: 0 var(--gutter);
}
.next a { display: block; padding: 1.6rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--text); }
.next span { display: block; color: var(--faint); font-size: .9rem; }
.next strong { font-family: var(--display); font-weight: 400; font-size: 1.5rem; }
.next a:hover strong { color: var(--zari-strong); }

/* Writing index page */
.page-head { padding: 9rem 0 1rem; }
.page-head h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); }
.page-head p { color: var(--muted); max-width: 36rem; margin-top: 1rem; font-size: 1.1rem; }

/* Longer essays and research reports: subheads, lists, tables, code and charts */
.prose h3 { font-size: clamp(1.2rem, 2.2vw, 1.4rem); margin: 2.4rem 0 .8rem; color: var(--zari-strong); }
.prose ol, .prose ul { padding-left: 1.4rem; margin: 1.4rem 0; }
.prose li { margin-bottom: .7rem; padding-left: .3rem; }
.prose li::marker { color: var(--zari); font-family: var(--display); }
.prose strong { font-weight: 600; }
.prose code { font-size: .88em; overflow-wrap: anywhere; }
.prose pre {
  margin: 1.6rem 0;
  padding: 1.1rem 1.3rem;
  background: var(--bg-2);
  border-left: 2px solid var(--zari);
  border-radius: 4px;
  overflow-x: auto;
  font-size: .95rem;
  line-height: 1.7;
  white-space: pre-wrap;
}
.prose pre code { font-family: var(--deva), var(--serif); font-size: 1em; }

.table-wrap { margin: 2rem 0; overflow-x: auto; -webkit-overflow-scrolling: touch; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.5; }
.table-wrap th, .table-wrap td { padding: .6rem .75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--zari-faint); }
.table-wrap thead th { font-weight: 600; color: var(--zari-strong); border-bottom: 1px solid var(--rule); }
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.table-wrap td:first-child { white-space: nowrap; }
@media (min-width: 60rem) {
  .prose .table-wrap.is-wide { margin-left: calc(50% - min(32rem, 50vw - var(--gutter))); margin-right: calc(50% - min(32rem, 50vw - var(--gutter))); }
}

/* Charts sit on a silk-coloured panel in both themes, so they read the same in dark mode. */
.prose figure.chart .chart__panel { background: #F4EEDF; padding: 1rem; border-radius: 4px; }
.prose figure.chart img { mix-blend-mode: multiply; border-radius: 0; }
@media (min-width: 60rem) {
  .prose figure.chart { margin-left: -3rem; margin-right: -3rem; }
}

/* Reports open plainly, without the drop cap. */
.prose--plain > p:first-of-type::first-letter { all: unset; }
.prose .report-meta { font-size: .95rem; color: var(--muted); margin: 0 0 .4rem; }
.prose .report-meta strong { color: var(--text); }
.prose .callout { margin: 2.4rem 0; padding: 1.2rem 1.4rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--bg-2); font-size: 1rem; }
.prose .callout p { margin: 0; }

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

