/* Self CRM. The visual language lives in DESIGN.md: a hot-rod garage at night. Dark only. */
@font-face { font-family: 'Plex'; font-weight: 400; font-display: swap; src: url(/fonts/plex-400-he.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Plex'; font-weight: 400; font-display: swap; src: url(/fonts/plex-400-la.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF; }
@font-face { font-family: 'Plex'; font-weight: 600; font-display: swap; src: url(/fonts/plex-600-he.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Plex'; font-weight: 600; font-display: swap; src: url(/fonts/plex-600-la.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF; }
@font-face { font-family: 'Karantina'; font-weight: 700; font-display: swap; src: url(/fonts/karantina-he.woff2) format('woff2'); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Karantina'; font-weight: 700; font-display: swap; src: url(/fonts/karantina-la.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF; }
@font-face { font-family: 'Black Ops One'; font-display: block; src: url(/fonts/blackops.woff2) format('woff2'); }

:root {
  color-scheme: dark;
  --bg: #141413;
  --chest: #0e0e0d;
  --surface: #1c1c1a;
  --line: #2a2926;
  --line-strong: #3a3935;
  --ink: #E6E3DC;
  --ink-bright: #E9E4D8;
  --muted: #8d8a82;
  --dim: #55524c;
  --accent: #E8461E;
  --on-accent: #1A0500;

  --body: 'Plex', -apple-system, sans-serif;
  --display: 'Karantina', 'Plex', sans-serif;
  --digits: 'Black Ops One', 'Plex', sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* Worn steel: dark blotches, diagonal scratches, horizontal brushing, base plate. */
  --steel:
    radial-gradient(circle at 18% 30%, #0006, #0000 35%),
    radial-gradient(circle at 82% 75%, #0004, #0000 40%),
    repeating-linear-gradient(112deg, #0000 0 11px, #ffffff0d 11px 12px),
    repeating-linear-gradient(90deg, #ffffff08 0 1px, #0000 1px 3px),
    linear-gradient(180deg, #45443f, #2a2926);
  --rivets:
    radial-gradient(circle at 12px 50%, #9a978f 0 2px, #3a3935 2.5px, #0000 3.5px),
    radial-gradient(circle at calc(100% - 12px) 50%, #9a978f 0 2px, #3a3935 2.5px, #0000 3.5px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 var(--body);
  font-variant-numeric: tabular-nums;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  caret-color: var(--accent);
}
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header: a riveted steel plate that runs up under the status bar. */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 6px) 28px 8px;
  background: var(--rivets), var(--steel);
  border-bottom: 1px solid #000;
  box-shadow: inset 0 -1px 0 #ffffff10;
}
.logo { font: 22px/1 'Black Ops One', var(--display); color: #d9d4c7; direction: ltr; text-shadow: 0 1px 0 #000; letter-spacing: .02em; }
.gear { display: grid; place-items: center; width: 44px; height: 44px; margin-inline-end: -12px; color: var(--muted); }
.gear svg { width: 22px; height: 22px; }

main { padding: 16px 16px 32px; overflow-y: auto; }
main > * { max-width: 65ch; }
h1 { font: 700 56px/1 var(--display); color: var(--ink-bright); margin: 4px 0 12px; }
h2 { font: 700 32px/1.1 var(--display); color: var(--ink-bright); margin: 24px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }

/* Drawer chest: the main navigation, by the thumb. Scrolls sideways so life areas can be added. */
nav {
  display: flex;
  gap: 4px;
  padding: 10px 8px calc(env(safe-area-inset-bottom) + 8px);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  background: var(--chest);
  border-top: 1px solid #000;
}
nav::-webkit-scrollbar { display: none; }
nav a {
  flex: 1 0 76px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-height: 56px;
  padding: 10px 4px 8px;
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid #000;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 #ffffff0d;
  text-decoration: none;
  transition: transform .16s var(--ease), background-color .16s var(--ease);
}
nav a::before { content: ''; width: 22px; height: 3px; border-radius: 2px; background: var(--dim); transition: background-color .16s var(--ease); }
nav a[aria-current] { transform: translateY(-8px); background: #2f2e2a; }
nav a[aria-current]::before { background: var(--accent); }
nav a:last-child span { color: var(--muted); }

/* Dymo tape: the drawer labels. */
.dymo {
  display: inline-block;
  background: #121212;
  color: #eee;
  font: 600 12px/1.4 var(--body);
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: 2px;
  box-shadow: inset 0 1px 0 #ffffff22, inset 0 -1px 0 #0008;
  white-space: nowrap;
}

.logged-out header, .logged-out nav { visibility: hidden; }

/* Controls */
button, input { font: inherit; width: 100%; min-height: 52px; border-radius: 6px; padding: 0 16px; }
input {
  background: var(--chest);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 2px 4px #0008;
}
input:focus { outline: none; border-color: var(--accent); }
input::placeholder { color: var(--muted); }
button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--ink);
  font-weight: 600;
  background: var(--steel);
  border: 1px solid #000;
  box-shadow: inset 0 1px 0 #ffffff1a, 0 2px 4px #0006;
  cursor: pointer;
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
button::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent); }
button:active { transform: translateY(1px); box-shadow: inset 0 2px 5px #000a; }
button:disabled { opacity: .55; cursor: default; }
button.quiet { background: none; border: 0; box-shadow: none; color: var(--muted); font-weight: 400; }
button.quiet::before { display: none; }

/* LCD readout: numbers that are measurements (streak, gear, stage). */
.lcd {
  display: inline-block;
  min-width: 3.2em;
  background: #0b0b0a;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 8px;
  font: 600 18px/1.6 var(--digits);
  font-synthesis: none;
  letter-spacing: .04em;
  color: var(--accent);
  text-align: center;
}

/* Rows */
.rows { margin-top: 8px; }
.rows details { border-bottom: 1px solid var(--line); }
.rows summary { display: flex; align-items: center; gap: 12px; min-height: 56px; list-style: none; cursor: pointer; }
.rows summary::-webkit-details-marker { display: none; }
.rows summary > span:first-child { flex: 1; }
.rows summary svg { width: 20px; height: 20px; flex: none; color: var(--muted); transition: transform .16s var(--ease); }
.rows details[open] summary svg { transform: rotate(180deg); color: var(--accent); }
.rows details p { margin: 0 0 16px; padding-inline-end: 32px; color: var(--muted); font-size: 15px; }

.login { max-width: 360px; margin: 18vh auto 0; }
.login .logo { display: block; font-size: 40px; text-align: center; margin-bottom: 28px; }
.error, .status { color: var(--accent); margin-top: 12px; }
.settings dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0 0 20px; }
.settings dt { color: var(--muted); }
.settings dd { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before { transition: none !important; animation: none !important; }
}
