/* ============================================================
   dilipshanghvi.in — global.css
   Design system: "Editorial Archive"
   Warm ivory paper · graphite ink · deep petrol · oxide clay
   ============================================================ */

/* ---------- 1. Design tokens ---------- */
:root {
  /* Surfaces */
  --paper:        #f5f2eb;   /* warm ivory — primary page ground */
  --paper-pure:   #fbf9f5;   /* lifted card / plate ground        */
  --paper-alt:    #ece7dd;   /* recessed band                     */
  --deep:         #0e2429;   /* deep petrol — controlled dark     */
  --deep-2:       #143138;   /* petrol, one step up               */

  /* Ink */
  --ink:          #15181a;   /* headings, primary text            */
  --ink-2:        #2c3134;   /* body text                         */
  --stone:        #585c5e;   /* metadata, captions (AA on paper)  */
  --stone-light:  #8a8a82;   /* decorative only, never body copy  */

  /* Accent — used sparingly */
  --accent:       #b0543a;   /* oxide clay — marks, rules         */
  --accent-ink:   #96412b;   /* accent for text / links (AA)      */
  --accent-lt:    #e08a66;   /* accent on dark grounds            */
  --accent-wash:  #efe1d9;

  /* On dark */
  --on-deep:      #f2efe8;
  --on-deep-soft: #a8b4b6;

  /* Lines */
  --rule:         #d8d2c6;
  --rule-strong:  #bdb5a5;
  --rule-deep:    rgba(242, 239, 232, 0.18);

  /* Type */
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans:  "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Rhythm */
  --shell:   1320px;
  --gutter:  clamp(20px, 5vw, 72px);
  --band:    clamp(64px, 9vw, 132px);   /* vertical section padding */
  --stack:   clamp(28px, 3.4vw, 44px);

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 400; }
p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 0; }

::selection { background: var(--accent-wash); color: var(--ink); }

/* ---------- 3. Accessibility ---------- */
:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
  border-radius: 2px;
}
.on-deep :focus-visible,
.deep-band :focus-visible { outline-color: var(--accent-lt); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -60px; left: 16px;
  z-index: 200;
  background: var(--deep);
  color: var(--on-deep);
  padding: 10px 18px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 14px; }

/* ---------- 4. Layout primitives ---------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.shell--wide { max-width: 1560px; }
.shell--narrow { max-width: 900px; }

.band { padding-block: var(--band); }
.band--tight { padding-block: clamp(44px, 6vw, 84px); }
.band--alt { background: var(--paper-alt); }
.band--pure { background: var(--paper-pure); }

.deep-band {
  background: var(--deep);
  color: var(--on-deep);
}
.deep-band h1, .deep-band h2, .deep-band h3, .deep-band h4 { color: var(--on-deep); }
.deep-band p { color: var(--on-deep-soft); }
.deep-band .eyebrow { color: var(--accent-lt); }
.deep-band .eyebrow::before { background: var(--accent-lt); }
.deep-band hr,
.deep-band .rule { border-top-color: var(--rule-deep); }

.rule { border-top: 1px solid var(--rule); }
.rule--strong { border-top: 1px solid var(--rule-strong); }

/* Grid used by most compositions */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(20px, 2.6vw, 40px);
}

/* ---------- 5. Typography scale ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 20px;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--accent);
  flex: none;
}
.eyebrow--plain { color: var(--stone); }
.eyebrow--plain::before { background: var(--rule-strong); }

.index-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--stone-light);
}

.display {
  font-family: var(--serif);
  font-weight: 300;
  line-height: 0.98;
  letter-spacing: -0.022em;
  color: var(--ink);
  font-size: clamp(3rem, 8.4vw, 7.2rem);
}

.title-xl {
  font-family: var(--serif);
  font-weight: 300;
  line-height: 1.03;
  letter-spacing: -0.018em;
  color: var(--ink);
  font-size: clamp(2.5rem, 6vw, 4.6rem);
}

.title-lg {
  font-family: var(--serif);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.014em;
  color: var(--ink);
  font-size: clamp(2rem, 3.9vw, 3.1rem);
}

.title-md {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-size: clamp(1.45rem, 2.3vw, 1.95rem);
}

.title-sm {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.25;
  color: var(--ink);
  font-size: clamp(1.15rem, 1.5vw, 1.32rem);
}

.label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stone);
}

.lede {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.22rem, 2.05vw, 1.6rem);
  line-height: 1.5;
  letter-spacing: -0.004em;
  color: var(--ink-2);
}

.caption {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  letter-spacing: 0.03em;
  color: var(--stone);
}

.source {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone);
}

/* Long-form editorial prose */
.prose > * + * { margin-top: 1.15em; }
.prose p {
  font-family: var(--serif);
  font-size: clamp(1.03rem, 1.18vw, 1.13rem);
  line-height: 1.72;
  color: var(--ink-2);
}
.prose h3 {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 400;
  line-height: 1.22;
  color: var(--ink);
  margin-top: 2.1em;
  letter-spacing: -0.01em;
}
.prose h4 {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-top: 2.2em;
}
.prose strong { font-weight: 600; color: var(--ink); }
.prose em { font-style: italic; }
.prose a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(150, 65, 43, 0.4);
  transition: text-decoration-color 0.25s var(--ease);
}
.prose a:hover { text-decoration-color: var(--accent-ink); }

.prose ul.marks { margin-top: 1.3em; }
.prose ul.marks li {
  position: relative;
  padding-left: 26px;
  font-family: var(--serif);
  font-size: clamp(1.02rem, 1.15vw, 1.1rem);
  line-height: 1.68;
  color: var(--ink-2);
}
.prose ul.marks li + li { margin-top: 0.7em; }
.prose ul.marks li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.72em;
  width: 12px; height: 1px;
  background: var(--accent);
}

/* Drop-cap for opening editorial paragraph */
.prose .opens::first-letter {
  float: left;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 4.1em;
  line-height: 0.78;
  padding: 0.06em 0.12em 0 0;
  color: var(--ink);
}

/* ---------- 6. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- 7. Print ---------- */
@media print {
  .site-header, .site-footer, .page-nav, .index-panel, .read-progress { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- 8. Overrides inside .prose ---------- */
.prose p.source,
.prose .source {
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.65;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--stone);
}
.deep-band .prose p.source { color: var(--on-deep-soft); }
.prose p.caption { font-family: var(--mono); font-size: 11.5px; line-height: 1.55; color: var(--stone); text-transform: none; letter-spacing: 0.03em; }

/* Beginning-of-story marker (home opening) */
.begin-mark {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: clamp(30px, 4vw, 54px);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--stone);
}
.begin-mark::before {
  content: "";
  width: 1px;
  height: 46px;
  background: linear-gradient(to bottom, var(--accent), rgba(176, 84, 58, 0));
  flex: none;
}
.begin-mark span { display: block; }

/* ---------- 9. Dark-context colour overrides ----------
   Any section carrying .deep-band gets a complete inverted
   palette, so no component can inherit dark ink on a dark
   ground. Keep this block last so it always wins.          */
.deep-band .prose p,
.deep-band .prose li,
.deep-band .prose ul.marks li { color: var(--on-deep-soft); }
.deep-band .prose h3,
.deep-band .prose strong,
.deep-band .lede,
.deep-band .title-xl,
.deep-band .title-lg,
.deep-band .title-md,
.deep-band .title-sm,
.deep-band .display { color: var(--on-deep); }
.deep-band .prose ul.marks li::before { background: var(--accent-lt); }
.deep-band .prose a { color: var(--accent-lt); text-decoration-color: rgba(224, 138, 102, 0.5); }
.deep-band .prose a:hover { text-decoration-color: var(--accent-lt); }
.deep-band .caption,
.deep-band .label,
.deep-band .source,
.deep-band .prose p.source { color: var(--on-deep-soft); }
.deep-band .masthead__crumb,
.deep-band .masthead__crumb a { color: var(--on-deep-soft); }
.deep-band .masthead__crumb a:hover,
.deep-band .masthead__crumb [aria-current] { color: var(--accent-lt); }
.deep-band .masthead__crumb .sep { color: rgba(242, 239, 232, 0.3); }
.deep-band .masthead__title,
.deep-band .masthead__lede { color: var(--on-deep); }
.deep-band .itable td,
.deep-band .itable th { border-bottom-color: var(--rule-deep); color: var(--on-deep-soft); }
.deep-band .itable td:first-child { color: var(--accent-lt); }
.deep-band .related a { border-color: var(--rule-deep); }
.deep-band .related .t { color: var(--on-deep); }
.deep-band .related .n { color: var(--accent-lt); }
.deep-band .related .arrow { color: var(--on-deep-soft); }
