/* Popcorn: the visual system, from the Figma file (SRi7cpWyF72zoorgiLw0eR).
   Built from the frames alone in 0.11; since 0.16 it is the only stylesheet.

   The design is drawn at 393pt wide with a 45pt gutter, so a 302pt column.
   JC found that too narrow on a phone (21 September): the gutter is 16px and
   the column 408px, so every iPhone up to a Pro Max runs edge to 16px.

   The whole identity is four things: cream paper, near-black ink, one red,
   and a hard 4px drop under every raised surface. Instrument Serif carries
   the voice (the second half of a title turns italic and red), Inter does
   the work. */

:root {
  --cream: #FFFBF0;
  --white: #FFFFFF;
  --ink: #0A0A0A;
  --night: #0F0F0E;
  --red: #F80909;
  --green: #00C431;
  --sand: #D8D2C4;
  --stone: #706A5D;
  --slate: #514E47;

  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --line: 2px solid var(--ink);
  --line-thin: 1.5px solid var(--ink);
  --drop: 0 4px 0 var(--ink);
  --drop-sm: 0 1px 0 var(--ink);

  --r-field: 14px;
  --r-chip: 11px;
  --r-btn: 20px;
  --r-tile: 16px;

  --col: 408px;
  --gutter: 16px;

  /* The tab bar's footprint (page.js): the 60px cream bar and the safe area
     under it (0.51). Anything fixed above it, and the room a screen leaves at
     its foot, is measured from this one number. */
  --tabbar-h: calc(60px + env(safe-area-inset-bottom));

  color-scheme: light;
}

* { box-sizing: border-box; }

/* An app, not a site (JC, 21 September): no pinch, no double-tap zoom. The
   viewport meta and a gesturestart guard in pop.html do the rest. */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
body.dark { background: var(--ink); color: var(--white); }
body.night { background: var(--night); color: var(--white); }

a { color: inherit; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

/* ── the column ─────────────────────────────────────────────── */

.screen {
  width: 100%;
  max-width: calc(var(--col) + 2 * var(--gutter));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px var(--gutter) calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
.screen > form { display: flex; flex-direction: column; flex: 1; }
.foot { margin-top: auto; padding-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.foot.row { flex-direction: row; gap: 10px; }
.foot.row > * { flex: 1; }

/* ── type ───────────────────────────────────────────────────── */

.title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 40px;
  line-height: 38px;
  letter-spacing: -0.01em;
  margin: 30px 0 28px;
  text-wrap: balance;
}
.title em, .hero em { font-style: italic; color: var(--red); }
.hero {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 48px;
  line-height: 46px;
  margin: 0 0 18px;
}

.label {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--stone);
  margin: 0 0 10px;
}
.hint { font-size: 11px; color: var(--stone); margin: 8px 0 0; }
.muted { color: var(--sand); }

.field { margin-bottom: 20px; }
.field.gap { margin-bottom: 32px; }

/* ── inputs ─────────────────────────────────────────────────── */

.input, select.input, textarea.input {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 15px;
  font: 600 13px/1 var(--sans);
  color: var(--ink);
  background: var(--white);
  border: var(--line);
  border-radius: var(--r-field);
  appearance: none;
  -webkit-appearance: none;
}
/* iOS zooms into any field under 16px on focus. The design's 13px holds on
   screen; the zoom is what is prevented. */
@supports (-webkit-touch-callout: none) {
  .input, select.input, textarea.input, .tag input { font-size: 16px; }
}
.input::placeholder { color: var(--stone); font-weight: 500; }
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%230A0A0A' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  padding-right: 34px;
}
textarea.input {
  height: 105px;
  padding: 14px 15px;
  font-weight: 500;
  line-height: 1.35;
  resize: none;
}
.count { font-size: 11px; color: var(--stone); text-align: right; margin-top: 6px; }

/* ── buttons ────────────────────────────────────────────────── */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 47px;
  padding: 0 18px;
  font: 800 16px/1 var(--sans);
  color: var(--white);
  text-decoration: none;
  background: var(--red);
  border: var(--line);
  border-radius: var(--r-btn);
  box-shadow: var(--drop);
  cursor: pointer;
  transition: transform .12s cubic-bezier(.16, 1, .3, 1), box-shadow .12s cubic-bezier(.16, 1, .3, 1);
}
.btn:active { transform: translateY(3px); box-shadow: var(--drop-sm); }
.btn.light { background: var(--white); color: var(--ink); font-weight: 600; }
.btn.flat { box-shadow: none; }
.btn.flat:active { transform: none; }
.btn .g { flex: none; }

/* On a dark ground a button has no outline and no drop (JC, 7 October 2026): never a
   white outline. The door's second button is a soft fill instead. */
body.dark .btn, body.night .btn { border-color: transparent; box-shadow: none; }
body.dark .btn:active, body.night .btn:active { transform: scale(.98); box-shadow: none; }
.btn.door { border-color: transparent; background: rgba(255,255,255,.14); box-shadow: none; font-size: 13px; font-weight: 600; }
.btn.door.solid { background: var(--white); color: var(--ink); }
.btn.door:active { transform: scale(.98); }

.small-btn {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  font: 600 11px/1 var(--sans);
  color: var(--ink);
  background: var(--white);
  border: var(--line-thin);
  border-radius: var(--r-chip);
  box-shadow: var(--drop-sm);
  cursor: pointer;
}

/* ── chips (radio groups) ───────────────────────────────────── */

.chips { display: flex; flex-wrap: wrap; gap: 10px 10px; }
.chips.fill > * { flex: 1; }
.chip-in { position: absolute; opacity: 0; pointer-events: none; }
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 14px;
  font: 600 11px/1 var(--sans);
  white-space: nowrap;
  color: var(--ink);
  background: var(--white);
  border: var(--line-thin);
  border-radius: var(--r-chip);
  box-shadow: var(--drop-sm);
  cursor: pointer;
  user-select: none;
  width: 100%;
}
.chip-in:checked + .chip { background: var(--red); color: var(--white); }
.chip-in:focus-visible + .chip { outline: 3px solid var(--red); outline-offset: 3px; }
.chip-in:disabled + .chip { color: var(--stone); border-color: var(--stone); box-shadow: none; cursor: default; }
.chips > span { display: inline-flex; flex: 0 0 auto; }
.chips.fill > span { flex: 1; }
button.chip { font-family: var(--sans); }

/* ── progress ───────────────────────────────────────────────── */

.bars { display: flex; gap: 4px; }
.bar { flex: 1; height: 5px; border-radius: 100px; background: var(--sand); }
.bar.on { background: var(--red); }
body.night .bar { background: var(--stone); }
body.night .bar.on { background: var(--red); }

.meter { margin-top: 22px; }
.meter-top { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; color: var(--stone); margin-bottom: 8px; }
.meter-track { height: 7px; border-radius: 100px; background: var(--sand); overflow: hidden; }
body.night .meter-track { background: var(--stone); }
.meter-fill { height: 100%; background: var(--red); border-radius: 100px; min-width: 7px; }

/* ── messages ───────────────────────────────────────────────── */

.err, .ok {
  font-size: 12px;
  font-weight: 600;
  border: var(--line-thin);
  border-radius: var(--r-field);
  padding: 10px 13px;
  margin: 0 0 18px;
}
.err { background: #FFE3E0; color: #A10000; }
.ok { background: #E1F7E7; color: #0A6B22; }
body.dark .err, body.dark .ok { border-color: var(--white); }

/* ── the avatar ─────────────────────────────────────────────── */

.avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--red);
  color: var(--white);
  font-family: var(--serif);
  line-height: 1;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── the trades on a card: up to three pills, one row that wraps ── */

.face-roles { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.face-roles .face-role { margin-top: 0; }

/* ── grounds: the ink contract ──────────────────────────────── */

.ink-light { color: var(--white); }
.ink-dark { color: var(--ink); }

/* ── check lists ────────────────────────────────────────────── */

.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.checks li { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.checks .g { flex: none; }
.checks li.later { color: var(--stone); }
.tag-soon {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  border: 1px solid currentColor; border-radius: 100px; padding: 2px 7px; margin-left: 2px;
}

/* ── the dock: one action pinned on the tab bar ──────────────── */

/* Sits flush on the tab bar, never with a gap for the page to show through.
   A screen with a dock leaves calc(var(--tabbar-h) + 100px) at its foot. */
.dock {
  position: fixed; left: 0; right: 0; bottom: var(--tabbar-h); z-index: 4;
  padding: 24px var(--gutter) 10px;
  background: linear-gradient(rgba(255,251,240,0), var(--cream) 24px);
}
.dock .btn { max-width: var(--col); margin: 0 auto; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* The bar under the owner's screens: Carte, Réseau, Explorer, Collection, Profil (src/page.js'
   tabBar). Served with pop.css, as one cached stylesheet (src/static.js).

   Flat since 0.51 (JC's frame of 8 October), where it was a floating glass pill: a cream bar
   across the foot of the screen, the page's ground ending on it, the active tab in red. Its
   height with the safe area is --tabbar-h in pop.css; keep the two in step.

   The notifications' bell (0.54) comes with the bar: the icon alone, no frame (JC), in a
   49px tap area at the column's top right corner, on the line of the screen's first
   element (48px down, where Réseau's box and Explorer's search start; centred on the title
   where a title leads), the number in red, the icon red on the wall itself. That first element stops short of it; nothing moves down. On the card home (.float)
   it sits in the top corner, the photo centred below it with the rest of the column (0.54.0.2). */
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; height: var(--tabbar-h);
            padding: 0 6px env(safe-area-inset-bottom); background: var(--cream); box-shadow: 0 -1px 0 rgba(10, 10, 10, .06); }
  .tabbar nav { height: 60px; max-width: 440px; margin: 0 auto; display: flex; justify-content: space-between; }
  .tabbar a, .tabbar span { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
            font: 500 11px/1 var(--sans); color: var(--ink); text-decoration: none; white-space: nowrap;
            -webkit-tap-highlight-color: transparent; transition: transform .15s; }
  .tabbar a:active { transform: scale(.92); }
  /* One 26 × 24 slot for every icon, so the labels sit on one line, and each glyph inset
     to one optical size (0.56.0.2): at a common height the wide Carte ran 27px across and
     the full squares of Réseau and Explorer outweighed the rest. */
  .tabbar svg { width: 26px; height: 24px; }
  .tabbar [data-tab="carte"] svg { padding: 0 1px; }
  .tabbar [data-tab="reseau"] svg, .tabbar [data-tab="explorer"] svg { padding: 2px 3px; }
  .tabbar [data-tab="collection"] svg { padding: 1.5px 2.5px; }
  .tabbar [data-tab="profil"] svg { padding: 1.5px; }
  .tabbar .on { color: var(--red); font-weight: 700; }
  .tabbar .off { color: var(--stone); opacity: .6; }
  .tabbar a.dot::after { content: ""; position: absolute; top: 7px; left: calc(50% + 9px); width: 9px; height: 9px;
            border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--cream); }
  .pc-toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); z-index: 95; display: flex; align-items: center; gap: 10px;
              padding: 8px 18px 8px 8px; border-radius: 100px; background: var(--ink); color: var(--cream); text-decoration: none;
              font: 500 14px/1.2 var(--sans); white-space: nowrap; box-shadow: 0 12px 34px rgba(10, 10, 10, .32);
              transform: translate(-50%, calc(-100% - 40px)) scale(.9); transition: transform .55s cubic-bezier(.2, 1.4, .4, 1); }
  .pc-toast.in { transform: translate(-50%, 0) scale(1); }
  .pc-toast img { width: 36px; height: 36px; animation: pc-pop .7s .4s cubic-bezier(.3, 1.8, .5, 1) both; }
  .pc-toast b { font-weight: 800; color: var(--white); }
  @keyframes pc-pop { 0% { transform: scale(.4) rotate(-30deg); } 100% { transform: none; } }
  @media (prefers-reduced-motion: reduce) { .pc-toast { transition: opacity .3s; transform: translate(-50%, 0); opacity: 0; } .pc-toast.in { opacity: 1; } .pc-toast img { animation: none; } }
  .pc-bell { position: absolute; z-index: 4; top: calc(48px + env(safe-area-inset-top)); right: max(var(--gutter), calc((100% - var(--col)) / 2));
            width: 49px; height: 49px; display: grid; place-items: center;
            color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; transition: transform .15s; }
  .pc-bell svg { width: 23px; height: auto; }
  .pc-bell:active { transform: scale(.92); }
  .pc-bell.on { color: var(--red); }
  .pc-bell .n { position: absolute; top: 6px; left: 25px; min-width: 19px; height: 19px; border-radius: 10px; padding: 0 5px;
            background: var(--red); color: var(--white); box-shadow: 0 0 0 2px var(--cream); font: 700 10px/19px var(--sans); text-align: center; }
  .pc-bell .n[hidden] { display: none; }
  .pc-bell.float { top: calc(24px + env(safe-area-inset-top)); }
  body:has(> .pc-bell:not(.float)) .screen > :first-child { margin-right: 52px; }
  body:has(.screen > .title:first-child) > .pc-bell { top: calc(38px + env(safe-area-inset-top)); }
