/* Palette and type from the ephemerator Brand Book v1.0. See PLAN.md "Styling". */

@font-face { font-family: "Manrope"; font-weight: 400; font-display: swap; src: url("/assets/Manrope-Regular-b38355fd.ttf") format("truetype"); }
@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url("/assets/Manrope-Bold-98ffc9fd.ttf") format("truetype"); }
@font-face { font-family: "Manrope"; font-weight: 800; font-display: swap; src: url("/assets/Manrope-ExtraBold-6d9091b9.ttf") format("truetype"); }
@font-face { font-family: "BIZ UDGothic"; font-weight: 700; font-display: swap; src: url("/assets/BIZUDGothic-Bold-79bfab1a.ttf") format("truetype"); }

:root {
  --bg: #F9F9EB;
  --surface: #FFFFFA;
  --text: #1C1D1C;
  --text-muted: #8A8A83;
  --border: #C1C1B7;
  --streak: #C6639B;
  --cta-bg: #1C1D1C;
  --cta-text: #F9F9EB;
  --error: #BC2E30;

  --font-body: "Manrope", system-ui, sans-serif;
  --font-digits: "BIZ UDGothic", ui-monospace, monospace;
  --radius: 6px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --text: #f0f0f0;
    --text-muted: #888888;
    --border: #2a2a2a;
    --cta-bg: #f0f0f0;
    --cta-text: #0f0f0f;
    --error: #ff6b6b;
  }
}

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

body {
  margin: 0 auto;
  max-width: 560px;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.4 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
h1, h2 { margin: 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.wordmark { font: 800 28px/1.4 var(--font-body); letter-spacing: -0.02em; }
.page-title { font: 800 18px/1.4 var(--font-body); }
.section-label { margin: 32px 0 8px; font: 700 13px/1.4 var(--font-body); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.muted { color: var(--text-muted); }
.empty { color: var(--text-muted); text-align: center; margin: 64px 0; }
.footer { margin-top: 48px; display: flex; justify-content: center; }

/* Buttons and forms */

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px;
  border: 0; border-radius: 999px;
  background: var(--cta-bg); color: var(--cta-text);
  font: 700 15px/1 var(--font-body); text-decoration: none; cursor: pointer;
}
.button-quiet { background: transparent; color: var(--text-muted); }
.button-danger { background: transparent; color: var(--error); margin-top: 24px; padding: 0; }

.stack { display: flex; flex-direction: column; gap: 8px; }
.stack label { font-weight: 700; font-size: 14px; margin-top: 8px; }
.stack .button { margin-top: 16px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
  min-height: 48px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font: 400 16px var(--font-body);
}
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 20px; height: 20px; accent-color: var(--cta-bg); }

.flash { margin: 0 0 16px; padding: 0; list-style: none; font-size: 14px; }
.flash-alert { color: var(--error); }

.auth { margin-top: 18vh; }
.auth .wordmark { text-align: center; margin-bottom: 32px; }

/* Clocks: each card is its own progress bar. The track is a tint of the clock's colour and the
   completed part is the colour itself (darkened for the near-white mint and yellow, so progress
   stays visible). Vinyl text clears 4.5:1 on both for every colour. */

.clocks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; }

.clock:nth-child(7n+1) { --c: #FD8E4B; } /* orange */
.clock:nth-child(7n+2) { --c: #71C4D9; } /* blue   */
.clock:nth-child(7n+3) { --c: #C6639B; } /* pink   */
.clock:nth-child(7n+4) { --c: #A9F5B0; --track: color-mix(in oklch, var(--c), white 30%); --fill: color-mix(in oklch, var(--c), black 20%); } /* mint   */
.clock:nth-child(7n+5) { --c: #8984A1; } /* violet, lifted 25% toward white for text contrast */
.clock:nth-child(7n+6) { --c: #FEF9A0; --track: color-mix(in oklch, var(--c), white 30%); --fill: color-mix(in oklch, var(--c), black 20%); } /* yellow */
.clock:nth-child(7n+7) { --c: #279E90; } /* green  */

.clock {
  --ink: #1C1D1C;
  position: relative; overflow: hidden;
  background: var(--track, color-mix(in oklch, var(--c), white 55%));
  color: var(--ink);
}
.clock-fill { position: absolute; inset: 0 auto 0 0; max-width: 100%; background: var(--fill, var(--c)); transition: width 0.4s linear; }
.clock > form { position: relative; }

.clock-toggle {
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  width: 100%; min-height: 92px; padding: 14px 16px 12px;
  border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.clock-toggle:active { background: rgb(28 29 28 / 0.06); }
.clock-toggle:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }

.clock-name { display: flex; align-items: center; gap: 8px; min-width: 0; margin-right: 36px; }
.clock-status { flex: none; width: 16px; height: 16px; fill: color-mix(in oklch, var(--c), black 55%); }
.clock-title { font: 800 18px/1.4 var(--font-body); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.done-mark { display: none; font-weight: 800; }
.done .done-mark { display: inline; }

.clock-time { align-self: flex-end; font: 700 13px/1.4 var(--font-digits); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; opacity: 0.7; }
.clock-time > span { opacity: 1; font-size: 15px; }

.clock-edit {
  position: absolute; top: 4px; right: 4px;
  display: grid; place-items: center; width: 44px; height: 44px;
  color: var(--ink); opacity: 0.55;
}
.clock-edit svg { width: 18px; height: 18px; fill: currentColor; }

.streak {
  flex: none; padding: 1px 8px; border-radius: 999px;
  background: var(--streak); color: #FFFFFA;
  font: 700 12px/1.5 var(--font-digits); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.clock .streak { background: rgb(28 29 28 / 0.12); color: var(--ink); }
.streak-all { margin: -12px 0 20px; font-size: 14px; color: var(--text-muted); }
.streak-all .streak { font-size: 14px; }

/* Phones: the stack runs edge to edge; card content stays clear of notches via the safe-area insets. */
@media (max-width: 600px) {
  .clocks {
    margin-inline: calc(-1 * max(16px, env(safe-area-inset-left))) calc(-1 * max(16px, env(safe-area-inset-right)));
    border-radius: 0;
  }
  .clock-toggle { padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
  .clock-edit { right: max(4px, env(safe-area-inset-right)); }
}

.disabled-clocks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.disabled-clocks a { color: var(--text-muted); font-weight: 700; }
