/* tinyhfx UI: paper labels on a sketchbook page (see .claude/skills/tinyhfx-style/SKILL.md §7). */
:root {
  --paper: #f4efe4;
  --label: #f8f4ea;
  --ink: #3b3631;
  --ink-soft: rgba(59, 54, 49, 0.6);
  --muted: #7a7168;
  --accent: #d9893b;
  --retro: "Courier Prime", "Courier New", ui-monospace, monospace;   /* typewriter: retro, not cursive */
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); }
body { background: var(--paper); touch-action: none; }
#c { display: block; width: 100vw; height: 100vh; }
#snowfall { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; }
#snowfall[hidden] { display: none; }

.panel { position: fixed; background: var(--label); border: 1px solid var(--ink-soft); border-radius: 3px;
         box-shadow: 1px 2px 0 rgba(59, 54, 49, 0.08); }
#title { top: 16px; left: 16px; padding: 5px 6px 5px 12px; display: flex; gap: 10px; align-items: center; }
#title strong { font-family: var(--retro); font-size: 19px; font-weight: 700; letter-spacing: .5px; line-height: 1; }
#loading { top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 10px 16px; font-family: var(--retro); font-size: 15px; }
#loading.mini { top: auto; bottom: 16px; left: 50%; transform: translateX(-50%); padding: 2px 10px; font-size: 12px; color: var(--muted); }
#loading[hidden] { display: none; }
#tip, #uitip { position: fixed; pointer-events: none; padding: 2px 8px; border-radius: 2px; background: var(--label); z-index: 20;
       border: 1px solid var(--ink-soft); color: var(--ink); font-size: 12px; white-space: nowrap; display: none; }
#uitip { font-family: var(--retro); }

/* ink-line icons: drawn with the text colour, round ends, no fills */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { -webkit-tap-highlight-color: transparent; }
.panel button:focus-visible, #credits-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; }

/* go to: a paper button and a paper list (the browser's own select list can't take the style) */
.menu { position: relative; }
#goto-btn { display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 4px 0 9px; border: 1px solid var(--ink-soft);
            border-radius: 3px; background: var(--paper); color: var(--ink); font: 13px var(--retro); cursor: pointer; }
#goto-btn:hover, #goto-btn[aria-expanded="true"] { border-color: var(--ink); background: #efe6d4; }
#goto-btn .caret { width: 16px; height: 16px; transition: transform .15s; }
#goto-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
#goto-list { position: absolute; top: calc(100% + 7px); left: -1px; min-width: 220px; margin: 0; padding: 4px; list-style: none;
             background: var(--label); border: 1px solid var(--ink-soft); border-radius: 3px; box-shadow: 1px 2px 0 rgba(59, 54, 49, 0.08); z-index: 10; }
#goto-list[hidden] { display: none; }
#goto-list button { display: block; width: 100%; padding: 6px 10px; border: 0; border-radius: 2px; background: none; color: var(--ink);
                    font: 13px var(--retro); text-align: left; cursor: pointer; }
#goto-list button:hover, #goto-list button:focus-visible { background: #f7e6d1; outline: none; box-shadow: inset 2px 0 0 var(--accent); }

/* time panel: a small chip (time · date, pin) that pins open into the slider and seasons */
#sunpanel { top: 16px; right: 16px; padding: 5px 6px; display: flex; flex-direction: column; gap: 6px; }
#sunpanel.open { width: 284px; padding: 6px 8px 8px; }
#sunpanel .sun-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
#sunpanel .sun-tools { display: flex; gap: 4px; }
#sun-time { border: 0; background: none; padding: 2px 4px; font: 14px var(--retro); color: var(--ink); white-space: nowrap; cursor: pointer; }
#sun-time.picked { color: #a0602a; }
#sunpanel button.icon-btn, #sun-now { height: 28px; border: 1px solid var(--ink-soft); border-radius: 3px; background: var(--paper); color: var(--ink);
                   font: 12px var(--retro); padding: 0 7px; cursor: pointer; }
#sunpanel button.icon-btn { width: 30px; padding: 0; }
#sunpanel button.icon-btn:hover, #sun-now:hover { background: #efe6d4; border-color: var(--ink); }
#sunpanel button.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: #8a5a2b; }
#sun-pin[aria-pressed="true"] { border-color: var(--accent); color: #8a5a2b; }
#sun-pin[aria-pressed="true"] .ico { fill: rgba(217, 137, 59, 0.25); }
#sun-more { display: none; flex-direction: column; gap: 6px; }
#sunpanel.open #sun-more { display: flex; }
#sun-now[hidden], #sun-snow[hidden] { display: none; }
#sun-slider { width: 100%; margin: 2px 0; accent-color: var(--accent); }
#sun-seasons { display: flex; gap: 5px; }

#card { top: 64px; right: 16px; width: 280px; max-width: calc(100vw - 32px); padding: 12px 16px 14px; border-left: 3px solid var(--accent); }
#sunpanel.open ~ #card { top: 132px; }
#card h2 { margin: 0 24px 8px 0; font-family: var(--retro); font-size: 17px; font-weight: 700; line-height: 1.2; }
#card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
#card dt { color: var(--muted); }
#card dd { margin: 0; }
#card a { color: #8a5a2b; }
#card-close { position: absolute; top: 6px; right: 10px; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }

/* map controls: compass, zoom and quality in a column at the bottom right */
#controls { right: 16px; bottom: 16px; padding: 5px; display: flex; flex-direction: column; gap: 5px; }
#controls button { width: 38px; height: 38px; border: 1px solid var(--ink-soft); border-radius: 3px; background: var(--paper);
                   font-size: 18px; cursor: pointer; color: var(--ink); padding: 0; }
#controls button:hover { background: #efe6d4; border-color: var(--ink); }
#quality { font: 700 12px var(--retro) !important; }
#compass { border-radius: 50% !important; touch-action: none; }
#compass svg { width: 100%; height: 100%; display: block; }
#compass .dial { fill: none; stroke: var(--ink-soft); stroke-width: 1; }
#compass .ticks { stroke: var(--ink-soft); stroke-width: 1.2; stroke-linecap: round; }
#compass .north { fill: var(--accent); stroke: #8a5a2b; stroke-width: .8; stroke-linejoin: round; }
#compass .south { fill: var(--paper); stroke: var(--ink); stroke-width: .8; stroke-linejoin: round; }
#compass .hub { fill: var(--ink); }
#compass text { font: 700 6.5px var(--retro); fill: var(--ink); }
#needle { transform-origin: 20px 20px; transition: transform .25s ease-out; }

/* credits: an (i) chip with the short OpenStreetMap credit; the full list on hover (or tap on touch) */
#credits { position: fixed; left: 16px; bottom: 16px; }
#credits-btn { position: static; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px 0 5px;
               font: 11px system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--muted); cursor: pointer; }
#credits-btn .ico { width: 16px; height: 16px; color: var(--ink); }
#credits-panel { position: absolute; left: 0; bottom: calc(100% + 6px); width: max-content; max-width: min(420px, calc(100vw - 32px));
                 padding: 8px 11px; font-size: 11.5px; line-height: 1.5; color: var(--ink); display: none; }
#credits-panel p { margin: 0; }
#credits-panel p + p { margin-top: 3px; }
#credits.open #credits-panel { display: block; }
@media (hover: hover) { #credits:hover #credits-panel, #credits:focus-within #credits-panel { display: block; } }

/* phones: title and the time chip share the top line, controls stay a column at the right, cards rise from the bottom */
@media (max-width: 640px) {
  #title { top: 12px; left: 12px; padding: 4px 4px 4px 10px; gap: 8px; }
  #title strong { font-size: 17px; }
  #goto-btn { height: 34px; }
  #goto-list { position: fixed; top: 58px; left: 12px; right: 12px; min-width: 0; }
  #goto-list button { padding: 10px 12px; font-size: 14px; }
  #sunpanel { top: 12px; right: 12px; padding: 4px 5px; }
  #sunpanel.open { left: 12px; width: auto; top: 58px; }
  #sunpanel.open .sun-row:first-child { justify-content: space-between; }
  #sunpanel button.icon-btn, #sun-now { height: 34px; }
  #sunpanel button.icon-btn { width: 40px; }
  #sun-time { font-size: 13px; }
  #sun-seasons { gap: 6px; }
  #controls { right: 12px; bottom: 12px; }
  #controls button { width: 42px; height: 42px; }
  #credits { left: 12px; bottom: 12px; }
  #loading.mini { bottom: 12px; }
  #card { top: auto !important; bottom: 12px; left: 12px; right: 72px; width: auto; max-height: 45vh; overflow: auto; }
}
@media (max-width: 420px) {                     /* small phones: title and time chip share one line */
  #sunpanel:not(.open) #sun-time .zone { display: none; }   /* time · date, no zone */
  #title { padding-left: 8px; gap: 6px; }
  #title strong { font-size: 16px; letter-spacing: 0; }
  #goto-btn { padding: 0 2px 0 7px; font-size: 12.5px; }
  #sunpanel:not(.open) { padding: 4px; }
  #sunpanel:not(.open) .sun-row { gap: 2px; }
  #sun-time { font-size: 12.5px; padding: 2px; }
  #sunpanel:not(.open) #sun-pin { display: none; }        /* tapping the time opens it; the pin shows once open */
  #sun-time { min-height: 34px; }
}
@media (max-width: 345px) { #sunpanel:not(.open) { top: 58px; } }   /* very narrow: the chip under the title */
#card .muted { color: var(--muted); font-size: 12px; }

/* route tags over buses and ferries (tags.js): a paper label with a hairline border and an ink leader */
#vtags { position: fixed; inset: 0; pointer-events: none; overflow: hidden; transition: opacity .2s; }
.vtag { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer; display: flex; align-items: center;
        padding: 0 4px; height: 17px; margin-top: -13px; background: var(--label); color: var(--ink);
        border: 1px solid var(--ink-soft); border-radius: 2px; font: 700 11.5px/1 var(--retro); white-space: nowrap;
        box-shadow: 1px 1px 0 rgba(59, 54, 49, 0.08); }
.vtag::after { content: ''; position: absolute; left: calc(50% - 0.5px); top: 100%; width: 1.5px; height: 12px; background: var(--ink); opacity: .75; }
.vtag:hover, .vtag.on { border-color: var(--accent); background: #f7e6d1; z-index: 1; }
.vtag:hover::after, .vtag.on::after { background: var(--accent); }
