/* Pomodoro — web rebuild of the native WPF timer.
   Palette and dimensions match PomodoroTimer.ps1 (Catppuccin Mocha). */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent: #89B4FA;          /* set per mode from JS (focus blue / break green) */
  --accent-fg: #11111B;
  --card: #181825;
  --track: #26263A;
  --text: #CDD6F4;
  --muted: #6C7086;
  --dim: #9399B2;
  --chip-fg: #A6ADC8;
}

html, body { min-height: 100%; }

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #11111B;
}

/* Full-viewport hero keeps the timer centered; the article scrolls below it */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-user-select: none;
  user-select: none;
}

button { font-family: inherit; border: none; background: none; cursor: pointer; }

/* display:flex would otherwise override the hidden attribute */
.pip-placeholder[hidden] { display: none; }

/* ---------- Full card (320x446, radius 22) ---------- */

.card {
  position: relative;
  width: 320px;
  height: 446px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top bar */
.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  margin: 12px 12px 0 14px;
}

.topbar-left, .topbar-right { display: flex; }

.mode-btn {
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mode-btn:hover { background: #26263A; }
.mode-btn.active { color: var(--text); }
.mode-btn.inactive { color: var(--muted); }

/* Settings popup */
.settings-popup {
  position: absolute;
  top: 36px;
  right: 0;
  width: 200px;
  background: #1E1E2E;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.5);
  z-index: 10;
}
.settings-title {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  margin: 0 0 10px 2px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.settings-label { color: var(--text); font-size: 13px; }

/* Sliding on/off toggle (40x22) */
.toggle {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #3B3B52;
  position: relative;
  transition: background 0.15s;
  flex: none;
}
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  transition: left 0.15s, background 0.15s;
}
.toggle[aria-checked="true"] { background: var(--accent); }
.toggle[aria-checked="true"] .toggle-thumb { left: 21px; background: var(--accent-fg); }

/* Ring + time */
.ring-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ring { display: block; }
#progressArc, #miniArc { stroke: var(--accent); }

.ring-text {
  position: absolute;
  text-align: center;
}
.time {
  color: var(--text);
  font-size: 46px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.state {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

/* Quick-add chips */
.chips {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.chip {
  color: var(--chip-fg);
  background: #222234;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 11px;
  margin: 0 4px;
}
.chip:hover { background: #2E2E44; }
.chip:active { background: #383852; }

/* Controls */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 18px 0 22px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: #2A2A3C;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: #3B3B52; }
.icon-btn:active { background: #494966; }

.primary-btn {
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: var(--accent);
  color: var(--accent-fg);
  margin: 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { filter: brightness(0.88); }

/* Pulsing flash overlay (alert when a session ends) */
.flash-overlay {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
}
.flashing .flash-overlay {
  animation: flash-pulse 1.3s ease-in-out infinite;
}
@keyframes flash-pulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.22; }
}

/* ---------- Mini pill (220x64, radius 32) ---------- */

.mini {
  position: relative;
  width: 220px;
  height: 64px;
  background: var(--card);
  border-radius: 32px;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  padding: 0 10px 0 14px;
  overflow: hidden;
}

.mini-ring { display: block; flex: none; }

.mini-time {
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-left: 10px;
  flex: 1;
}

.mini-primary {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  background: var(--accent);
  color: var(--accent-fg);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mini-primary:hover { filter: brightness(1.08); }
.mini-primary:active { filter: brightness(0.88); }

.mini-icon {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: #222234;
  color: var(--chip-fg);
  flex: none;
  margin-left: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mini-icon:hover { background: #2E2E44; }
.mini-icon:active { background: #383852; }

.mini-flash { border-radius: 32px; }

/* Placeholder shown on the page while the timer is popped out */
.pip-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

/* Inside the PiP window the active view fills the whole window
   (the PiP body holds the card/mini directly — there is no .hero).
   100vh, not 100%: html only has min-height, so a percentage height
   can't resolve inside the PiP document and the layouts collapse. */
body.pip {
  height: 100vh;
  background: var(--card);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  -webkit-user-select: none;
  user-select: none;
}
body.pip .card,
body.pip .mini {
  width: 100%;
  height: 100%;
  border-radius: 0;
  box-shadow: none;
}
body.pip .flash-overlay { border-radius: 0; }

/* Size-toggle buttons only make sense inside the pop-out window */
.pip-only { display: none; }
body.pip .pip-only { display: flex; }

/* ...and the pop-out buttons don't — closing the window pops back in */
body.pip #pipBtn, body.pip #miniPipBtn { display: none; }

/* Responsive layout: the compact pill replaces the full card whenever the
   window (page or PiP) is too small for it — no manual mode switch.
   (Kept last so it wins over the .card/.mini display rules above.) */
@media (max-width: 329px), (max-height: 455px) {
  .card { display: none; }
}
@media (min-width: 330px) and (min-height: 456px) {
  .mini { display: none; }
}

/* ---------- Informational content below the timer ---------- */

.content {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 24px 56px;
  color: var(--dim);
  font-size: 15px;
  line-height: 1.7;
}

.content h1 {
  color: var(--text);
  font-size: 26px;
  line-height: 1.3;
  margin-bottom: 14px;
}

.content h2 {
  color: var(--text);
  font-size: 20px;
  margin: 36px 0 10px;
}

.content h3 {
  color: var(--text);
  font-size: 15px;
  margin: 22px 0 6px;
}

.content p { margin-bottom: 12px; }

.content ol, .content ul {
  margin: 0 0 12px;
  padding-left: 24px;
}
.content li { margin-bottom: 6px; }

.content strong, .content em { color: var(--text); font-style: normal; }

.content a { color: var(--accent); }

.more-timers { margin-top: 36px; }
.timer-links {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px 16px;
}

.content footer {
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid var(--track);
  color: var(--muted);
  font-size: 13px;
}

/* The article never belongs inside the PiP window */
body.pip .content { display: none; }
