@font-face { font-family: 'Fell'; src: url(/fonts/im-fell-english-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Fell'; font-style: italic; src: url(/fonts/im-fell-english-latin-400-italic.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url(/fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Plex Mono'; font-weight: 600; src: url(/fonts/ibm-plex-mono-latin-600-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Plex Mono'; font-style: italic; src: url(/fonts/ibm-plex-mono-latin-400-italic.woff2) format('woff2'); font-display: swap; }

:root {
  --water: #D5E8E3; --shoal: #A9D3D8; --land: #EFD9A0; --ink: #13284A; --sound: #3B5767; --grat: #7C9BAA;
  --mag: #A3134F; --mag-d: #85103F; --buoy: #F2B701; --wreck: #B8341B; --paper: #F7F3E6; --line: #13284A33;
  --fell: 'Fell', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --mono: 'Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --pad: clamp(16px, 4vw, 40px);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--water); color: var(--ink); font: 15px/1.6 var(--mono); min-height: 100vh; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--mag); }
h1, h2, h3, .fell { font-family: var(--fell); font-weight: 400; letter-spacing: 0; line-height: 1.1; margin: 0; }
h1 { font-size: clamp(38px, 7vw, 68px); }
h2 { font-size: clamp(28px, 4.4vw, 38px); margin-bottom: .4em; }
h3 { font-size: 23px; margin-bottom: .3em; }
em, .it { font-family: var(--fell); font-style: italic; font-size: 1.12em; }
p { margin: 0 0 1em; }
small, .muted { color: var(--sound); }
.small { font-size: 13px; }
:focus-visible { outline: 3px solid var(--buoy); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }

/* neatline: a thin graduated border along the top (and the left on desktop) */
.neat { height: 10px; background: repeating-linear-gradient(90deg, var(--ink) 0 28px, var(--paper) 28px 56px); border-bottom: 1px solid var(--ink); box-shadow: 0 3px 0 -2px var(--ink); }
.neat-v { display: none; }
.margin-art { display: none; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--pad); }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0 12px; border-bottom: 1px solid var(--grat); }
.mark { display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); }
.mark b { font: italic 30px/1 var(--fell); }
.mark span { display: none; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--sound); }
.mark svg { width: 30px; height: 30px; align-self: center; }
.coords { font-size: 12px; letter-spacing: .06em; color: var(--sound); white-space: nowrap; }

/* buttons: square, double-ruled */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 9px 18px; border: 3px double var(--ink); background: var(--water); color: var(--ink); font: 600 14px/1.2 var(--mono); letter-spacing: .02em; cursor: pointer; text-decoration: none; border-radius: 0; transition: transform .08s, background .15s; }
.btn:hover { background: var(--paper); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--mag); border-color: var(--mag); color: #fff; box-shadow: inset 0 0 0 2px var(--mag), inset 0 0 0 3px #ffffff88; }
.btn.primary:hover { background: var(--mag-d); }
.btn.ghost { border: 1px solid transparent; background: transparent; text-decoration: underline; text-underline-offset: 3px; padding: 9px 10px; }
.btn.ghost:hover { border-color: var(--grat); }
.btn.small { min-height: 44px; padding: 6px 12px; font-size: 13px; }
.btn.icon { padding: 0; width: 44px; min-height: 44px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* fields */
label { display: block; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--sound); margin: 0 0 6px; }
input[type=text], input[type=search], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; font: 15px/1.4 var(--mono); color: var(--ink); background: var(--paper);
  border: 1px solid var(--ink); border-radius: 0; box-shadow: inset 0 -2px 0 var(--grat);
}
textarea { min-height: 80px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #5E7785; }
.field { margin-bottom: 18px; }
fieldset { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
legend { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--sound); margin-bottom: 8px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--ink); background: var(--water); font-size: 14px; cursor: pointer; }
.chip input:checked + span { background: var(--ink); color: var(--paper); }
.chip input:focus-visible + span { outline: 3px solid var(--buoy); outline-offset: 2px; }
.chip input:disabled + span { opacity: .45; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--ink); }
.seg .chip span { border: 0; border-right: 1px solid var(--ink); }
.seg .chip:last-child span { border-right: 0; }

/* cartouche: a double-ruled title block */
.cartouche { border: 1px solid var(--ink); outline: 1px solid var(--ink); outline-offset: 4px; padding: 18px 20px; background: var(--water); margin: 5px; }
.rule { border: 0; border-top: 1px solid var(--grat); margin: 28px 0; }
.legend-num { font: italic 18px/1 var(--fell); color: var(--mag); }

/* home */
.hero { display: grid; gap: 36px; padding: 36px 0 30px; }
.hero h1 { max-width: 13ch; }
.hero .lede { font-size: 16px; max-width: 48ch; margin-top: 18px; }
.hero .rose-wrap { display: none; }
.start { border-top: 1px solid var(--ink); padding-top: 20px; }
.start h2 { font-size: 30px; }
.legs { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--grat); }
.legs li { display: grid; grid-template-columns: 42px 1fr; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--grat); }
.legs li .i { width: 28px; height: 28px; color: var(--mag); margin-top: 2px; }
.legs h3 { font-size: 22px; margin: 0 0 2px; }
.legs p { margin: 0; color: var(--sound); font-size: 14px; }
.recent { margin: 0 0 24px; }
.recent a { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--grat); text-decoration: none; min-height: 44px; }
.recent a span:last-child { color: var(--sound); font-size: 13px; }
.quiz-strip { display: grid; gap: 14px; align-items: center; padding: 22px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); margin: 34px 0; }
.quiz-strip h2 { margin: 0; }
.dests { columns: 2 160px; column-gap: 24px; font-size: 14px; }
.dests a { display: block; padding: 6px 0; break-inside: avoid; }
footer.foot { border-top: 1px solid var(--grat); margin-top: 48px; padding-top: 22px; padding-bottom: 110px; font-size: 13px; color: var(--sound); display: flex; flex-wrap: wrap; gap: 8px 22px; }
footer.foot a { color: var(--sound); }

/* rose */
.rose .ring { fill: none; stroke: var(--ink); stroke-width: .7; }
.rose .ring.thin { stroke-width: .35; }
.rose .ticks line { stroke: var(--ink); stroke-width: .35; }
.rose .rd { fill: var(--ink); } .rose .rl { fill: var(--paper); stroke: var(--ink); stroke-width: .3; }
.rose .minor .rd { fill: var(--grat); }
.rose .hub { fill: var(--paper); stroke: var(--ink); stroke-width: .5; }
.rose .n { font: 9px var(--fell); fill: var(--ink); text-anchor: middle; }
.rose .needle { transform: rotate(var(--b)); transition: transform 0s; }
.rose .needle path { fill: var(--mag); stroke: var(--paper); stroke-width: .5; }
.rose .needle circle { fill: var(--paper); }
.rose.swing .needle { animation: swing .95s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes swing { from { transform: rotate(calc(var(--b) - 140deg)); } to { transform: rotate(var(--b)); } }

/* dialogs */
dialog.sheet { border: 1px solid var(--ink); outline: 1px solid var(--ink); outline-offset: 4px; background: var(--water); color: var(--ink); padding: 26px 22px 22px; width: min(520px, calc(100vw - 28px)); max-height: calc(100dvh - 40px); overflow: auto; }
dialog.sheet.wide { width: min(760px, calc(100vw - 28px)); }
dialog::backdrop { background: #13284Acc; }
dialog .x { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; background: none; font: 28px/1 var(--fell); color: var(--ink); cursor: pointer; }
#toast { position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 12px 18px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 880px) {
  body { padding-left: 12px; }
  .neat-v { display: block; position: fixed; left: 0; top: 0; bottom: 0; width: 10px; background: repeating-linear-gradient(180deg, var(--ink) 0 28px, var(--paper) 28px 56px); border-right: 1px solid var(--ink); box-shadow: 3px 0 0 -2px var(--ink); z-index: 3; }
  .margin-art { display: block; position: fixed; right: 0; top: 0; bottom: 0; width: 120px; pointer-events: none; z-index: 0; opacity: .55; }
  .hero { grid-template-columns: 1.15fr .85fr; align-items: start; padding: 64px 0 40px; gap: 56px; }
  .hero .rose-wrap { display: block; margin: 34px 0 0 -6px; }
  .home-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; }
  .quiz-strip { grid-template-columns: 1fr auto; }
  footer.foot { padding-bottom: 30px; }
  .app footer.foot { max-width: 1240px; }
}
@media (min-width: 1300px) { .margin-art { width: calc((100vw - 1180px) / 2); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (min-width: 560px) { .mark span { display: inline; } }
