/*
 * POMODORO TIMER
 * ==============
 * Concept: "Monastery clock" — time is precious and finite. The timer
 * should feel like a quiet companion, not a productivity app screaming
 * at you. The countdown numeral IS the interface.
 *
 * Hook: The massive serif number dominates the viewport. The entire page
 * color atmosphere shifts between work (deep wine) and rest (cool sage).
 * No chrome. The number is the design.
 *
 * Why Cormorant Garamond? High-contrast serif with beautiful numerals
 * at display size. The light weight makes the large number feel elegant
 * rather than heavy. It's a clock face, not a scoreboard.
 */

/* ============================================
   TOKENS
   ============================================ */

:root {
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-mono:    'IBM Plex Mono', 'Consolas', monospace;

  /* Work mode: deep wine/burgundy — warmth, focus, quiet intensity */
  --bg:         #1e1418;
  --bg-btn:     #2c1f25;
  --text:       #e8ddd0;
  --text-mid:   #a89484;
  --text-quiet: #6e5c50;
  --accent:     #c4897a;
  --accent-dim: #c4897a33;

  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Break mode: cool sage — relief, exhale, reward */
[data-mode="break"] {
  --bg:         #141e18;
  --bg-btn:     #1c2c22;
  --text:       #d0e0d8;
  --text-mid:   #84a894;
  --text-quiet: #506e5c;
  --accent:     #7ac4a0;
  --accent-dim: #7ac4a033;
}

/* Light mode variants */
@media (prefers-color-scheme: light) {
  :root {
    --bg:         #f5ece6;
    --bg-btn:     #e8dbd2;
    --text:       #2c2018;
    --text-mid:   #7a6858;
    --text-quiet: #b0a090;
    --accent:     #9e5a48;
    --accent-dim: #9e5a4822;
  }

  [data-mode="break"] {
    --bg:         #e8f2ec;
    --bg-btn:     #d4e6dc;
    --text:       #182c20;
    --text-mid:   #587a64;
    --text-quiet: #90b0a0;
    --accent:     #3e7a5c;
    --accent-dim: #3e7a5c22;
  }
}


/* ============================================
   BASE
   ============================================ */

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  /* The background color transition IS the design — it tells you the state */
  transition: background 1.2s var(--ease), color 0.8s var(--ease);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
  width: 100%;
  padding: 2rem;
}


/* ============================================
   MODE LABEL — tiny structural label above the time
   ============================================ */

.mode-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 1rem;
  transition: color 0.8s var(--ease);
}


/* ============================================
   THE TIMER — the soul of the page
   
   Massive serif numerals. The number IS the interface.
   At this size, Cormorant's thin strokes and elegant
   proportions make it feel like a clock face engraved
   in stone, not a digital countdown.
   ============================================ */

.timer {
  margin-bottom: 2.5rem;
  line-height: 1;
}

.timer__digits {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(6rem, 22vw, 16rem);
  letter-spacing: -0.03em;
  color: var(--text);
  transition: color 0.8s var(--ease);
  display: block;
}

/* 
 * Pulse animation for last 10 seconds.
 * Subtle opacity breathe — not a jarring flash, just a gentle
 * acknowledgment that time is running out. Like a candle flickering.
 */
.timer__digits.pulse {
  animation: breathe 1s var(--ease) infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}


/* ============================================
   CONTROLS
   ============================================ */

.controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  border: none;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  background: none;
  color: var(--text-mid);
  padding: 0.6rem 1.2rem;
}

.btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.btn--primary {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.65rem 2rem;
  font-weight: 500;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent);
  color: var(--bg);
}

.btn--secondary:hover:not(:disabled) {
  color: var(--text);
}

/* Focus states */
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}


/* ============================================
   MODE SWITCH — duration pills
   ============================================ */

.mode-switch {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-quiet);
  background: none;
  border: 1px solid transparent;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}

.pill:hover {
  color: var(--text-mid);
}

.pill--active {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* ============================================
   SESSION COUNT — quiet, rewarding to notice
   ============================================ */

.sessions {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-quiet);
  letter-spacing: 0.08em;
  transition: color 0.8s var(--ease);
}


/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
  .controls {
    gap: 0.6rem;
  }

  .btn--primary {
    padding: 0.6rem 1.4rem;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  body {
    transition: none;
  }

  .timer__digits.pulse {
    animation: none;
  }

  .mode-label,
  .timer__digits,
  .sessions {
    transition: none;
  }
}
