@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/EBGaramond.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/EBGaramond-Italic.woff2") format("woff2");
  font-weight: 400 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #f6f1e7;
  --ink: #1f1c19;
  --muted: #6b6158;
  --rule: #ddd3c3;
  --accent: #9c5640; /* clay, darkened for text contrast on paper */
  color-scheme: light dark;
}
/* Dark theme: from the system setting, unless the reader picked a theme with the toggle (assets/theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1f1c19;
    --ink: #efe8da;
    --muted: #a99f92;
    --rule: #3a342e;
    --accent: #d98e72;
  }
}
:root[data-theme="dark"] {
  --paper: #1f1c19;
  --ink: #efe8da;
  --muted: #a99f92;
  --rule: #3a342e;
  --accent: #d98e72;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.25rem/1.6 "EB Garamond", Georgia, "Times New Roman", serif;
  font-variant-numeric: oldstyle-nums;
}
.wrap { position: relative; max-width: 48rem; margin: 0 auto; padding: 2.5rem 1rem 3rem; }

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  color: var(--ink); text-decoration: none; font-size: 1.35rem; font-weight: 450;
}
.mark {
  display: inline-block; width: 2.1rem; height: 2.2rem; background: currentColor;
  -webkit-mask: url("/assets/mark.svg") center / contain no-repeat;
  mask: url("/assets/mark.svg") center / contain no-repeat;
}

h1 { font-size: clamp(2.2rem, 7vw, 3.2rem); line-height: 1.12; font-weight: 450; margin: 3.5rem 0 1.25rem; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 1.05rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 3rem 0 0.75rem; }
p { margin: 0 0 1rem; text-wrap: pretty; }
.lede { font-size: 1.4rem; line-height: 1.45; color: var(--muted); }
/* A personal note under the home page intro. */
.self { font-size: 1.2rem; font-style: italic; color: var(--muted); }
ul { padding-left: 1.2rem; }
li { margin-bottom: 0.4rem; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0 1.5rem; }
footer { font-size: 1rem; color: var(--muted); }
footer p { margin-bottom: 0.6rem; }

.code {
  font: 0.95rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  border: 1px solid var(--rule); border-radius: 6px;
  padding: 0.75rem; overflow-wrap: anywhere; user-select: all;
}
button {
  font: inherit; font-size: 1rem; color: var(--paper); background: var(--ink);
  border: 0; border-radius: 999px; padding: 0.45rem 1.1rem; cursor: pointer; margin-top: 0.75rem;
}
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
code { font: 0.85em ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Light/dark toggle, top right, level with the logo (added by assets/theme.js) */
.theme-toggle {
  position: absolute; top: 2.2rem; right: 0.25rem; width: 2.75rem; height: 2.75rem; margin: 0; padding: 0;
  display: grid; place-items: center; border-radius: 50%; background: transparent; color: var(--ink);
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }
.theme-toggle .sun, .theme-toggle.is-dark .moon { display: none; }
.theme-toggle.is-dark .sun { display: block; }

/* Article list on the home page */
.posts { list-style: none; padding: 0; margin: 0; }
.posts li { margin: 0 0 1.75rem; }
.posts a { font-size: 1.6rem; line-height: 1.2; color: var(--ink); text-decoration-color: var(--rule); }
.posts a:hover { text-decoration-color: var(--accent); }
.posts p { margin: 0.35rem 0 0.2rem; color: var(--muted); }
.posts time, .meta { font-size: 0.95rem; color: var(--muted); letter-spacing: 0.02em; }

/* Articles */
.article h1 { margin-bottom: 0.75rem; }
.article .lede { margin-bottom: 0.75rem; }
.meta { margin-bottom: 2.5rem; }
.article h2 {
  font-size: 1.55rem; line-height: 1.25; font-weight: 500; letter-spacing: 0; text-transform: none;
  color: var(--ink); margin: 3.25rem 0 0.35rem; text-wrap: balance;
}
.article h2 .n { color: var(--accent); margin-right: 0.35rem; }
.article h2 + p:not(.name) { margin-top: 0.8rem; }
.article .name { font-style: italic; color: var(--accent); margin: 0 0 1.1rem; letter-spacing: 0.01em; }
.article sup { font-size: 0.7em; line-height: 0; margin-left: 0.05em; }
.article sup a { text-decoration: none; }
.article blockquote { margin: 1.5rem 0; padding-left: 1.1rem; border-left: 2px solid var(--rule); color: var(--muted); }

.loop { margin: 2rem 0; text-align: center; }
.loop ol { list-style: none; padding: 0; margin: 0; }
.loop li { margin: 0; font-style: italic; }
.loop li + li::before {
  content: ""; display: block; width: 1px; height: 1.1rem; margin: 0.3rem auto; background: var(--rule);
}
.loop figcaption { margin-top: 0.75rem; font-size: 1rem; color: var(--muted); }

.article .verse { margin: 2.25rem 0; padding: 0; border: 0; text-align: center; }
.verse .hi { font-family: "Tiro Devanagari Hindi", "Noto Serif Devanagari", "Kohinoor Devanagari", "Devanagari Sangam MN", serif; font-size: 1.2rem; line-height: 1.8; color: var(--ink); margin-bottom: 0.6rem; }
.verse .tr { font-style: italic; color: var(--muted); }
.verse .en { margin-bottom: 0.4rem; }
.verse cite { font-size: 1rem; font-style: normal; color: var(--muted); }

.pull { font-size: clamp(1.5rem, 4.5vw, 1.85rem); line-height: 1.3; text-align: center; margin: 2.5rem 0; text-wrap: balance; }
.question { font-style: italic; }

.note { margin-top: 3rem; padding: 1.25rem 1.25rem 0.5rem; border: 1px solid var(--rule); border-radius: 6px; font-size: 1.1rem; }
.note h2 { margin-top: 0; font-size: 1.05rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.note ul, .note ol { margin: 0 0 0.75rem; }
.note ol { padding-left: 1.4rem; }
.note ol li::marker { color: var(--accent); }
.tldr { margin: 0 0 2.75rem; background: color-mix(in srgb, var(--ink) 4%, transparent); }
.tldr h2 { margin-bottom: 0.6rem; }
.tldr li { margin-bottom: 0.55rem; }

.fine { font-size: 1rem; color: var(--muted); }

.sources { font-size: 1rem; color: var(--muted); padding-left: 1.4rem; }
.sources li { margin-bottom: 0.6rem; overflow-wrap: anywhere; }
.sources li:target { color: var(--ink); }

/* Sources start collapsed. assets/sources.js opens them when a reader follows a footnote. */
.sources-box { margin: 3.25rem 0 1.25rem; }
.sources-box summary {
  display: flex; align-items: center; gap: 0.65rem; width: fit-content; min-height: 2.75rem;
  cursor: pointer; list-style: none;
}
.sources-box summary::-webkit-details-marker { display: none; }
.sources-box summary h2 { margin: 0; }
.sources-box summary::after {
  content: ""; width: 0.5rem; height: 0.5rem; margin-top: -0.2rem;
  border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform 0.2s;
}
.sources-box[open] summary::after { margin-top: 0.2rem; transform: rotate(-135deg); }
.sources-box summary:hover h2, .sources-box summary:hover::after { color: var(--accent); border-color: var(--accent); }
.sources-box summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sources-box .sources { margin: 0.75rem 0 0; }

/* Heart, share, Instagram and subscribe: a rail that sticks to the bottom of the screen beside the article text, and stops
   at the end of the article so it never reaches the footer. The track spans the article's height; the rail is
   sticky inside it. On narrow screens, where there's no room beside the text, the track sits on the right edge. */
.article { position: relative; }
.rail-track {
  position: absolute; top: 0; bottom: 0; right: -0.25rem; z-index: 5;
  display: flex; flex-direction: column; justify-content: flex-end; pointer-events: none;
}
.rail {
  position: sticky; bottom: 1rem; pointer-events: auto;
  display: flex; flex-direction: column; align-items: center; gap: 0.7rem;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
/* Set by assets/rail.js while scrolling down on phones. */
.rail.away:not(:focus-within) { transform: translateX(calc(100% + 1rem)); opacity: 0; pointer-events: none; }
.rail-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem; margin: 0; padding: 0;
  background: transparent; color: var(--ink); border-radius: 0; text-decoration: none; line-height: 1;
}
.rail .disc {
  width: 2.9rem; height: 2.9rem; border-radius: 50%; display: grid; place-items: center; background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--rule), 0 2px 10px rgb(0 0 0 / 0.14); transition: box-shadow 0.15s;
}
.rail .disc svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }
.rail-btn:hover { color: var(--accent); }
.rail-btn:hover .disc { box-shadow: inset 0 0 0 1px var(--accent), 0 2px 10px rgb(0 0 0 / 0.14); }
.heart .heart-on, .heart[aria-pressed="true"] .heart-off { display: none; }
.heart[aria-pressed="true"] .heart-on { display: block; }
.heart[aria-pressed="true"] { color: var(--accent); }
.heart[aria-pressed="true"] .disc { box-shadow: inset 0 0 0 1px var(--accent), 0 2px 10px rgb(0 0 0 / 0.14); }
.heart-count { font-size: 0.9rem; color: var(--muted); font-variant-numeric: lining-nums tabular-nums; }
.heart-count:empty { display: none; }
.heart.pop svg { animation: pop 0.35s ease-out; }
@keyframes pop { 40% { transform: scale(1.3); } }
/* On narrow screens the rail rests over the text column at the end, so give it room below the last paragraph. */
@media (max-width: 59.99rem) {
  .article { padding-bottom: 15rem; }
  /* Clip the rail as it slides off to the right (.away), so the page never gets wider than the screen and can't be
     dragged sideways. The padding keeps the rail in the same place and leaves room for the discs' shadows. */
  .rail-track { right: -0.95rem; padding: 0 0.7rem; overflow-x: clip; }
}
@media (min-width: 60rem) {
  /* Just right of the text column, low on the screen. */
  .rail-track { right: auto; left: calc(100% + 1.5rem); }
  .rail { bottom: 3rem; }
  .rail .disc { box-shadow: inset 0 0 0 1px var(--rule); }
}
.watch { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 3rem; }

/* Email sign-up (assets/subscribe.js): inline on the home page, and in a popup from the rail on articles. */
.subscribe { flex: 1 1 19rem; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; }
.subscribe input[type="email"] {
  flex: 1 1 11rem; min-width: 0; min-height: 2.75rem; padding: 0.45rem 1rem;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  border: 1px solid var(--rule); border-radius: 999px;
}
.subscribe input[type="email"]::placeholder { color: var(--muted); opacity: 1; }
.subscribe input[type="email"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.subscribe input[aria-invalid="true"] { border-color: var(--accent); }
.subscribe button { margin: 0; min-height: 2.75rem; }
.subscribe button:disabled { opacity: 0.6; cursor: default; }
.subscribe .trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sub-msg { flex-basis: 100%; margin: 0; font-size: 1rem; color: var(--muted); }
.sub-msg:empty { display: none; }
.subbox-dek { margin: 0.5rem 0 1rem; font-size: 1.1rem; color: var(--muted); }
.subbox-fine { margin: 0.9rem 0 0; font-size: 0.95rem; color: var(--muted); }
.ig { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; margin: -0.5rem 0; color: var(--ink); border-radius: 50%; }
.ig:hover { color: var(--accent); }
.ig svg { width: 1.5rem; height: 1.5rem; fill: currentColor; }

/* Share popup (assets/share.js) */
.sharebox {
  width: min(34rem, calc(100vw - 2rem)); max-width: none; padding: 0; border: 1px solid var(--rule); border-radius: 14px;
  background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgb(0 0 0 / 0.25);
}
.sharebox::backdrop { background: rgb(20 18 16 / 0.55); }
.sharebox-in { padding: 1.1rem 1.25rem 1.4rem; }
.sharebox-head { display: flex; align-items: center; justify-content: space-between; }
.sharebox-head h2 { margin: 0; font-size: 1.35rem; letter-spacing: 0; text-transform: none; color: var(--ink); font-weight: 500; }
.sharebox button { margin: 0; }
.sharebox-close { background: transparent; color: var(--ink); padding: 0.5rem; width: 2.5rem; height: 2.5rem; display: grid; place-items: center; }
.sharebox-close svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }
.sharebox-row { position: relative; margin: 1rem -1.25rem 1.25rem; }
.sharebox-targets {
  list-style: none; margin: 0; padding: 0.25rem 1.25rem; display: flex; gap: 0.35rem; overflow-x: auto;
  scroll-snap-type: x proximity; scroll-padding-inline: 1.25rem; scrollbar-width: none; overscroll-behavior-x: contain;
}
.sharebox-targets::-webkit-scrollbar { display: none; }
.sharebox-targets li { margin: 0; flex: none; scroll-snap-align: start; }
.sharebox-targets a, .sharebox-targets button {
  display: flex; flex-direction: column; align-items: center; gap: 0.45rem; width: 5.25rem; padding: 0.35rem 0;
  font: inherit; font-size: 0.95rem; line-height: 1.2; color: var(--ink); text-decoration: none;
  background: transparent; border-radius: 10px;
}
.sharebox-targets a:hover .ico, .sharebox-targets button:hover .ico { filter: brightness(1.08); transform: translateY(-1px); }
.sharebox .ico {
  width: 3.6rem; height: 3.6rem; border-radius: 50%; display: grid; place-items: center; color: #fff;
  transition: transform 0.15s, filter 0.15s;
}
.sharebox .ico svg { width: 46%; height: 46%; fill: currentColor; }
.ico-whatsapp { background: #25d366; }
.ico-facebook { background: #1877f2; }
.ico-x { background: #000; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18); }
.ico-messages { background: #1a73e8; }
.ico-email { background: #7d756c; }
.ico-reddit { background: #ff4500; }
.ico-pinterest { background: #e60023; }
.ico-linkedin { background: #0a66c2; }
.ico-more { background: color-mix(in srgb, var(--ink) 12%, var(--paper)); }
.sharebox .ico-more { color: var(--ink); }
.sharebox-arrow {
  position: absolute; top: 1.2rem; width: 2.5rem; height: 2.5rem; padding: 0; border-radius: 50%;
  display: grid; place-items: center; background: var(--paper); color: var(--ink);
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.22), inset 0 0 0 1px var(--rule); z-index: 1;
}
.sharebox-arrow[hidden] { display: none; }
.sharebox-arrow svg { width: 1rem; height: 1rem; fill: currentColor; }
.sharebox-arrow.prev { left: 0.4rem; }
.sharebox-arrow.next { right: 0.4rem; }
@media (pointer: coarse) { .sharebox-arrow { display: none; } }
.sharebox-link {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.35rem 0.35rem 0.9rem;
  border: 1px solid var(--rule); border-radius: 12px; background: color-mix(in srgb, var(--ink) 4%, transparent);
}
.sharebox-link input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font: 1rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis;
}
.sharebox-link input:focus { outline: none; }
.sharebox-link:focus-within { border-color: var(--accent); }
.sharebox-copy { flex: none; padding: 0.45rem 1.1rem; }
@media (prefers-reduced-motion: reduce) {
  .heart.pop svg { animation: none; }
  .rail { transition: opacity 0.2s; }
  .rail.away:not(:focus-within) { transform: none; }
  .sharebox .ico { transition: none; }
  .sources-box summary::after { transition: none; }
}
