/*
Theme Name: Coroner
Theme URI: https://coroner.dev
Author: The Systems Coroner
Description: Dark editorial theme for the Office of the Systems Coroner. Autopsies, corpses, resuscitations, toxicology.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: coroner
*/

:root {
  --bg: #0a0a0b;
  --bg-2: #0e0e10;
  --bg-3: #141416;
  --ink: #e8e6e1;
  --ink-soft: #cfccc5;
  --muted: #b8b5ae;
  --dim: #98958e;
  --faint: #66635d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --accent: #7ad79c;
  --cat-autopsy: oklch(0.75 0.12 25);
  --cat-corpse: oklch(0.75 0.08 250);
  --cat-resuscitation: var(--accent);
  --cat-toxicology: oklch(0.8 0.12 100);
  --serif: 'Newsreader', Georgia, serif;
  --mono: 'IBM Plex Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--serif); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }
::selection { background: rgba(122, 215, 156, 0.25); }
img { max-width: 100%; height: auto; }

.wrap { max-width: 1180px; margin: 0 auto; }
.mono { font-family: var(--mono); }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; color: var(--dim); text-transform: uppercase; margin-bottom: 20px; }

/* ---------- Header ---------- */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 48px; border-bottom: 1px solid var(--line); }
.site-brand { display: flex; align-items: baseline; gap: 12px; }
.site-brand .cross { font-family: var(--mono); font-size: 13px; letter-spacing: 0.18em; color: var(--accent); }
.site-brand .name { font-family: var(--mono); font-size: 14px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); }
.site-brand .office { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--dim); }
.site-nav { display: flex; align-items: center; gap: 28px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.site-nav ul { display: flex; align-items: center; gap: 28px; list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--dim); }
.site-nav a:hover, .site-nav .current-menu-item > a { color: var(--ink); }
.btn-cta { padding: 9px 18px; border: 1px solid var(--accent); color: var(--accent) !important; }
.btn-cta:hover { background: var(--accent); color: var(--bg) !important; }

/* ---------- Buttons ---------- */
.btn { display: inline-block; font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; padding: 14px 26px; cursor: pointer; }
.btn-solid { background: var(--accent); color: var(--bg) !important; border: none; font-weight: 600; }
.btn-solid:hover { background: var(--ink); }
.btn-ghost { border: 1px solid var(--line-strong); color: var(--muted) !important; }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink) !important; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 96px 48px 84px; border-bottom: 1px solid var(--line); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1fr 300px; gap: 64px; align-items: start; }
.hero h1 { font-size: clamp(48px, 6vw, 84px); line-height: 1.02; font-weight: 400; margin: 0 0 28px; letter-spacing: -0.01em; text-wrap: balance; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lede { font-size: 22px; line-height: 1.5; font-weight: 300; color: var(--muted); max-width: 560px; margin: 0 0 40px; }
.hero-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.stamp { justify-self: end; margin-top: 32px; transform: rotate(8deg); border: 3px double var(--cat-autopsy); color: var(--cat-autopsy); padding: 18px 26px; font-family: var(--mono); text-align: center; opacity: 0.85; }
.stamp .big { font-size: 26px; font-weight: 600; letter-spacing: 0.3em; }
.stamp .small { font-size: 11px; letter-spacing: 0.14em; margin-top: 8px; border-top: 1px solid var(--cat-autopsy); padding-top: 8px; }
@keyframes pulse-line { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
.hero-pulse { position: absolute; left: 0; right: 0; bottom: 28px; height: 1px; background: linear-gradient(90deg, transparent, var(--accent) 40%, transparent 60%); animation: pulse-line 4s ease-in-out infinite; }

/* ---------- Category strip ---------- */
.cat-strip { border-bottom: 1px solid var(--line); background: var(--bg-2); }
.cat-strip .wrap { display: grid; grid-template-columns: repeat(4, 1fr); }
.cat-cell { padding: 36px 28px; border-right: 1px solid var(--line); }
.cat-cell:last-child { border-right: none; }
.cat-cell .label { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.16em; margin-bottom: 14px; display: block; }
.cat-cell p { margin: 0; font-size: 15.5px; line-height: 1.55; color: var(--muted); font-weight: 300; }
.cat-autopsy { color: var(--cat-autopsy); }
.cat-corpse { color: var(--cat-corpse); }
.cat-resuscitation { color: var(--cat-resuscitation); }
.cat-toxicology { color: var(--cat-toxicology); }

/* ---------- Category tag ---------- */
.tag-cat { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; padding: 6px 10px; border: 1px solid currentColor; text-transform: uppercase; }

/* ---------- Ledger (post lists) ---------- */
.ledger-row { display: grid; grid-template-columns: 110px 140px 1fr 120px 90px; gap: 24px; align-items: baseline; padding: 26px 8px; border-bottom: 1px solid var(--line); color: var(--ink); }
.ledger-row:hover { background: var(--bg-2); color: var(--ink); }
.ledger-row .case-no, .ledger-row .date, .ledger-row .mins { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.ledger-row .mins { text-align: right; }
.ledger-row .cat { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.ledger-row .title { display: block; font-size: 23px; font-weight: 400; margin-bottom: 6px; }
.ledger-row .deck { display: block; font-size: 15px; font-weight: 300; color: var(--dim); line-height: 1.5; }

/* ---------- Featured ---------- */
.featured { padding: 72px 48px; border-bottom: 1px solid var(--line); }
.featured .wrap { display: grid; grid-template-columns: 1.15fr 1fr; gap: 56px; align-items: center; }
.featured-media { display: block; aspect-ratio: 4 / 3; background: repeating-linear-gradient(-45deg, var(--bg-3) 0, var(--bg-3) 12px, #101012 12px, #101012 24px); border: 1px solid var(--line); position: relative; overflow: hidden; }
.featured-media img { width: 100%; height: 100%; object-fit: cover; }
.featured-media .tag-cat { position: absolute; top: 16px; left: 16px; background: var(--bg); }
.featured h2 { font-size: 44px; line-height: 1.1; font-weight: 400; margin: 0 0 20px; text-wrap: balance; }
.meta-line { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; color: var(--dim); text-transform: uppercase; }

/* ---------- Sections ---------- */
.section { padding: 72px 48px; border-bottom: 1px solid var(--line); }
.section-alt { background: var(--bg-2); }
.section h3.section-title { font-size: 30px; font-weight: 400; margin: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 36px; }
.index-link { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }

/* ---------- Cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.card { border: 1px solid var(--line-strong); padding: 32px 28px; background: var(--bg); }
.card .label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; color: var(--accent); margin-bottom: 16px; display: block; }
.card p { font-size: 16px; line-height: 1.55; font-weight: 300; color: var(--muted); margin: 0 0 24px; }
.card .fine { font-family: var(--mono); font-size: 12px; color: var(--faint); }

/* ---------- Newsletter ---------- */
.newsletter { padding: 84px 48px; border-bottom: 1px solid var(--line); text-align: center; }
.newsletter h3 { font-size: 36px; font-weight: 400; margin: 0 0 16px; text-wrap: balance; }
.newsletter p { font-size: 17px; font-weight: 300; color: var(--dim); margin: 0 0 36px; }
.newsletter-form { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.newsletter-form input[type="email"] { font-family: var(--mono); font-size: 13px; padding: 14px 18px; width: 320px; max-width: 100%; background: var(--bg-2); border: 1px solid var(--line-strong); color: var(--ink); }

/* ---------- Single post ---------- */
.post-header { max-width: 1180px; margin: 0 auto; padding: 72px 48px 0; }
.post-header-inner { max-width: 760px; }
.post-header h1 { font-size: clamp(40px, 5vw, 64px); line-height: 1.05; font-weight: 400; margin: 0 0 24px; letter-spacing: -0.01em; text-wrap: balance; }
.post-header .excerpt { font-size: 22px; line-height: 1.5; font-weight: 300; color: var(--muted); margin: 0 0 32px; font-style: italic; }
.post-header .meta-row { display: flex; gap: 24px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; color: var(--faint); padding-bottom: 40px; border-bottom: 1px solid var(--line); text-transform: uppercase; flex-wrap: wrap; }
.post-layout { max-width: 1180px; margin: 0 auto; padding: 48px 48px 96px; display: grid; grid-template-columns: 260px 1fr; gap: 72px; align-items: start; }
.post-aside { position: sticky; top: 40px; display: flex; flex-direction: column; gap: 32px; }
.toc .toc-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; color: var(--faint); text-transform: uppercase; margin-bottom: 16px; }
.toc ul { display: flex; flex-direction: column; gap: 12px; font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.04em; list-style: none; margin: 0; padding: 0; }
.toc a { color: var(--dim); }
.toc a:hover, .toc a.active { color: var(--accent); }
.report-box { border: 1px solid var(--line-strong); background: var(--bg-2); padding: 24px; font-family: var(--mono); }
.report-box .box-title { font-size: 11px; letter-spacing: 0.16em; color: var(--faint); text-transform: uppercase; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.report-box dl { display: flex; flex-direction: column; gap: 14px; font-size: 12px; line-height: 1.5; margin: 0; }
.report-box dt { color: var(--faint); margin-bottom: 2px; text-transform: uppercase; }
.report-box dd { margin: 0; color: var(--ink); }
.report-box dd.cause { color: var(--cat-autopsy); }
.report-box dd.verdict { color: var(--accent); }

.entry-content { max-width: 720px; font-size: 18.5px; line-height: 1.7; font-weight: 300; color: var(--ink-soft); }
.entry-content h2 { font-size: 32px; font-weight: 500; margin: 48px 0 20px; color: var(--ink); }
.entry-content h3 { font-size: 24px; font-weight: 500; margin: 40px 0 16px; color: var(--ink); }
.entry-content p { margin: 0 0 24px; }
.entry-content strong { font-weight: 500; color: var(--ink); }
.entry-content blockquote { margin: 40px 0; padding: 8px 0 8px 28px; border-left: 2px solid var(--accent); font-size: 26px; line-height: 1.4; font-style: italic; color: var(--ink); }
.entry-content blockquote p { margin: 0; }
.entry-content ul, .entry-content ol { margin: 0 0 24px; padding-left: 24px; }
.entry-content li { margin-bottom: 12px; }
.entry-content figure { margin: 0 0 40px; }
.entry-content figcaption { font-family: var(--mono); font-size: 12px; color: var(--faint); margin-top: 12px; }
.entry-content pre { background: var(--bg-2); border: 1px solid var(--line-strong); margin: 0 0 40px; padding: 20px; overflow-x: auto; font-family: var(--mono); font-size: 13.5px; line-height: 1.7; color: var(--ink); }
.entry-content code { font-family: var(--mono); font-size: 0.85em; background: var(--bg-2); padding: 2px 6px; }
.entry-content pre code { background: none; padding: 0; }
.entry-content a { color: var(--accent); border-bottom: 1px solid var(--accent); }

.post-tags { display: flex; gap: 10px; flex-wrap: wrap; padding: 32px 0; border-top: 1px solid var(--line); }
.post-tags a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; padding: 7px 14px; border: 1px solid var(--line-strong); color: var(--dim); text-transform: uppercase; }
.post-tags a:hover { border-color: var(--ink); color: var(--ink); }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-strong); }
.post-nav a { padding: 24px 28px; }
.post-nav a:hover { background: var(--bg-2); }
.post-nav .prev { border-right: 1px solid var(--line-strong); }
.post-nav .next { text-align: right; }
.post-nav .dir { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--faint); margin-bottom: 10px; display: block; text-transform: uppercase; }
.post-nav .t { font-size: 19px; color: var(--ink); }

/* ---------- Archive ---------- */
.archive-hero { padding: 72px 48px 48px; border-bottom: 1px solid var(--line); }
.archive-hero h1 { font-size: clamp(44px, 5vw, 64px); line-height: 1.05; font-weight: 400; margin: 0 0 40px; letter-spacing: -0.01em; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em; }
.filters a { padding: 8px 16px; border: 1px solid var(--line-strong); text-transform: uppercase; }
.filters a.active { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.pagination { display: flex; justify-content: center; gap: 12px; padding-top: 48px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; }
.pagination .page-numbers { padding: 10px 16px; border: 1px solid var(--line-strong); color: var(--dim); }
.pagination .page-numbers.current { border-color: var(--accent); color: var(--accent); }
.pagination .page-numbers:hover { color: var(--ink); border-color: var(--ink); }

/* ---------- 404 ---------- */
.error-404 { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 96px 48px; }
.error-404 .code { font-size: 140px; line-height: 1; font-weight: 400; margin: 0 0 8px; letter-spacing: -0.02em; }
.error-404 h2 { font-size: 34px; font-weight: 400; margin: 0 0 16px; }
.error-404 p { font-size: 18px; font-weight: 300; color: var(--dim); margin: 0 0 40px; max-width: 480px; line-height: 1.6; }
@keyframes flatline { from { stroke-dashoffset: 1200; } to { stroke-dashoffset: 0; } }
.flatline path { animation: flatline 3s ease-out forwards; }

/* ---------- Forms (intake, comments, search) ---------- */
.form-section { border: 1px solid var(--line-strong); padding: 32px; margin: 0 0 40px; background: var(--bg-2); }
.form-section legend { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; color: var(--faint); padding: 0 12px; text-transform: uppercase; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--dim); text-transform: uppercase; }
input[type="text"], input[type="email"], input[type="url"], textarea, select {
  font-family: var(--mono); font-size: 14px; padding: 13px 16px; background: var(--bg); border: 1px solid var(--line-strong); color: var(--ink);
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; }
::placeholder { color: #55534d; }

/* ---------- Mausoleum ---------- */
.crypt { padding: 80px 0; border-bottom: 1px solid var(--line); }
.crypt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 12px; }
.crypt-head h2 { font-size: 40px; font-weight: 400; margin: 0; }
.crypt-no { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; color: var(--faint); }
.crypt-dates { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.1em; color: var(--dim); margin-bottom: 40px; }
.crypt-dates .status { color: var(--accent); }
.before-after { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 36px; }
.ba-frame { position: relative; aspect-ratio: 16 / 10; background: repeating-linear-gradient(-45deg, var(--bg-3) 0, var(--bg-3) 12px, #101012 12px, #101012 24px); }
.ba-frame img { width: 100%; height: 100%; object-fit: cover; }
.ba-before { border: 1px solid var(--cat-autopsy); }
.ba-after { border: 1px solid var(--accent); }
.ba-label { position: absolute; top: 12px; left: 12px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; padding: 5px 10px; background: var(--bg); border: 1px solid currentColor; }
.ba-before .ba-label { color: var(--cat-autopsy); }
.ba-after .ba-label { color: var(--accent); }
.crypt-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.crypt-cols .col-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; margin-bottom: 12px; display: block; text-transform: uppercase; }
.crypt-cols p { font-size: 17px; line-height: 1.65; font-weight: 300; color: var(--ink-soft); margin: 0; }

/* ---------- Footer ---------- */
.site-footer { padding: 40px 48px; display: flex; justify-content: space-between; align-items: baseline; gap: 24px; border-top: 1px solid var(--line); }
.site-footer .colophon { font-family: var(--mono); font-size: 12px; color: var(--faint); letter-spacing: 0.08em; text-transform: uppercase; }
.site-footer nav { display: flex; gap: 24px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.site-footer a { color: var(--faint); }
.site-footer a:hover { color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .site-header { flex-direction: column; gap: 16px; padding: 20px 24px; }
  .hero, .section, .featured, .newsletter, .archive-hero { padding-left: 24px; padding-right: 24px; }
  .hero-grid, .featured .wrap, .post-layout, .crypt-cols, .before-after { grid-template-columns: 1fr; }
  .cat-strip .wrap { grid-template-columns: 1fr 1fr; }
  .cat-cell { border-bottom: 1px solid var(--line); }
  .post-aside { position: static; }
  .card-grid { grid-template-columns: 1fr; }
  .ledger-row { grid-template-columns: 90px 1fr 80px; }
  .ledger-row .cat, .ledger-row .date { display: none; }
  .stamp { display: none; }
}
