:root {
  color-scheme: light;
  --ink: #171812;
  --paper: #f1eee4;
  --paper-deep: #e5dfd1;
  --line: rgba(23, 24, 18, 0.18);
  --acid: #c9ff3d;
  --rust: #b94b2d;
  --muted: #6f7066;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 84% 7%, rgba(201, 255, 61, 0.2), transparent 23rem),
    repeating-linear-gradient(90deg, transparent 0, transparent 95px, rgba(23, 24, 18, 0.035) 96px),
    var(--paper);
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }

.admin-shell { min-height: 100vh; }

.masthead {
  min-height: 112px;
  display: grid;
  grid-template-columns: 220px 1fr auto;
  align-items: center;
  border-bottom: 1px solid var(--ink);
  padding: 0 34px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand > span {
  width: 42px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--acid);
  font: 700 25px/1 Baskerville, "Iowan Old Style", serif;
}

.brand strong { font: 600 20px/1 Baskerville, "Iowan Old Style", serif; }

.masthead__title { display: flex; align-items: baseline; gap: 22px; }
.masthead__title span,
.panel-kicker,
.rail-label,
.section-heading p,
.template-card__eyebrow,
.field > span {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
  font-weight: 700;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin: 0; font: 400 clamp(26px, 3vw, 42px)/0.95 Baskerville, "Iowan Old Style", serif; }

.live-indicator {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.live-indicator i { width: 8px; height: 8px; border-radius: 50%; background: #57a735; box-shadow: 0 0 0 5px rgba(87, 167, 53, 0.12); }

.workspace {
  display: grid;
  grid-template-columns: 190px minmax(450px, 1fr) minmax(330px, 430px);
  min-height: calc(100vh - 112px);
}

.catalog-rail {
  padding: 38px 28px;
  border-right: 1px solid var(--ink);
  display: flex;
  flex-direction: column;
}
.rail-label { color: var(--rust); }
.metric { margin-top: 72px; }
.metric strong { display: block; font: 400 84px/0.8 Baskerville, "Iowan Old Style", serif; letter-spacing: -0.08em; }
.metric span { display: block; margin-top: 18px; font-size: 11px; line-height: 1.4; text-transform: uppercase; letter-spacing: 0.08em; }
.rail-note { margin-top: auto; border-top: 1px solid var(--ink); padding-top: 16px; }
.rail-note span { display: inline-block; padding: 3px 7px; margin-bottom: 9px; background: var(--acid); font-size: 10px; text-transform: uppercase; font-weight: 800; }
.rail-note p { color: var(--muted); font-size: 12px; line-height: 1.5; }

.catalog-stage { padding: 38px clamp(24px, 4vw, 64px) 60px; min-width: 0; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 28px; }
.section-heading > div { display: flex; align-items: center; gap: 18px; }
.section-index { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--ink); border-radius: 50%; font-size: 11px; }
.section-heading p { margin-bottom: 7px; color: var(--muted); }
.section-heading h2, .draft-panel h2 { margin: 0; font: 400 clamp(28px, 3vw, 44px)/1 Baskerville, "Iowan Old Style", serif; letter-spacing: -0.025em; }
.refresh-button { border: 0; border-bottom: 1px solid var(--ink); background: transparent; padding: 8px 0; cursor: pointer; font-size: 12px; }
.refresh-button span { margin-left: 8px; font-size: 16px; }

.notice { margin: -10px 0 22px; padding: 12px 15px; border-left: 4px solid var(--ink); background: rgba(255,255,255,.45); font-size: 13px; }
.notice--success { border-color: #659e32; }
.notice--error { border-color: var(--rust); color: #7f2918; }

.catalog-board { display: grid; gap: 13px; }
.catalog-board[aria-busy="true"] { opacity: 0.58; transition: opacity 160ms ease; }
.catalog-row { position: relative; animation: row-in 420ms both; }
.catalog-row:nth-child(2) { animation-delay: 70ms; }
.catalog-row:nth-child(3) { animation-delay: 140ms; }
@keyframes row-in { from { opacity: 0; transform: translateY(12px); } }

.template-card {
  min-height: 180px;
  display: grid;
  grid-template-columns: 154px 1fr;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: rgba(249, 247, 239, 0.82);
}
.template-cover { position: relative; display: grid; place-items: center; overflow: hidden; border-right: 1px solid var(--ink); background: #e27652; }
.template-cover::after { content: ""; position: absolute; inset: 17%; border: 1px solid rgba(23,24,18,.72); border-radius: 50% 50% 43% 57% / 62% 38% 62% 38%; transform: rotate(-18deg); }
.template-cover[data-tone="1"] { background: #89aab0; }
.template-cover[data-tone="2"] { background: #d3b9e7; }
.template-cover[data-tone="3"] { background: #d5d272; }
.template-ordinal { position: absolute; top: 11px; left: 12px; font-size: 10px; letter-spacing: .1em; }
.cover-glyph { position: relative; z-index: 1; font: italic 400 76px/1 Baskerville, "Iowan Old Style", serif; }
.template-card__body { min-width: 0; padding: 21px 60px 18px 24px; }
.template-card__eyebrow { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; color: var(--muted); }
.status-chip { padding: 4px 7px; background: var(--acid); color: var(--ink); }
.template-card h3 { margin: 16px 0 5px; font: 400 27px/1 Baskerville, "Iowan Old Style", serif; }
.template-card p { margin-bottom: 17px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.template-meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 10px; }
.template-meta dt { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.template-meta dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.template-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 5px; }
.icon-button { width: 31px; height: 31px; padding: 0; border: 1px solid var(--ink); background: var(--paper); cursor: pointer; transition: transform 130ms ease, background 130ms ease; }
.icon-button:hover:not(:disabled) { transform: translateY(-2px); background: var(--acid); }
.icon-button:disabled { opacity: .28; cursor: default; }
.icon-button--danger:hover:not(:disabled) { background: var(--rust); color: white; }

.empty-catalog { min-height: 360px; display: grid; place-items: center; align-content: center; border: 1px dashed var(--ink); text-align: center; padding: 35px; }
.empty-catalog__mark { width: 92px; height: 92px; display: grid; place-items: center; margin-bottom: 25px; border-radius: 50%; background: var(--acid); font: 400 54px/1 Baskerville, serif; }
.empty-catalog h3 { margin-bottom: 8px; font: 400 27px/1.1 Baskerville, serif; }
.empty-catalog p { max-width: 330px; color: var(--muted); font-size: 13px; }

.draft-panel { padding: 38px 34px; border-left: 1px solid var(--ink); background: rgba(229, 223, 209, .73); }
.panel-kicker { margin-bottom: 42px; color: var(--rust); }
.panel-intro { max-width: 340px; margin: 14px 0 28px; color: var(--muted); font: 400 14px/1.5 Baskerville, "Iowan Old Style", serif; }
.draft-form { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 12px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field > span { color: var(--muted); }
.field input, .field textarea, .field select { width: 100%; border: 0; border-bottom: 1px solid rgba(23,24,18,.55); border-radius: 0; padding: 9px 0; outline: 0; background: transparent; font-size: 13px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--rust); box-shadow: 0 2px 0 var(--rust); }
.primary-button, .publish-button { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); padding: 14px 16px; cursor: pointer; font-weight: 700; transition: background 160ms ease, color 160ms ease; }
.primary-button:hover, .publish-button:hover { background: var(--acid); color: var(--ink); }
.publish-strip { margin-top: 18px; border: 1px solid var(--ink); padding: 12px; background: var(--acid); }
.publish-strip:not([hidden]) { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.publish-strip strong, .publish-strip span { display: block; }
.publish-strip strong { font: 400 17px Baskerville, serif; }
.draft-id { margin-top: 2px; color: var(--muted); font-size: 9px; }
.publish-button { padding: 9px 12px; font-size: 11px; }
button:disabled { cursor: wait; }

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 130px 1fr; }
  .draft-panel { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--ink); padding-left: max(34px, calc((100vw - 900px) / 2)); padding-right: max(34px, calc((100vw - 900px) / 2)); }
  .draft-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .masthead { min-height: 94px; grid-template-columns: 1fr auto; padding: 0 18px; }
  .masthead__title { display: none; }
  .brand strong { display: none; }
  .workspace { display: block; }
  .catalog-rail { min-height: auto; border-right: 0; border-bottom: 1px solid var(--ink); padding: 20px; flex-direction: row; align-items: center; justify-content: space-between; }
  .metric { margin: 0; display: flex; align-items: center; gap: 12px; }
  .metric strong { font-size: 48px; }
  .metric span { margin: 0; }
  .rail-note { display: none; }
  .catalog-stage { padding: 30px 18px 45px; }
  .template-card { grid-template-columns: 105px 1fr; }
  .template-card__body { padding: 18px 45px 16px 16px; }
  .template-card h3 { font-size: 22px; }
  .template-meta { display: none; }
  .draft-panel { padding: 34px 18px 48px; }
  .draft-form { grid-template-columns: 1fr; }
  .field--wide { grid-column: auto; }
}

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