/* Trackbirds · base
   Tokens and shared components. Taken from design/home/home.css (the
   reference); page-specific styles live in home.css and app.css. */

:root {
  color-scheme: light;

  /* paper and ink */
  --paper: #f5f8fb;
  --paper-2: #e9f0f7;
  --surface: #fff;                /* cards, inputs, popovers */
  --ink: #1c2e45;
  --ink-soft: #46586e;

  /* soft blues (sky) */
  --sky-100: #dde8f3;
  --sky-200: #bcd2e8;
  --sky-300: #93b5d8;
  --sky-400: #6a94c2;
  --sky-500: #3f6c9c;

  /* the one warm accent: rose (bullfinch breast) */
  --rose: #e9809c;
  --rose-hover: #ef97af;
  --rose-soft: #f8d7e0;
  --rose-wash: #fff8fa;
  --rose-ink: #a3385a;
  --on-rose: #1c2e45;             /* text on rose (buttons, badges): same in both themes */
  --ochre: #e9b44c;
  --danger-wash: #fce8ee;
  --danger-line: #edb8c7;

  /* shadows ("r g b" so alpha can vary) and the dim behind dialogs */
  --shadow: 28 46 69;
  --backdrop: rgb(28 46 69 / .25);

  /* night: terminal blocks and the privacy band, dark in both themes */
  --night: #1c2e45;
  --on-night: #eef3f8;
  --on-night-soft: #c9d6e4;
  --night-line: rgb(188 210 232 / .45);
  --night-accent: #93b5d8;
  --night-card: #f5f8fb;          /* the light "what is sent" card inside the band */
  --night-card-ink: #1c2e45;

  /* the bird keeps its colours in both themes */
  --bird-line: #1c2e45;
  --bird-line-deep: #0f1c2c;
  --bird-body: #bcd2e8;
  --bird-wing: #6a94c2;
  --bird-pale: #e6eef7;
  --bird-mid: #93b5d8;
  --bird-deep: #3f6c9c;
  --bird-breast: #e9809c;
  --bird-beak: #e9b44c;
  --note-paper: #fff;

  /* bird (variables inherited by the sprite) */
  --b-body: var(--bird-body);
  --b-wing: var(--bird-wing);
  --b-breast: var(--bird-breast);
  --b-line: var(--bird-line);

  /* boxes (phase 2): Personal warm, Work blue */
  --box-personal: #fbf4e6;
  --box-personal-line: #f0dcb4;
  --box-personal-ink: #8a5d0f;
  --box-work: #eef4fa;
  --box-work-line: var(--sky-200);
  --box-work-ink: var(--sky-500);

  /* desktop categories: blues for work at the keyboard, warm only for meetings */
  --cat-code: var(--sky-500);
  --cat-terminal: #5a6f8a;
  --cat-browser: var(--sky-300);
  --cat-docs: #8db3a2;
  --cat-design: #a89cc9;
  --cat-chat: #6cabaf;
  --cat-email: #d9b765;
  --cat-meeting: var(--rose);
  --cat-other: #c3ccd6;
  --stripe: rgb(255 255 255 / .7); /* calls: stripes over the category colour */

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: 10px;
}

/* Dark theme: "Auto" follows the system; data-theme on <html> (set before
   first paint from localStorage) forces light or dark. The two blocks below
   must stay identical. Same identity: soft blues and the rose accent. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0f1a27;
  --paper-2: #16253a;
  --surface: #162536;
  --ink: #e6edf5;
  --ink-soft: #a9b8c9;
  --sky-100: #1d3149;
  --sky-200: #2b4562;
  --sky-300: #4d74a0;
  --sky-400: #6f9bcc;
  --sky-500: #9cc0e6;
  --rose-hover: #f19ab2;
  --rose-soft: #4b2836;
  --rose-wash: #2a1c25;
  --rose-ink: #f4a9be;
  --danger-wash: #3b1f2b;
  --danger-line: #7d3c53;
  --shadow: 0 0 0;
  --backdrop: rgb(0 0 0 / .55);
  --night: #08111b;
  --box-personal: #221d14;
  --box-personal-line: #4a3c20;
  --box-personal-ink: #e8c27a;
  --box-work: #13233a;
  --cat-terminal: #8197b3;
  --cat-other: #9aa6b4;
  --stripe: rgb(255 255 255 / .55);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0f1a27;
    --paper-2: #16253a;
    --surface: #162536;
    --ink: #e6edf5;
    --ink-soft: #a9b8c9;
    --sky-100: #1d3149;
    --sky-200: #2b4562;
    --sky-300: #4d74a0;
    --sky-400: #6f9bcc;
    --sky-500: #9cc0e6;
    --rose-hover: #f19ab2;
    --rose-soft: #4b2836;
    --rose-wash: #2a1c25;
    --rose-ink: #f4a9be;
    --danger-wash: #3b1f2b;
    --danger-line: #7d3c53;
    --shadow: 0 0 0;
    --backdrop: rgb(0 0 0 / .55);
    --night: #08111b;
    --box-personal: #221d14;
    --box-personal-line: #4a3c20;
    --box-personal-ink: #e8c27a;
    --box-work: #13233a;
    --cat-terminal: #8197b3;
    --cat-other: #9aa6b4;
    --stripe: rgb(255 255 255 / .55);
  }
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--rose-ink);
  outline-offset: 3px;
  border-radius: 4px;
}

.sprite { position: absolute; }

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--ink);
  color: var(--paper);
  padding: .5rem .8rem;
  border-radius: 6px;
  z-index: 10;
}
.skip:focus { top: 1rem; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- typography ---------- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 100;
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.6rem, 7.2vw, 5.6rem);
  font-weight: 350;
  letter-spacing: -0.025em;
}
h1 em {
  font-style: italic;
  color: var(--sky-500);
}

h2 { font-size: clamp(1.9rem, 4.2vw, 3rem); }
h3 { font-size: 1.35rem; font-weight: 500; }

p { margin: 0 0 1em; }

.eyebrow,
.section-kicker {
  font-family: var(--font-mono);
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--sky-500);
  margin-bottom: 1.25rem;
}

.fine { font-size: .875rem; color: var(--ink-soft); }

q { quotes: "“" "”" "‘" "’"; }

code, kbd, samp { font-family: var(--font-mono); font-size: .92em; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--rose);
  color: var(--on-rose);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  padding: .85rem 1.4rem;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 1px 0 rgb(var(--shadow) / .25), inset 0 -2px 0 rgb(28 46 69 / .12);
  transition: transform .2s ease, background-color .2s ease;
}
.btn:hover { background: var(--rose-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }
.btn-small { padding: .5rem 1rem; font-size: .95rem; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  background: transparent;
  border: 1.5px solid var(--sky-300);
  border-radius: 999px;
  padding: .35rem .8rem;
  white-space: nowrap;
  color: var(--sky-500);
  text-decoration: none;
  cursor: pointer;
}
a.btn-ghost:hover, button.btn-ghost:hover { border-color: var(--sky-500); color: var(--ink); }

.link-quiet {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: var(--sky-300);
  text-underline-offset: .25em;
  text-decoration-thickness: 1.5px;
}
.link-quiet:hover { color: var(--ink); text-decoration-color: var(--rose); }

/* ---------- header ---------- */

.site-header { padding-block: 1.25rem; }

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: flex-end;
  gap: .4rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 100;
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand-bird { width: 2rem; height: auto; margin-bottom: -.1rem; }

.nav { display: flex; align-items: center; gap: 1.5rem; }
.nav-link, .nav-login {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: .975rem;
}
.nav-link:hover, .nav-login:hover { color: var(--ink); }
.nav-login { color: var(--ink); font-weight: 600; }

/* ---------- bird (sprite) ---------- */

.bird-lines path {
  stroke: var(--b-line);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.b-body { fill: var(--b-body); }
.b-wing { fill: var(--b-wing); }
.b-breast { fill: var(--b-breast); }
.b-beak { fill: var(--bird-beak); }
.b-legs { fill: none; }
.b-eye { fill: var(--b-line); }

.tone-pale { --b-body: var(--bird-pale); --b-wing: var(--bird-mid); }
.tone-deep { --b-body: var(--bird-mid); --b-wing: var(--bird-deep); --b-breast: var(--bird-beak); }

/* flying bird (inline, so the wing can flap) */
.f-tail, .f-body, .f-breast, .f-beak, .f-wing {
  stroke: var(--bird-line);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.f-tail { fill: var(--bird-wing); }
.f-body { fill: var(--bird-body); }
.f-breast { fill: var(--bird-breast); }
.f-beak { fill: var(--bird-beak); }
.f-eye { fill: var(--bird-line); }
.f-wing {
  fill: var(--bird-wing);
  transform-box: fill-box;
  transform-origin: 30% 100%;
  animation: flap .34s ease-in-out infinite alternate;
}

@keyframes flap {
  from { transform: scaleY(1); }
  to { transform: scaleY(-.55); }
}

.wire {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.3;
  opacity: .75;
}

/* ---------- lanes (day view) ---------- */

.day-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--sky-200);
  border-radius: 14px;
  padding: clamp(1rem, 3vw, 1.75rem);
  box-shadow: 0 1px 0 var(--sky-100), 0 18px 40px -28px rgb(var(--shadow) / .35);
}

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.day-date {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 100;
  font-size: 1.3rem;
  margin: 0;
}
.day-total { margin: 0; font-size: .9rem; color: var(--ink-soft); }

.lanes {
  --label: 5.2rem;
  display: grid;
  gap: 1.15rem;
  margin-bottom: 1.5rem;
}
.scale {
  position: relative;
  margin-left: var(--label);
  height: 1rem;
  font-size: .72rem;
  color: var(--ink-soft);
}
.scale span {
  position: absolute;
  left: calc(var(--at) * 1%);
  transform: translateX(-50%);
}
.lane {
  display: grid;
  grid-template-columns: var(--label) 1fr;
  align-items: center;
}
.lane-name { font-size: .85rem; color: var(--ink-soft); }
.lane-wire {
  position: relative;
  height: 18px;
  background: linear-gradient(var(--ink), var(--ink)) 0 50% / 100% 1px no-repeat;
}
.seg {
  position: absolute;
  top: 50%;
  height: 8px;
  margin-top: -4px;
  left: calc(var(--from) * 1%);
  width: calc((var(--to) - var(--from)) * 1%);
  border-radius: 999px;
  transform-origin: left center;
}
.s-a { background: var(--sky-400); }
.s-b { background: var(--sky-300); }
.s-c { background: var(--sky-500); }

.lane-bird {
  position: absolute;
  width: 26px;
  height: auto;
  left: calc(var(--at) * 1%);
  bottom: 50%;
  transform: translateX(-50%);
  margin-bottom: -1px;
}

.entries {
  list-style: none;
  margin: 0;
  padding: 1rem 0 0;
  border-top: 1px dashed var(--sky-200);
  display: grid;
  gap: .55rem;
  font-size: .95rem;
}
.entries li {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: .75rem;
  align-items: baseline;
}
.entries .t { font-size: .8rem; color: var(--ink-soft); }
.entries .dot {
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  align-self: center;
}

@keyframes seg-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes bird-land {
  from { opacity: 0; transform: translate(-30%, -16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- footer ---------- */

.site-footer { position: relative; padding-bottom: 2.5rem; background: var(--paper); }
.footer-birds { position: absolute; inset: 0 0 auto 0; height: 60px; pointer-events: none; }
.fb { position: absolute; width: 30px; height: auto; top: calc(37.5px - 30px * 32 / 40); }
.fb-1 { left: calc(50% - 44px); }
.fb-2 { left: calc(50% + 14px); transform: scaleX(-1); }
.footer-wire { width: 100%; height: 60px; }
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}
.footer-row .fine { margin: 0; }
.footer-nav { display: flex; gap: 1.5rem; }
.footer-nav a { color: var(--ink-soft); text-decoration: none; font-size: .95rem; }
.footer-nav a:hover { color: var(--ink); }

/* ---------- theme switch (Auto / Light / Dark) ---------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font: inherit;
  font-size: .85rem;
  color: var(--ink-soft);
  background: transparent;
  border: 1.5px solid var(--sky-200);
  border-radius: 999px;
  padding: .2rem .65rem .2rem .45rem;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--sky-400); }
.theme-icon { width: 1rem; height: 1rem; }
.ti-ring { fill: none; stroke: currentColor; stroke-width: 1.5; }
.ti-half { fill: currentColor; }
.ti-full { fill: currentColor; display: none; }
[data-theme-current="light"] .ti-half { display: none; }
[data-theme-current="dark"] .ti-half { display: none; }
[data-theme-current="dark"] .ti-full { display: inline; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .nav-link { display: none; }
}

@media (max-width: 480px) {
  body { font-size: 1rem; }
  .nav { gap: .9rem; }
  .brand { font-size: 1.25rem; }
  .brand-bird { width: 1.7rem; }
  .btn { white-space: nowrap; }
  .btn-small { padding: .45rem .85rem; }
  .lanes { --label: 4.2rem; }
  .entries li { grid-template-columns: auto 1fr; }
  .entries .dot { display: none; }
  .day-head { flex-direction: column; }
}

@media (max-width: 400px) {
  .site-header .brand-bird { display: none; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
