/* Fulmaire brand: the one place the palette, type and base controls live.
 *
 * Every page links this file before its own <style>. A page may style its own
 * components, but it never redefines a token here: four pages each carrying a
 * copy of the palette is how the paper drifted to three shades of cream and
 * the ink to two blues. BRAND.md explains the choices; a test holds the rule.
 *
 * The identity is an Admiralty chart, not wildlife (NAMING.md): chart paper,
 * fine ink linework, and magenta for what a paddler has claimed, which is the
 * chart's own colour for lights and marks.
 */

:root {
  /* Paper and ink */
  --paper:        #f4f1ea;   /* chart paper: page background */
  --card:         #fffefb;   /* raised surfaces */
  --tint:         #ebe5d7;   /* wells, segmented controls, quiet notes */
  --ink:          #12303d;   /* text, the night colour, the brand's dark */
  --ink-soft:     #2b4a58;   /* hover on ink surfaces */
  --muted:        #4f6370;   /* secondary text: 5.2:1 on paper, passes AA */
  --rule:         #988a64;   /* edges of things you press: 3:1 on paper and card */
  --line:         #e4ddcc;   /* dividers only, never the edge of a control */

  /* Magenta: claims, the primary action, and nothing decorative */
  --magenta:      #bf007a;
  --magenta-dark: #a10067;
  --magenta-wash: #fbeaf3;
  --magenta-ring: rgba(191, 0, 122, .18);

  /* Water and the map. The water is the playing field, so it is the lightest
     thing on screen after the paper itself. */
  --sea:          #dbe7ee;   /* open water fill */
  --sea-deep:     #4b93b8;   /* named waters, rivers, the water kind marker: 3:1 on paper */
  --sea-label:    #3a6c87;   /* names on the water, in the chart's blue: 4.5:1 on sea */
  --land:         #f4f1ea;   /* the same paper: land is the chart's ground */
  --mine:         #bf007a;   /* cells you hold */
  --others:       #6d7f88;   /* cells other paddlers hold: neutral slate */
  --track:        #12303d;   /* a paddle's line */

  /* State */
  --ok:           #2f7d5f;
  --ok-wash:      #e6f2ec;

  /* Type. Barlow Semi Condensed is chart lettering: titles, numbers, the
     wordmark. Inter is everything a paddler reads. */
  --display: "Barlow Semi Condensed", "Inter", system-ui, sans-serif;
  --sans:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:    ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Shape and depth */
  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(18, 48, 61, .06);
  --shadow:    0 1px 2px rgba(18, 48, 61, .06), 0 8px 24px rgba(18, 48, 61, .10);
  --shadow-lg: 0 2px 6px rgba(18, 48, 61, .08), 0 18px 48px rgba(18, 48, 61, .16);

  /* Spacing: a 4px base, named by use rather than size */
  --s1: 4px;  --s2: 8px;  --s3: 12px;  --s4: 16px;  --s5: 24px;  --s6: 32px;  --s7: 48px;

  /* The fulmar, head-on in a glide: stiff wings bowed at the tips, drifting
     over the swell while a paddle uploads. Never a mascot, never on the mark
     or the name (NAMING.md, Pa 7 Oct 2026). --glide is a mask, so it takes
     whatever colour it sits on. */
  --glide: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 9'%3E%3Cpath d='M1 7.2 Q3 5.6 6 5.2 C13 4.2 19 3.4 22.5 2.6 Q24 1.6 25.5 2.6 C29 3.4 35 4.2 42 5.2 Q45 5.6 47 7.2' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  --glide-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 9'%3E%3Cpath d='M1 7.2 Q3 5.6 6 5.2 C13 4.2 19 3.4 22.5 2.6 Q24 1.6 25.5 2.6 C29 3.4 35 4.2 42 5.2 Q45 5.6 47 7.2' fill='none' stroke='%2312303d' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  --swell: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 20'%3E%3Cpath d='M0 12 C10 6 20 6 30 12 S50 18 60 12 S80 6 90 12 S110 18 120 12' fill='none' stroke='%236aa6c4' stroke-width='2'/%3E%3C/svg%3E");

  color-scheme: light;
}

/* ---- Base ------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--magenta); text-underline-offset: .15em; }
a:hover { color: var(--magenta-dark); }

/* Solid magenta, 5:1 on paper: the faint ring it replaced was 1.2:1 and a
   keyboard or switch user could not see where they were (WCAG 1.4.11). */
:focus-visible { outline: 2px solid var(--magenta); outline-offset: 2px; }

/* ---- The wordmark ------------------------------------------------------
   Mark and name together, the way a chart carries its title: the cell with a
   lap round an island, then FULMAIRE in spaced chart capitals. Use
   <a class="wordmark" href="/"><img src="/icons/mark.svg" alt=""> Fulmaire</a>.
*/
.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 22px/1 var(--display);
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
}
.wordmark img, .wordmark svg { width: 32px; height: 32px; flex: none; }
.wordmark:hover { color: var(--ink); }


/* Section labels: small spaced capitals, the chart's way of naming a panel. */
.eyebrow {
  font: 600 12px/1.3 var(--sans); color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
}

/* ---- Buttons -----------------------------------------------------------
   One primary action per screen, in magenta. Everything else is a quiet
   button on card. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  font: 500 15px var(--sans); color: var(--ink); text-decoration: none;
  background: var(--card); border: 1px solid var(--rule); cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .12s, border-color .12s, box-shadow .12s, transform .06s;
}
.btn:hover { background: #fff; border-color: var(--ink); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary {
  height: 48px; font-weight: 600; font-size: 16px; color: #fff;
  background: var(--magenta); border-color: var(--magenta);
  box-shadow: 0 2px 8px rgba(191, 0, 122, .25);
}
.btn-primary:hover { background: var(--magenta-dark); border-color: var(--magenta-dark); color: #fff; }
.btn-ink { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.btn-ink:hover { background: var(--ink-soft); border-color: var(--ink-soft); color: var(--paper); }
.btn-block { display: flex; width: 100%; }

/* ---- Fields ----------------------------------------------------------- */
.field {
  width: 100%; height: 44px; padding: 0 12px; font: 15px var(--sans);
  color: var(--ink); background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); transition: border-color .12s, box-shadow .12s;
}
.field:focus { outline: none; border-color: var(--magenta);
  box-shadow: 0 0 0 1px var(--magenta), 0 0 0 4px var(--magenta-ring); }

/* ---- Surfaces --------------------------------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s4);
}
.callout {
  background: var(--tint); border-radius: var(--radius-sm);
  padding: var(--s3) 14px; font-size: 14px; line-height: 1.5;
}

/* A single page of reading: terms, privacy, history, the dashboard. */
.page { max-width: 640px; margin: 0 auto; padding: var(--s5) var(--s4) 64px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap;
  padding-bottom: var(--s4); margin-bottom: var(--s5);
  border-bottom: 1px solid var(--line);
}
.page-head nav { display: flex; gap: var(--s4); font-size: 14px; }
.page-head nav a { display: inline-block; padding: 2px 0; color: var(--muted); text-decoration: none; }
.page-head nav a:hover, .page-head nav a[aria-current] { color: var(--magenta); }

/* A section of a page: the eyebrow as a heading, with an optional count or
   aside on the right in ordinary type. */
.section {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3);
  font: 600 12px/1.3 var(--sans); color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em;
  margin: var(--s6) 0 var(--s3);
}
.section span { font-weight: 500; text-transform: none; letter-spacing: 0;
  font-variant-numeric: tabular-nums; }

/* Three numbers in a row: the summary at the top of a page. */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: var(--s3) var(--s3) 10px; }
.stat .n { font: 600 28px/1 var(--display); font-variant-numeric: tabular-nums; }
.stat .k { font-size: 13px; line-height: 1.3; color: var(--muted); margin-top: var(--s1); }

/* Small rounded labels: places, members, the parts of a collection. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; font-size: 14px; line-height: 1.4; color: var(--ink); }
.chip small { color: var(--muted); font-size: 12px; }

/* A paddler's avatar beside their name (avatars.py). The ring is their
   colour on the World map, set per use as --ring; none when there is none. */
.avatar { display: inline-block; flex: none; width: 22px; height: 22px;
  border-radius: 50%; vertical-align: middle;
  box-shadow: 0 0 0 2px var(--ring, transparent); }
.avatar.big { width: 44px; height: 44px; box-shadow: 0 0 0 3px var(--ring, transparent); }

/* A card that opens something: the whole card is the link, with a chevron. */
.card-link { display: flex; align-items: center; gap: var(--s3);
  color: inherit; text-decoration: none; transition: border-color .12s, box-shadow .12s; }
.card-link::after { content: ""; flex: none; width: 8px; height: 8px; margin-left: auto;
  border: solid var(--muted); border-width: 2px 2px 0 0; transform: rotate(45deg); }
.card-link:hover { color: inherit; border-color: var(--rule); box-shadow: var(--shadow-sm); }

.display, .page h1 {
  font: 600 32px/1.1 var(--display); letter-spacing: -.005em; margin: 0 0 var(--s2);
}

/* ---- Native controls, finished ----------------------------------------
   The browser's own disclosure triangle, select arrow and blue checkbox are
   the quickest tell that a page was not designed. These bring them into the
   chart's ink and magenta without changing how any of them behave. */
input[type=checkbox], input[type=radio] { accent-color: var(--magenta); }

select:not([multiple]):not([size]) {
  -webkit-appearance: none; appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%234f6370' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  background-size: 12px 8px;
}

details:not(.fold) > summary { list-style: none; display: flex;
  align-items: center; gap: 10px; min-height: 32px; cursor: pointer; }
details:not(.fold) > summary::-webkit-details-marker { display: none; }
details:not(.fold) > summary::before {
  content: ""; flex: none; width: 7px; height: 7px; margin: 0 2px 0 1px;
  border: solid currentColor; border-width: 0 1.6px 1.6px 0; opacity: .7;
  transform: rotate(-45deg); transition: transform .15s;
}
details:not(.fold)[open] > summary::before { transform: rotate(45deg) translate(-2px, -1px); }

/* The map's own furniture: the credit line and the scale, set like the
   chart's margin notes rather than in the library's defaults. */
.maplibregl-ctrl-attrib.maplibregl-compact,
.maplibregl-ctrl.maplibregl-ctrl-attrib {
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  font: 11px/1.4 var(--sans); color: var(--muted); border-radius: 999px;
}
.maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-scale {
  background: color-mix(in srgb, var(--paper) 80%, transparent);
  border-color: var(--muted); color: var(--muted); font: 500 10px var(--sans);
}
.maplibregl-ctrl-group { border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }

/* The links every page ends on, above the licence credits. */
.footLinks { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px;
  font-size: 13px; }
.footLinks a { display: inline-block; padding: 2px 0; color: var(--ink); text-decoration: none; }
.footLinks a:hover { color: var(--magenta); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .01ms !important; }
}

/* The bar from the map page, on every other page a paddler reaches from it
   (appbar.js): the four places and Add, so the way back is always the same.
   Desktop: a bar along the top. Phone: the mark and avatar on top, the
   places along the foot, as on the map. */
.sitebar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center;
  gap: 12px; height: 60px; padding: 0 16px 0 20px; background: var(--card);
  border-bottom: 1px solid var(--line); }
.siteMark { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.siteMark .wordmark { font-size: 19px; }
.siteDest { display: flex; gap: 2px; margin-left: 28px; }
.siteDest a, .siteBottom a { font: 500 15px var(--sans); color: var(--muted); text-decoration: none; }
.siteDest a { display: flex; align-items: center; height: 38px; padding: 0 14px; border-radius: 9px; }
.siteDest a:hover { color: var(--ink); }
.siteDest a.on { color: var(--ink); background: var(--tint); font-weight: 600; }
.siteAdd { margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 16px 0 13px; border-radius: 10px; text-decoration: none;
  background: var(--magenta); color: #fff; font: 600 14px var(--sans);
  box-shadow: 0 2px 8px rgba(191, 0, 122, .22); }
.siteAdd::before { content: "+"; font: 400 22px/1 var(--sans); margin-top: -2px; }
.siteAdd:hover { background: var(--magenta-dark); color: #fff; }
.siteMe { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px;
  border-radius: 999px; text-decoration: none; font: 600 14px var(--sans); color: var(--ink); }
.siteMe:hover { background: var(--tint); color: var(--ink); }
.siteAvatar { width: 34px; height: 34px; border-radius: 50%; }
.siteAvatar.blank { display: block; background: var(--tint); }
.siteBottom { display: none; }
@media (max-width: 720px) {
  .sitebar { height: 56px; padding: 0 12px 0 16px; }
  .siteDest, .siteAdd, .siteMe span { display: none; }
  .siteMe { margin-left: auto; padding: 0; }
  body.hasSitebar { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
  .siteBottom { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; display: flex;
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--card); border-top: 1px solid var(--line); }
  .siteBottom a { flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; font-size: 11px; }
  .siteBottom a.on { color: var(--ink); font-weight: 600; }
  .siteBottom svg { width: 24px; height: 24px; fill: none; stroke: currentColor;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .siteBottom .siteFab i { display: grid; place-items: center; width: 54px; height: 54px;
    margin-top: -24px; border-radius: 50%; background: var(--magenta);
    border: 4px solid var(--card); box-shadow: 0 4px 14px rgba(191, 0, 122, .35); }
  .siteBottom .siteFab svg { stroke: #fff; stroke-width: 2.4; }
}
