/* =========================================================================
   Slower Hours — stylesheet
   Palette follows criativos/estilo.json: espresso brown, cream, butter
   yellow, faded sage, aged brass.
   ========================================================================= */

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

:root {
  color-scheme: light;

  --paper:        #f7f2e8;
  --paper-2:      #efe7d8;
  --paper-3:      #e6dbc7;
  --ink:          #241c16;
  --ink-2:        #4a3d33;
  --ink-3:        #7a6a5c;
  --rule:         #d8cbb4;
  --rule-strong:  #bfae92;
  --brass:        #8a6a2f;
  --brass-soft:   #c9a24d;
  --sage:         #5f7259;
  --accent:       #8a3a22;
  --shadow:       0 1px 2px rgba(36, 28, 22, .06), 0 12px 28px -18px rgba(36, 28, 22, .5);

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body:    "Newsreader", Georgia, "Times New Roman", serif;

  --wrap:  1180px;
  --gutter: clamp(1rem, 4vw, 2.75rem);

  --step--1: clamp(.78rem, .76rem + .1vw, .84rem);
  --step-0:  clamp(1.02rem, .99rem + .16vw, 1.12rem);
  --step-1:  clamp(1.2rem, 1.12rem + .4vw, 1.45rem);
  --step-2:  clamp(1.45rem, 1.3rem + .75vw, 1.95rem);
  --step-3:  clamp(1.8rem, 1.5rem + 1.5vw, 2.7rem);
  --step-4:  clamp(2.3rem, 1.7rem + 3vw, 4.2rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --paper:       #17120e;
    --paper-2:     #1f1813;
    --paper-3:     #2a211a;
    --ink:         #f2e9da;
    --ink-2:       #d3c5b1;
    --ink-3:       #a08e79;
    --rule:        #3a2f25;
    --rule-strong: #54442f;
    --brass:       #d8b163;
    --brass-soft:  #8a6a2f;
    --sage:        #9db092;
    --accent:      #e08a63;
    --shadow:      0 1px 2px rgba(0, 0, 0, .5), 0 16px 32px -20px rgba(0, 0, 0, .9);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --paper:       #17120e;
  --paper-2:     #1f1813;
  --paper-3:     #2a211a;
  --ink:         #f2e9da;
  --ink-2:       #d3c5b1;
  --ink-3:       #a08e79;
  --rule:        #3a2f25;
  --rule-strong: #54442f;
  --brass:       #d8b163;
  --brass-soft:  #8a6a2f;
  --sage:        #9db092;
  --accent:      #e08a63;
  --shadow:      0 1px 2px rgba(0, 0, 0, .5), 0 16px 32px -20px rgba(0, 0, 0, .9);
}

/* --- Base -------------------------------------------------------------- */

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

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: .2em; }
a:hover { text-decoration-color: currentColor; }

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.015em;
  margin: 0;
  font-variation-settings: "SOFT" 0, "WONK" 0;
}

p { margin: 0 0 1.05em; }
p:last-child { margin-bottom: 0; }

.wrap {
  width: min(100% - (var(--gutter) * 2), var(--wrap));
  margin-inline: auto;
}

.wrap--narrow { width: min(100% - (var(--gutter) * 2), 44rem); }

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -110%);
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: .6rem 1.1rem;
  font-family: var(--font-body);
  font-size: var(--step--1);
  text-decoration: none;
  border-radius: 0 0 4px 4px;
}
.skip-link:focus { transform: translate(-50%, 0); }

/* --- Small caps label -------------------------------------------------- */

.eyebrow {
  font-family: var(--font-body);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 .55rem;
  display: block;
}

.eyebrow--sage { color: var(--sage); }

/* --- Top bar ----------------------------------------------------------- */

.topbar {
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
  font-size: var(--step--1);
  color: var(--ink-3);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.6rem;
  padding-block: .35rem;
}

.topbar__meta {
  display: flex;
  gap: .6rem;
  align-items: center;
  flex-wrap: wrap;
  letter-spacing: .02em;
}
.topbar__meta span:not(:first-child)::before {
  content: "·";
  margin-right: .6rem;
  color: var(--rule-strong);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-2);
  font: inherit;
  font-size: var(--step--1);
  padding: .25rem .75rem;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.theme-toggle:hover { background: var(--paper-3); color: var(--ink); border-color: var(--rule-strong); }
/* The button is revealed by JavaScript; without it there is nothing to toggle. */
.theme-toggle[hidden] { display: none; }
.theme-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon,
:root[data-theme="dark"] .theme-toggle .icon-sun { display: revert; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: revert; }
}

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

.masthead {
  text-align: center;
  padding: clamp(1.8rem, 5vw, 3.2rem) 0 clamp(1rem, 2.5vw, 1.6rem);
}

.masthead__title {
  font-size: var(--step-4);
  font-weight: 600;
  letter-spacing: -.03em;
  font-variation-settings: "SOFT" 8, "WONK" 1;
  line-height: .95;
  margin: 0;
}
.masthead__title a { text-decoration: none; }

.masthead__rule {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.1rem auto 0;
  max-width: 34rem;
  color: var(--ink-3);
  font-size: var(--step--1);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.masthead__rule::before,
.masthead__rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule-strong), transparent);
}

.byline-top {
  margin: .8rem 0 0;
  font-size: var(--step-0);
  font-style: italic;
  color: var(--ink-2);
}
.byline-top strong { font-style: normal; font-weight: 600; }

/* --- Navigation -------------------------------------------------------- */

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

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(.6rem, 2.5vw, 2rem);
  flex-wrap: wrap;
  min-height: 3rem;
  padding-block: .5rem;
}

.nav a {
  font-size: .78rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-2);
  padding: .3rem .1rem;
  border-bottom: 2px solid transparent;
  transition: color .18s ease, border-color .18s ease;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--brass); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brass); }

/* --- Sections ---------------------------------------------------------- */

.section { padding-block: clamp(2.2rem, 6vw, 4rem); }
.section--tint {
  background: var(--paper-2);
  border-block: 1px solid var(--rule);
}

.section__head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: clamp(1.4rem, 3vw, 2.2rem);
  border-bottom: 2px solid var(--ink);
  padding-bottom: .55rem;
}
.section__head h2 {
  font-size: var(--step-1);
  letter-spacing: .02em;
  text-transform: uppercase;
  font-weight: 600;
}
.section__head p {
  margin: 0;
  margin-left: auto;
  font-size: var(--step--1);
  color: var(--ink-3);
  font-style: italic;
  text-align: right;
}

/* --- Lead story -------------------------------------------------------- */

.lead {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  padding-block: clamp(1.8rem, 5vw, 3.4rem);
}
@media (min-width: 62rem) {
  .lead { grid-template-columns: 1.05fr .95fr; }
  .lead__figure { order: 2; }
}

.lead__figure { margin: 0; }
.lead__figure img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: var(--shadow);
}
@media (min-width: 62rem) {
  .lead__figure img { aspect-ratio: 5 / 6; }
}

.lead__title {
  font-size: var(--step-3);
  margin-bottom: .7rem;
  font-variation-settings: "SOFT" 4, "WONK" 1;
}
.lead__title a { text-decoration: none; background-image: linear-gradient(var(--brass), var(--brass)); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .35s ease; }
.lead__title a:hover { background-size: 100% 1px; }

.standfirst {
  font-size: var(--step-1);
  line-height: 1.45;
  color: var(--ink-2);
  margin-bottom: 1rem;
}

figcaption {
  font-size: var(--step--1);
  color: var(--ink-3);
  margin-top: .55rem;
  line-height: 1.45;
  font-style: italic;
}

/* --- Byline / meta ----------------------------------------------------- */

.meta {
  font-size: var(--step--1);
  color: var(--ink-3);
  letter-spacing: .04em;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.meta span::after { content: "·"; margin-left: .5rem; color: var(--rule-strong); }
.meta span:last-child::after { content: none; }
.meta b { font-weight: 600; color: var(--ink-2); }

/* --- Story grid -------------------------------------------------------- */

.grid {
  display: grid;
  gap: clamp(1.6rem, 3.5vw, 2.6rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.card { display: flex; flex-direction: column; }

.card__figure { margin: 0 0 1rem; overflow: hidden; border-radius: 3px; }
.card__figure img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform .5s cubic-bezier(.2, .7, .3, 1);
}
.card:hover .card__figure img { transform: scale(1.035); }

.card__title {
  font-size: var(--step-2);
  margin-bottom: .5rem;
}
.card__title a { text-decoration: none; }
.card__title a:hover { color: var(--accent); }

.card__dek {
  color: var(--ink-2);
  margin-bottom: .8rem;
  font-size: calc(var(--step-0) * .98);
}

/* --- Research list ----------------------------------------------------- */

.checklist { display: grid; gap: 0; }

.check {
  display: grid;
  gap: .35rem 1.4rem;
  padding: clamp(1.1rem, 2.5vw, 1.6rem) 0;
  border-top: 1px solid var(--rule);
  align-items: start;
}
.check:last-child { border-bottom: 1px solid var(--rule); }
@media (min-width: 48rem) {
  .check { grid-template-columns: 7.5rem 1fr; }
}

.check__flag {
  font-family: var(--font-body);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--sage);
  padding: .2rem .55rem;
  border-radius: 2px;
  justify-self: start;
  white-space: nowrap;
}
.check__flag--myth { background: var(--accent); }

.check h3 { font-size: var(--step-1); margin-bottom: .35rem; }
.check h3 a { text-decoration: none; }
.check h3 a:hover { color: var(--accent); }
.check p { color: var(--ink-2); margin-bottom: .5rem; font-size: calc(var(--step-0) * .96); }

.source {
  font-size: var(--step--1);
  color: var(--ink-3);
  font-style: italic;
}

/* --- Notebook / column ------------------------------------------------- */

.notebook {
  display: grid;
  gap: clamp(1.6rem, 4vw, 3rem);
  align-items: center;
}
@media (min-width: 60rem) {
  .notebook { grid-template-columns: .9fr 1.1fr; }
}
.notebook__figure { margin: 0; }
.notebook__figure img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: var(--shadow);
}
.notebook blockquote {
  margin: 0 0 1.1rem;
  padding-left: 1.1rem;
  border-left: 3px solid var(--brass);
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.25;
  font-style: italic;
  color: var(--ink);
  font-variation-settings: "SOFT" 6, "WONK" 1;
}

/* --- Archive list ------------------------------------------------------ */

.archive { display: grid; gap: 0; }
.archive__item {
  display: grid;
  gap: .2rem 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
@media (min-width: 45rem) {
  .archive__item { grid-template-columns: 8rem 1fr auto; }
}
.archive__item:first-child { border-top: 1px solid var(--rule); }
.archive__date { font-size: var(--step--1); color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }
.archive__title { font-family: var(--font-display); font-size: var(--step-1); font-weight: 600; line-height: 1.2; }
.archive__title a { text-decoration: none; }
.archive__title a:hover { color: var(--accent); }
.archive__cat { font-size: var(--step--1); color: var(--brass); letter-spacing: .1em; text-transform: uppercase; }

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

.article { padding-block: clamp(2rem, 5vw, 3.5rem); }

.article__header { margin-bottom: clamp(1.6rem, 4vw, 2.4rem); }
.article__title {
  font-size: var(--step-3);
  margin-bottom: .8rem;
  font-variation-settings: "SOFT" 4, "WONK" 1;
}
.article__byline {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1rem;
  align-items: center;
  padding-top: .9rem;
  margin-top: 1.1rem;
  border-top: 1px solid var(--rule);
  font-size: var(--step--1);
  color: var(--ink-3);
}
.article__byline strong { color: var(--ink); font-weight: 600; }

.article__figure { margin: 0 0 clamp(1.5rem, 4vw, 2.2rem); }
.article__figure img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: var(--shadow);
}

.prose { font-size: calc(var(--step-0) * 1.06); line-height: 1.72; }
.prose > p:first-of-type::first-letter {
  float: left;
  font-family: var(--font-display);
  font-size: 3.4em;
  line-height: .82;
  padding: .05em .09em 0 0;
  color: var(--brass);
  font-weight: 600;
}
.prose h2 {
  font-size: var(--step-2);
  margin: 2.2rem 0 .8rem;
}
.prose h3 {
  font-size: var(--step-1);
  margin: 1.8rem 0 .6rem;
}
.prose ul, .prose ol { margin: 0 0 1.2rem; padding-left: 1.3rem; }
.prose li { margin-bottom: .5rem; }
.prose li::marker { color: var(--brass); }
.prose blockquote {
  margin: 1.8rem 0;
  padding: .3rem 0 .3rem 1.3rem;
  border-left: 3px solid var(--brass);
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-style: italic;
  line-height: 1.35;
  color: var(--ink);
}
.prose strong { font-weight: 700; }

.callout {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--sage);
  border-radius: 3px;
  padding: clamp(1rem, 3vw, 1.4rem);
  margin: 1.8rem 0;
  font-size: calc(var(--step-0) * .98);
}
.callout p:last-child { margin-bottom: 0; }

.article__footer {
  margin-top: clamp(2rem, 5vw, 3rem);
  padding-top: 1.3rem;
  border-top: 2px solid var(--ink);
  font-size: var(--step--1);
  color: var(--ink-3);
}

.related { margin-top: clamp(2rem, 5vw, 3rem); }

/* --- Legal pages ------------------------------------------------------- */

.legal { padding-block: clamp(2rem, 5vw, 3.5rem); }
.legal h2 {
  font-size: var(--step-2);
  margin: 2.4rem 0 .7rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--rule);
}
.legal h3 { font-size: var(--step-1); margin: 1.6rem 0 .5rem; }
.legal ul { padding-left: 1.3rem; margin-bottom: 1.2rem; }
.legal li { margin-bottom: .5rem; }
.legal li::marker { color: var(--brass); }
.legal dl { margin: 1.2rem 0; }
.legal dt { font-weight: 700; margin-top: 1rem; }
.legal dd { margin: .2rem 0 0; color: var(--ink-2); }

.updated {
  display: inline-block;
  font-size: var(--step--1);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .25rem .8rem;
  margin-top: 1rem;
}

.toc {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: clamp(1rem, 3vw, 1.4rem);
  margin: 2rem 0;
}
.toc h2 {
  font-size: var(--step--1);
  letter-spacing: .14em;
  text-transform: uppercase;
  border: 0;
  margin: 0 0 .7rem;
  padding: 0;
  color: var(--ink-3);
}
.toc ol { margin: 0; padding-left: 1.2rem; columns: 2; column-gap: 2rem; }
@media (max-width: 40rem) { .toc ol { columns: 1; } }
.toc li { margin-bottom: .35rem; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

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

.footer {
  background: var(--paper-2);
  border-top: 1px solid var(--rule);
  padding-block: clamp(2.2rem, 5vw, 3.4rem);
  margin-top: clamp(2rem, 6vw, 4rem);
}

.footer__grid {
  display: grid;
  gap: clamp(1.6rem, 4vw, 3rem);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}

.footer__brand h2 {
  font-size: var(--step-2);
  font-variation-settings: "SOFT" 8, "WONK" 1;
  margin-bottom: .4rem;
}
.footer p { color: var(--ink-2); font-size: calc(var(--step-0) * .95); }

.footer h3 {
  font-family: var(--font-body);
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: .8rem;
  font-weight: 600;
}

.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: .45rem; font-size: calc(var(--step-0) * .95); }
.footer a { text-decoration: none; color: var(--ink-2); }
.footer a:hover { color: var(--ink); text-decoration: underline; }

.footer__bottom {
  margin-top: clamp(1.8rem, 4vw, 2.6rem);
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.5rem;
  justify-content: space-between;
  align-items: center;
  font-size: var(--step--1);
  color: var(--ink-3);
}
.footer__bottom p { margin: 0; font-size: inherit; color: inherit; }

.disclosure {
  margin-top: 1.2rem;
  font-size: var(--step--1);
  color: var(--ink-3);
  line-height: 1.55;
  font-style: italic;
  max-width: 46rem;
}

/* --- Utilities --------------------------------------------------------- */

.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;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: var(--step--1);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-decoration: none;
  margin-bottom: 1.4rem;
}
.back-link:hover { color: var(--ink); }

.error-page {
  text-align: center;
  padding-block: clamp(3rem, 12vw, 7rem);
}
.error-page h1 { font-size: var(--step-4); margin-bottom: 1rem; }
.error-page p { color: var(--ink-2); font-size: var(--step-1); }

@media print {
  .nav, .topbar, .footer, .back-link, .related { display: none; }
  body { background: #fff; color: #000; }
}
