/* spudnote / watch — the public journey page.
 *
 * The two themes are the APP'S OWN, lifted from spudnote/Theme.swift rather than
 * invented here: CLASSIC CREAM and NIGHT GARDEN, the same hex values the app ships,
 * mapped the same way the translation-review pages map them so the two cannot drift.
 * The system's preference decides; the header toggle overrides it and is remembered.
 *
 * The layout is AstroPiggy's, in spudnote's clothes: a map that owns the top of the
 * page, then two columns — the ladder on the left, everything about you on the right.
 * Panels, hairlines and one accent, so the data is the only thing shouting.
 */

/* LIGHT = spudnote.com's own field, value for value, so the two pages are one site:
   the same cream ground, the same ink, the same rule colour, the same greens. (The app's
   classic-cream theme is a shade deeper; this page follows the website it belongs to.) */
:root {
  color-scheme: light;
  --cream: #FFFAF1;       /* the page */
  --glow: #FFFAF1;        /* flat, like the landing page */
  --card: #FFFDF8;
  --cream-mid: #FFF3E2;
  --cream-deep: #FDEEDA;
  --ink: #2A1408;
  --ink-dim: #6E4A2E;
  --sun: #FFE6A8;
  --spud: #C07A30;
  --accent-text: #9A5518; /* spud-brown: 5.2:1 on cream, which #C07A30 is not */
  --sprout: #49A22B;      /* the fill green — the map wants more life than the text green */
  --cta: #2E7018;         /* the landing page's Download green, exactly */
  --rule: rgba(90, 52, 12, .14);
  /* Deeper than --cream-deep on purpose: an unreached country has to be a shade, not a
     suggestion, or the map reads as blank paper. */
  --map-empty: #F2E3CB;
  --map-stroke: rgba(90, 52, 12, .18);
  /* The dashboard's card treatment, in cream: a panel is a faint top-lit gradient over
     the card colour, a hairline inset highlight, and two shadows — one resting, one for
     hover — plus a wash that fades in under the content. */
  --card-top: #FFFFFF;
  --card-bot: #FFF9EE;
  /* Row states, per theme. On cream a warm wash reads; on night it does not — --sun
     there is a muted navy barely lighter than the card, so the hover was invisible.
     Night lifts with light instead. */
  --row-hover: rgba(154, 85, 24, .07);
  --row-mine: rgba(255, 214, 138, .3);
  --edge-strong: rgba(154, 85, 24, .32);
  --sheen: rgba(200, 150, 90, .07);
  --shadow-1: inset 0 1px 0 #fff, 0 1px 2px rgba(90, 52, 12, .04), 0 8px 20px -12px rgba(90, 52, 12, .18);
  --shadow-2: inset 0 1px 0 #fff, 0 2px 8px rgba(90, 52, 12, .07), 0 26px 48px -22px rgba(90, 52, 12, .28);
}
/* night garden, Themes.night — the app's values, with the GROUND taken a step deeper
   (its own creamDeep direction) and the card pulled back toward its card colour. The
   panels were nearly as light as the page and read as flat lavender slabs; a darker
   field under a quieter card is the same palette with the contrast the app gets from
   having a sky behind it. */
/* LIGHT IS THE DEFAULT, not the system's preference: this is the app's front door and
   the app opens in classic cream. Night garden is a choice the reader makes with the
   header toggle, and it is remembered. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --cream: #1A1F33;
  --glow: #232941;
  --card: #2E3452;
  --cream-mid: #171A2C;
  --cream-deep: #333852;
  --ink: #F2EEFF;
  --ink-dim: #B0AACC;
  --sun: #3A4166;
  --spud: #E7A24E;
  --accent-text: #F0B968;
  --sprout: #7FC44C;
  --rule: rgba(176, 170, 204, .28);
      --row-hover: rgba(255, 255, 255, .075);
  --row-mine: rgba(240, 185, 104, .1);
  --card-top: #2F3556;
  --card-bot: #272D48;
  --edge-strong: rgba(240, 185, 104, .34);
  --sheen: rgba(184, 166, 242, .07);
  --shadow-1: inset 0 1px 0 rgba(255, 255, 255, .05), 0 1px 2px rgba(0, 0, 0, .3), 0 8px 20px -12px rgba(0, 0, 0, .6);
  --shadow-2: inset 0 1px 0 rgba(255, 255, 255, .08), 0 2px 8px rgba(0, 0, 0, .36), 0 28px 52px -20px rgba(0, 0, 0, .72);
  --map-empty: #333852;
  --map-stroke: rgba(176, 170, 204, .34);
  --cta: #7FC44C;   /* night's Download green: #2E7018 is unreadable on it */
    --shadow: 0 12px 34px -24px rgba(0, 0, 0, .8);
}

:root {
  --fred: 'Fredoka', ui-rounded, -apple-system, system-ui, sans-serif;
  --sans: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* The site's own measure and gutter, so the logo and the panels land in exactly the
     same place on this page as on spudnote.com. */
  --wrap: 1100px;
  --pad: clamp(20px, 5vw, 36px);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }
/* The ground colour goes on <html> as well: the body's gradient is fixed to the
   viewport, so on a long page everything past the first screen would otherwise fall
   through to the browser's own white. */
html { touch-action: manipulation; }   /* the background is the field: /site/site.css */
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); }

/* The header, footer, back-to-top and the field wallpaper are the site's own:
   /site/site.css, shared with the landing page. Don't restyle them here. */
main.wrap { padding-bottom: 26px; }   /* the gap the shared footer has no margin for */

/* ── Hero: one sentence (the crops moved to the header, 2026-11-08) ───────────── */
/* Centred and tight under the pill row. Scattering the crops around the page was once the
   alternative and would have put cartoon vegetables over the map and the chart, which is
   where the reading happens; they parade in the header instead. */
.hero { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 40px 0 16px; text-align: center; }
.hero h1 {
  font-family: var(--fred); font-weight: 500; font-size: clamp(.98rem, 1.9vw, 1.18rem);
  line-height: 1.3; margin: 0; color: var(--ink-dim);
  /* No max-width: the sentence is one line at any desktop width, and a wrapped
     one-line sentence beside a row of vegetables looks like a mistake. */
}
/* The wordmark in the sentence is the wordmark: ink and spud-brown, exactly as the
   header and the app draw it — not the sentence's muted grey. */
.hero h1 b { color: var(--ink); font-weight: 600; }
.hero h1 b .sp { color: var(--accent-text); }
.hero h1 .n { color: var(--sprout); font-weight: 600; }
/* What spudnote is, for someone who arrives from a country video (2026-11-05): the landing page's line. */


/* ── Panels ────────────────────────────────────────────────────────────────── */
.panel {
  position: relative;
  isolation: isolate;
  background: linear-gradient(180deg, var(--card-top), var(--card-bot)), var(--card);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 14px 16px 16px;
  box-shadow: var(--shadow-1);
  transition: box-shadow .45s var(--ease), border-color .45s var(--ease);
  /* A panel is a grid or flex item everywhere it appears, and the joins strip inside one
     is a nowrap row. Without this, that row's content width becomes the panel's minimum
     and the whole page grows sideways to fit a month of chips. */
  min-width: 0;
}
/* A soft, even wash on hover — the whole panel lifting slightly out of the page, not a
   spotlight following the cursor. Behind the content, clipped to the radius. */
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(140% 120% at 50% 35%, var(--sheen), transparent 85%);
  opacity: 0;
  transition: opacity .5s var(--ease);
  pointer-events: none;
  z-index: -1;
}
@media (hover: hover) {
  .panel:hover { box-shadow: var(--shadow-2); border-color: var(--edge-strong); }
  .panel:hover::before { opacity: 1; }
}
/* The panels arrive in order rather than all at once, which is what makes a page feel
   assembled rather than dumped. */
@media (prefers-reduced-motion: no-preference) {
  .panel { animation: rise .5s var(--ease) backwards; }
  #map-panel { animation-delay: .04s; }
  .grid-2 > section { animation-delay: .12s; }
  .side > .panel:nth-child(1) { animation-delay: .16s; }
  .side > .panel:nth-child(2) { animation-delay: .2s; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.grid-2 { margin-top: 14px; }
main > .panel + .panel { margin-top: 14px; }
/* The right-hand stack spaces itself, so nothing has to know about margins. */
.side { display: flex; flex-direction: column; gap: 14px; }
.phead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
h2 { font-family: var(--fred); font-weight: 500; font-size: .84rem; letter-spacing: .01em; color: var(--ink-dim); margin: 0; }
.phead .note { font-size: .74rem; color: var(--ink-dim); opacity: .8; }
/* min-width: 0 on the columns, or a grid item's default "never narrower than my
   content" lets one long line in the right-hand card stretch the whole page sideways. */
.grid-2 { display: grid; grid-template-columns: 0.92fr 1.08fr; gap: 14px; align-items: start; }
.grid-2 > * { min-width: 0; }
/* One column: the reader's own region comes FIRST. It is the reason the page knows
   where they are, and burying it under twelve rows of ladder wastes it. `display:
   contents` dissolves the right-hand stack so its panels can be ordered individually
   against the board. */
@media (max-width: 900px) {
  /* align-items back to stretch: the desktop grid uses `start` so the two columns keep
     their own heights, but in a COLUMN flex that same value sizes each panel to its own
     content — and the joins strip's content is a month of chips. */
  .grid-2 { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
  .side { display: contents; }
  #you-panel { order: -1; }
}

/* ── Map ───────────────────────────────────────────────────────────────────── */
.worldmap { position: relative; width: 100%; }
.worldmap > div:first-child { line-height: 0; }
.worldmap svg { width: 100%; height: auto; display: block; }
.mapc { stroke: var(--map-stroke); stroke-width: .4px; vector-effect: non-scaling-stroke; transition: fill .2s var(--ease); }
.mapdot { stroke: var(--map-stroke); stroke-width: .7px; vector-effect: non-scaling-stroke; }
.mapc.has, .mapdot.has { cursor: pointer; }
@media (hover: hover) {
  .mapc.has:hover, .mapdot.has:hover { filter: brightness(1.12); }
}
.mapdot.ping { animation: ping 1.5s var(--ease); }
/* A tapped country's real border, above all the land so no neighbor covers it. */
.map-outline {
  fill: none;
  stroke: var(--spud);
  stroke-width: 1.4px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  filter: drop-shadow(0 0 1.5px color-mix(in srgb, var(--spud) 55%, transparent));
  animation: map-outline 3.2s var(--ease) forwards;
}
@keyframes map-outline {
  0% { opacity: 0; }
  10%, 75% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes ping {
  0% { filter: drop-shadow(0 0 0 transparent); }
  25%, 60% { filter: drop-shadow(0 0 3px var(--spud)); }
  100% { filter: drop-shadow(0 0 0 transparent); }
}
@media (prefers-reduced-motion: reduce) { .mapdot.ping, .map-outline { animation: none; } }
/* Spud wanders the map (see spudOnTheMap). Under the label and untouchable, so he can
   never intercept a hover or hide a country's number. */
.spud-walker {
  position: absolute; left: 0; top: 0; z-index: 5;
  width: 34px;
  transform-origin: 50% 100%;
  will-change: transform;
  /* Grabbable, like he is in the app. touch-action: none so dragging him on a phone
     moves him instead of scrolling the page out from under him. */
  cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none;
  -webkit-user-drag: none;
}
.spud-walker.held { cursor: grabbing; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .3)); }
.spud-walker img { display: block; width: 100%; height: auto; pointer-events: none; -webkit-user-drag: none; }
.spud-shadow {
  position: absolute; left: 0; top: 0; z-index: 2;
  width: 26px; height: 7px; border-radius: 50%;
  background: rgba(31, 12, 4, .55);
  filter: blur(2px); pointer-events: none;
}
:root[data-theme="dark"] .spud-shadow { background: rgba(0, 0, 0, .6); }
@media (max-width: 700px) { .spud-walker { width: 24px; } .spud-shadow { width: 18px; height: 5px; } }

.map-tip {
  position: absolute; z-index: 6; pointer-events: none;
  display: flex; flex-direction: column; gap: 1px;
  padding: 7px 10px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--rule);
  box-shadow: 0 12px 28px -18px rgba(0, 0, 0, .6);
  font-family: var(--fred); font-size: .8rem; line-height: 1.3;
}
.map-tip[hidden] { display: none; }
.map-tip b { font-size: .84rem; color: var(--ink); font-weight: 600; }
.map-tip span { font-size: .78rem; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.map-tip small { font-family: var(--sans); font-size: .7rem; color: var(--ink-dim); opacity: .8; }

/* The completion meter, under the map exactly as the dashboard has it. */
.quest { margin-top: 12px; }
.qhead { display: flex; justify-content: space-between; align-items: baseline; font-size: .78rem; color: var(--ink-dim); margin-bottom: 7px; }
.qhead b { font-family: var(--fred); font-weight: 600; font-size: .95rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.qbar { height: 8px; border-radius: 99px; background: var(--cream-deep); overflow: hidden; }
.qbar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--sprout); transition: width 1s var(--ease); }
@media (prefers-reduced-motion: reduce) { .qbar i { transition: none; } }

/* ── The ladder ────────────────────────────────────────────────────────────── */
.board { display: grid; gap: 1px; }
/* Frozen by "more" (see renderBoard): the rest of the ladder scrolls inside the height
   the list already had, so the panel — and the column beside it — never move. */
.board.capped { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.row {
  display: grid;
  /* The name gets the room; the bar is the part that can shrink. "United Arab Emirates"
     truncating next to a decorative track is the wrong trade. */
  grid-template-columns: 30px 20px minmax(0, 1.25fr) minmax(30px, .8fr) 40px 44px;
  align-items: center; column-gap: 11px;
  width: 100%; padding: 7px 4px; border: 0;
  background: none; color: inherit; font: inherit; font-size: .88rem; text-align: left; cursor: pointer;
  border-radius: 7px;
  position: relative;
}
/* The divider is its own line rather than the row's bottom border: the row is rounded
   so its hover and "you" states read as a pill, and a rounded border curls up at both
   ends — which is what made every row look clipped at the sides on a phone. */
.row::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--rule);
}
.row:last-of-type::after { display: none; }
/* Your own row is a closed pill, so the rules that meet it have to stop.
   The divider runs the full width of the row while the highlight is rounded, so the two
   lines crossed the curve at both ends and the box read as sliced off at the sides —
   the very thing the rounded corners exist to avoid. Its own line goes, and so does the
   one belonging to the row above it, which lands on the same edge. */
.row.mine::after,
.row:has(+ .row.mine)::after { display: none; }
.row { transition: background-color .16s var(--ease); }
@media (hover: hover) { .row:hover { background: var(--row-hover); } }
.row .rk { font-family: var(--fred); font-size: .76rem; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.row .fl { font-size: 1rem; line-height: 1; }
.row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .tr { height: 6px; border-radius: 99px; background: var(--cream-deep); overflow: hidden; }
.row .tr i { display: block; height: 100%; border-radius: inherit; background: var(--sprout); }
/* Which way the region is moving. Reserved width in every row, chip or no chip, so the
   counts stay in one column and the ladder does not jitter as arrows come and go. */
.mv {
  /* Two slots of fixed width — direction, then magnitude. As one string they centred on
     their own length, so "▲+1" and a bare "▼" put their arrows in different places. */
  display: grid; grid-template-columns: 11px 21px;
  justify-content: center; align-items: center;
  white-space: nowrap;
  font-family: var(--fred); font-size: .74rem; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--ink-dim);
}
.mv .mv-a { font-style: normal; text-align: center; }
/* Left, so the signs stack under each other rather than the last digit. */
.mv .mv-n { font-style: normal; text-align: left; }
.mv.new { display: block; text-align: center; }
.mv.up { color: var(--cta); }
.mv.down { color: #C1594A; }
:root[data-theme="dark"] .mv.down { color: #E0796A; }
.mv.flat { opacity: .45; }
.mv.new { color: var(--accent-text); font-size: .66rem; letter-spacing: .04em; text-transform: uppercase; }
/* A region reached in the latest report carries the accent in its name too, so the row
   reads as new at a glance — the same treatment the dashboard gives it. */
.row.fresh .nm { color: color-mix(in srgb, var(--accent-text) 78%, var(--ink)); font-weight: 600; }
.row .n { text-align: right; font-family: var(--fred); font-weight: 600; font-variant-numeric: tabular-nums; }
.row.mine { background: var(--row-mine); outline: 1px solid color-mix(in srgb, var(--accent-text) 40%, transparent); }
.row.mine .nm { font-weight: 700; }
@media (max-width: 560px) {
  .row { grid-template-columns: 28px 20px minmax(0, 1fr) 38px 42px; column-gap: 9px; }
  .row .tr { display: none; }
}
.more {
  margin-top: 10px; width: 100%; padding: 8px; cursor: pointer;
  background: none; border: 1px dashed var(--rule); border-radius: 10px;
  font-family: var(--fred); font-size: .8rem; color: var(--ink-dim);
}
.more:hover { border-color: var(--spud); color: var(--ink); }

/* ── You ───────────────────────────────────────────────────────────────────── */
/* Centred as one group rather than pinned to the edges: the sentence is short and the
   badge is small, and spreading them left and right left a hole between them. */
.you { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; text-align: center; }
.you .fl { font-size: 1.9rem; line-height: 1; }
.you .txt { min-width: 0; }
.you .l1 { font-family: var(--fred); font-weight: 600; font-size: 1rem; }
.you .l2 { color: var(--ink-dim); font-size: .84rem; }
.badge { display: inline-block; flex: 0 0 auto; }
.badge img { display: block; height: 40px; width: auto; }
/* On a phone the badge drops to its own line rather than squeezing the sentence into
   two-word ribbons beside it. It keeps the flag's indent so the card still reads as one
   block. */
@media (max-width: 560px) {
  .badge { flex-basis: 100%; display: flex; justify-content: center; }
  .badge img { height: 38px; }
}

/* ── Chart ───────────────────────────────────────────────────────────────────
   The dashboard's idiom: every bar reads at full strength until one is being read,
   then the rest step back and the chosen one stays lit. */
.chart { height: 84px; }
.chart svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.chart .bar { fill: var(--sprout); opacity: .92; transition: opacity .12s linear; }
.chart .bar.zero { fill: var(--cream-deep); opacity: 1; }
.chart.is-focus .bar { opacity: .34; }
.chart.is-focus .bar.on { opacity: 1; }
.chart.is-focus .bar.zero { opacity: .5; }
.chart.is-focus .bar.zero.on { opacity: 1; }
.phead .note b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: .7rem; color: var(--ink-dim); }

/* ── Joins ─────────────────────────────────────────────────────────────────── */
.joins {
  display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none;
  margin-top: 12px; padding: 2px 0;
  /* The last chip dissolves rather than ending flush, which is what says there is more. */
  mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent 100%);
}
.joins::-webkit-scrollbar { display: none; }
.join {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: none; color: inherit; font: inherit; font-size: .82rem;
}
.join i { font-style: normal; font-size: .74rem; color: var(--ink-dim); }
.join.fresh { border-color: color-mix(in srgb, var(--spud) 60%, transparent); background: color-mix(in srgb, var(--sun) 42%, transparent); }
.join.fresh i { color: var(--accent-text); font-weight: 600; }
.join:hover { border-color: var(--spud); }

/* ── Phone in landscape: the map takes over ───────────────────────────────────
   The dashboard's own rule, same heuristics — short viewport plus a coarse pointer, so
   a small desktop window is not caught by it — and gated on `map-ready`, which JS sets
   once there is actually a map to show. Portrait returns to the normal page. */
@media (orientation: landscape) and (max-height: 540px) and (pointer: coarse) {
  html.map-ready header.nav,
  html.map-ready .hero,
  html.map-ready .grid-2,
  html.map-ready footer { display: none !important; }
  html.map-ready main { display: block; padding: 0; margin: 0; max-width: none; }
  html.map-ready #map-panel {
    position: fixed; inset: 0; z-index: 60;
    margin: 0; border: 0; border-radius: 0; box-shadow: none;
    display: flex; flex-direction: column; padding: 8px 10px 10px;
  }
  html.map-ready #map-panel .worldmap { flex: 1; min-height: 0; }
  html.map-ready #map-panel .worldmap > div:first-child { height: 100%; }
  html.map-ready #map-panel .worldmap svg { width: 100%; height: 100%; }
  /* The map owns the touches that land on it — no double-tap zoom stealing a tap that
     was meant to label a country. The effective touch-action is intersected up the
     tree, so the ancestors have to say it too. */
  html.map-ready #map-panel,
  html.map-ready #map-panel .worldmap,
  html.map-ready #map-panel .worldmap svg,
  html.map-ready .mapc,
  html.map-ready .mapdot { touch-action: manipulation; }
  html.map-ready .quest { margin-top: 8px; }
  html.map-ready .joins { margin-top: 8px; }
}


.err { padding: 16px; border: 1px dashed var(--rule); border-radius: 12px; color: var(--ink-dim); font-size: .86rem; }
