:root {
  color-scheme: light;
  --bg: #f5f2ec;
  --surface: #fffefa;
  --surface-2: #ebe7df;
  --ink: #15191c;
  --muted: #60686d;
  --line: #d5d0c7;
  --accent: #9b6a25;
  --accent-strong: #76501b;
  --focus: #146aa3;
  --shadow: 0 24px 70px rgba(26, 24, 20, .11);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111416;
  --surface: #191d20;
  --surface-2: #24292d;
  --ink: #f2eee6;
  --muted: #adb4b8;
  --line: #363d41;
  --accent: #d0a15d;
  --accent-strong: #e2b979;
  --focus: #70b7e7;
  --shadow: 0 24px 70px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); font-family: var(--sans); line-height: 1.55; }
a { color: inherit; text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 99; top: .75rem; left: .75rem; transform: translateY(-180%); padding: .7rem 1rem; background: var(--ink); color: var(--bg); border-radius: .25rem; }
.skip-link:focus { transform: none; }
.site-header { width: min(1180px, calc(100% - 3rem)); margin: 0 auto; min-height: 96px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .75rem; color: var(--ink); text-decoration: none; }
.wordmark-lines { width: max-content; display: flex; flex-direction: column; font-family: var(--serif); font-size: 1.62rem; font-weight: 500; line-height: .83; letter-spacing: .18em; text-transform: uppercase; }
.wordmark-lines span:last-child { margin-left: 2.15rem; color: var(--accent); }
.brand-context { margin-left: .25rem; padding-left: 1rem; border-left: 1px solid var(--line); color: var(--muted); font-size: .78rem; font-weight: 650; letter-spacing: .04em; }
.theme-toggle { border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; gap: .55rem; padding: .65rem; cursor: pointer; font-weight: 650; }
.construction-main { width: min(1180px, calc(100% - 3rem)); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); align-items: center; gap: clamp(3rem, 8vw, 8rem); min-height: calc(100vh - 190px); padding: 5rem 0; }
.construction-copy { max-width: 720px; }
.eyebrow { margin: 0 0 1rem; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -.035em; line-height: 1.02; }
.construction-copy h1 { margin: 0; font-size: clamp(3.3rem, 7.5vw, 7rem); max-width: 11ch; }
.lede { max-width: 660px; margin: 2rem 0; color: var(--muted); font-family: var(--serif); font-size: clamp(1.18rem, 2vw, 1.48rem); line-height: 1.55; }
.status-line { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .88rem; font-weight: 650; }
.status-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 .28rem color-mix(in srgb, var(--accent) 16%, transparent); }
.manifesto-card { margin: 0; padding: clamp(2rem, 4vw, 4rem); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.manifesto-card::before { content: "“"; display: block; height: 3rem; color: var(--accent); font-family: var(--serif); font-size: 5rem; line-height: 1; }
.manifesto-card blockquote { margin: 1rem 0 2rem; font-family: var(--serif); font-size: clamp(1.7rem, 3vw, 2.6rem); line-height: 1.18; letter-spacing: -.025em; }
.manifesto-card figcaption { color: var(--muted); font-size: .78rem; font-weight: 760; letter-spacing: .14em; text-transform: uppercase; }
.site-footer { width: min(1180px, calc(100% - 3rem)); margin: 0 auto; min-height: 94px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .7rem 1.25rem; }
.privacy-main { width: min(760px, calc(100% - 3rem)); margin: 0 auto; padding: clamp(3.5rem, 8vw, 7rem) 0; }
.privacy-header { padding-bottom: clamp(2.5rem, 6vw, 4.5rem); border-bottom: 1px solid var(--line); }
.privacy-header h1 { max-width: 720px; margin: .55rem 0 1rem; font-family: var(--serif); font-size: clamp(3.25rem, 10vw, 6.75rem); font-weight: 400; letter-spacing: -.055em; line-height: .9; }
.privacy-header .lede { max-width: 660px; }
.policy-meta { margin: 1.5rem 0 0; color: var(--muted); font-size: .82rem; }
.policy-content { padding-top: clamp(2.5rem, 6vw, 4.5rem); }
.policy-content section + section { margin-top: 2.75rem; }
.policy-content h2 { margin: 0 0 .8rem; font-family: var(--serif); font-size: clamp(1.7rem, 4vw, 2.35rem); font-weight: 400; letter-spacing: -.025em; }
.policy-content p, .policy-content li { color: var(--muted); line-height: 1.75; }
.policy-content ul { margin: .8rem 0 0; padding-left: 1.25rem; }
.policy-content li + li { margin-top: .65rem; }
.policy-content strong { color: var(--ink); }

.editor-page { background: var(--surface-2); }
.editor-header { width: 100%; padding: 0 2rem; background: var(--surface); }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.editor-shell { min-height: calc(100vh - 96px); }
.login-panel { width: min(520px, calc(100% - 2rem)); margin: clamp(4rem, 12vh, 9rem) auto; padding: clamp(2rem, 5vw, 4rem); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-panel h1 { margin: 0 0 1rem; font-size: clamp(2.7rem, 7vw, 4.5rem); }
.login-panel p:not(.eyebrow) { color: var(--muted); }
.fine-print { margin-top: 1.25rem; font-size: .78rem; }
.button { min-height: 44px; border: 1px solid var(--line); border-radius: .2rem; padding: .65rem 1rem; background: var(--surface); color: var(--ink); font-weight: 750; cursor: pointer; }
.button:hover { border-color: var(--ink); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button-primary { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.button-danger { color: var(--accent-strong); }
.button-quiet { background: transparent; }
.button-small { min-height: 38px; padding: .45rem .8rem; }
.workspace { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); min-height: calc(100vh - 96px); }
.article-rail { padding: 2rem 1.5rem; border-right: 1px solid var(--line); background: var(--surface); }
.rail-heading, .canvas-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.rail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.rail-heading h1, .canvas-heading h2 { margin: 0; font-size: 2rem; }
.status-tabs { display: flex; gap: .25rem; margin: 1.8rem 0 1rem; border-bottom: 1px solid var(--line); }
.status-tabs button { min-height: 44px; padding: .6rem .55rem; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: .82rem; font-weight: 750; }
.status-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.article-list { display: grid; gap: .5rem; }
.article-list button { width: 100%; padding: .9rem; border: 1px solid transparent; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.article-list button:hover, .article-list button[aria-current="true"] { border-color: var(--line); background: var(--surface-2); }
.article-list strong, .article-list small { display: block; }
.article-list small { margin-top: .25rem; color: var(--muted); }
.empty-state { color: var(--muted); font-size: .9rem; }
.editor-canvas { padding: clamp(2rem, 5vw, 5rem); background: var(--bg); }
.canvas-heading { max-width: 920px; margin: 0 auto 2rem; }
.save-state { color: var(--muted); font-size: .82rem; }
.editor-canvas form { max-width: 920px; margin: auto; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.field { display: grid; gap: .45rem; color: var(--muted); font-size: .82rem; font-weight: 720; }
.field-wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: .2rem; padding: .8rem .9rem; background: var(--surface); color: var(--ink); font-weight: 450; }
.field textarea { resize: vertical; line-height: 1.6; }
.field small, .optional { color: var(--muted); font-weight: 450; }
.photo-field { min-width: 0; margin: 0; padding: 1.25rem; border: 1px solid var(--line); background: var(--surface); }
.record-field, .change-field { min-width: 0; margin: 0; padding: 1.25rem; border: 1px solid var(--line); background: var(--surface); }
.photo-field legend { padding: 0 .4rem; color: var(--ink); font-weight: 760; }
.record-field legend, .change-field legend { padding: 0 .4rem; color: var(--ink); font-weight: 760; }
.record-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.record-heading legend { padding: 0; }
.record-list { display: grid; gap: 1rem; }
.record-card { padding: 1rem; border: 1px solid var(--line); background: var(--bg); }
.record-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.record-card-grid .field-wide { grid-column: 1 / -1; }
.record-card-actions { display: flex; justify-content: flex-end; margin-top: .8rem; }
.check-field { min-height: 44px; display: flex; align-items: center; gap: .6rem; color: var(--ink); font-size: .86rem; font-weight: 650; }
.check-field input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.field-help { margin: 0 0 1rem; color: var(--muted); font-size: .86rem; font-weight: 450; }
.upload-box { min-height: 116px; display: grid; place-items: center; align-content: center; gap: .25rem; padding: 1.25rem; border: 1px dashed var(--muted); background: var(--bg); color: var(--muted); text-align: center; cursor: pointer; font-size: .78rem; }
.upload-box:hover, .upload-box.is-dragging { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--bg)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.upload-box:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.upload-box.is-dragging .upload-title { color: var(--accent-strong); }
.upload-title { color: var(--ink); font-size: .95rem; font-weight: 760; }
.upload-box input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.photo-list { display: grid; gap: 1rem; margin-top: 1rem; }
.photo-card { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 1rem; padding: 1rem; border: 1px solid var(--line); background: var(--bg); }
.photo-preview { width: 170px; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); }
.photo-details { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.photo-details .field:first-child { grid-column: 1 / -1; }
.photo-card-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.upload-progress { color: var(--muted); font-size: .78rem; }
.body-field { gap: 0; }
.body-field > span { margin-bottom: .45rem; }
.format-toolbar { display: flex; flex-wrap: wrap; gap: .25rem; padding: .45rem; border: 1px solid var(--line); border-bottom: 0; background: var(--surface-2); }
.format-toolbar button { min-width: 42px; min-height: 38px; padding: .35rem .55rem; border: 1px solid transparent; background: transparent; color: var(--ink); cursor: pointer; font-size: .78rem; font-weight: 760; }
.format-toolbar button:hover { border-color: var(--line); background: var(--surface); }
.body-field textarea { border-top-left-radius: 0; border-top-right-radius: 0; }
.change-grid { display: grid; grid-template-columns: .75fr 1.25fr; gap: 1rem; }
.preview-dialog { width: min(1000px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 1px solid var(--line); background: var(--bg); color: var(--ink); box-shadow: var(--shadow); }
.analytics-dialog { width: min(1120px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 1px solid var(--line); background: var(--bg); color: var(--ink); box-shadow: var(--shadow); }
.analytics-dialog::backdrop { background: rgba(10, 12, 13, .72); }
.analytics-period { display: block; margin-top: .15rem; color: var(--muted); font-size: .78rem; }
.analytics-content { padding: clamp(1.25rem, 4vw, 3rem); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.metric-grid > div { min-height: 145px; padding: 1.1rem; display: flex; flex-direction: column; border: 1px solid var(--line); background: var(--surface); }
.metric-grid span, .metric-grid small { color: var(--muted); font-size: .78rem; }
.metric-grid strong { margin-top: auto; font-family: var(--serif); font-size: 2.7rem; font-weight: 500; line-height: 1; }
.analytics-table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
.analytics-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.analytics-table caption { padding: 1rem; color: var(--muted); text-align: left; }
.analytics-table th, .analytics-table td { padding: .85rem 1rem; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.analytics-table th:first-child { min-width: 240px; text-align: left; white-space: normal; }
.analytics-table thead th { color: var(--muted); font-size: .74rem; text-transform: uppercase; }
.analytics-note { color: var(--muted); font-size: .82rem; }
.preview-dialog::backdrop { background: rgba(10, 12, 13, .72); }
.preview-bar { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.article-preview { max-width: 760px; margin: auto; padding: clamp(2rem, 6vw, 5rem); font-family: var(--serif); font-size: 1.14rem; line-height: 1.75; }
.article-preview > h1 { margin: 0 0 1rem; font-size: clamp(2.8rem, 7vw, 5.5rem); }
.article-preview .preview-deck { color: var(--muted); font-size: 1.35rem; }
.article-preview .preview-meta { padding: 1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-family: var(--sans); font-size: .78rem; text-transform: uppercase; }
.article-preview img { width: 100%; height: auto; margin: 2rem 0 .5rem; }
.article-preview figcaption { color: var(--muted); font-family: var(--sans); font-size: .78rem; }
.article-preview .article-body h1 { margin: 3rem 0 1rem; font-size: clamp(2.45rem, 5vw, 3.5rem); line-height: 1.05; }
.article-preview .article-body h2, .article-preview > section h2 { margin: 2.75rem 0 1rem; font-size: 2.1rem; line-height: 1.1; }
.article-preview .article-body h3 { margin: 2.25rem 0 .8rem; font-size: 1.65rem; line-height: 1.18; }
.article-preview .article-body h4 { margin: 2rem 0 .65rem; font-size: 1.18rem; line-height: 1.3; }
.article-preview blockquote { margin: 2rem 0; padding: 1rem 1.5rem; border-left: 4px solid var(--accent); background: var(--surface-2); font-size: 1.35rem; }
.article-preview blockquote p { margin: 0; }
.article-preview a { color: var(--accent-strong); }
.article-preview .article-body img { max-width: 100%; height: auto; display: block; margin: 2rem auto; }
.form-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.toast { position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 10; max-width: min(420px, calc(100% - 3rem)); padding: .9rem 1.1rem; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); }
.callback-page { display: grid; place-items: center; }

@media (max-width: 800px) {
  .construction-main { grid-template-columns: 1fr; padding: 4rem 0; }
  .construction-copy h1 { font-size: clamp(3rem, 15vw, 5rem); }
  .workspace { grid-template-columns: 1fr; }
  .article-rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .field-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .photo-card { grid-template-columns: 1fr; }
  .photo-preview { width: 100%; max-height: 260px; }
  .record-card-grid, .change-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .record-card-grid .field-wide { grid-column: auto; }
}

@media (max-width: 540px) {
  .site-header, .site-footer, .construction-main, .privacy-main { width: calc(100% - 2rem); }
  .editor-header { width: 100%; padding: 0 1rem; }
  .theme-toggle [data-theme-label] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .brand-context { display: none; }
  .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: .25rem; }
  .editor-canvas { padding: 2rem 1rem; }
  .metric-grid { grid-template-columns: 1fr; }
}

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

[hidden] { display: none !important; }
