/* Homes for Thought — base styles. Owned by the orchestrator; workers add page CSS in their own files.
   Direction (Melvin, 5 Nov 2026), three layers:
     1. Aesop restraint: five neutrals, flat, matte, generous space.
     2. Newsroom trust (Straits Times grammar): masthead, dateline, section bar, heavy section rules,
        headline / standfirst / byline / status on every story, sources, disclosure, standards.
     3. scroll-craft motion (vendored engine, chaptered-editorial grammar): restrained reveals,
        one pinned signature act on the front page, a reading-progress rule. */

:root {
  /* five neutrals: the whole palette */
  --cream: #FFFDF3;      /* newsprint page */
  --parchment: #F3EEE1;  /* alternate sections, panels */
  --sand: #E2D9C6;       /* photo frames, quiet blocks */
  --clay: #8C6B4F;       /* the single accent: kickers, active states, progress rule */
  --charcoal: #33312D;   /* ink, heavy rules, buttons, dark band */
  --grey: #6E6A62;       /* charcoal's secondary-text step, not a sixth colour */
  --line: rgba(51, 49, 45, 0.15);
  --line-strong: rgba(51, 49, 45, 0.85);
  --line-light: rgba(255, 253, 243, 0.22);

  --font-display: "Cormorant Garamond", "Times New Roman", serif;  /* masthead + rare display */
  --font-text: "Newsreader", Georgia, serif;                        /* headlines + reading */
  --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif; /* labels, meta, UI */

  --max: 1280px;
  --measure: 64ch;
  --gutter: clamp(16px, 4vw, 48px);
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: clamp(4rem, 8vw, 7.5rem);
  --bar-h: 52px;
  --ease: cubic-bezier(0.25, 0.6, 0.3, 1);

  /* scrollcraft engine roles, mapped onto our palette (engine files stay unedited) */
  --sc-canvas: var(--cream);
  --sc-surface: var(--parchment);
  --sc-ink: var(--charcoal);
  --sc-ink-soft: var(--grey);
  --sc-accent: var(--clay);
  --sc-accent-ink: var(--cream);
  --sc-font-display: var(--font-text);
  --sc-font-text: var(--font-text);
  --sc-maxw: var(--max);
  --sc-gutter: var(--gutter);
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.menu-open { overflow: hidden; }
body {
  margin: 0; background: var(--cream); color: var(--charcoal);
  font-family: var(--font-text); font-weight: 400; font-size: 1.125rem; line-height: 1.65;
  letter-spacing: 0; font-optical-sizing: auto; font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased; overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
a { color: var(--charcoal); text-decoration-thickness: 1px; text-underline-offset: 0.2em; text-decoration-color: var(--line); transition: color 0.18s var(--ease), text-decoration-color 0.18s var(--ease); }
a:hover { color: var(--clay); text-decoration-color: currentColor; }
:focus-visible { outline: 1.5px solid var(--clay); outline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-text); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.5em; color: inherit; }
p { margin: 0 0 1em; }
button { font: inherit; color: inherit; }
::selection { background: var(--clay); color: var(--cream); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--charcoal); color: var(--cream); padding: 0.5rem 1rem; font-family: var(--font-sans); font-size: 0.875rem; }
.skip-link:focus { left: 8px; }

/* ---------- layout ---------- */
.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: var(--space-6); }
.section--tight { padding-block: var(--space-5); }
.grid { display: grid; gap: var(--space-4) var(--space-3); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.band { background: var(--cream); color: var(--charcoal); }
.band--parchment { background: var(--parchment); }
.band--sand { background: var(--sand); }
.band--clay { background: var(--clay); color: var(--cream); }
.band--dark { background: var(--charcoal); color: var(--cream); }
.band--clay a:not(.btn), .band--dark a:not(.btn) { color: var(--cream); text-decoration-color: var(--line-light); }
.band--clay a:not(.btn):hover, .band--dark a:not(.btn):hover { color: var(--sand); }

/* ---------- type ---------- */
.kicker { font-family: var(--font-sans); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.01em; color: var(--clay); margin: 0 0 0.6rem; }
.band--clay .kicker, .band--dark .kicker { color: var(--sand); }
.display { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; line-height: 1.02; font-size: clamp(2.75rem, 7vw, 5.5rem); margin: 0; }
.title { font-family: var(--font-text); font-weight: 600; letter-spacing: -0.015em; line-height: 1.1; font-size: clamp(1.9rem, 3.6vw, 2.9rem); margin: 0 0 0.45em; }
.lede, .standfirst { font-family: var(--font-text); font-weight: 400; font-size: clamp(1.15rem, 1.5vw, 1.32rem); line-height: 1.55; color: var(--grey); max-width: 58ch; }
.band--clay .lede, .band--dark .lede { color: rgba(255, 253, 243, 0.82); }
.prose { max-width: var(--measure); }
.prose h2 { font-size: 1.6rem; margin-top: 2em; }
.prose h3 { font-size: 1.25rem; margin-top: 1.6em; }
.prose li + li { margin-top: 0.35em; }
.small, .meta { font-family: var(--font-sans); font-size: 0.8125rem; line-height: 1.55; color: var(--grey); }
.rule { border: 0; height: 1px; background: var(--line); margin: var(--space-4) 0; }
.band--clay .rule, .band--dark .rule { background: var(--line-light); }

/* ---------- news grammar ---------- */
/* Section head: a heavy rule, the section name, an optional "more" link. */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-top: 3px solid var(--charcoal); padding-top: 0.7rem; margin-bottom: var(--space-3); }
.section-head__title { font-family: var(--font-text); font-weight: 700; font-size: clamp(1.35rem, 2.2vw, 1.7rem); letter-spacing: -0.01em; margin: 0; }
.section-head__more { font-family: var(--font-sans); font-size: 0.8125rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.section-head__more::after { content: "  →"; white-space: pre; }

/* Story: kicker, headline, standfirst, meta. Sizes: --lead, default, --small. */
.story { display: flex; flex-direction: column; gap: 0.45rem; color: inherit; }
.story__headline { font-family: var(--font-text); font-weight: 600; font-size: 1.3rem; line-height: 1.2; letter-spacing: -0.01em; margin: 0; }
.story__headline a { text-decoration: none; }
.story__headline a:hover { text-decoration: underline; text-decoration-color: var(--line-strong); color: var(--charcoal); }
.story__standfirst { font-size: 1.02rem; line-height: 1.5; color: var(--grey); margin: 0; }
.story--lead .story__headline { font-size: clamp(1.9rem, 3.8vw, 3.1rem); line-height: 1.08; letter-spacing: -0.02em; }
.story--lead .story__standfirst { font-size: clamp(1.1rem, 1.4vw, 1.25rem); }
.story--small .story__headline { font-size: 1.08rem; }
.story .frame { margin-bottom: 0.5rem; }

/* Story list: "Latest" style, hairline-separated, optional numbering via .story-list--numbered */
.story-list { list-style: none; margin: 0; padding: 0; counter-reset: story; }
.story-list > li { padding: 0.9rem 0; border-top: 1px solid var(--line); }
.story-list > li:first-child { border-top: 0; padding-top: 0; }
.story-list--numbered > li { counter-increment: story; display: grid; grid-template-columns: 2.2rem 1fr; }
.story-list--numbered > li::before { content: counter(story); font-family: var(--font-text); font-weight: 600; font-size: 1.5rem; line-height: 1; color: var(--clay); }

/* Byline block: who wrote it and their standing */
.byline { display: flex; align-items: center; gap: 0.8rem; font-family: var(--font-sans); font-size: 0.8125rem; line-height: 1.45; color: var(--grey); }
.byline__photo { width: 44px; height: 44px; flex: none; background: var(--sand); border-radius: 50%; overflow: hidden; }
.byline__name { color: var(--charcoal); font-weight: 700; }
.status { font-family: var(--font-sans); font-size: 0.75rem; font-weight: 600; color: var(--grey); }
.status--draft::before { content: ""; display: inline-block; width: 0.45rem; height: 0.45rem; margin-right: 0.4rem; background: var(--clay); vertical-align: 0.05em; }

/* Trust furniture */
.disclosure, .sources { border-top: 1px solid var(--charcoal); padding-top: 0.9rem; font-family: var(--font-sans); font-size: 0.8125rem; line-height: 1.6; color: var(--grey); }
.disclosure strong, .sources strong { color: var(--charcoal); }
.sources ol { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.tag { display: inline-flex; align-items: center; min-height: 32px; padding: 0 0.7rem; border: 1px solid var(--line); font-family: var(--font-sans); font-size: 0.75rem; text-decoration: none; color: var(--charcoal); }
.tag:hover { border-color: var(--charcoal); color: var(--charcoal); }

/* ---------- buttons & links ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.6em; min-height: 48px; padding: 0 1.6rem; font-family: var(--font-sans); font-weight: 600; font-size: 0.875rem; text-decoration: none; border: 1px solid var(--charcoal); background: var(--charcoal); color: var(--cream); transition: background-color 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--clay); border-color: var(--clay); color: var(--cream); }
.btn--ghost { background: transparent; color: var(--charcoal); }
.btn--ghost:hover { background: var(--charcoal); border-color: var(--charcoal); color: var(--cream); }
.btn--light { background: var(--cream); border-color: var(--cream); color: var(--charcoal); }
.btn--light:hover { background: var(--sand); border-color: var(--sand); color: var(--charcoal); }
.btn--light.btn--ghost { background: transparent; color: var(--cream); border-color: rgba(255, 253, 243, 0.6); }
.btn--light.btn--ghost:hover { background: var(--cream); color: var(--charcoal); }
.btn--sm { min-height: 40px; padding: 0 1.1rem; font-size: 0.8125rem; }
.link-arrow { font-family: var(--font-sans); font-weight: 600; font-size: 0.875rem; text-decoration: underline; text-decoration-color: var(--line); }
.link-arrow::after { content: "  →"; white-space: pre; }

/* ---------- cards & photo frames ---------- */
.card { display: flex; flex-direction: column; gap: 0.45rem; padding-top: var(--space-2); border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
a.card:hover { color: inherit; }
a.card:hover .card__title { text-decoration: underline; text-decoration-color: var(--line-strong); }
.card__title { font-family: var(--font-text); font-weight: 600; font-size: 1.3rem; line-height: 1.2; margin: 0; }
.card__meta { font-family: var(--font-sans); font-size: 0.78rem; font-weight: 600; color: var(--clay); }
.card p { color: var(--grey); margin: 0; }
.frame { position: relative; aspect-ratio: var(--ratio, 3 / 2); background: var(--sand); overflow: hidden; margin: 0; }
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame figcaption, .frame__caption { position: absolute; left: 0.9rem; bottom: 0.75rem; right: 0.9rem; font-family: var(--font-sans); font-size: 0.75rem; color: var(--charcoal); }

/* ---------- masthead ---------- */
.masthead { background: var(--cream); }
.masthead__utility { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 40px; border-bottom: 1px solid var(--line); font-family: var(--font-sans); font-size: 0.78rem; color: var(--grey); }
.masthead__utility p { margin: 0; }
.masthead__utility-links { display: flex; gap: 1.25rem; }
.masthead__utility-links a { text-decoration: none; font-weight: 600; }
.masthead__plate { display: flex; flex-direction: column; align-items: center; text-align: center; padding-block: clamp(1.4rem, 3.5vw, 2.6rem) clamp(1rem, 2.5vw, 1.6rem); }
.masthead__brand { display: inline-flex; align-items: center; gap: clamp(0.6rem, 1.4vw, 1rem); text-decoration: none; color: var(--charcoal); }
.masthead__brand:hover { color: var(--charcoal); }
.masthead__word { display: block; line-height: 1; font-size: clamp(2.6rem, 7.6vw, 5.6rem); }
.masthead__tagline { margin: 0.6rem 0 0; font-style: italic; color: var(--grey); font-size: clamp(0.95rem, 1.3vw, 1.1rem); }
.masthead--solid .masthead__plate { padding-block: 1.1rem 0.9rem; }
.masthead--solid .masthead__word { font-size: clamp(1.9rem, 4.2vw, 2.9rem); }
.masthead--solid .masthead__tagline { display: none; }

/* ---------- section bar (sticky) ---------- */
.section-bar { position: sticky; top: 0; z-index: 50; background: var(--cream); border-top: 1px solid var(--charcoal); border-bottom: 1px solid var(--charcoal); box-shadow: 0 -3px 0 var(--cream), inset 0 3px 0 var(--cream), inset 0 4px 0 var(--charcoal); }
.section-bar__inner { display: flex; align-items: center; gap: 1rem; height: var(--bar-h); padding-top: 4px; }
.section-bar__brand { display: none; align-items: center; gap: 0.5rem; flex: none; text-decoration: none; font-size: 1.3rem; color: var(--charcoal); }
.section-bar.is-stuck .section-bar__brand { display: inline-flex; }
.section-bar__links { display: flex; gap: clamp(1rem, 2.2vw, 1.9rem); list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.section-bar__links::-webkit-scrollbar { display: none; }
.section-bar.is-stuck .section-bar__links { justify-content: flex-end; }
.section-bar__links a { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; text-decoration: none; font-family: var(--font-sans); font-weight: 600; font-size: 0.875rem; }
.section-bar__links a[aria-current] { color: var(--clay); box-shadow: inset 0 -2px 0 var(--clay); }
.read-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--clay); transform: scaleX(0); transform-origin: 0 50%; pointer-events: none; }

.menu-btn { display: inline-flex; align-items: center; gap: 0.6rem; min-height: 44px; padding: 0; flex: none; background: none; border: 0; cursor: pointer; font-family: var(--font-sans); font-size: 0.875rem; font-weight: 600; }
.menu-btn__bars, .menu-btn__bars::before, .menu-btn__bars::after { display: block; width: 20px; height: 1.5px; background: currentColor; position: relative; transition: transform 0.25s var(--ease), background-color 0.15s; }
.menu-btn__bars::before, .menu-btn__bars::after { content: ""; position: absolute; left: 0; }
.menu-btn__bars::before { top: -6px; }
.menu-btn__bars::after { top: 6px; }
[aria-expanded="true"] .menu-btn__bars { background: transparent; }
[aria-expanded="true"] .menu-btn__bars::before { transform: translateY(6px) rotate(45deg); }
[aria-expanded="true"] .menu-btn__bars::after { transform: translateY(-6px) rotate(-45deg); }

/* ---------- menu ---------- */
.menu { position: fixed; inset: var(--bar-h) 0 0 0; z-index: 40; background: var(--cream); overflow-y: auto; animation: menu-in 0.3s var(--ease); }
.menu[hidden] { display: none; }
@keyframes menu-in { from { opacity: 0; } to { opacity: 1; } }
.menu__panels { display: flex; min-height: 100%; }
.menu-panel { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; padding: clamp(2rem, 5vw, 4rem) clamp(1.25rem, 2.5vw, 2.5rem); border-left: 1px solid var(--line); transition: flex-grow 0.5s var(--ease), background-color 0.5s var(--ease); }
.menu-panel:first-child { border-left: 0; }
.menu-panel:hover, .menu-panel:has(:focus-visible) { flex-grow: 1.5; background: var(--parchment); }
.menu-panel__title { font-family: var(--font-text); font-weight: 600; font-size: clamp(1.6rem, 2.4vw, 2.1rem); margin: 0 0 1.25rem; }
.menu-panel__title a { text-decoration: none; }
.menu-panel__links { list-style: none; margin: 0; padding: 0; max-width: 22rem; }
.menu-panel__links li { border-top: 1px solid var(--line); }
.menu-panel__links a { display: block; padding: 0.75rem 0; text-decoration: none; font-family: var(--font-sans); font-size: 0.9375rem; }
@media (max-width: 899px) {
  .menu__panels { flex-direction: column; }
  .menu-panel { flex: none; padding: 1.75rem var(--gutter); border-left: 0; border-top: 1px solid var(--line); }
  .menu-panel:first-child { border-top: 0; }
  .menu-panel:hover, .menu-panel:has(:focus-visible) { background: none; }
}

/* ---------- colophon (footer) ---------- */
.colophon { background: var(--charcoal); color: var(--cream); padding-block: var(--space-5) var(--space-3); }
.colophon a { color: var(--cream); text-decoration-color: var(--line-light); }
.colophon a:hover { color: var(--sand); }
.colophon__plate { display: flex; flex-direction: column; align-items: center; text-align: center; padding-bottom: var(--space-4); border-bottom: 1px solid var(--line-light); }
.colophon__word { font-size: 2.6rem; margin: 0; }
.colophon .wordmark__for, .colophon .wordmark__stop { color: var(--sand); }
.colophon__tagline { font-style: italic; color: rgba(255, 253, 243, 0.7); margin: 0.35rem 0 0; }
.colophon__nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); padding-block: var(--space-4); }
.colophon__nav ul { list-style: none; margin: 0; padding: 0; }
.colophon__nav li + li { margin-top: 0.6rem; }
.colophon__nav a { font-family: var(--font-sans); font-size: 0.875rem; text-decoration: none; }
.colophon__contact { max-width: 62ch; font-size: 1.05rem; line-height: 1.6; margin: 0 0 var(--space-4); }
.colophon__legal { padding-top: var(--space-3); border-top: 1px solid var(--line-light); font-family: var(--font-sans); font-size: 0.75rem; line-height: 1.65; color: rgba(255, 253, 243, 0.65); }
.colophon__legal p { margin: 0 0 0.4rem; max-width: 84ch; }

/* ---------- small screens ---------- */
@media (max-width: 639px) {
  :root { --bar-h: 48px; }
  .hide-sm { display: none !important; }
  .menu-btn__label { display: none; }
  .masthead__word { font-size: 10.2vw; }
  .masthead--solid .masthead__word { font-size: 8.4vw; }
  .section-bar.is-stuck .section-bar__links { justify-content: flex-start; }
  body { font-size: 1.0625rem; }
}

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

/* ---------- team byline: overlapping initials (no stock or AI faces for real people) ---------- */
.byline__team { display: inline-flex; flex: none; }
.byline__initial { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--sand); border: 2px solid var(--cream); color: var(--charcoal); font-family: var(--font-text); font-weight: 600; font-size: 0.95rem; }
.byline__initial + .byline__initial { margin-left: -9px; }
.band--parchment .byline__initial { border-color: var(--parchment); }

/* ---------- frames holding a real (or generated) image: news-style caption under the picture ---------- */
.frame:has(img) { aspect-ratio: auto; background: none; overflow: visible; }
.frame:has(img) img { width: 100%; height: auto; aspect-ratio: var(--ratio, 3 / 2); object-fit: cover; background: var(--sand); }
.frame:has(img) figcaption { position: static; margin-top: 0.5rem; color: var(--grey); }
/* real headshots (team photo supplied by Melvin, 5 Nov 2026) */
img.byline__photo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--sand); flex: none; }
.byline__face { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--sand); border: 2px solid var(--cream); }
.byline__face + .byline__face { margin-left: -10px; }
.band--parchment .byline__face { border-color: var(--parchment); }
.byline__standing { margin: 0; }

/* ---------- wordmark: the name is the logo (Melvin, 5 Nov 2026: no icon, typography as logo) ----------
   "Homes for Thought." in bold Newsreader; italic clay "for"; clay full stop. See design/wordmark-options.html */
.wordmark { font-family: var(--font-text); font-weight: 700; letter-spacing: -0.025em; line-height: 1; white-space: nowrap; font-variant-numeric: lining-nums; }
.wordmark__for { font-weight: 400; font-style: italic; letter-spacing: -0.01em; color: var(--clay); }
.wordmark__stop { color: var(--clay); }
.wordmark--stack { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 0.92; }
