:root {
  --ink: #101828;
  --muted: #5d6679;
  --line: #d8dde7;
  --paper: #ffffff;
  --wash: #f5f7fb;
  --signal: #ff5c35;
  --blue: #2546d8;
  --blue-dark: #1732a6;
  --success: #087a55;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { color: var(--ink); background: var(--paper); font-size: 16px; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font-family: var(--sans); line-height: 1.55; }
a { color: inherit; text-decoration-color: #9aa7c2; text-underline-offset: .2em; }
a:hover { color: var(--blue); }
strong { color: inherit; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #ffb29f; outline-offset: 3px; }
.shell { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 50; left: 1rem; top: -5rem; padding: .75rem 1rem; background: var(--ink); color: white; }
.skip-link:focus { top: 1rem; }

.site-header { border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.header-inner { min-height: 72px; display: flex; align-items: center; gap: 2rem; }
.wordmark { display: inline-flex; align-items: center; gap: .55rem; font: 700 1.1rem/1 var(--sans); text-decoration: none; letter-spacing: -.03em; }
.wordmark span { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 8px; color: white; background: var(--ink); font-family: var(--serif); font-size: 1.35rem; }
.site-nav { display: flex; align-items: center; gap: 1.5rem; margin-left: auto; }
.site-nav a { position: relative; padding: .55rem 0; color: #394258; font-size: .92rem; font-weight: 650; text-decoration: none; }
.site-nav a[aria-current='page']::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--signal); }
.site-nav .nav-compose { padding: .65rem 1rem; border-radius: 8px; color: white; background: var(--ink); }
.identity-pill { border: 0; border-left: 1px solid var(--line); padding: .35rem 0 .35rem 1.4rem; color: var(--muted); background: none; cursor: pointer; }
.signout-form { margin: 0; }

.edition-head, .workspace-head { display: grid; grid-template-columns: 1fr auto; gap: 3rem; align-items: end; padding-block: 5.5rem 3rem; }
.eyebrow { margin: 0 0 .8rem; color: var(--blue); font-size: .73rem; font-weight: 800; letter-spacing: .16em; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { max-width: 820px; margin: 0; font: 500 clamp(2.6rem, 7vw, 5.6rem)/.97 var(--serif); letter-spacing: -.055em; }
.dek { max-width: 700px; margin: 1.3rem 0 0; color: var(--muted); font: 400 clamp(1.05rem, 2vw, 1.3rem)/1.55 var(--sans); }
.edition-meter { min-width: 145px; border-left: 2px solid var(--signal); padding: .2rem 0 .2rem 1.15rem; display: grid; }
.edition-meter strong { font: 500 3.2rem/1 var(--serif); }
.edition-meter span { font-weight: 750; }
.edition-meter small { margin-top: .35rem; color: var(--muted); }

.section-rule { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-top: 2px solid var(--ink); padding: .8rem 0 1rem; }
.section-rule h2 { margin: 0; font-size: .82rem; letter-spacing: .13em; text-transform: uppercase; }
.section-rule span { color: var(--muted); font-size: .8rem; }
.story-row { display: grid; grid-template-columns: 70px 1fr; gap: 1.25rem; padding: 2.25rem 0; border-top: 1px solid var(--line); }
.story-index { color: #9ba4b5; font: 500 1rem var(--serif); }
.story-main { max-width: 820px; }
.story-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; color: var(--muted); font-size: .78rem; }
.evidence-chip { display: inline-flex; align-items: center; min-height: 27px; padding: .25rem .55rem; border: 1px solid #a8b5da; border-radius: 999px; color: var(--blue-dark); background: #f1f4ff; font-weight: 750; }
.story-main h3 { margin: .75rem 0 .65rem; font: 500 clamp(1.65rem, 3vw, 2.5rem)/1.08 var(--serif); letter-spacing: -.035em; }
.story-main h3 a { text-decoration: none; }
.story-main p { display: -webkit-box; max-width: 720px; margin: 0; overflow: hidden; color: #394258; font-size: 1.02rem; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.story-source { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.1rem; color: var(--muted); font-size: .82rem; }
.story-source a { color: var(--blue); font-weight: 700; text-decoration: none; }
.empty-edition { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.5rem; min-height: 190px; border: 1px solid var(--line); border-radius: 14px; padding: 2rem; background: var(--wash); }
.empty-mark { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; color: white; background: var(--ink); font: 500 1.5rem var(--serif); }
.empty-edition h3, .empty-card h3 { margin: 0 0 .3rem; font: 500 1.5rem var(--serif); }
.empty-edition p, .empty-card p { margin: 0; color: var(--muted); }
.edition-end { display: grid; place-items: center; margin: 4rem 0 2rem; padding: 2.2rem; border-top: 1px solid var(--line); text-align: center; }
.edition-end span { color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .18em; }
.edition-end p { margin: .4rem 0 0; font: 500 1.7rem var(--serif); }

.button-primary, .button-secondary { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; border-radius: 8px; padding: .75rem 1.15rem; font-weight: 750; text-decoration: none; cursor: pointer; }
.button-primary { border: 1px solid var(--blue); color: white; background: var(--blue); }
.button-primary:hover { color: white; background: var(--blue-dark); }
.button-secondary { border: 1px solid #aeb7c8; color: var(--ink); background: white; }
.is-full { width: 100%; }

.workspace-head h1 { max-width: 720px; font-size: clamp(2.4rem, 6vw, 4.5rem); }
.studio-grid { display: grid; grid-template-columns: 250px 1fr; gap: 3.5rem; padding-bottom: 5rem; }
.studio-summary { align-self: start; display: grid; padding: 1.5rem; border-radius: 12px; color: white; background: var(--ink); }
.studio-summary span { font-size: .76rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.studio-summary strong { margin: .8rem 0; font: 500 3.5rem/1 var(--serif); }
.studio-summary small { color: #cbd2df; }
.studio-post { display: grid; grid-template-columns: 72px 1fr 110px auto; gap: 1rem; align-items: center; min-height: 76px; border-top: 1px solid var(--line); text-decoration: none; }
.format-label { color: var(--blue); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.studio-post time { color: var(--muted); font-size: .82rem; }
.empty-card { padding: 2rem; border: 1px solid var(--line); border-radius: 10px; background: var(--wash); }

.composer-shell { max-width: 900px; padding-block: 4rem 6rem; }
.composer-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.composer-head h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); }
.composer-head > a { color: var(--muted); }
.composer { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: white; box-shadow: 0 24px 70px rgba(16,24,40,.08); }
.format-picker { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--line); }
.format-picker legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.format-picker label { position: relative; min-height: 98px; padding: 1.15rem; border-right: 1px solid var(--line); cursor: pointer; }
.format-picker label:last-child { border-right: 0; }
.format-picker input { position: absolute; opacity: 0; }
.format-picker span { display: grid; gap: .25rem; }
.format-picker strong { font-size: 1rem; }
.format-picker small { color: var(--muted); }
.format-picker label:has(input:checked) { color: white; background: var(--ink); }
.format-picker label:has(input:checked) small { color: #d2d8e4; }
.format-panel { padding: 2rem; }
.format-panel[hidden] { display: none; }
.format-panel label, .signin-card label { display: block; margin: 1.25rem 0 .45rem; font-size: .84rem; font-weight: 750; }
.format-panel label:first-child { margin-top: 0; }
.format-panel label span, .signin-card label span { color: var(--muted); font-weight: 450; }
.format-panel input, .format-panel textarea, .signin-card input { display: block; width: 100%; border: 1px solid #b9c1d0; border-radius: 8px; padding: .85rem .95rem; color: var(--ink); background: #fff; }
.format-panel textarea { resize: vertical; line-height: 1.55; }
.field-foot { display: flex; justify-content: space-between; gap: 1rem; margin-top: .4rem; color: var(--muted); font-size: .78rem; }
.field-error { color: #b42318; }
.is-near-limit { color: #b42318; font-weight: 750; }
.is-over-limit { color: #fff; background: #b42318; border-radius: 4px; padding: 0 .35rem; font-weight: 750; }
.handoff { max-width: 640px; padding-block: 3rem; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 2rem; border-top: 1px solid var(--line); padding: 1.15rem 2rem; background: var(--wash); }
.composer-actions p { max-width: 490px; margin: 0; color: var(--muted); font-size: .82rem; }
.form-alert, .success-banner, .notice-banner { margin-bottom: 1rem; border-radius: 8px; padding: .9rem 1rem; }
.form-alert { border: 1px solid #f2b8b5; color: #8d2119; background: #fff3f2; }

.post-page { max-width: 900px; padding-block: 4.5rem 6rem; }
.success-banner { display: flex; gap: .6rem; border: 1px solid #91d6bc; color: #075b40; background: #edfff8; }
.success-banner strong { color: inherit; }
.notice-banner { display: flex; gap: .6rem; border: 1px solid #f3c77a; color: #7a4a05; background: #fff8eb; }
.post-head { padding: 2rem 0 2.5rem; border-bottom: 1px solid var(--line); }
.post-head h1 { margin-top: 1.1rem; font-size: clamp(2.3rem, 6vw, 4.7rem); }
.post-format-short h1 { font-size: clamp(2rem, 4.2vw, 3.5rem); line-height: 1.08; }
.byline { margin: 1.2rem 0 0; color: var(--muted); }
.post-body { max-width: 720px; padding: 2.5rem 0; }
.long-copy { font: 400 1.15rem/1.8 var(--serif); overflow-wrap: anywhere; }
.long-copy > * + * { margin-top: 1.1em; }
.long-copy h1, .long-copy h2, .long-copy h3 { font-weight: 750; line-height: 1.25; margin-top: 1.6em; }
.long-copy ul, .long-copy ol { padding-left: 1.5em; }
.long-copy ul { list-style: disc; }
.long-copy ol { list-style: decimal; }
.long-copy blockquote { border-left: 3px solid var(--line); padding-left: 1em; color: var(--muted); }
.long-copy code { color: var(--ink); font-size: .88em; background: var(--wash); border-radius: 4px; padding: .1em .3em; }
.long-copy pre { color: var(--ink); background: var(--wash); border: 1px solid var(--line); border-radius: 8px; padding: 1em; overflow-x: auto; }
.long-copy pre code { background: none; padding: 0; }
.long-copy a { text-decoration: underline; }
.post-sources { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: .9rem; }
.post-sources summary { cursor: pointer; color: var(--muted); font-size: .8rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.post-sources[open] summary { margin-bottom: .9rem; }
.post-sources .byline { margin: 0 0 .9rem; }
.source-card { display: grid; gap: .4rem; border: 1px solid var(--line); border-left: 5px solid var(--signal); border-radius: 8px; padding: 1.3rem; text-decoration: none; }
.source-card span { color: var(--blue); font-size: .7rem; font-weight: 800; letter-spacing: .14em; }
.source-card strong { font: 500 1.4rem var(--serif); }
.source-card small { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.card-comment { margin-top: 1.5rem; font-size: 1.08rem; }
.record-panel { display: flex; justify-content: space-between; gap: 2rem; align-items: center; border-top: 2px solid var(--ink); padding-top: 1rem; }
.record-panel div { min-width: 0; display: grid; gap: .25rem; }
.record-panel span { font-size: .7rem; font-weight: 800; letter-spacing: .13em; }
.record-panel code { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }

.signin-shell { display: grid; grid-template-columns: 1.1fr minmax(320px, .7fr); gap: 7vw; align-items: center; min-height: calc(100vh - 190px); padding-block: 4rem; }
.signin-copy h1 { max-width: 620px; font-size: clamp(3rem, 7vw, 5.6rem); }
.signin-copy > p:not(.eyebrow) { max-width: 580px; color: var(--muted); font-size: 1.15rem; }
.signin-copy ul { margin: 2rem 0 0; padding: 0; list-style: none; }
.signin-copy li { border-top: 1px solid var(--line); padding: .75rem 0; font-weight: 650; }
.signin-card { border: 1px solid var(--line); border-radius: 14px; padding: 2rem; box-shadow: 0 25px 70px rgba(16,24,40,.1); }
.signin-card h2 { margin: 0; font: 500 2rem var(--serif); }
.signin-card button { margin-top: 1.5rem; }
.dev-notice { display: inline-flex; margin: 1rem 0 0; border-radius: 99px; padding: .3rem .65rem; color: #6d3d00; background: #fff0c2; font-size: .75rem; font-weight: 750; }
.auth-status { min-height: 1.5rem; margin: 1rem 0 0; color: var(--muted); font-size: .84rem; }

.error-page { min-height: 65vh; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.error-page h1 { font-size: clamp(2.6rem, 7vw, 5rem); }
.error-page > p:not(.eyebrow) { max-width: 600px; color: var(--muted); font-size: 1.1rem; }
.site-footer { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); padding-block: 1.5rem 2.5rem; color: var(--muted); font-size: .78rem; }
.site-footer p { margin: 0; }

@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 1120px); }
  .header-inner { min-height: 64px; gap: .8rem; }
  .site-nav { gap: 1rem; }
  .site-nav a:not(.nav-compose):not([aria-current='page']) { display: none; }
  .identity-pill { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .edition-head, .workspace-head { grid-template-columns: 1fr; align-items: start; padding-block: 3.5rem 2.5rem; }
  .edition-meter { grid-template-columns: auto auto; gap: .5rem; align-items: baseline; }
  .edition-meter small { grid-column: 1 / -1; }
  .story-row { grid-template-columns: 38px 1fr; gap: .55rem; }
  .story-source { flex-direction: column; }
  .empty-edition { grid-template-columns: 1fr; }
  .empty-mark { display: none; }
  .studio-grid { grid-template-columns: 1fr; gap: 2rem; }
  .studio-post { grid-template-columns: 60px 1fr auto; padding-block: .8rem; }
  .studio-post time { display: none; }
  .composer-shell { padding-block: 2.5rem 4rem; }
  .format-picker { grid-template-columns: 1fr; }
  .format-picker label { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .format-panel { padding: 1.25rem; }
  .composer-actions { align-items: stretch; flex-direction: column; padding: 1.25rem; }
  .record-panel { align-items: stretch; flex-direction: column; }
  .signin-shell { grid-template-columns: 1fr; min-height: 0; gap: 2.5rem; }
  .site-footer { flex-direction: column; }
}

@media (prefers-reduced-motion: no-preference) {
  a, button { transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
}
.post-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 1.25rem; margin-top: 1.5rem; }
.state-label { margin-left: .4rem; border-radius: 999px; padding: .1rem .5rem; color: #7a4a05; background: #fff1d6; font: 700 .7rem var(--sans); letter-spacing: .04em; text-transform: uppercase; vertical-align: middle; }
.button-link-danger { border: 0; background: none; color: #b42318; font-weight: 650; text-decoration: underline; cursor: pointer; padding: 0; }
