@import url('/fonts/fonts.css');

/* ── Capture ────────────────────────────────────────────────────────────────
   Warm paper, ink, one apricot accent. Built for a thumb at 390px.
   Motion rule: entrances are choreographed once; everything else is feedback.
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --bg:         #F6F1E8;
  --bg-sink:    #EFE8DB;
  --surface:    #FFFDFA;
  --surface-2:  #FBF6EE;
  --ink:        #1A1714;
  --ink-2:      #46403A;
  --muted:      #8C8478;
  --faint:      #B4AB9C;
  --hair:       #E6DCCB;
  --hair-soft:  #EFE7D9;
  --accent:     #C4562C;
  --accent-lo:  #F7E4D8;
  --done:       #5F8A5E;
  --over:       #B93B2C;

  --sh-1: 0 1px 2px rgba(74,54,32,.04), 0 4px 12px -6px rgba(74,54,32,.10);
  --sh-2: 0 2px 6px rgba(74,54,32,.06), 0 16px 34px -14px rgba(74,54,32,.24);
  --sh-3: 0 3px 10px rgba(74,54,32,.09), 0 30px 60px -20px rgba(74,54,32,.34);

  --r:    18px;
  --r-sm: 12px;
  --rail: 74px;                       /* width of the time column */

  --sans:  'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;

  --quart: cubic-bezier(.25, 1, .5, 1);
  --quint: cubic-bezier(.22, 1, .36, 1);
  --expo:  cubic-bezier(.16, 1, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #121110;
    --bg-sink:    #0D0C0B;
    --surface:    #1D1B18;
    --surface-2:  #232019;
    --ink:        #F4EFE6;
    --ink-2:      #D3CABC;
    --muted:      #978E81;
    --faint:      #6E665C;
    --hair:       #2F2A24;
    --hair-soft:  #262119;
    --accent:     #E2865A;
    --accent-lo:  #35251B;
    --done:       #7FA87C;
    --over:       #E07A66;

    --sh-1: 0 1px 2px rgba(0,0,0,.34), 0 4px 12px -6px rgba(0,0,0,.5);
    --sh-2: 0 2px 6px rgba(0,0,0,.4),  0 16px 34px -14px rgba(0,0,0,.62);
    --sh-3: 0 3px 10px rgba(0,0,0,.46), 0 30px 60px -20px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

/* light falling from the top-left, so the page isn't a flat slab */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(128% 62% at 6% -8%, rgba(255,241,225,.9), transparent 60%),
    radial-gradient(92% 48% at 104% 2%, rgba(196,86,44,.075), transparent 62%);
}
@media (prefers-color-scheme: dark) {
  body::before {
    background:
      radial-gradient(128% 62% at 6% -8%, rgba(226,134,90,.11), transparent 60%),
      radial-gradient(92% 48% at 104% 2%, rgba(226,134,90,.05), transparent 62%);
  }
}

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

/* ── shell ──────────────────────────────────────────────────────────────── */
#app { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }

.head {
  padding: calc(env(safe-area-inset-top) + 24px) 22px 4px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  animation: settle .62s var(--expo) backwards;
}
.head h1 {
  margin: 0; font-family: var(--serif); font-weight: 600;
  font-size: clamp(32px, 9vw, 38px); line-height: 1; letter-spacing: -.022em;
  font-variation-settings: 'SOFT' 36, 'opsz' 72;
}
.head .dow {
  display: block; font-weight: 700; font-size: 11px;
  letter-spacing: .19em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 9px;
}
.gear {
  width: 42px; height: 42px; margin: -6px -8px 0 0; border-radius: 50%;
  display: grid; place-items: center; color: var(--muted);
  transition: background .24s var(--quart), color .24s, transform .5s var(--expo);
}
.gear:active { transform: rotate(40deg) scale(.92); background: var(--bg-sink); color: var(--ink); }

/* ── tabs ───────────────────────────────────────────────────────────────── */
.tabs {
  position: relative; display: flex; gap: 2px; padding: 18px 18px 4px;
  animation: settle .62s var(--expo) 60ms backwards;
}
.tab {
  position: relative; z-index: 1; padding: 8px 15px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; letter-spacing: -.005em; color: var(--muted);
  transition: color .3s var(--quart);
  display: inline-flex; align-items: center; gap: 7px;
}
.tab[aria-selected="true"] { color: var(--surface); }
.pill {
  position: absolute; z-index: 0; top: 0; left: 0; height: 36px;
  border-radius: 999px; background: var(--ink); box-shadow: var(--sh-1);
  transition: transform .46s var(--expo), width .46s var(--expo);
  will-change: transform, width;
}
.count {
  min-width: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 800; line-height: 19px; text-align: center;
}

/* ── list ───────────────────────────────────────────────────────────────── */
main { flex: 1; padding: 4px 14px 200px; }

@keyframes settle { from { opacity: 0; transform: translateY(9px); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(14px) scale(.986); } }

.daymark {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 6px; padding: 8px 6px 8px 0;
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  background: linear-gradient(to bottom, var(--bg) 62%, transparent);
  animation: settle .5s var(--expo) backwards;
  animation-delay: calc(var(--i, 0) * 34ms + 90ms);
}
.daymark::after { content: ''; flex: 1; height: 1px; background: var(--hair-soft); }
.daymark.is-today { color: var(--accent); }

/* ── the now line — where you are in the day ────────────────────────────── */
.now {
  position: relative; display: flex; align-items: center;
  height: 22px; margin: 6px 0;
  animation: nowIn .8s var(--expo) backwards;
  animation-delay: calc(var(--i, 0) * 34ms + 150ms);
}
.now::before {                       /* the rule itself, drawn from the dot outwards */
  content: ''; position: absolute; left: 20px; right: 4px; height: 1.5px;
  background: linear-gradient(to right, var(--accent), color-mix(in srgb, var(--accent) 18%, transparent));
  transform-origin: left center;
  animation: drawLine .9s var(--expo) backwards;
  animation-delay: calc(var(--i, 0) * 34ms + 220ms);
}
.now-dot {
  position: relative; z-index: 1; width: 9px; height: 9px; margin-left: 16px;
  border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.now-time {
  position: relative; z-index: 1; margin-left: auto; padding: 2px 9px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em;
}
@keyframes nowIn { from { opacity: 0; } }
@keyframes drawLine { from { transform: scaleX(0); } }

/* ── cards ──────────────────────────────────────────────────────────────── */
.card-wrap {
  position: relative; margin: 7px 0; border-radius: var(--r); overflow: hidden;
}
.card-wrap.collapsing {
  height: 0 !important; margin: 0; opacity: 0;
  transition: height .38s var(--quint), margin .38s var(--quint), opacity .22s ease-out;
}

/* what sits under the card while you swipe */
.behind {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 0 22px;
  font-size: 13px; font-weight: 700; letter-spacing: .02em; color: #fff;
  background: linear-gradient(90deg, var(--done) 50%, var(--accent) 50%);
  opacity: calc(var(--reveal, 0) * .95 + .05);
}
.behind .act { display: inline-flex; align-items: center; gap: 7px; }
.behind svg { width: 16px; height: 16px; }
.act-done  { transform: scale(calc(.86 + var(--reveal, 0) * .14)); transform-origin: left center; }
.act-later { transform: scale(calc(.86 + var(--reveal, 0) * .14)); transform-origin: right center; }
.card-wrap.armed .behind { opacity: 1; }

.card {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  padding: 15px 15px 15px 0; background: var(--surface); border-radius: var(--r);
  box-shadow: var(--sh-1); border: 1px solid var(--hair-soft);
  touch-action: pan-y; will-change: transform;
  transition: transform .42s var(--quint), box-shadow .3s var(--quart), opacity .3s;
  animation: riseIn .58s var(--expo) backwards;
  animation-delay: calc(var(--i, 0) * 34ms + 110ms);
}
.card-wrap.swiping .card { transition: none; }
.card-wrap.swiping .card, .card-wrap.armed .card { box-shadow: var(--sh-2); }
.card.is-new { animation: stamp .62s var(--expo); }
@keyframes stamp {
  0%   { opacity: 0; transform: translateY(16px) scale(.96); }
  58%  { opacity: 1; transform: translateY(-2px) scale(1.008); }
  100% { transform: none; }
}

/* the project spine — colour without noise */
.card::before {
  content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--spine, transparent); opacity: .6;
}
.card.urgent::before { background: var(--over); opacity: 1; }

/* time column */
.when {
  flex: 0 0 var(--rail); padding-left: 16px; padding-top: 1px;
  display: flex; align-items: baseline; gap: 3px; flex-wrap: wrap;
  font-family: var(--serif); color: var(--ink);
  font-variant-numeric: tabular-nums lining-nums;
}
.t-hour {
  font-size: 25px; font-weight: 600; line-height: 1; letter-spacing: -.02em;
  font-variation-settings: 'SOFT' 22, 'opsz' 34;
}
.t-min { font-size: 16px; font-weight: 500; letter-spacing: -.01em; }
.t-period {
  font-family: var(--sans); font-size: 10px; font-weight: 800;
  letter-spacing: .1em; color: var(--muted); text-transform: uppercase;
}
.t-date {
  font-size: 17px; font-weight: 600; line-height: 1.1; letter-spacing: -.01em;
  font-variation-settings: 'SOFT' 22, 'opsz' 30;
}
.t-none { font-size: 20px; color: var(--faint); line-height: .8; }
.when .sub {
  flex-basis: 100%; font-family: var(--sans); font-size: 9.5px; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase; color: var(--faint); margin-top: 4px;
}
.when.is-over, .when.is-over .t-period, .when.is-over .sub { color: var(--over); }

.body { flex: 1; min-width: 0; padding-top: 1px; }
.title {
  font-size: 16.5px; font-weight: 600; line-height: 1.33; letter-spacing: -.011em;
  color: var(--ink); overflow-wrap: anywhere;
}
.meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 6px; font-size: 12.5px; color: var(--muted); letter-spacing: -.002em;
}
.proj { color: var(--ink-2); font-weight: 500; }
.sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.flag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 999px; text-transform: uppercase;
}
.flag.rec  { background: var(--bg-sink); color: var(--muted); }
.flag.warn { background: var(--accent-lo); color: var(--accent); }

.card.done { opacity: .46; }
.card.done .title { text-decoration: line-through; text-decoration-color: var(--faint); }

/* the tick draws itself */
.check {
  flex: none; width: 25px; height: 25px; margin-top: 1px; border-radius: 50%;
  border: 1.5px solid var(--hair); display: grid; place-items: center;
  transition: border-color .26s var(--quart), background .26s var(--quart), transform .3s var(--quint);
}
.check:active { transform: scale(.85); }
.check svg { width: 13px; height: 13px; color: #fff; }
.check .tick {
  stroke-dasharray: 24; stroke-dashoffset: 24;
  transition: stroke-dashoffset .34s var(--quart) .04s;
}
.card.done .check { background: var(--done); border-color: var(--done); }
.card.done .check .tick { stroke-dashoffset: 0; }

/* ── empty ──────────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 76px 32px; animation: settle .7s var(--expo) 120ms backwards; }
.empty svg { width: 50px; height: 50px; color: var(--faint); opacity: .55; margin-bottom: 18px; }
.empty p {
  margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 500;
  font-variation-settings: 'SOFT' 60, 'opsz' 40; color: var(--ink-2); letter-spacing: -.01em;
}
.empty small { display: block; margin-top: 8px; font-size: 13.5px; color: var(--muted); }

/* ── capture bar ────────────────────────────────────────────────────────── */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 14px 14px calc(env(safe-area-inset-bottom) + 14px);
  background: linear-gradient(to top, var(--bg) 58%, color-mix(in srgb, var(--bg) 0%, transparent));
  animation: settle .6s var(--expo) 160ms backwards;
}
.bar-inner {
  display: flex; align-items: flex-end; gap: 8px; padding: 7px 7px 7px 17px;
  background: var(--surface); border: 1px solid var(--hair); border-radius: 25px;
  box-shadow: var(--sh-1);
  transition: box-shadow .4s var(--expo), border-color .3s var(--quart), transform .4s var(--expo);
}
.bar-inner:focus-within {
  box-shadow: var(--sh-3); transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--hair));
}
#input {
  flex: 1; border: 0; outline: 0; background: none; resize: none;
  font-size: 16.5px; line-height: 1.42; letter-spacing: -.006em; padding: 9px 0; max-height: 132px;
}
#input::placeholder { color: var(--faint); }

.send {
  flex: none; width: 41px; height: 41px; border-radius: 50%;
  background: var(--ink); color: var(--bg); display: grid; place-items: center;
  transition: transform .34s var(--quint), background .3s var(--quart), opacity .3s;
}
.send svg { width: 19px; height: 19px; transition: transform .3s var(--quint), opacity .2s; }
.send[disabled] { opacity: .28; transform: scale(.9); }
.send:not([disabled]):active { transform: scale(.87); }
.send.busy { background: var(--accent); }
.send.sent { background: var(--done); }
.send.sent svg { transform: rotate(-90deg) scale(.9); opacity: 0; }

/* live parse preview — the trust-builder */
.ghost {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 0 8px; max-height: 0; opacity: 0; overflow: hidden;
  transition: max-height .36s var(--expo), opacity .28s, margin .36s var(--expo);
}
.ghost.show { max-height: 48px; opacity: 1; margin: 10px 0 4px; }
.ghost b {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--hair-soft); color: var(--ink-2);
  white-space: nowrap; box-shadow: var(--sh-1);
  animation: chipIn .42s var(--expo) backwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.ghost b i { width: 7px; height: 7px; border-radius: 50%; }
.ghost b.key { background: var(--accent); border-color: var(--accent); color: #fff; }
.ghost b.dim { color: var(--muted); box-shadow: none; }
@keyframes chipIn { from { opacity: 0; transform: translateY(7px) scale(.94); } }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 100px);
  transform: translate(-50%, 12px); z-index: 40;
  padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; box-shadow: var(--sh-2);
  opacity: 0; pointer-events: none;
  transition: opacity .26s, transform .42s var(--expo);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── sheets ─────────────────────────────────────────────────────────────── */
.scrim {
  position: fixed; inset: 0; z-index: 50; background: rgba(20,17,14,.4);
  backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .34s var(--quart);
}
.scrim.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-height: 88vh; overflow-y: auto; background: var(--bg);
  border-radius: 26px 26px 0 0; box-shadow: var(--sh-3);
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 26px);
  transform: translateY(101%); transition: transform .46s var(--expo);
}
.sheet.show { transform: none; }
.grab { width: 38px; height: 4px; border-radius: 4px; background: var(--hair); margin: 6px auto 18px; }
.sheet h2 {
  margin: 0 0 18px; font-family: var(--serif); font-weight: 600; font-size: 23px;
  letter-spacing: -.017em; font-variation-settings: 'SOFT' 46, 'opsz' 40;
}
.field { margin-bottom: 15px; }
.field label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--hair); background: var(--surface); outline: 0;
  font-size: 16px; transition: border-color .24s var(--quart), box-shadow .24s;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent);
}
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 13px; border-radius: 999px; border: 1px solid var(--hair);
  background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  transition: background .24s var(--quart), color .24s, border-color .24s, transform .3s var(--quint);
}
.chip i { width: 8px; height: 8px; border-radius: 50%; }
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.row { display: flex; gap: 9px; margin-top: 22px; }
.btn {
  flex: 1; padding: 15px; border-radius: 14px; font-size: 15.5px; font-weight: 700;
  letter-spacing: -.008em; background: var(--ink); color: var(--bg);
  transition: transform .3s var(--quint), opacity .24s, background .24s;
}
.btn:active { transform: scale(.975); }
.btn.ghostbtn { background: var(--bg-sink); color: var(--ink-2); }
.btn.danger { background: none; color: var(--over); flex: 0 0 auto; padding-inline: 18px; }
a.btn { display: block; text-align: center; text-decoration: none; }

.hint { font-size: 12.5px; line-height: 1.65; color: var(--muted); margin: 10px 0 0; }
.hint b { color: var(--ink-2); font-weight: 600; }

.setting {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 0; border-bottom: 1px solid var(--hair-soft);
}
.setting:last-of-type { border-bottom: 0; }
.setting .k { font-size: 15px; font-weight: 600; letter-spacing: -.008em; }
.setting .v { font-size: 12.5px; color: var(--muted); margin-top: 4px; word-break: break-all; }
.copy {
  padding: 9px 15px; border-radius: 999px; background: var(--bg-sink);
  font-size: 13px; font-weight: 700; transition: transform .3s var(--quint);
}
.copy:active { transform: scale(.94); }

/* ── lock ───────────────────────────────────────────────────────────────── */
.lock {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  background: var(--bg); padding: 32px;
}
.lock .box { width: 100%; max-width: 300px; text-align: center; animation: settle .8s var(--expo) backwards; }
.mark {
  width: 64px; height: 64px; margin: 0 auto 22px; border-radius: 21px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent));
  display: grid; place-items: center;
  box-shadow: 0 14px 34px -12px color-mix(in srgb, var(--accent) 72%, transparent);
}
.lock h1 {
  font-family: var(--serif); font-weight: 600; font-size: 29px; margin: 0 0 7px;
  letter-spacing: -.02em; font-variation-settings: 'SOFT' 52, 'opsz' 50;
}
.lock p { margin: 0 0 26px; color: var(--muted); font-size: 14.5px; }
.lock input {
  width: 100%; text-align: center; letter-spacing: .52em; text-indent: .52em;
  font-size: 22px; font-family: var(--serif); padding: 16px; border-radius: 16px;
  border: 1px solid var(--hair); background: var(--surface); outline: 0;
  transition: border-color .24s var(--quart), box-shadow .24s;
}
.lock input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent);
}
.lock .btn { margin-top: 14px; }
.lock .btn[disabled] { opacity: .35; }
.lock.bad .box { animation: shake .44s var(--quart); }
@keyframes shake {
  20% { transform: translateX(-8px); } 45% { transform: translateX(7px); }
  70% { transform: translateX(-4px); } 100% { transform: none; }
}

.hidden { display: none !important; }
.offline-pill {
  display: inline-flex; align-items: center; margin-left: 9px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent); vertical-align: middle;
}

/* ── respect the system, and bigger screens ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
}
@media (min-width: 620px) {
  #app { max-width: 580px; margin: 0 auto; }
  .bar { left: 50%; transform: translateX(-50%); width: 100%; max-width: 580px; }
  .sheet { max-width: 580px; margin: 0 auto; border-radius: 26px 26px 0 0; }
}
