/* qso.no – jukselapp. Logbook paper, ink, one stamp-red accent. */

:root {
  --paper: #edf0ea;
  --paper-2: #e2e7df;
  --ink: #11212b;
  --ink-2: #41535d;
  --rule: #c3cdc6;
  --rule-2: #a9b6ae;
  --red: #b5222e;
  --teal: #0e5b59;
  --teal-2: #cfe2df;
  --hit: #f2e38f;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Barlow", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1a1f;
    --paper-2: #16242b;
    --ink: #dbe3df;
    --ink-2: #93a3a9;
    --rule: #2b3b43;
    --rule-2: #3a4d56;
    --red: #e4555f;
    --teal: #45b3ad;
    --teal-2: #163c3c;
    --hit: #5b4f12;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.5;
}

a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.wrap { max-width: 72rem; margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mute { color: var(--ink-2); }

/* ---------- Hero ---------- */
.hero { padding: 28px 0 8px; }
.hero-top {
  display: flex; flex-wrap: wrap; gap: 16px 40px;
  align-items: flex-end; justify-content: space-between;
}
.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(4.5rem, 12vw, 8.5rem);
  line-height: 0.85;
  letter-spacing: -0.02em;
}
.wordmark span { color: var(--red); }
.tagline {
  margin: 14px 0 0;
  max-width: 34rem;
  font-size: 1.25rem;
  color: var(--ink-2);
}
.clock {
  font-family: var(--font-mono);
  text-align: right;
  line-height: 1.2;
}
.clock-utc { font-size: 2.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.clock small, .clock-local { font-size: 0.9rem; color: var(--ink-2); font-weight: 400; }
.clock-local { margin-top: 4px; font-variant-numeric: tabular-nums; }

.ruler { margin: 28px 0 0; }
.ruler svg { width: 100%; height: auto; display: block; overflow: visible; }
.ruler figcaption { font-size: 0.9rem; color: var(--ink-2); margin-top: 8px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin: 0 2px 0 10px; }
.sw-full { background: var(--teal); }
.sw-beg { background: var(--red); }
.sw-sek { background: var(--teal); opacity: 0.4; }

/* ruler svg parts */
.rl-axis { stroke: var(--rule-2); stroke-width: 1; }
.rl-tick { stroke: var(--rule-2); stroke-width: 1; }
.rl-tick-lbl { font-family: var(--font-mono); font-size: 11px; fill: var(--ink-2); }
.rl-band { fill: var(--teal); cursor: pointer; }
.rl-band.beg { fill: var(--red); }
.rl-band.sek { opacity: 0.4; }
.rl-band:hover, .rl-band.on { opacity: 1; filter: brightness(1.15); }
.rl-lbl { font-family: var(--font-display); font-weight: 600; font-size: 15px; fill: var(--ink); pointer-events: none; }
.rl-leader { stroke: var(--rule-2); stroke-width: 1; }
.rl-info { font-family: var(--font-mono); font-size: 12px; fill: var(--ink); }

/* ---------- Sticky bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--paper);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-top: 16px;
}
.bar-in { display: flex; align-items: center; gap: 12px; padding-top: 8px; padding-bottom: 8px; }
.toc {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 2px; overflow-x: auto; flex: 1 1 auto;
  scrollbar-width: none;
}
.toc::-webkit-scrollbar { display: none; }
.toc a {
  display: block; padding: 6px 10px; border-radius: 4px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.toc a:hover { background: var(--paper-2); color: var(--ink); }
.toc a.on { color: var(--red); }
.search { flex: 0 0 auto; }
.search input {
  width: 16rem; max-width: 45vw;
  padding: 7px 10px;
  border: 1px solid var(--rule-2); border-radius: 4px;
  background: var(--paper-2); color: var(--ink);
  font: inherit; font-size: 0.95rem;
}
.search input:focus { border-color: var(--teal); }

/* ---------- Sections ---------- */
main { padding-bottom: 40px; }
.sec { padding: 44px 0 12px; border-bottom: 1px solid var(--rule); scroll-margin-top: 64px; }
.sec:last-of-type { border-bottom: 0; }
.sec h2 {
  margin: 0 0 12px;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1; letter-spacing: -0.01em;
}
.sec h3 {
  margin: 20px 0 8px;
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.4rem; line-height: 1.1;
}
.lead { max-width: 64ch; margin: 0 0 20px; font-size: 1.0625rem; }
.note { max-width: 64ch; margin: 14px 0 0; font-size: 0.95rem; color: var(--ink-2); }
.empty { padding: 32px 0; font-size: 1.1rem; color: var(--ink-2); }

.cols { display: grid; gap: 0 40px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 760px) { .cols { grid-template-columns: 1fr 1fr; } .cols-3 { grid-template-columns: 1fr 1fr 1fr; } }

/* ---------- Tables, ruled like a logbook ---------- */
.k { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }
.t { width: 100%; border-collapse: collapse; margin: 0 0 16px; }
.t th {
  text-align: left; padding: 6px 10px 6px 0;
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
  color: var(--ink-2); border-bottom: 2px solid var(--rule-2);
}
.t td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.t-dense td { padding-top: 4px; padding-bottom: 4px; }
.t td.k { color: var(--teal); }
.t tr.beg td.k:first-child { color: var(--red); }
.t tr.hit td { background: var(--hit); }
.scroll { overflow-x: auto; }
.t-band { min-width: 48rem; }
.t-band td:nth-child(2) { font-weight: 400; }
.t-band tr.grp th {
  padding: 18px 10px 4px 0; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.04em; color: var(--ink-2);
  border-bottom: 1px solid var(--rule-2);
}
.t-band tbody tr.grp:first-child th { padding-top: 8px; }
body.searching .t tr.grp { display: none; }
.st { font-size: 0.85rem; white-space: nowrap; }
.st.sek { color: var(--ink-2); }

.more { margin: 4px 0 8px; }
.more summary { cursor: pointer; font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; padding: 6px 0; }
.more[open] summary { color: var(--red); }

/* ---------- QSO script ---------- */
.script { border-top: 2px solid var(--rule-2); margin-bottom: 8px; }
.turn { display: grid; grid-template-columns: 1fr; gap: 2px 24px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
@media (min-width: 760px) { .turn { grid-template-columns: 11rem 1fr; } }
.who { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; color: var(--red); padding-top: 2px; }
.say { margin: 0; grid-column: 2; }
@media (max-width: 759px) { .say { grid-column: 1; } }
.say b { font-weight: 600; color: var(--teal); }
.say.en { color: var(--ink-2); font-size: 0.95rem; margin-top: 4px; }
.cw-script {
  margin: 0; padding: 14px 16px;
  background: var(--paper-2); border-left: 3px solid var(--teal);
  font-family: var(--font-mono); font-size: 0.9rem; line-height: 1.5;
  overflow-x: auto; white-space: pre;
}
.tips { margin: 0; padding-left: 1.1rem; }
.tips li { margin-bottom: 8px; }

/* ---------- Morse grid ---------- */
.morse {
  display: grid; gap: 6px 20px;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  margin-bottom: 12px;
}
.morse > div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--rule); }
.morse .k { color: var(--teal); }
.morse .m { font-family: var(--font-mono); font-size: 1.1rem; letter-spacing: 0.08em; }
.morse > div.hit { background: var(--hit); }

/* ---------- Links ---------- */
.links { list-style: none; padding: 0; margin: 0 0 12px; max-width: 64ch; }
.links li { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.links a { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; margin-right: 8px; text-decoration: none; }
.links a:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
.foot { border-top: 2px solid var(--rule-2); padding: 24px 0 40px; font-size: 0.95rem; color: var(--ink-2); }
.foot p { max-width: 64ch; margin: 0 0 8px; }
.foot .mute { font-family: var(--font-mono); font-size: 1.5rem; color: var(--red); }

/* ---------- Search state ---------- */
[hidden] { display: none !important; }
body.searching .lead, body.searching .note, body.searching .script, body.searching .tips,
body.searching .cw-script, body.searching .sec h3, body.searching .links, body.searching #logg .cols > div:last-child { display: none; }
body.searching .more { display: block; }
body.searching .more summary { display: none; }
body.searching .more > table { display: table; }

@media (max-width: 600px) {
  .hero { padding-top: 20px; }
  .clock { text-align: left; }
  .clock-utc { font-size: 1.6rem; }
  .search input { width: 10rem; }
  body { font-size: 1rem; }
}

@media print {
  .bar, .clock, .foot .mute { display: none; }
  .sec { break-inside: avoid; }
  body { font-size: 10pt; }
}
