/* JP-01 Muji / Kenya Hara (design-brief.md). One accent, and it appears only when
   you must act: the Start button and the pour phases. */
:root {
  --bg: #F5F3EE; --surface: #FFFFFF; --ink: #2B2926; --muted: #6E6A64;
  --accent: #7F0019; --on-accent: #FFFFFF; --line: #D9D5CC;
  --font: 'Noto Sans JP', 'Hiragino Sans', system-ui, sans-serif;
  --step-0: 0.6875rem; --step-1: 0.8125rem; --step-2: 0.9375rem; --step-3: 1.125rem; --step-4: 1.375rem; --step-5: 1.75rem;
  --tracking: 0.06em;
  --fade: 400ms cubic-bezier(0.22, 1, 0.36, 1);
  --pad: 24px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body {
  font: 300 var(--step-2)/1.8 var(--font);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  transition: background-color var(--fade), color var(--fade);
}
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: var(--step-1); }
[hidden] { display: none !important; }

.screen {
  min-height: 100dvh; max-width: 34rem; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: max(var(--pad), env(safe-area-inset-top)) var(--pad) max(var(--pad), env(safe-area-inset-bottom));
  animation: in var(--fade);
}
@keyframes in { from { opacity: 0; } to { opacity: 1; } }

.bar { display: flex; justify-content: space-between; font-size: var(--step-1); letter-spacing: var(--tracking); }
.mark { font-weight: 400; }
.centre { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.title { font-size: var(--step-4); letter-spacing: var(--tracking); margin: 0; }
p { margin: 0; }

/* Steppers: 48px targets, numbers in the middle */
.steppers { display: flex; gap: 16px; margin: 28px 0 8px; }
.stepper { flex: 1; display: grid; grid-template-columns: 48px 1fr 48px; grid-template-rows: auto 48px; align-items: center; border-top: 1px solid var(--line); padding-top: 8px; }
.stepper .label { grid-column: 1 / -1; font-size: var(--step-0); letter-spacing: var(--tracking); color: var(--muted); text-transform: uppercase; }
.stepper button { width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); font-size: var(--step-3); }
.stepper output { text-align: center; font-size: var(--step-4); font-variant-numeric: tabular-nums; }

.suggestion { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.suggestion p { font-size: var(--step-1); }
.quiet { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); letter-spacing: var(--tracking); font-size: var(--step-1); }

.foot { display: flex; flex-direction: column; gap: 8px; }
.toggle { display: flex; gap: 12px; align-items: center; min-height: 44px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }
.primary {
  min-height: 64px; width: 100%; border: 0; border-radius: 2px;
  background: var(--accent); color: var(--on-accent); letter-spacing: var(--tracking); font-weight: 400;
}
.primary:disabled { background: var(--line); color: var(--muted); }

/* Brewing. The clock is the one object; it is large because the phone sits 1–2 m
   away (research: phones sit far from the kettle). Weight stays 300 per the theme. */
#brewing { padding-top: max(16px, env(safe-area-inset-top)); }
.corner { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; width: 48px; height: 48px; border: 0; background: none; font-size: var(--step-5); color: inherit; opacity: 0.6; z-index: 2; }
.upper { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; text-align: center; gap: 6px; padding-top: 56px; }
.phase { font-size: clamp(1.75rem, 8vw, 2.5rem); letter-spacing: var(--tracking); line-height: 1.3; }
.next { font-size: var(--step-2); opacity: 0.7; min-height: 1.8em; }
.clock {
  text-align: center; font-size: clamp(6rem, 32vw, 10rem); line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em; margin: 12px 0 20px;
}
.done-zone {
  flex: 1; min-height: 36dvh; width: 100%; border: 1px solid currentColor; border-radius: 2px;
  background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  opacity: 0.85;
}
.done-label { font-size: var(--step-5); letter-spacing: var(--tracking); }
.done-zone.holding { background: color-mix(in srgb, currentColor 10%, transparent); }

/* Phase fields: the accent is the "act now" signal; waiting is the plain ground. */
body[data-phase="bloom"], body[data-phase="pour"] { background: var(--accent); color: var(--on-accent); }
body[data-phase="ready"] { background: #EAE6DD; }
body[data-phase="window"] .clock { text-decoration: underline 2px; text-underline-offset: 12px; }

/* After */
.finish { font-size: clamp(3rem, 16vw, 4.5rem); line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.rating { display: flex; gap: 12px; margin: 24px 0 8px; }
.rating button { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--ink); background: transparent; font-size: var(--step-1); }
.rating button[aria-checked="true"] { background: var(--ink); color: var(--bg); }
details { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
summary { min-height: 44px; display: flex; align-items: center; letter-spacing: var(--tracking); cursor: pointer; }
.slider { display: grid; grid-template-columns: 4.5em 1fr 4.5em; align-items: center; gap: 8px; min-height: 48px; }
.slider span:last-child { text-align: right; }
.slider input { width: 100%; accent-color: var(--ink); }
.result { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
}
