/* Pomodoro Timer — a big draining focus ring. Phase-colored (focus / break).
 * One Page Toys tool family, self-contained, theme-aware (light/dark). */

@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800;900&family=Inter:wght@400;500;600;700&display=swap");

:root{
  --font-display: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ink: #241d1b;
  --bg: #faf7f6;
  --surface: #ffffff;
  --surface-2: #f3eeec;
  --muted: #77706c;
  --line: #ece5e2;
  --line-strong: #dbd1cd;
  --radius: 18px;
  --radius-pill: 999px;
  --shadow: 0 2px 8px rgba(40, 24, 20, 0.06);
  --shadow-md: 0 8px 22px rgba(40, 24, 20, 0.10);
  --shadow-lg: 0 16px 40px rgba(40, 24, 20, 0.13);
  --glass: rgba(255, 255, 255, 0.72);
  /* phase colors */
  --focus-1: #ff7a5c; --focus-2: #e5533d; --focus-3: #c23b28;
  --break-1: #4fd0c0; --break-2: #2ba79a; --break-3: #1c7d73;
  --accent: var(--focus-2);
  --accent-hi: var(--focus-1);
  --accent-lo: var(--focus-3);
  --accent-soft: rgba(229, 83, 61, 0.14);
}
:root[data-theme="dark"]{
  --ink: #efe6e2;
  --bg: #16110f;
  --surface: #201815;
  --surface-2: #29201c;
  --muted: #a1938c;
  --line: #2c221e;
  --line-strong: #3d302b;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 10px 30px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 48px -10px rgba(0, 0, 0, 0.6);
  --glass: rgba(32, 24, 21, 0.62);
  --focus-1: #ff8f73; --focus-2: #ff6a4d; --focus-3: #e5533d;
  --break-1: #6ee6d6; --break-2: #45d0c0; --break-3: #2ba79a;
}
body[data-phase="short"], body[data-phase="long"]{
  --accent: var(--break-2); --accent-hi: var(--break-1); --accent-lo: var(--break-3);
  --accent-soft: rgba(43, 167, 154, 0.16);
}

*, *::before, *::after{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0; min-height: 100%;
  display: flex; flex-direction: column;
  font-family: var(--font-sans); color: var(--ink);
  background: radial-gradient(62% 46% at 50% 30%, var(--accent-soft), transparent 70%), var(--bg);
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background 500ms ease;
}

/* ---------- Top bar (shared chrome) ---------- */
.topbar{
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; padding: 14px clamp(16px, 4vw, 30px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand{
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 0.86rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); text-decoration: none;
}
.brand__mark{
  width: 1.1em; height: 1.1em; border: 1.5px solid var(--ink); border-radius: 6px;
  background: linear-gradient(90deg, var(--ink) 0 50%, var(--surface) 50% 100%);
}
.topbar__right{ display: inline-flex; align-items: center; gap: 10px; }
.topbar__tag{
  font-family: var(--font-display); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
}
.iconbtn{
  appearance: none; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; font-size: 1rem; line-height: 1;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, color 140ms ease;
}
.iconbtn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--ink); }
.iconbtn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent-soft); }
#soundBtn[aria-pressed="false"]{ color: var(--muted); border-style: dashed; }
.theme-toggle__sun, .theme-toggle__moon, .theme-toggle__auto{ display: none; }
:root[data-theme-mode="system"] .theme-toggle__auto{ display: inline; }
:root[data-theme-mode="light"] .theme-toggle__sun{ display: inline; }
:root[data-theme-mode="dark"] .theme-toggle__moon{ display: inline; }

/* ---------- Stage ---------- */
.stage{
  position: relative; z-index: 2; flex: 1 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: clamp(20px, 4vw, 44px) 20px clamp(48px, 6vw, 72px);
}
.pomo{ width: 100%; max-width: 460px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 24px; }

.phase{
  margin: 0; font-family: var(--font-display); font-size: 0.78rem; font-weight: 800;
  letter-spacing: 0.28em; text-transform: uppercase; color: var(--accent);
  transition: color 400ms ease;
}

/* ---------- Ring ---------- */
.ring{ position: relative; width: min(340px, 82vw); aspect-ratio: 1; }
.ring__svg{ width: 100%; height: 100%; display: block; overflow: visible; }
.ring__track{ fill: none; stroke: var(--line); stroke-width: 14; }
.ring__prog{
  fill: none; stroke: url(#pomograd); stroke-width: 14; stroke-linecap: round;
  stroke-dasharray: 829.38; stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.35s linear, stroke 0.4s ease;
  filter: drop-shadow(0 0 14px var(--accent-soft));
}
.pomograd-a{ stop-color: var(--accent-hi); }
.pomograd-b{ stop-color: var(--accent-lo); }
.ring__center{ position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; pointer-events: none; }
.time{
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(3.6rem, 17vw, 5.2rem); line-height: 1; letter-spacing: -0.03em;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.dots{ display: inline-flex; gap: 8px; min-height: 12px; }
.dot{ width: 11px; height: 11px; border-radius: 50%; background: var(--line-strong); transition: background 300ms ease, transform 300ms ease; }
.dot.is-done{ background: var(--accent); }
.dot.is-pop{ animation: dotpop 420ms cubic-bezier(0.2, 0.9, 0.3, 1.3); }
@keyframes dotpop{ 0%{ transform: scale(0.4); } 55%{ transform: scale(1.5); } 100%{ transform: scale(1); } }

/* ---------- Actions ---------- */
.actions{ display: flex; gap: 12px; align-items: center; justify-content: center; }
.btn{
  appearance: none; font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  padding: 14px 30px; border-radius: var(--radius-pill); border: 1.5px solid var(--ink);
  background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease, background 200ms ease, color 200ms ease, border-color 200ms ease;
}
.btn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active{ transform: translateY(0); }
.btn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent-soft), var(--shadow); }
.btn--primary{
  min-width: 148px; font-size: 1.08rem; padding: 15px 38px;
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 8px 26px -6px var(--accent);
}
.btn--primary:hover{ background: var(--accent-lo); border-color: var(--accent-lo); }
.btn--ghost{ border-color: var(--line-strong); color: var(--muted); box-shadow: none; }
.btn--ghost:hover{ color: var(--ink); border-color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Focus length chips ---------- */
.lengths{ display: inline-flex; gap: 6px; padding: 5px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); box-shadow: var(--shadow); }
.len{
  font-family: var(--font-display); font-size: 0.82rem; font-weight: 700;
  padding: 8px 16px; border: 0; border-radius: var(--radius-pill);
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.len:hover{ color: var(--ink); }
.len.is-on{ background: var(--accent); color: #fff; }
.len:focus-visible{ outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.len:disabled{ opacity: 0.45; cursor: not-allowed; }

.backlink{
  font-family: var(--font-display); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
  text-decoration: none; border-bottom: 1px solid transparent;
  transition: color 140ms ease, border-color 140ms ease;
}
.backlink:hover{ color: var(--ink); border-bottom-color: var(--accent); }

@media (prefers-reduced-motion: reduce){
  .ring__prog{ transition: none; } .dot, .btn, .iconbtn, body{ transition: none; } .dot.is-pop{ animation: none; }
}
