/* Cinematic materials, editorial reading. Specificity keeps this shared layer
   independent of the loading order of the home, News, and essay stylesheets. */
:root {
  --paper:#f4f0e6; --surface:#fcf9f2; --ink:#292d26; --body:#53584d;
  --muted:#686e60; --line:#d8d3c5; --accent:#566542; --accent-soft:#e6e9da;
  --notebook:#eee6d8; --reading:#141a15; --reading-ink:#f5f0e3;
  --reading-muted:#c9ccbd; --serif:Georgia,'Times New Roman',serif;
  --metal:#d9c49b; --night:#111711; --ivory:#f4efdf;
}
:root[data-theme='dark'] {
  --paper:#151a16; --surface:#1d241e; --ink:#f1eddf; --body:#c3c8b8;
  --muted:#a8b19e; --line:#3a4235; --accent:#bdc998; --accent-soft:#2c3828;
  --notebook:#24291f; --reading:#0f1410; --reading-ink:#f5f0e3;
}
html body h1, html body h2 { font-family:var(--serif); font-weight:400; letter-spacing:-.045em; }
html body .wordmark { font-family:var(--serif); font-weight:500; letter-spacing:-.055em; }
html body .wordmark span { color:#9da77c; }
html body .button { border-radius:50px; }
html body :focus-visible { outline:2px solid var(--accent); outline-offset:5px; }
html body .main-nav a[aria-current='page'] { text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:.55rem; }

/* Full-bleed cinematic home. All foreground elements are real HTML. */
html body.home-cinematic #main { width:100%; margin:0; }
html body.home-cinematic .site-header {
  position:absolute; inset:0 0 auto; z-index:5; min-height:96px;
  border-bottom:1px solid #eee8d51c; color:var(--ivory);
}
html body.home-cinematic .site-header .wordmark,
html body.home-cinematic .site-header .github-link { color:var(--ivory); }
html body.home-cinematic .site-header .github-link { border-color:#e9ddc332; }
html body.home-cinematic .site-header .theme-toggle { color:var(--ivory); border-color:#ddd5be47; }
html body.home-cinematic .site-header .theme-toggle:hover { background:#ffffff13; }
html body .kinetic-hero {
  display:block; position:relative; isolation:isolate; overflow:hidden;
  min-height:760px; padding:196px 0 144px; background:var(--night); color:var(--ivory);
}
.machine-scene, .hero-vignette { position:absolute; inset:0; pointer-events:none; }
.machine-scene { z-index:-3; overflow:hidden; }
.machine-image {
  position:absolute; right:-4%; top:0; width:77%; height:100%; max-width:none;
  object-fit:cover; object-position:44% center;
  transform:translate3d(var(--machine-x,0px),var(--machine-y,0px),0) scale(1.035);
  mask-image:linear-gradient(to right,transparent,#000 23%);
}
.machine-filaments { position:absolute; inset:0; width:100%; height:100%; }
.machine-light {
  position:absolute; inset:0; opacity:.17; mix-blend-mode:screen;
  background:radial-gradient(ellipse at 76% 36%,#d1b87444,transparent 34%);
}
.hero-vignette {
  z-index:-1;
  background:linear-gradient(90deg,#111711f7 0%,#111711ed 28%,#111711cf 46%,#11171124 70%,transparent 90%),
    linear-gradient(0deg,#101610b8,transparent 23%,transparent 85%,#10161070);
}
html body .hero-content { position:relative; z-index:1; }
html body .hero-content .eyebrow { display:flex; align-items:center; gap:.8rem; color:#c4c9ad; margin:0 0 1.8rem; font-size:.64rem; letter-spacing:.12em; }
.hero-mark { width:23px; height:10px; border:1px solid #b0bf89; border-radius:50%; transform:rotate(-24deg); position:relative; }
.hero-mark::after { content:''; position:absolute; inset:-1px; border:1px solid #b0bf89; border-radius:50%; transform:rotate(48deg); }
html body .hero-content h1 { color:var(--ivory); max-width:780px; font-size:clamp(3.2rem,5.4vw,5.45rem); line-height:1.04; }
html body .hero-content h1 em { font-weight:400; color:#ccd4b2; }
html body .hero-description { max-width:500px; margin:1.8rem 0 0; color:#d5d7c8; font-size:.98rem; line-height:1.85; text-wrap:pretty; }
.hero-actions { display:flex; flex-wrap:wrap; gap:.85rem; margin-top:2rem; }
html body .hero-actions .button { display:inline-flex; align-items:center; justify-content:center; gap:1.4rem; min-height:50px; padding:.8rem 1.6rem; background:#b9c693; color:#182012; border:1px solid #b9c693; font-size:.82rem; font-weight:700; text-decoration:none; }
html body .hero-actions .button:hover { background:#d1dcb1; border-color:#d1dcb1; }
html body .hero-actions .hero-secondary { color:var(--ivory); border-color:#ddd8c783; background:#131b145c; }
html body .hero-actions .hero-secondary:hover { background:#ffffff13; border-color:#eee8d5; }
html body .hero-bottom { position:absolute; bottom:27px; left:0; right:0; display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.hero-scroll { display:inline-flex; align-items:center; gap:1rem; min-height:44px; font: .65rem var(--mono); color:#c9cfb8; }
html body .hero-bottom .motion-control { color:#e2e6d2; font-size:.7rem; gap:.65rem; }
html body .hero-bottom .motion-indicator { width:27px; height:16px; border-radius:20px; border-color:#b4bea2; position:relative; background:transparent; }
html body .hero-bottom .motion-indicator::after { content:''; position:absolute; width:10px; height:10px; left:2px; top:2px; background:#b4bea2; border-radius:50%; }
html body .hero-bottom [aria-pressed='true'] .motion-indicator { background:#a1b276; }
html body .hero-bottom [aria-pressed='true'] .motion-indicator::after { left:13px; background:#f5f3e6; }
html body .kinetic-hero :focus-visible, html body.home-cinematic .site-header :focus-visible { outline-color:#d8deb8; }

/* Distinct pieces on a warm, readable surface. */
html body .projects.section { background:none; border:0; border-radius:0; padding:4.3rem 0 3rem; }
html body .section-heading { margin-bottom:2rem; }
html body .section-heading h2 { font-size:clamp(2.6rem,4vw,3.5rem); }
html body .section-heading > p { max-width:340px; text-align:left; }
html body .project-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:1.5rem; }
html body .project-card, html body .project-card[data-project='codearbiter'] { display:flex; flex-direction:column; grid-column:auto; border-radius:12px; min-height:0; border-color:var(--line); background:var(--surface); }
html body .project-card .project-visual, html body .project-card[data-project='codearbiter'] .project-visual { aspect-ratio:1.48; min-height:0; border:0; position:relative; isolation:isolate; }
html body .project-card .project-copy, html body .project-card[data-project='codearbiter'] .project-copy { padding:1.6rem; }
html body .project-card h3, html body .project-card[data-project='codearbiter'] h3 { font-family:var(--serif); font-size:1.85rem; font-weight:400; letter-spacing:-.04em; }
html body .project-card .project-copy > p { font-size:.85rem; line-height:1.8; }
html body .project-actions { margin-top:auto; padding-top:1.5rem; }
/* These previews illustrate each project's actual workflow or fictional demo, not machine concept art. */
.project-preview { display:block; width:100%; height:100%; object-fit:cover; object-position:center; background:#12211f; }
[data-project='meridian'] .project-preview { object-fit:contain; background:#121a1e; }
.project-preview-fallback { display:grid; place-items:center; width:100%; height:100%; background:#20312a; color:#e9ebdd; font:700 1rem var(--mono); text-align:center; padding:1rem; }
html body .game-label { background:#1e1c17df; color:#f0e5c9; border-color:#9c865e66; font-size:.55rem; }
html body .project-visual .game-art { filter:saturate(.75); }
/* Destination cues give the artwork a clear purpose without covering it at rest. */
.project-preview-cue { position:absolute; z-index:1; top:1rem; right:1rem; display:inline-flex; align-items:center; gap:.6rem; padding:.55rem .8rem; border:1px solid #dce5c43d; border-radius:50px; background:#14231def; color:#edf1e1; font:600 .67rem/1.5 var(--sans); opacity:0; pointer-events:none; }
.project-preview-cue .icon { width:.85rem; height:.85rem; }
html body .project-card:focus-within { border-color:var(--accent); box-shadow:0 12px 28px -18px #26322245; }
.project-card:focus-within .project-preview-cue { opacity:1; }
@media (hover:hover) and (pointer:fine) {
  html body .project-card:hover { border-color:var(--accent); }
  .project-card:hover .project-preview-cue { opacity:1; }
}
@media (prefers-reduced-motion:no-preference) {
  :root[data-motion='on'] .project-preview-cue { transform:translateY(5px); transition:opacity .2s ease,transform .25s ease; }
  :root[data-motion='on'] .project-card:focus-within .project-preview-cue { transform:none; }
}
@media (hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference) {
  :root[data-motion='on'] .project-card:hover .project-preview-cue { transform:none; }
}
:root[data-motion='on'] .project-preview { transition:transform .75s cubic-bezier(.2,.65,.3,1); }
:root[data-motion='on'] .project-card:hover .project-preview { transform:scale(1.025); }

/* The same materials recur; ambient animation stays in the main hero only. */
html body .reading.section { position:relative; isolation:isolate; overflow:hidden; border-radius:14px; padding:2.6rem 3rem 1.6rem; background:#131b15; }
html body .reading.section::before { content:''; position:absolute; inset:0; z-index:-1; background:linear-gradient(90deg,#111911fc 10%,#111911e8 60%,#111911b8),url('atelier-machine.avif') right center/75% auto no-repeat; }
html body .reading h2 { font-family:var(--serif); font-size:clamp(2.5rem,4.3vw,3.7rem); font-weight:400; }
html body .reading h2 span { color:#ccd4b2; }
html body .reading-topic-mark { background:#c5bb9410; border:1px solid #c5bb943b; color:#c8cfa9; border-radius:50%; width:42px; height:42px; }
html body .reading-index .topic-name { color:#e4e5d8; }
html body .reading-brand { color:#c3c9af; letter-spacing:.08em; }
html body .about h2 { font-family:var(--serif); font-weight:400; font-size:clamp(2.2rem,3.5vw,3rem); }
html body .notebook { background:var(--notebook); border-radius:12px; overflow:hidden; transform:none; box-shadow:none; }
html body .notebook:hover { transform:none; box-shadow:none; }
html body .notebook h3 { font-family:var(--serif); font-weight:400; font-size:1.9rem; }
html body .notebook-drawing { height:165px; max-width:none; padding:0; margin:1.2rem -1.8rem 1.4rem; background:#151812 url('hero-forge.webp') 65% 58%/cover; border:0; }
html body .notebook-drawing svg { visibility:hidden; height:100%; }
html body .site-footer { border-top-color:var(--line); }

/* Daily editions and archive: cinematic mastheads, quiet text columns. */
html body .topbar { background:#151c16; color:#e7e9dc; border-color:#6e755349; }
html body .topbar .wordmark, html body .topbar .news-label { color:#f3f0e3; }
html body .topbar .site-nav a, html body .topbar .news-home-divider { color:#c7cdb7; }
html body .topbar .site-nav a[aria-current='page'] { color:#f3f0e3; border-color:#c6d1a4; }
html body .topbar .theme-toggle { border-color:#b3b99d50; color:#e7e9dc; }
html body .topbar .theme-toggle:hover { background:#ffffff12; }
html body .mast {
  --ink:#f3f0e3; --body:#d1d5c5; --muted:#bac5a6; --accent:#c7d4a5; --line:#c6d0ab33;
  isolation:isolate; overflow:hidden; padding:2.8rem 2.8rem 2.4rem; margin-top:2rem;
  background:#151c16; color:#d1d5c5; border:1px solid #53604450; border-radius:14px;
}
html body .mast h1 { color:#f3f0e3; font-size:clamp(2.7rem,4.5vw,4rem); font-weight:400; line-height:1.07; }
html body .mast .eyebrow { color:#c6d0ab; }
html body .mast p, html body .mast .edition-meta { color:#cbd1bf; }
html body .mast .edition-links a, html body .mast .archive-jump { color:#e2e6d1; }
html body .mast .edition-links, html body .mast .edition-meta { border-color:#c6d0ab33; }
html body .mast a:focus-visible { outline-color:#d8deb8; }
html body .mast .archive-jump span { color:#c7cdb7; }
html body .mast-art { width:100%; max-width:320px; height:255px; opacity:.9; border-radius:160px 160px 12px 12px; overflow:hidden; border:1px solid #c5bb9440; }
html body .mast-art .atelier-study { width:100%; height:100%; object-fit:cover; object-position:36% 34%; }
html body .mast-art svg { display:none; }
html body .mast-art:not(:has(.atelier-study)) { background:#162016 url('atelier-machine.avif') 65% 30%/cover; }
html body .story-header h2, html body .story h3 { font-family:var(--serif); font-size:clamp(1.45rem,2.2vw,1.9rem); font-weight:400; letter-spacing:-.025em; line-height:1.3; }
html body .archive-section-head h2 { font-size:2rem; }
html body .archive-date { background:var(--notebook); border-color:#867754; color:var(--ink); border-radius:0 0 5px 5px; }
html body .archive-date > b { font-family:var(--serif); font-size:1.8rem; font-weight:400; }
html body .topic-panel { border-radius:12px; }

/* Essay: retain every word and citation; change the presentation only. */
html body .essay-mast { position:relative; isolation:isolate; padding:3rem; margin-block:2rem 3rem; border:1px solid #766a4840; border-radius:14px; background:#111811; color:#cbd1bf; gap:2rem; }
html body .essay-mast h1 { font-size:clamp(3.7rem,6vw,5.5rem); font-weight:400; color:#f3f0e3; }
html body .essay-mast .eyebrow, html body .essay-mast .byline { color:#c4cbb3; }
html body .essay-mast .byline a { color:#e2e6d1; text-decoration:underline; text-decoration-thickness:1px; }
html body .essay-mast :focus-visible { outline-color:#d8deb8; }
html body .essay-title h1 span::after { background:#d1b97544; }
html body .essay-motif { margin:0; min-height:290px; align-self:stretch; padding:0; position:relative; background:#111811 url('hero-forge.webp') 66% 50%/cover no-repeat; border-radius:9px; }
html body .essay-motif svg { visibility:hidden; max-height:290px; }
html body .essay-motif figcaption { border:0; color:#c8cdb9; background:#111811e8; padding:.65rem; font-size:.53rem; }
html body .essay-body h2 { font-family:var(--serif); font-weight:400; }
html body .essay-contents a[aria-current='location'] { color:var(--accent); }

@media (min-width:1600px) {
  html body .kinetic-hero { min-height:840px; padding-block:220px 175px; }
  .machine-image { width:73%; object-position:center 38%; }
}
@media (max-width:1080px) {
  html body .kinetic-hero { min-height:700px; padding-top:176px; }
  html body .hero-content h1 { max-width:680px; font-size:clamp(3.2rem,6.5vw,4.4rem); }
  .machine-image { width:85%; right:-16%; }
  .hero-vignette { background:linear-gradient(90deg,#111711f5 0%,#111711e8 30%,#11171187 58%,#11171122),linear-gradient(0deg,#111711a8,transparent 35%); }
  html body .reading.section { padding-inline:2rem; }
}
@media (max-width:760px) {
  html body.home-cinematic .site-header { min-height:80px; }
  html body .kinetic-hero { min-height:790px; padding:142px 0 255px; }
  html body .hero-content h1 { font-size:clamp(2.75rem,7.7vw,3.9rem); max-width:620px; }
  html body .hero-description { max-width:420px; font-size:.91rem; }
  .machine-image { top:auto; bottom:-10%; right:-13%; width:115%; height:75%; object-position:45% center; mask-image:linear-gradient(to bottom,transparent,#000 38%); }
  .hero-vignette { background:linear-gradient(180deg,#111711fa 0%,#111711f3 32%,#111711ce 52%,#11171128 77%,#11171185); }
  html body .hero-content .eyebrow { margin-bottom:1.4rem; font-size:.57rem; }
  html body .hero-actions .button { font-size:.78rem; gap:.8rem; }
  html body .projects.section { padding-top:3rem; }
  html body .reading.section { padding:1.8rem 1.5rem 1.2rem; }
  html body .reading.section::before { background-size:auto,cover; opacity:.75; }
  html body .mast { margin-top:1.4rem; padding:2rem; }
  html body .mast-grid { grid-template-columns:1fr; gap:0; }
  html body .mast-art { position:absolute; z-index:-1; right:-20%; top:0; width:70%; height:100%; border:0; border-radius:0; opacity:.16; }
  html body .essay-mast { padding:2rem; gap:0; }
  html body .essay-motif { position:absolute; inset:0; z-index:-1; opacity:.28; background-position:85% center; }
  html body .essay-motif figcaption { display:none; }
}
@media (max-width:580px) {
  html body .project-grid { grid-template-columns:1fr; gap:1.4rem; }
  html body .project-card[data-project='codearbiter'] { display:flex; grid-column:auto; }
  html body .project-card[data-project='codearbiter'] .project-visual { aspect-ratio:1.55; min-height:0; }
  html body .project-card .project-visual { aspect-ratio:1.55; }
  html body .project-card .project-copy, html body .project-card[data-project='codearbiter'] .project-copy { padding:1.4rem; }
  html body .hero-description { max-width:350px; }
  html body .hero-bottom { bottom:18px; }
  html body .hero-scroll, html body .hero-bottom .motion-control { font-size:.6rem; }
  html body .hero-actions .button { padding:.75rem 1.1rem; }
  html body .mast { padding:1.75rem 1.3rem; border-radius:10px; }
  html body .mast h1 { font-size:2.9rem; }
  html body .essay-mast { padding:2rem 1.4rem; }
}
@media (prefers-reduced-motion:no-preference) {
  :root[data-motion='on'] .kinetic-hero[data-scene-active='true'] .machine-light { animation:machine-breathe 12s ease-in-out infinite alternate; }
}
@keyframes machine-breathe { from { opacity:.08; } to { opacity:.32; } }
@media (forced-colors:active) {
  html body .machine-scene, .hero-vignette, .mast-art, .essay-motif, .reading.section::before { display:none; }
  html body .kinetic-hero, html body .mast, html body .reading.section, html body .topbar, html body .essay-mast { background:Canvas; color:CanvasText; border-color:CanvasText; }
  html body .hero-content h1, html body .hero-content h1 em, html body .hero-description, html body .hero-content .eyebrow, html body .mast h1, html body .mast p, html body .mast .eyebrow, html body .essay-mast h1 { color:CanvasText; }
  html body .hero-actions .button { border:1px solid ButtonText; }
}
@media print {
  html body.home-cinematic .site-header { position:static; color:#111; }
  html body .kinetic-hero { padding:2rem 0; min-height:0; background:white; }
  .machine-scene, .hero-vignette, .hero-bottom, .mast-art, .essay-motif { display:none!important; }
  html body .hero-content h1, html body .hero-content h1 em, html body .hero-description, html body .hero-content .eyebrow { color:#111; }
  html body .mast, html body .essay-mast { background:white; color:#111; border-color:#bbb; }
  html body .mast h1, html body .mast p, html body .essay-mast h1, html body .mast .eyebrow, html body .essay-mast .eyebrow { color:#111; }
}

:root[data-theme="dark"] body .notebook { box-shadow:none; }
