/* crossword.fjordbench.com */
@font-face { font-family: "Libre Franklin"; src: url("/fonts/franklin-regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Libre Franklin"; src: url("/fonts/franklin-semibold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("/fonts/serif-semibold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("/fonts/serif-italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --ground: #f2f3f0;
  --field: #ffffff;
  --ink: #161b1a;
  --muted: #4f5855;
  --line: #ccd2cf;
  --line-strong: #8d9792;
  --accent: #8e2a1c;          /* Falu red */
  --accent-hover: #6f1f13;
  --on-accent: #fff4f0;
  --link: #8e2a1c;
  --focus: #0b57d0;
  --paper: #ffffff;           /* the preview sheet stays paper-white in both schemes */
  --paper-ink: #161b1a;
  --paper-muted: #5e6663;
  --paper-line: #d7dcd9;
  --sans: "Libre Franklin", "Franklin Gothic Medium", "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #121716;
    --field: #1b2321;
    --ink: #e6eae8;
    --muted: #a7b1ad;
    --line: #2f3a37;
    --line-strong: #63706b;
    --link: #f0a08f;
    --focus: #8ab4f8;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--sans);
  overflow-wrap: break-word;
}
a { color: var(--link); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2 { font-family: var(--serif); font-weight: 600; text-wrap: balance; letter-spacing: -.01em; margin: 0; }
h1 { font-size: clamp(2.25rem, 1.3rem + 3.8vw, 4.1rem); line-height: 1.02; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); line-height: 1.15; }
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 .4rem; }
p { text-wrap: pretty; margin: 0 0 1rem; }
.fine { font-size: .9375rem; color: var(--muted); }
.vh, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -80px; background: var(--ink); color: var(--ground); padding: 10px 14px; z-index: 10; }
.skip:focus { top: 10px; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.mark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1.125rem; min-height: 44px; }
.mark-sq {
  width: 20px; height: 20px; border: 2px solid var(--ink); background:
    linear-gradient(var(--ink), var(--ink)) center / 2px 100% no-repeat,
    linear-gradient(var(--ink), var(--ink)) center / 100% 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) right bottom / 50% 50% no-repeat,
    var(--paper);
}
.by { font-size: .9375rem; color: var(--muted); }

/* hero */
.hero { display: grid; gap: 28px; padding-top: 28px; padding-bottom: 44px; }
.pitch { max-width: 36rem; }
.lede { font-size: clamp(1.125rem, 1rem + .45vw, 1.3125rem); margin-top: 1.1rem; }
.price { font-size: 1.0625rem; }
.price strong { font-family: var(--serif); font-size: 1.6em; font-weight: 600; margin-right: .1em; }
.sample { margin: 0; justify-self: center; max-width: 420px; width: 74%; }
.sample img {
  display: block; width: 100%; height: auto; background: #fff;
  border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(20, 27, 26, .08), 0 10px 28px rgba(20, 27, 26, .10);
}
.sample figcaption { font-size: .9375rem; color: var(--muted); margin-top: 12px; }
@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: center; gap: 56px; padding-top: 40px; padding-bottom: 72px; }
  .sample { width: 100%; justify-self: end; }
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 6px; border: 1.5px solid var(--line-strong);
  background: transparent; color: var(--ink); font: 600 1.0625rem/1.2 var(--sans);
  text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.quiet { border: 0; padding: 0; min-height: 44px; color: var(--muted); text-decoration: underline; text-underline-offset: .15em; font-weight: 400; }
.btn.quiet:hover { color: var(--ink); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* maker */
.maker { display: grid; gap: 36px; padding-top: 36px; padding-bottom: 56px; border-top: 3px solid var(--ink); }
.jump { display: inline-block; margin-top: 4px; min-height: 44px; padding: 10px 0; }
@media (min-width: 1000px) {
  .maker { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: start; }
  /* the preview follows the words as you type; its buttons sit on top so they stay in view */
  .preview { position: sticky; top: 16px; display: flex; flex-direction: column; }
  .preview .actions { order: -1; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin: 0 0 14px; }
  .preview .actions #buy, .preview .actions .fine { grid-column: 1 / -1; }
  .preview .grid svg { max-height: 56vh; }
  .jump { display: none; }
}
.hint { color: var(--muted); margin-top: .6rem; }
.field { margin-bottom: 14px; }
.field label, .paste label { display: block; font-weight: 600; margin-bottom: 4px; }
.opt { font-weight: 400; color: var(--muted); }
input[type="text"], input:not([type]), input[type="email"], textarea {
  width: 100%; min-height: 46px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 4px;
  background: var(--field); color: var(--ink); font: 400 1.0625rem/1.4 var(--sans);
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }

.rows-head { display: none; }
.rows { list-style: none; margin: 8px 0 0; padding: 0; }
.row {
  display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) 44px;
  grid-template-areas: "n a x" ". c c" ". m m"; gap: 6px 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.row-n { grid-area: n; color: var(--muted); font-size: .9375rem; text-align: right; font-variant-numeric: tabular-nums; }
.row .answer { grid-area: a; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.row .answer::placeholder { text-transform: none; letter-spacing: 0; font-weight: 400; }
.row .clue { grid-area: c; }
.remove { grid-area: x; width: 44px; height: 44px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.remove:hover { color: var(--accent); background: var(--field); }
.row-msg { grid-area: m; margin: 0; font-size: .9375rem; color: var(--link); }
.row-msg:empty { display: none; }
@media (min-width: 560px) {
  .rows-head { display: grid; grid-template-columns: 1.6rem minmax(0, 11rem) minmax(0, 1fr) 44px; gap: 8px; margin-top: 18px; font-size: .9375rem; color: var(--muted); }
  .rows-head span:first-child { grid-column: 2; }
  .row { grid-template-columns: 1.6rem minmax(0, 11rem) minmax(0, 1fr) 44px; grid-template-areas: "n a c x" ". m m m"; }
}
.row-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.count { color: var(--muted); font-size: .9375rem; margin-left: auto; }
.paste { margin-top: 18px; }
.paste summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.paste label { font-weight: 400; color: var(--muted); }
.paste .btn { margin-top: 10px; }
.options { border: 0; margin: 22px 0 6px; padding: 0; min-width: 0; }
.options legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
.check.small { font-size: .9375rem; min-height: 40px; }
.paper { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; }
.paper > span { font-weight: 600; }

/* preview sheet */
.sheet { color-scheme: light; background: var(--paper); color: var(--paper-ink); border: 1px solid var(--paper-line); border-radius: 4px; padding: 16px; }
@media (min-width: 720px) { .sheet { padding: 22px 24px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sheet-head h2 { font-size: 1.375rem; }
.status { font-size: .9375rem; color: var(--paper-muted); margin: 6px 0 14px; }
.grid svg { display: block; width: 100%; height: auto; max-height: 68vh; margin: 0 auto; }
.grid .sq { fill: #fff; stroke: var(--paper-ink); stroke-width: .38; }
.grid .n { font-family: var(--sans); font-weight: 600; font-size: 2.9px; fill: var(--paper-ink); }
.grid .l { font-family: var(--sans); font-size: 6.2px; text-anchor: middle; fill: var(--paper-ink); }
.grid .wm { font-family: var(--sans); font-weight: 600; fill: var(--paper-ink); fill-opacity: .07; text-anchor: middle; dominant-baseline: middle; letter-spacing: .06em; pointer-events: none; }
.grid-empty { aspect-ratio: 3 / 2; border: 1.5px dashed var(--paper-line); border-radius: 4px; }
.clues { display: grid; gap: 4px 24px; margin-top: 18px; font-size: .9375rem; line-height: 1.4; }
@media (min-width: 560px) { .clues { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.clues ol { list-style: none; margin: 0 0 12px; padding: 0; }
.clues li { display: grid; grid-template-columns: 1.9rem minmax(0, 1fr); margin-bottom: 4px; }
.clues .num { font-weight: 600; text-align: right; padding-right: 8px; font-variant-numeric: tabular-nums; }
.clues .en { color: var(--paper-muted); }
.clues .ans { font-weight: 600; letter-spacing: .04em; color: #8e2a1c; }
.clues .missing { color: var(--paper-muted); }
.actions { display: grid; gap: 10px; margin-top: 16px; }
.actions .fine { margin: 4px 0 0; }

/* small print */
.small-print { border-top: 3px solid var(--ink); padding-top: 36px; padding-bottom: 48px; }
.small-print dl { display: grid; gap: 22px 48px; margin: 22px 0 0; }
@media (min-width: 800px) { .small-print dl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.small-print dt { font-weight: 600; }
.small-print dd { margin: 4px 0 0; max-width: 34rem; }

.foot { border-top: 1px solid var(--line); padding-top: 22px; padding-bottom: 40px; font-size: .9375rem; color: var(--muted); }
.foot p { margin-bottom: 6px; }

/* notify dialog */
dialog {
  width: calc(100% - 32px); max-width: 460px; border: 1px solid var(--line); border-radius: 8px;
  padding: 24px; background: var(--ground); color: var(--ink);
}
dialog::backdrop { background: rgba(10, 14, 13, .5); }
dialog h2 { font-size: 1.5rem; margin-bottom: .6rem; }
dialog label { display: block; font-weight: 600; margin-bottom: 4px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

@media print {
  body * { visibility: hidden; }
  body::before { content: "For a print-ready puzzle, use the PDF buttons on crossword.fjordbench.com."; visibility: visible; font: 14pt var(--sans); }
}
