/* The Dev's Desk — Dispute Letter Writer
   Look: paperwork on a desk. Paper white, blotter green-grey, ink black,
   ballpoint blue for Dev's handwritten notes, mustard (Dev's mug) for actions only. */

@font-face { font-family: "Newsreader"; src: url("/fonts/newsreader-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("/fonts/source-serif-4-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("/fonts/public-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("/fonts/public-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("/fonts/public-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("/fonts/caveat-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --paper: #ffffff;
  --desk: #eef0ec;
  --desk-line: #d6dad3;
  --ink: #1d1f24;
  --ink-soft: #4e535c;
  --ballpoint: #2443a8;
  --mustard: #e9ae27;
  --mustard-deep: #c98f12;
  --stamp: #b5302a;
  --display: "Newsreader", Georgia, serif;
  --letter: "Source Serif 4", Georgia, "Times New Roman", serif;
  --ui: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--ui); font-size: 1rem; line-height: 1.55; }
a { color: var(--ballpoint); text-underline-offset: 3px; }
img, svg { display: block; }
:focus-visible { outline: 3px solid var(--ballpoint); outline-offset: 3px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 680px; }

/* Header */
.site-header { padding: 22px 0; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em; }
.brand svg { width: 30px; height: 30px; }
.header-link { font-size: .95rem; font-weight: 600; color: var(--ink); }

/* Hero */
.hero { padding: 24px 0 64px; overflow-x: clip; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.hero h1 { font-family: var(--display); font-weight: 500; font-size: clamp(2.3rem, 5.2vw, 3.9rem); line-height: 1.02; letter-spacing: -0.025em; margin: 0 0 22px; font-variation-settings: "opsz" 72; }
.hero .lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 34em; margin: 0 0 28px; }
.hero .lede strong { color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
.hero-actions .small { font-size: .92rem; color: var(--ink-soft); }

/* The sample letter on the desk: the one bold thing on the page */
.desk { position: relative; background: var(--desk); border-radius: 6px; padding: 38px 30px 34px; }
.sheet { position: relative; background: var(--paper); padding: 30px 30px 34px; box-shadow: 0 1px 1px rgba(29,31,36,.06), 0 10px 24px -12px rgba(29,31,36,.28); transform: rotate(-1.4deg); font-family: var(--letter); font-size: .86rem; line-height: 1.5; }
.sheet p { margin: 0 0 9px; max-width: 60%; }
.sheet .from { color: var(--ink-soft); }
.sheet .re { font-weight: 650; position: relative; display: inline-block; }
.sheet .ask { position: relative; display: inline-block; }
.sheet .sample-tag { position: absolute; top: 12px; right: 14px; font-family: var(--ui); font-size: .7rem; font-weight: 600; color: var(--ink-soft); border: 1px solid var(--desk-line); border-radius: 3px; padding: 1px 6px; transform: rotate(1.4deg); }
.scribble { position: absolute; pointer-events: none; color: var(--ballpoint); }
.underline { left: -2px; right: -4px; bottom: -6px; height: 8px; width: calc(100% + 6px); }
.circle { left: -12px; top: -12px; width: calc(100% + 22px); height: calc(100% + 18px); }
.has-note { position: relative; }
.note { position: absolute; left: calc(100% + 36px); top: -4px; width: 6.6em; font-family: var(--hand); font-weight: 600; color: var(--ballpoint); font-size: 1.22rem; line-height: 1.02; transform: rotate(-3deg); }
.note svg { position: absolute; left: -42px; top: 6px; width: 38px; height: 22px; color: var(--ballpoint); }
.note-2 { top: 2px; transform: rotate(2deg); }
.mug { position: absolute; width: 74px; height: 80px; right: -14px; top: -26px; transform: rotate(8deg); }
.ring { position: absolute; right: 26px; bottom: -34px; width: 92px; height: 92px; border-radius: 50%; border: 5px solid rgba(150, 102, 35, .13); border-left-color: rgba(150, 102, 35, .05); transform: rotate(20deg); pointer-events: none; }

/* Dev's note */
.devnote { padding: 0 0 72px; }
.devnote .wrap { display: grid; grid-template-columns: 1fr 2fr; gap: 56px; }
.devnote h2 { font-family: var(--display); font-weight: 500; font-size: 1.6rem; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
.devnote p { margin: 0 0 14px; font-size: 1.08rem; max-width: 36em; }
.devnote .sign { font-family: var(--hand); font-weight: 600; font-size: 1.9rem; color: var(--ballpoint); margin-top: 4px; line-height: 1; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 1rem; padding: 14px 22px; border-radius: 6px; border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--desk); }
.btn.primary { background: var(--mustard); border-color: var(--mustard-deep); box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.btn.primary:hover { background: #f0b937; }
.btn.primary:active { box-shadow: none; transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.wide { width: 100%; }
.btn.link { border: 0; background: none; padding: 10px 0; color: var(--ballpoint); text-decoration: underline; font-weight: 600; }
.btn svg { width: 18px; height: 18px; }

/* Form section on the desk colour */
.workspace { background: var(--desk); padding: 64px 0 72px; }
.workspace h2 { font-family: var(--display); font-weight: 500; font-size: clamp(1.8rem, 3.6vw, 2.4rem); line-height: 1.1; letter-spacing: -0.015em; margin: 0 0 8px; }
.workspace .intro { color: var(--ink-soft); margin: 0 0 30px; max-width: 38em; }

fieldset { border: 0; padding: 0; margin: 0 0 26px; min-width: 0; }
legend { font-weight: 700; margin-bottom: 12px; padding: 0; }
.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.type-grid input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; margin: 0; }
.type-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 14px 12px; background: var(--paper); border: 1.5px solid var(--desk-line); border-radius: 4px; cursor: pointer; margin: 0; font-weight: 700; line-height: 1.25; }
.type-card svg { width: 26px; height: 26px; color: var(--ink-soft); }
.type-card small { color: var(--ink-soft); font-weight: 400; font-size: .86rem; }
.type-grid input:checked + .type-card { border-color: var(--ink); box-shadow: inset 0 -4px 0 var(--mustard); }
.type-grid input:checked + .type-card svg { color: var(--ink); }
.type-grid input:focus-visible + .type-card { outline: 3px solid var(--ballpoint); outline-offset: 2px; }

.form-group { border-top: 1px solid var(--desk-line); padding-top: 22px; margin-top: 4px; }
label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 16px; }
label em { color: var(--stamp); font-style: normal; }
label small { font-weight: 400; color: var(--ink-soft); }
input, select, textarea { display: block; width: 100%; margin-top: 6px; padding: 12px 12px; font: inherit; font-weight: 400; color: var(--ink); background: var(--paper); border: 1.5px solid #c4c9c1; border-radius: 4px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ballpoint); box-shadow: 0 0 0 3px rgba(36, 67, 168, .15); }
textarea { resize: vertical; min-height: 130px; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.row.two .full { grid-column: 1 / -1; }
.hint { display: block; font-weight: 400; color: var(--ink-soft); font-size: .82rem; margin-top: 5px; }
label[hidden] { display: none; }
.counter { display: block; text-align: right; font-weight: 400; color: var(--ink-soft); font-size: .8rem; margin-top: 4px; }
.fine { font-size: .88rem; color: var(--ink-soft); margin: 12px 0 0; }
.submit-row { margin-top: 8px; }

.error { background: #fbeceb; color: var(--stamp); border-left: 4px solid var(--stamp); border-radius: 2px; padding: 12px 14px; font-weight: 600; margin: 0 0 16px; }
.error ul { margin: 8px 0 0; padding-left: 20px; font-weight: 500; color: #7d211d; }

/* Letter paper (preview + result) */
.paper { position: relative; background: var(--paper); padding: 36px 40px 40px; margin: 22px 0; box-shadow: 0 1px 1px rgba(29,31,36,.06), 0 14px 30px -18px rgba(29,31,36,.35); overflow: hidden; }
.paper pre { white-space: pre-wrap; word-wrap: break-word; font-family: var(--letter); font-size: 1.02rem; line-height: 1.6; margin: 0; }
.locked { filter: blur(5px); user-select: none; pointer-events: none; max-height: 240px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.lock-note { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%) rotate(-2deg); background: var(--paper); border: 1.5px solid var(--ink); padding: 6px 14px; font-weight: 700; font-size: .9rem; white-space: nowrap; }
.preview-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.pay-box { display: grid; gap: 4px; }

/* Result page */
.result { padding: 8px 0 72px; }
.result h1 { font-family: var(--display); font-weight: 500; font-size: clamp(2rem, 4.5vw, 2.8rem); line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 10px; }
.result .lede { color: var(--ink-soft); font-size: 1.08rem; margin: 0 0 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.notice { background: #fff7e0; border: 1.5px solid var(--mustard); border-radius: 4px; padding: 14px 16px; margin: 0 0 22px; }
.notice small { display: block; margin-top: 6px; color: var(--ink-soft); }
.tips { border-top: 1px solid var(--desk-line); padding-top: 22px; }
.tips h2 { font-family: var(--display); font-weight: 500; font-size: 1.5rem; margin: 0 0 10px; }
.tips ul { margin: 0; padding-left: 20px; }
.tips li { margin-bottom: 6px; }
.loading { color: var(--ink-soft); font-weight: 600; }

/* FAQ */
.faq { padding: 64px 0 40px; }
.faq h2 { font-family: var(--display); font-weight: 500; font-size: 1.9rem; margin: 0 0 14px; letter-spacing: -0.01em; }
.faq details { border-top: 1px solid var(--desk-line); padding: 16px 0; }
.faq details:last-of-type { border-bottom: 1px solid var(--desk-line); }
.faq summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 400; font-size: 1.3rem; line-height: 1; color: var(--ink-soft); }
.faq details[open] summary::after { content: "\2212"; }
.faq p { margin: 10px 0 0; color: var(--ink-soft); max-width: 40em; }

/* Terms */
.prose { padding: 8px 0 64px; }
.prose h1 { font-family: var(--display); font-weight: 500; font-size: 2.4rem; letter-spacing: -0.02em; margin: 0 0 6px; }
.prose h2 { font-family: var(--display); font-weight: 600; font-size: 1.3rem; margin: 30px 0 8px; }
.prose p, .prose li { color: var(--ink); max-width: 40em; }

/* Footer */
.site-footer { border-top: 1px solid var(--desk-line); padding: 26px 0 40px; color: var(--ink-soft); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; }
.site-footer p { margin: 0; }
.site-footer nav { display: flex; gap: 20px; }

/* Phones */
@media (max-width: 860px) {
  .hero .wrap, .devnote .wrap { grid-template-columns: 1fr; gap: 34px; }
  .hero { padding-bottom: 48px; }
  .devnote { padding-bottom: 56px; }
  .devnote .wrap { gap: 12px; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .site-header { padding: 16px 0; }
  .header-link { display: none; }
  .desk { padding: 26px 14px 22px; margin: 0 -4px; }
  .sheet { padding: 22px 18px 26px; font-size: .74rem; }
  .sheet p { max-width: 60%; }
  .note { font-size: .98rem; width: 6.2em; left: calc(100% + 28px); }
  .note svg { left: -32px; width: 30px; }
  .mug { width: 56px; height: 62px; right: -6px; top: -22px; }
  .type-grid { grid-template-columns: 1fr 1fr; }
  .row.two { grid-template-columns: 1fr; }
  .workspace { padding: 48px 0 56px; }
  .paper { padding: 24px 20px 28px; margin: 18px -4px; }
  .paper pre { font-size: .95rem; }
  .actions .btn { flex: 1 1 calc(50% - 10px); }
  .actions .btn.primary { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media print {
  .site-header, .site-footer, .actions, .tips, .lede, .notice, .result h1 { display: none !important; }
  body, .paper { background: #fff; box-shadow: none; padding: 0; margin: 0; }
}
