/* ── The Letter Desk · vintage newsroom ─────────────────────────────── */

:root {
  --paper: #f2ead8;
  --paper-deep: #e9dfc7;
  --ink: #221b12;
  --ink-soft: #4c4234;
  --faded: #7c7060;
  --red: #9e2b1c;
  --red-deep: #7c1f13;
  --green: #2e5d3a;
  --rule: #2a2214;
  --serif: "Libre Caslon Text", "Iowan Old Style", Georgia, serif;
  --type: "Special Elite", "Courier New", monospace;
  --black: "UnifrakturMaguntia", serif;
}

* { box-sizing: border-box; }

html { background: #d8ccb2; }

body {
  margin: 0;
  font-family: var(--serif);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% -10%, #f7f1e2 0%, var(--paper) 55%, var(--paper-deep) 100%);
  background-attachment: fixed;
}

.sheet {
  max-width: 1060px;
  margin: 1.5rem auto 3rem;
  padding: 0 2rem;
  animation: settle 0.5s ease-out both;
}

@keyframes settle {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── masthead ── */

.masthead { text-align: center; position: relative; padding-top: 0.75rem; }

.ears {
  position: absolute; top: 1.9rem; left: 0; right: 0;
  display: flex; justify-content: space-between;
  font-size: 0.68rem; font-style: italic; color: var(--faded);
  line-height: 1.35; text-align: left; pointer-events: none;
}
.ear-right { text-align: right; }

.nameplate {
  font-family: var(--black);
  font-weight: 400;
  font-size: clamp(3rem, 8vw, 5.2rem);
  margin: 0;
  letter-spacing: 0.01em;
}
.nameplate a { color: var(--ink); text-decoration: none; }
.nameplate a:hover { color: var(--red-deep); }

.tagline {
  margin: 0.1rem 0 0.7rem;
  font-variant: small-caps;
  letter-spacing: 0.28em;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.dateline {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px solid var(--rule);
  border-bottom: 3px double var(--rule);
  padding: 0.3rem 0.2rem;
  font-size: 0.72rem;
  font-variant: small-caps;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}
.dateline-date { font-weight: 700; color: var(--ink); }

.sections {
  display: flex; justify-content: center; gap: 1.1rem; align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
  font-variant: small-caps;
  letter-spacing: 0.22em;
  font-size: 0.92rem;
}
.sections a { color: var(--ink); text-decoration: none; padding-bottom: 1px; }
.sections a:hover { color: var(--red-deep); }
.sections a.on { border-bottom: 2px solid var(--red); color: var(--red-deep); }
.sections .sep { color: var(--faded); font-size: 0.6rem; }
.sections .compose { color: var(--red-deep); font-weight: 700; }

main { padding-top: 1.6rem; }

/* ── shared type ── */

h2.deskhead {
  font-size: 1.65rem;
  margin: 0 0 0.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.kicker {
  font-variant: small-caps;
  letter-spacing: 0.3em;
  font-size: 0.7rem;
  color: var(--red-deep);
  margin: 0 0 0.15rem;
}
.subhead { font-style: italic; color: var(--faded); margin: 0 0 1.2rem; font-size: 0.92rem; }

a { color: var(--red-deep); }

/* ── ledger stats ── */

.ledger {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--rule);
  border-bottom: 3px double var(--rule);
  margin-bottom: 1.6rem;
  background: rgba(255, 252, 243, 0.4);
}
.ledger > div {
  padding: 0.7rem 1rem 0.55rem;
  text-align: center;
  border-right: 1px solid var(--rule);
}
.ledger > div:last-child { border-right: 0; }
.ledger .num { font-size: 2rem; font-weight: 700; line-height: 1; display: block; }
.ledger .lbl { font-variant: small-caps; letter-spacing: 0.2em; font-size: 0.68rem; color: var(--faded); }
.ledger .published .num { color: var(--green); }
.ledger .submitted .num { color: var(--red-deep); }

/* ── letter cards ── */

.letter-list { display: flex; flex-direction: column; gap: 0; }

.letter-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 1.5rem;
  align-items: start;
  padding: 1rem 0.6rem 1.05rem;
  border-bottom: 1px solid rgba(42, 34, 20, 0.35);
  position: relative;
}
.letter-row:hover { background: rgba(255, 252, 243, 0.55); }

.letter-row .headline {
  font-size: 1.25rem; font-weight: 700; margin: 0;
}
.letter-row .headline a { color: var(--ink); text-decoration: none; }
.letter-row .headline a:hover { color: var(--red-deep); }

.letter-row .byline {
  font-size: 0.78rem; color: var(--faded);
  font-variant: small-caps; letter-spacing: 0.12em;
}
.letter-row .snippet {
  grid-column: 1 / -1;
  font-family: var(--type);
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 0.15rem 0 0;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ── rubber stamps ── */

.stamp {
  display: inline-block;
  font-variant: small-caps;
  letter-spacing: 0.24em;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.18rem 0.65rem 0.12rem;
  border: 2px solid currentColor;
  border-radius: 3px;
  transform: rotate(-3deg);
  opacity: 0.85;
  box-shadow: inset 0 0 0 1.5px var(--paper), inset 0 0 0 2.5px currentColor;
  white-space: nowrap;
}
.stamp.draft     { color: var(--faded); transform: rotate(-2deg); }
.stamp.submitted { color: var(--red); }
.stamp.published { color: var(--green); transform: rotate(2deg); }
.stamp.declined  { color: #55503f; text-decoration: line-through; }

/* ── forms ── */

form.broadside { max-width: 100%; }

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-variant: small-caps;
  letter-spacing: 0.22em;
  font-size: 0.7rem;
  color: var(--ink-soft);
  margin-bottom: 0.25rem;
}
.field input, .field select, .field textarea {
  width: 100%;
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--ink);
  background: rgba(255, 252, 243, 0.65);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 0.5rem 0.6rem;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 2px 2px 0 rgba(158, 43, 28, 0.25);
}

.field textarea.typewriter {
  font-family: var(--type);
  font-size: 0.95rem;
  line-height: 1.9;
  min-height: 21rem;
  background:
    repeating-linear-gradient(transparent, transparent calc(1.9em - 1px), rgba(42, 34, 20, 0.14) calc(1.9em - 1px), rgba(42, 34, 20, 0.14) 1.9em),
    rgba(255, 252, 243, 0.75);
  background-attachment: local;
  padding-top: 0.45em;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
.four-col { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 1rem; }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 2rem; }
.editor-side {
  border-left: 1px solid var(--rule);
  padding-left: 1.5rem;
  position: sticky;
  top: 1rem;
  align-self: start;
}

/* ── word-count governor ── */

.governor {
  border: 1px solid var(--rule);
  background: rgba(255, 252, 243, 0.6);
  padding: 0.9rem 1rem 1rem;
  margin-bottom: 1.4rem;
}
.governor .kicker { margin-bottom: 0.4rem; }
.gov-count { font-size: 2.6rem; font-weight: 700; line-height: 1; font-family: var(--serif); }
.gov-limit { font-size: 0.8rem; color: var(--faded); }
.gov-bar {
  height: 9px; margin-top: 0.6rem;
  border: 1px solid var(--rule);
  background: rgba(42, 34, 20, 0.06);
  position: relative; overflow: hidden;
}
.gov-bar span {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: var(--green);
  transition: width 0.25s ease, background 0.25s ease;
}
.governor.near .gov-bar span { background: #a8761c; }
.governor.over .gov-bar span { background: var(--red); }
.governor.over .gov-count { color: var(--red); }
.gov-note { font-size: 0.75rem; font-style: italic; color: var(--faded); margin-top: 0.45rem; }
.governor.over .gov-note { color: var(--red-deep); font-weight: 700; font-style: normal; }

.fit-warn {
  border: 1px solid #a8761c;
  background: rgba(168, 118, 28, 0.08);
  color: #6d4c10;
  font-size: 0.78rem;
  line-height: 1.5;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1.4rem;
}

.tips { font-size: 0.8rem; color: var(--ink-soft); }
.tips h4 {
  font-variant: small-caps; letter-spacing: 0.24em; font-size: 0.7rem;
  color: var(--red-deep); margin: 0 0 0.4rem;
}
.tips ul { margin: 0; padding-left: 1rem; }
.tips li { margin-bottom: 0.45rem; }

/* ── buttons ── */

.btn {
  display: inline-block;
  font-family: var(--serif);
  font-variant: small-caps;
  letter-spacing: 0.2em;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  padding: 0.55rem 1.4rem 0.45rem;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 3px 3px 0 rgba(42, 34, 20, 0.3);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(42, 34, 20, 0.3); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(42, 34, 20, 0.3); }
.btn.red { background: var(--red); border-color: var(--red-deep); }
.btn.ghost {
  background: transparent; color: var(--ink); box-shadow: none;
  border: 1px solid var(--rule);
}
.btn.ghost:hover { background: rgba(42, 34, 20, 0.06); transform: none; }
.btn.tiny { font-size: 0.68rem; padding: 0.3rem 0.8rem 0.22rem; }

.actions { display: flex; gap: 0.8rem; align-items: center; margin-top: 1.4rem; flex-wrap: wrap; }

/* ── letter detail: the proof sheet ── */

.proof {
  background: #fbf7ea;
  border: 1px solid var(--rule);
  box-shadow: 4px 5px 0 rgba(42, 34, 20, 0.18);
  padding: 2.4rem 2.8rem;
  max-width: 640px;
  position: relative;
}
.proof .to-line { font-variant: small-caps; letter-spacing: 0.18em; font-size: 0.75rem; color: var(--faded); margin-bottom: 1.4rem; }
.proof h3 { font-size: 1.5rem; margin: 0 0 1.1rem; }
.proof .body-text { font-family: var(--type); font-size: 0.92rem; line-height: 1.95; white-space: pre-wrap; }
.proof .sig { margin-top: 1.6rem; font-style: italic; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.5; }
.proof .stamp-corner { position: absolute; top: 1.1rem; right: 1.2rem; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 2.2rem; align-items: start; }
.detail-side { border-left: 1px solid var(--rule); padding-left: 1.6rem; font-size: 0.85rem; }
.detail-side dt { font-variant: small-caps; letter-spacing: 0.2em; font-size: 0.66rem; color: var(--faded); margin-top: 0.8rem; }
.detail-side dd { margin: 0.1rem 0 0; }
.detail-side dl { margin: 0 0 1.2rem; }

.status-form select { width: 100%; margin-bottom: 0.5rem; }
.status-form input { width: 100%; margin-bottom: 0.5rem; }

/* ── directory ── */

.directory {
  column-count: 2;
  column-gap: 2.4rem;
  column-rule: 1px solid rgba(42, 34, 20, 0.35);
}
.paper-card {
  break-inside: avoid;
  border-bottom: 1px solid rgba(42, 34, 20, 0.35);
  padding: 0.9rem 0.2rem 1rem;
}
.paper-card h3 { margin: 0; font-size: 1.15rem; }
.paper-card h3 a { color: var(--ink); text-decoration: none; }
.paper-card h3 a:hover { color: var(--red-deep); }
.paper-card .meta {
  font-variant: small-caps; letter-spacing: 0.14em;
  font-size: 0.72rem; color: var(--faded); margin: 0.1rem 0 0.35rem;
}
.paper-card .limit-chip {
  display: inline-block;
  font-size: 0.7rem; font-weight: 700;
  border: 1px solid var(--rule);
  padding: 0.05rem 0.5rem;
  background: rgba(255, 252, 243, 0.7);
  letter-spacing: 0.08em;
}
.paper-card .email { font-family: var(--type); font-size: 0.78rem; }
.paper-card .notes { font-size: 0.82rem; color: var(--ink-soft); font-style: italic; margin: 0.35rem 0 0.5rem; }
.paper-card .card-actions { display: flex; gap: 0.6rem; align-items: baseline; font-size: 0.75rem; }

.empty {
  text-align: center; padding: 3rem 1rem; font-style: italic; color: var(--faded);
}
.empty .big { font-size: 2.6rem; display: block; margin-bottom: 0.4rem; font-style: normal; }

/* ── boilerplate plates ── */

.plate {
  border: 1px solid var(--rule);
  background: rgba(255, 252, 243, 0.55);
  box-shadow: 3px 4px 0 rgba(42, 34, 20, 0.15);
  padding: 1.2rem 1.5rem 1rem;
  margin-bottom: 1.6rem;
}
.plate-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem;
  border-bottom: 3px double var(--rule);
  padding-bottom: 0.7rem; margin-bottom: 0.9rem;
}
.plate-head h3 { margin: 0.05rem 0 0.2rem; font-size: 1.3rem; }
.plate-meta { font-variant: small-caps; letter-spacing: 0.14em; font-size: 0.7rem; color: var(--faded); }
.plate-body {
  font-family: var(--type);
  font-size: 0.85rem;
  line-height: 1.8;
  white-space: pre-wrap;
  max-height: 16rem;
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(#000 78%, transparent);
  mask-image: linear-gradient(#000 78%, transparent);
}
.plate-notes {
  font-size: 0.78rem; font-style: italic; color: var(--ink-soft);
  border-top: 1px dotted rgba(42, 34, 20, 0.4);
  padding-top: 0.5rem; margin: 0.6rem 0 0.4rem;
}
.plate .card-actions { margin-top: 0.3rem; }

/* ── composing room (slot pickers) ── */

.slot-mark {
  background: rgba(158, 43, 28, 0.12);
  color: inherit;
  border-bottom: 1px dashed var(--red);
  padding: 0 0.15em;
}

.compose-flow {
  font-family: var(--type);
  font-size: 0.92rem;
  line-height: 2.05;
  white-space: pre-wrap;
  background: rgba(255, 252, 243, 0.75);
  border: 1px solid var(--rule);
  padding: 1.4rem 1.6rem;
}
.slot-select {
  font-family: var(--type);
  font-size: 0.88rem;
  color: var(--red-deep);
  background: rgba(158, 43, 28, 0.07);
  border: none;
  border-bottom: 2px dashed var(--red);
  padding: 0 0.2rem;
  max-width: 100%;
  cursor: pointer;
}
.slot-select:focus { outline: 1px solid var(--red); }

.slot-block {
  border: 1px dashed var(--red);
  background: rgba(158, 43, 28, 0.04);
  margin: 0.5rem 0;
  padding: 0.6rem;
  white-space: normal;
  display: block;
}
.slot-block::before {
  content: "pick one";
  display: block;
  font-variant: small-caps;
  letter-spacing: 0.24em;
  font-size: 0.62rem;
  color: var(--red-deep);
  margin: 0 0 0.35rem 0.2rem;
}
.slot-opt {
  display: flex; gap: 0.65rem; align-items: flex-start;
  margin: 0.35rem 0 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(42, 34, 20, 0.3);
  background: rgba(255, 252, 243, 0.65);
  font-size: 0.85rem;
  line-height: 1.7;
  cursor: pointer;
}
.slot-opt:first-of-type { margin-top: 0; }
.slot-opt:hover { border-color: var(--red); }
.slot-opt input {
  accent-color: var(--red);
  flex-shrink: 0;
  margin-top: 0.35rem;
  width: 1rem; height: 1rem;
}
.slot-opt span { color: var(--faded); }
.slot-opt:has(input:checked) {
  border: 2px solid var(--red);
  background: rgba(158, 43, 28, 0.08);
  padding: calc(0.55rem - 1px) calc(0.7rem - 1px);
}
.slot-opt:has(input:checked) span { color: var(--ink); }

/* ── clipping watcher ── */

.check-note.claim-error {
  border: 1px solid var(--red);
  background: rgba(158, 43, 28, 0.08);
  color: var(--red-deep);
  font-style: normal;
  font-weight: 700;
}

.check-note {
  border: 1px dashed var(--rule);
  background: rgba(255, 252, 243, 0.7);
  padding: 0.5rem 0.8rem;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 1rem;
}

.sweep-bar { display: flex; align-items: baseline; gap: 0.8rem; margin: -0.6rem 0 1rem; }
.sweep-hint { font-size: 0.72rem; font-style: italic; color: var(--faded); }

.clip-flag { color: var(--red-deep); font-weight: 700; text-decoration: none; }
.clip-flag:hover { text-decoration: underline; }

.clipping-desk {
  border: 1px solid var(--red);
  background: rgba(158, 43, 28, 0.05);
  padding: 0.8rem 1rem 0.9rem;
  margin: 1rem 0;
}
.clipping-desk h4 {
  font-variant: small-caps; letter-spacing: 0.24em; font-size: 0.7rem;
  color: var(--red-deep); margin: 0 0 0.5rem;
}
.clipping { border-top: 1px dotted rgba(42, 34, 20, 0.4); padding: 0.55rem 0 0.2rem; }
.clipping:first-of-type { border-top: 0; padding-top: 0; }
.clipping a { font-weight: 700; font-size: 0.85rem; }
.clipping .snip { font-size: 0.75rem; color: var(--ink-soft); margin: 0.2rem 0; font-style: italic; }
.clipping .when { font-size: 0.68rem; color: var(--faded); font-variant: small-caps; letter-spacing: 0.12em; }
.clip-actions { display: flex; gap: 0.5rem; margin: 0.4rem 0 0.3rem; }

/* ── colophon ── */

.colophon {
  margin-top: 3rem;
  border-top: 3px double var(--rule);
  padding: 0.5rem 0.2rem 0;
  display: flex; justify-content: space-between; gap: 2rem;
  font-size: 0.68rem; font-style: italic; color: var(--faded);
}

.inline { display: inline; }

@media (max-width: 820px) {
  .sheet { padding: 0 1rem; }
  .ears { display: none; }
  .editor-grid, .detail-grid { grid-template-columns: 1fr; }
  .editor-side, .detail-side { border-left: 0; padding-left: 0; }
  .directory { column-count: 1; }
  .ledger { grid-template-columns: repeat(2, 1fr); }
  .ledger > div:nth-child(2) { border-right: 0; }
  .four-col { grid-template-columns: 1fr 1fr; }
}
