/* ==========================================================================
   Aditya Dave — editorial stylesheet
   Paper #FBF9F5 · Ink #1A1815 · Accent deep rust #9A3B24
   Reading-first: 19px / 1.75 / 68ch measure
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------- */

:root {
  --paper:      #FBF9F5;
  --paper-2:    #F4F1EA;
  --paper-3:    #EDE8DE;
  --ink:        #1A1815;
  --ink-soft:   #4A453D;
  --ink-mute:   #7A7368;
  --rule:       #E2DCD1;
  --rule-soft:  #EFEAE0;
  --accent:     #9A3B24;
  --accent-2:   #B85A3E;
  --selection:  #F2D9CE;

  --font-display: "Newsreader", Georgia, "Times New Roman", Times, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;

  --measure: 68ch;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --shell: 78rem;

  --step-back: 0.8125rem;
  --step-0: 1rem;
  --step-body: 1.1875rem;              /* 19px */
  --step-lede: clamp(1.3125rem, 2.6vw, 1.5rem);
  --step-h3: clamp(1.3rem, 2.4vw, 1.55rem);
  --step-h2: clamp(1.55rem, 3vw, 2rem);
  --step-h1: clamp(2rem, 5vw, 3rem);
  --step-hero: clamp(2.4rem, 7.5vw, 4rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:     #14120F;
    --paper-2:   #1B1815;
    --paper-3:   #24201B;
    --ink:       #F0EBE2;
    --ink-soft:  #C3BAAB;
    --ink-mute:  #8F8778;
    --rule:      #2E2A24;
    --rule-soft: #232019;
    --accent:    #E0836A;
    --accent-2:  #EC9C86;
    --selection: #4A2519;
  }
}

:root[data-theme="dark"] {
  --paper:     #14120F;
  --paper-2:   #1B1815;
  --paper-3:   #24201B;
  --ink:       #F0EBE2;
  --ink-soft:  #C3BAAB;
  --ink-mute:  #8F8778;
  --rule:      #2E2A24;
  --rule-soft: #232019;
  --accent:    #E0836A;
  --accent-2:  #EC9C86;
  --selection: #4A2519;
}

/* --- Reset -------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-body);
  line-height: 1.75;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

hr { border: 0; }

/* --- Focus & skip link -------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1.25rem;
  font-size: var(--step-back);
  text-decoration: none;
}
.skip-link:focus { left: 0; }

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

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.measure { max-width: var(--measure); }

.page { min-height: 100vh; display: flex; flex-direction: column; }
.page > main { flex: 1 0 auto; }

/* --- Reading progress --------------------------------------------------- */

.progress {
  position: fixed;
  inset-block-start: 0;
  inset-inline-start: 0;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: var(--accent);
  z-index: 60;
  will-change: transform;
}

/* --- Masthead ----------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.5rem;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.011em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark:hover { color: var(--accent); }

.nav { display: flex; align-items: center; gap: 2rem; }

.nav a {
  font-size: 0.9375rem;
  color: var(--ink-soft);
  text-decoration: none;
  padding-block: 0.25rem;
  border-bottom: 1px solid transparent;
  transition: color 0.16s ease, border-color 0.16s ease;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--rule); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 0.5rem;
  margin-inline-end: -0.5rem;
  cursor: pointer;
  color: var(--ink);
}
.nav-toggle svg { width: 22px; height: 22px; }

@media (max-width: 44rem) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed;
    inset: 4.5rem 0 auto 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: 0.5rem var(--gutter) 1.5rem;
    display: none;
  }
  .nav[data-open="true"] { display: flex; }
  .nav a {
    width: 100%;
    padding-block: 0.85rem;
    font-size: 1.0625rem;
    border-bottom: 1px solid var(--rule-soft);
  }
  .nav a[aria-current="page"] { border-bottom-color: var(--rule-soft); color: var(--accent); }
}

/* --- Illustrated hero --------------------------------------------------- */

.hero-scene {
  padding-block: clamp(1.5rem, 4vw, 2.75rem) 0;
}

/* The illustration is close to square, so at full container width it eats the
   whole first screen and pushes the introduction below the fold. Holding it to
   about 40rem keeps the picture and the opening words visible together. */
.hero-scene__frame {
  max-width: 40rem;
  margin-inline: auto;
}

.hero-art {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

/* The illustration carries its own warm ground, so in dark mode it would sit on
   the page like a lit panel. Softening it keeps it part of the page. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero-art { filter: brightness(.9) saturate(.94); }
}
:root[data-theme="dark"] .hero-art { filter: brightness(.9) saturate(.94); }

.intro {
  max-width: 46rem;
  margin-inline: auto;
  padding-block: clamp(2rem, 5vw, 3rem) clamp(2.5rem, 6vw, 4rem);
  text-align: center;
}

.intro__title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4.6vw, 2.9rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
  text-wrap: balance;
}

.intro__body {
  margin: 0 auto;
  max-width: 34em;
  font-size: var(--step-lede);
  line-height: 1.6;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.intro__body p { margin: 0; }
.intro__body strong { color: var(--ink); font-weight: 500; }

.intro__body a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  transition: color 0.16s ease;
}
.intro__body a:hover { color: var(--accent); }

.intro__actions {
  margin-top: clamp(1.75rem, 4vw, 2.25rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  justify-content: center;
}

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

.hero {
  padding-block: clamp(4rem, 12vw, 8.5rem) clamp(2.5rem, 6vw, 4rem);
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--step-hero);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.022em;
  margin: 0;
  max-width: 18ch;
  text-wrap: balance;
}

.hero__sub {
  margin: clamp(1.25rem, 3vw, 1.75rem) 0 0;
  font-size: var(--step-lede);
  line-height: 1.55;
  color: var(--ink-mute);
  max-width: 44ch;
  text-wrap: pretty;
}

.hero__actions {
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
}

/* --- Buttons & links ---------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  padding: 0.8125rem 1.375rem;
  border-radius: 2px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
  cursor: pointer;
}

.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--accent); }

.btn--ghost { border-color: var(--rule); color: var(--ink); background: transparent; }
.btn--ghost:hover { border-color: var(--ink); }

.textlink {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
  transition: color 0.16s ease;
}
.textlink:hover { color: var(--accent); }

.arrowlink {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9375rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.arrowlink span { transition: transform 0.18s ease; }
.arrowlink:hover span { transform: translateX(3px); }

/* --- Section furniture -------------------------------------------------- */

.eyebrow {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0;
}

.rule {
  height: 1px;
  background: var(--rule);
  border: 0;
  margin: 0;
}

.section { padding-block: clamp(3rem, 7vw, 5rem); }

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

/* --- Essay list --------------------------------------------------------- */

.essays { list-style: none; margin: 0; padding: 0; }

.essays > li { border-bottom: 1px solid var(--rule-soft); }

.essay-item {
  display: block;
  padding-block: clamp(1.75rem, 4vw, 2.5rem);
  text-decoration: none;
  color: inherit;
  position: relative;
}

.essay-item__meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 0.6rem;
}
.essay-item__meta i { font-style: normal; opacity: 0.55; }

.essay-item__title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.2vw, 1.875rem);
  font-weight: 400;
  line-height: 1.22;
  letter-spacing: -0.014em;
  margin: 0;
  max-width: 26ch;
  text-wrap: balance;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.28s ease;
}
.essay-item:hover .essay-item__title { background-size: 100% 1px; }

.essay-item__excerpt {
  margin: 0.75rem 0 0;
  color: var(--ink-soft);
  font-size: 1.0625rem;
  line-height: 1.65;
  max-width: 58ch;
  text-wrap: pretty;
}

/* --- Empty state -------------------------------------------------------- */

.empty {
  padding-block: clamp(2.5rem, 6vw, 4rem);
  border-top: 1px solid var(--rule);
}

.empty__title {
  font-family: var(--font-display);
  font-size: var(--step-h2);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.014em;
  margin: 0 0 0.75rem;
  max-width: 22ch;
}

.empty__body {
  margin: 0;
  color: var(--ink-soft);
  max-width: 52ch;
  font-size: 1.0625rem;
  line-height: 1.7;
}

/* --- Topic strip -------------------------------------------------------- */

.topics {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(1.75rem, 4vw, 3rem);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.topics h3 {
  font-family: var(--font-display);
  font-size: var(--step-h3);
  font-weight: 400;
  letter-spacing: -0.012em;
  line-height: 1.3;
  margin: 0 0 0.5rem;
}

.topics p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.0625rem;
  line-height: 1.65;
}

.topics li { border-top: 2px solid var(--ink); padding-top: 1rem; }

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

.article { padding-block: clamp(2.5rem, 6vw, 4rem) clamp(3rem, 7vw, 5rem); }

.article__back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  color: var(--ink-mute);
  text-decoration: none;
  margin-bottom: clamp(2rem, 5vw, 3rem);
}
.article__back:hover { color: var(--accent); }
.article__back span { transition: transform 0.18s ease; }
.article__back:hover span { transform: translateX(-3px); }

.article__meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 1rem;
}
.article__meta i { font-style: normal; opacity: 0.55; }

.article__title {
  font-family: var(--font-display);
  font-size: var(--step-h1);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 22ch;
  text-wrap: balance;
}

.article__lede {
  margin: 1.25rem 0 0;
  font-size: var(--step-lede);
  line-height: 1.6;
  color: var(--ink-mute);
  max-width: 50ch;
  text-wrap: pretty;
}

.article__divider { margin-block: clamp(2.25rem, 5vw, 3rem); }

/* --- Prose -------------------------------------------------------------- */

.prose { max-width: var(--measure); }

/* Flow spacing. Every rule here is (0,1,1) so element rules below
   cannot silently out-rank it, which is exactly what went wrong before. */
.prose > * { margin: 0; }
.prose > * + * { margin-top: 1.5em; }
.prose > * + h2 { margin-top: 2.4em; }
.prose > * + h3 { margin-top: 2em; }
.prose > * + h4 { margin-top: 1.9em; }
.prose > h2 + * { margin-top: 0.7em; }
.prose > h3 + * { margin-top: 0.65em; }
.prose > h4 + * { margin-top: 0.6em; }

.prose p {
  line-height: 1.75;
  text-wrap: pretty;
}

.prose .lede {
  font-size: var(--step-lede);
  line-height: 1.6;
  color: var(--ink);
}

.prose h2 {
  font-family: var(--font-display);
  font-size: var(--step-h2);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.014em;
  max-width: 24ch;
  text-wrap: balance;
}

.prose h3 {
  font-family: var(--font-display);
  font-size: var(--step-h3);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  max-width: 30ch;
}

.prose h4 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.prose a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  transition: color 0.16s ease, background 0.16s ease;
}
.prose a:hover { color: var(--accent); }

.prose strong { font-weight: 600; color: var(--ink); }

.prose em { font-style: italic; }

.prose ul, .prose ol { padding-inline-start: 1.35em; }
.prose li { margin-block: 0.5em; line-height: 1.7; }
.prose li::marker { color: var(--ink-mute); }

.prose blockquote {
  margin: 2em 0;
  padding-inline-start: 1.5rem;
  border-inline-start: 2px solid var(--accent);
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.5;
  font-style: italic;
  color: var(--ink-soft);
}
.prose blockquote p + p { margin-top: 0.8em; }

.prose figure { margin: 2.5em 0; }
.prose figure img { width: 100%; border-radius: 2px; }
.prose figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--ink-mute);
  text-align: center;
}

.prose img { border-radius: 2px; }

.prose hr {
  margin-block: 2.75em;
  height: auto;
  text-align: center;
  border: 0;
  color: var(--ink-mute);
}
.prose hr::before {
  content: "· · ·";
  letter-spacing: 0.5em;
  font-size: 0.9rem;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
  background: var(--paper-3);
  padding: 0.15em 0.4em;
  border-radius: 2px;
}

.prose pre {
  background: var(--paper-3);
  padding: 1.25rem;
  border-radius: 3px;
  overflow-x: auto;
  font-size: 0.9375rem;
  line-height: 1.6;
}
.prose pre code { background: none; padding: 0; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  display: block;
  overflow-x: auto;
}
.prose th, .prose td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--rule);
}
.prose th { font-weight: 600; }

/* --- Subscribe ---------------------------------------------------------- */

.subscribe {
  background: var(--paper-2);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding-block: clamp(3rem, 7vw, 4.5rem);
}

.subscribe__title {
  font-family: var(--font-display);
  font-size: var(--step-h2);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.016em;
  margin: 0 0 0.75rem;
  max-width: 20ch;
}

.subscribe__body {
  margin: 0 0 1.75rem;
  color: var(--ink-soft);
  max-width: 48ch;
  font-size: 1.0625rem;
  line-height: 1.65;
}

.subscribe__embed {
  width: 100%;
  max-width: 30rem;
  height: 112px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper);
  color-scheme: light;
}

.subscribe__note {
  margin: 1rem 0 0;
  font-size: 0.8125rem;
  color: var(--ink-mute);
}

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

.postscript {
  max-width: var(--measure);
  margin-top: clamp(3rem, 7vw, 4.5rem);
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9375rem;
  color: var(--ink-mute);
}

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

.about { padding-block: clamp(3rem, 8vw, 5rem); }

.about__title {
  font-family: var(--font-display);
  font-size: var(--step-h1);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 clamp(2rem, 5vw, 3rem);
}

.contact {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 1.75rem 0 0;
  border-top: 1px solid var(--rule);
  max-width: var(--measure);
  display: grid;
  gap: 0.85rem;
}
.contact li { display: flex; gap: 1rem; font-size: 1rem; }
.contact dt, .contact b {
  min-width: 6.5rem;
  color: var(--ink-mute);
  font-size: 0.75rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  font-weight: 500;
  padding-top: 0.35rem;
}

.about__layout {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}

@media (min-width: 58rem) {
  .about__layout { grid-template-columns: minmax(0, var(--measure)) 15rem; }
}

.about__portrait {
  width: 100%;
  max-width: 15rem;
  border-radius: 3px;
  filter: saturate(0.92);
}

.about__portrait-cap {
  margin: 0.85rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-mute);
  max-width: 15rem;
}

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

.footer {
  border-top: 1px solid var(--rule);
  padding-block: clamp(2.5rem, 6vw, 3.5rem);
  margin-top: auto;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  align-items: baseline;
  justify-content: space-between;
}

.footer__brand {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  margin: 0;
  font-weight: 400;
}

.footer__tag {
  margin: 0.2rem 0 0;
  font-size: 0.875rem;
  color: var(--ink-mute);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.9375rem;
}
.footer__links a { color: var(--ink-soft); text-decoration: none; }
.footer__links a:hover { color: var(--accent); }

.footer__legal {
  margin-top: 2rem;
  font-size: 0.8125rem;
  color: var(--ink-mute);
}

/* --- 404 ---------------------------------------------------------------- */

.notfound {
  padding-block: clamp(5rem, 15vw, 10rem);
  text-align: left;
}
.notfound h1 {
  font-family: var(--font-display);
  font-size: var(--step-h1);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  max-width: 16ch;
}
.notfound p { margin: 0 0 2rem; color: var(--ink-soft); max-width: 42ch; }

/* --- Utility ------------------------------------------------------------ */

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

@media print {
  .masthead, .footer, .subscribe, .progress, .article__back { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .prose a { border: 0; }
}
