/* base.css — shared structure for the three direction mockups (A/B/C).
   Colours, radii, fonts and bar shapes come from theme-a.css / theme-b.css / theme-c.css.
   Same markup, same data, three skins: that is the point of the pack.
   Layout: week grid >= 900px · single-day view < 900px. No JS anywhere. */

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

:root {
  --pad: 24px;
  --rowhead: 190px;      /* sticky city column, desktop */
  --cell-h: 44px;        /* day cell height, desktop */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Liberation Sans", Arial, sans-serif;
  --font-num: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --t-11: 11px; --t-12: 12px; --t-13: 13px; --t-14: 14px;
  --t-16: 16px; --t-20: 20px; --t-25: 25px; --t-31: 31px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--t-16)/1.5 var(--font-ui);
}
h1, h2, h3 { margin: 0; font-family: var(--font-head); font-weight: var(--head-weight, 700); letter-spacing: var(--head-track, -0.01em); line-height: 1.15; }
h1 { font-size: var(--t-31); }
h2 { font-size: var(--t-20); }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
code { font-family: var(--font-num); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

a { color: var(--link); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .chip, .cell, .bar, .rows .row { transition: background-color 120ms ease-out, box-shadow 120ms ease-out, color 120ms ease-out; }
}

.wrap { max-width: 1180px; margin: 0 auto; padding: var(--pad); display: grid; gap: var(--space-6); }

/* ---------- mockup badge (not part of the product) ---------- */
.pack { font: var(--t-12)/1.4 var(--font-num); color: var(--muted); border-left: 3px solid var(--accent); padding-left: 10px; }

/* ---------- masthead ---------- */
.masthead { display: grid; gap: var(--space-3); }
.lede { color: var(--muted); max-width: 62ch; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.url {
  font-size: var(--t-12); color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px 10px;
  overflow-wrap: anywhere; min-width: 0;
}
.hint { font-size: var(--t-12); color: var(--muted); }

.btn {
  font: 600 var(--t-14)/1 var(--font-ui); color: var(--btn-ink, var(--ink));
  background: var(--btn-bg); border: 1px solid var(--btn-line, var(--rule));
  border-radius: var(--btn-radius, var(--radius)); padding: 11px 14px; min-height: 44px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-block { width: 100%; justify-content: center; }

/* ---------- city chips (the plan's city list) ---------- */
.toolbar { display: grid; gap: var(--space-3); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: var(--space-3) 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--t-13); background: var(--chip-bg); border: 1px solid var(--rule);
  border-radius: var(--chip-radius, var(--radius)); padding: 6px 8px;
}
.chip .flag { font: var(--t-11)/1 var(--font-num); color: var(--muted); letter-spacing: 0.04em; }
.chip { position: relative; }
.chip .x {
  all: unset; cursor: pointer; position: relative; min-width: 32px; min-height: 32px;
  display: inline-grid; place-items: center; border-radius: var(--chip-radius, var(--radius));
  color: var(--muted); text-align: center;
}
.chip .x::after { content: ''; position: absolute; inset: -6px; }  /* 44px touch target around a 32px visual */
.chip .x:hover { color: var(--ink); background: var(--surface-2); }
.chip .move { all: unset; cursor: pointer; font: var(--t-11)/1 var(--font-num); color: var(--muted); padding: 0 2px; }
.toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.count { font-size: var(--t-12); color: var(--muted); }

/* ---------- panel ---------- */
.panel { display: grid; gap: var(--space-3); }
.panel-head { display: grid; gap: 6px; }
.axis { font-size: var(--t-12); color: var(--muted); font-family: var(--font-num); }

/* ---------- desktop week grid ---------- */
.grid {
  display: grid;
  grid-template-columns: var(--rowhead) repeat(7, minmax(0, 1fr));
  gap: 1px; background: var(--rule);
  border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
}
.grid > * { background: var(--surface); padding: 6px 8px; min-width: 0; }
.corner { background: var(--surface-2); display: flex; align-items: flex-end; }
.corner span { font-size: var(--t-12); color: var(--muted); }
.dayhead { background: var(--surface-2); display: grid; gap: 2px; align-content: start; }
.dayhead b { font-size: var(--t-13); font-weight: 600; }
.dayhead .date { font: var(--t-11)/1 var(--font-num); color: var(--muted); }
.ruler { position: relative; height: 13px; margin-top: 4px; }
.ruler i { position: absolute; left: var(--x); transform: translateX(-50%); font: 10px/1 var(--font-num); color: var(--muted); font-style: normal; }
.ruler i:first-child { transform: none; }
.dayhead.weekend, .cell.weekend { background: var(--weekend); }
.dayhead.today, .cell.today { background: var(--today-tint); }
.nowtag { font: 700 10px/1 var(--font-num); color: var(--now-c); }

.rowhead { background: var(--surface-2); font-size: var(--t-13); display: grid; gap: 1px; align-content: center; }
.rowhead strong { font-weight: 600; }
.rowhead .tz { font: var(--t-11)/1.2 var(--font-num); color: var(--muted); }
.rowhead em { font-style: normal; font-size: var(--t-12); color: var(--muted); }

.cell { position: relative; height: var(--cell-h); padding: 0; background: var(--out); }
.cell::before { /* night band 22:00-06:00, tint only: never the only signal */
  content: ''; position: absolute; inset: 0 auto 0 0; width: 25%;
  background: var(--night);
}
.cell::after { /* right edge of the night band = 06:00 */
  content: ''; position: absolute; top: 0; bottom: 0; left: 25%; width: 1px; background: var(--night-edge);
}
.bar {
  position: absolute; top: 11px; bottom: 11px;
  left: var(--from); width: calc(var(--to) - var(--from));
  background: var(--work); border-radius: var(--bar-radius);
  box-shadow: inset 0 0 0 1px var(--work-edge);
}
.cell.today .nowline { position: absolute; top: 0; bottom: 0; left: var(--at); width: 2px; background: var(--now-c); }
.cell.today .nowline::before { content: ''; position: absolute; top: 0; left: -3px; border: 4px solid transparent; border-top-color: var(--now-c); border-bottom: 0; }

/* best-overlap row */
.rowhead.best, .cell.best { background: var(--surface-2); }
.bar.best { background: var(--overlap); box-shadow: inset 0 0 0 1px var(--overlap-edge); }

.caption { font-size: var(--t-12); color: var(--muted); }
.caption b { color: var(--ink); font-weight: 600; }

/* ---------- selection detail: the text truth layer ---------- */
.detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--space-2); }
.detail li {
  display: flex; align-items: baseline; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface);
  font-size: var(--t-13);
}
.detail .clock { font-family: var(--font-num); font-variant-numeric: tabular-nums; margin-left: auto; }
.detail .state { font-size: var(--t-12); color: var(--muted); }
.detail li.in { border-left: 4px solid var(--work-edge); }
.detail li.out { border-left: 4px solid var(--rule); }
.detail .mark { font-family: var(--font-num); color: var(--muted); }
.detail li.in .mark { color: var(--work-edge); }

/* ---------- phone view: one day at a time ---------- */
.phone { display: none; }
.daybar { display: flex; align-items: center; gap: var(--space-2); }
.daychips { display: flex; gap: 4px; flex: 1; }
.daychips .d {
  flex: 1; text-align: center; font: 600 var(--t-12)/1 var(--font-ui);
  padding: 12px 0; min-height: 44px; border: 1px solid var(--rule);
  border-radius: var(--chip-radius, var(--radius)); background: var(--chip-bg); color: var(--ink);
}
.daychips .d[aria-current="date"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.rows { display: grid; }
.rows .row { border-top: 1px solid var(--rule); padding: var(--space-3) 0; display: grid; gap: 6px; }
.rows .rowhead { background: none; padding: 0; display: flex; gap: 8px; align-items: baseline; font-size: var(--t-13); }
.rows .rowhead .clock { font-family: var(--font-num); margin-left: auto; color: var(--muted); }
.track { position: relative; height: 30px; background: var(--out); border-radius: var(--bar-radius); }
.track .night { position: absolute; inset: 0 auto 0 0; width: 25%; background: var(--night); }
.track .bar { top: 4px; bottom: 4px; }
.track .bar .lab {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font: 600 10px/1 var(--font-num); color: var(--work-ink); white-space: nowrap;
}
.track .nowline { position: absolute; top: -4px; bottom: -4px; left: var(--at); width: 2px; background: var(--now-c); }
.share-sm { display: grid; gap: var(--space-2); }
.share-sm details summary { font-size: var(--t-13); color: var(--muted); cursor: pointer; min-height: 24px; }
.share-sm .url { display: block; margin-top: 8px; }

/* ---------- responsive switch ---------- */
@media (max-width: 899px) {
  .week { display: none; }
  .phone { display: grid; gap: var(--space-3); }
}
@media (min-width: 900px) {
  .phone { display: none; }
}
@media (max-width: 480px) {
  :root { --pad: 16px; }
  h1 { font-size: var(--t-25); }
  .masthead .share { gap: var(--space-2); }
}
@media print {
  .pack, .phone { display: none; }
  body { background: #fff; }
}
