/* ═══════════════════════════════════════════════════════════════
   PrecisionTimer — styles.css
   Theme  : Amber & Saffron  (orange #FF6B35 × yellow #FFD166)
   Style  : Precision instrument dashboard · glassmorphism cards
   ═══════════════════════════════════════════════════════════════ */

/* ── Design tokens ──────────────────────────────────────────── */
:root {
  /* Palette */
  --clr-orange:        #FF6B35;
  --clr-orange-light:  #FF8F61;
  --clr-orange-glow:   rgba(255, 107, 53, 0.45);
  --clr-yellow:        #FFD166;
  --clr-yellow-light:  #FFE39A;
  --clr-yellow-glow:   rgba(255, 209, 102, 0.45);
  --clr-amber-dark:    #C94B0C;

  /* Background gradient */
  --bg-grad: linear-gradient(
    150deg,
    #3a1206  0%,
    #7a2e06 28%,
    #c45c10 56%,
    #e8a020 80%,
    #f5c842 100%
  );

  /* Glass */
  --glass-bg:      rgba(255, 255, 255, 0.07);
  --glass-border:  rgba(255, 255, 255, 0.14);
  --glass-shadow:  0 12px 40px rgba(0, 0, 0, 0.30);
  --glass-blur:    blur(22px);

  /* Typography */
  --font-ui:      -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'SF Mono', 'Cascadia Code', 'Fira Code', 'Courier New', monospace;

  /* Scales */
  --radius-sm:  8px;
  --radius-md:  16px;
  --radius-lg:  24px;
  --radius-xl:  32px;

  /* Spacing */
  --gap-xs:   4px;
  --gap-sm:   8px;
  --gap-md:   16px;
  --gap-lg:   24px;
  --gap-xl:   36px;
  --gap-2xl:  52px;

  /* Transitions */
  --t-fast:   0.15s ease;
  --t-mid:    0.30s ease;
  --t-slow:   0.55s cubic-bezier(0.22, 1, 0.36, 1);

  /* Text */
  --txt-hi:   rgba(255, 255, 255, 0.96);
  --txt-mid:  rgba(255, 255, 255, 0.65);
  --txt-lo:   rgba(255, 255, 255, 0.38);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg-grad);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--txt-hi);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Background orbs ────────────────────────────────────────── */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}
.bg-orb--1 {
  width: 560px; height: 560px;
  background: radial-gradient(circle, rgba(255,107,53,0.35), transparent 70%);
  top: -180px; left: -180px;
  animation: orbDrift 12s ease-in-out infinite;
}
.bg-orb--2 {
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(255,209,102,0.28), transparent 70%);
  bottom: -140px; right: -140px;
  animation: orbDrift 16s ease-in-out infinite reverse;
}
.bg-orb--3 {
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(255,143,97,0.20), transparent 70%);
  top: 40%; left: 55%;
  animation: orbDrift 20s ease-in-out infinite 4s;
}
@keyframes orbDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(24px, -32px) scale(1.06); }
  66%       { transform: translate(-18px, 18px) scale(0.94); }
}

/* ── App Wrapper ────────────────────────────────────────────── */
.app-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.app-container {
  width: 100%;
  max-width: 880px;
  padding: 0 var(--gap-lg) var(--gap-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--gap-xl);
}

/* ════════════════════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════════════════════ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--gap-xl) 0 0;
}
.logo {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}
.logo-icon { font-size: 1.8rem; line-height: 1; }
.logo-name {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--txt-hi);
}
.logo-version {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--txt-mid);
  letter-spacing: 0.5px;
  align-self: center;
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px var(--gap-md);
  border-radius: 100px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--txt-mid);
  transition: color var(--t-mid), border-color var(--t-mid);
}
.status-pip {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--txt-lo);
  flex-shrink: 0;
  transition: background var(--t-mid), box-shadow var(--t-mid);
}
.status-badge--running  .status-pip {
  background: #4ade80;
  box-shadow: 0 0 10px #4ade80, 0 0 4px #4ade80;
  animation: pipPulse 1.4s ease-in-out infinite;
}
.status-badge--running  { color: #4ade80; border-color: rgba(74,222,128,0.35); }
.status-badge--paused   .status-pip { background: var(--clr-yellow); box-shadow: 0 0 8px var(--clr-yellow); }
.status-badge--paused   { color: var(--clr-yellow); border-color: rgba(255,209,102,0.35); }
.status-badge--stopped  .status-pip { background: var(--txt-lo); }
.status-badge--stopped  { color: var(--txt-mid); }

@keyframes pipPulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(1.4); }
}

/* ════════════════════════════════════════════════════════════
   TIMER CARDS GRID
   ════════════════════════════════════════════════════════════ */
.timers-grid {
  display: grid;
  grid-template-columns: 1fr 48px 1fr;
  gap: var(--gap-lg);
  align-items: center;
}

/* ── Timer Card ──────────────────────────────────────────────── */
.timer-card {
  position: relative;
  padding: var(--gap-xl) var(--gap-lg);
  border-radius: var(--radius-xl);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  text-align: center;
  overflow: hidden;
  transition: transform var(--t-mid), box-shadow var(--t-mid);
}
.timer-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 56px rgba(0,0,0,0.38);
}

/* Top accent stripe */
.timer-card__accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.timer-card__accent--actual  { background: linear-gradient(90deg, var(--clr-orange), var(--clr-orange-light)); }
.timer-card__accent--visual  { background: linear-gradient(90deg, var(--clr-yellow), var(--clr-yellow-light)); }

/* Subtle inner glow on hover */
.timer-card--actual::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,107,53,0.08) 0%, transparent 65%);
  pointer-events: none;
}
.timer-card--visual::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,209,102,0.08) 0%, transparent 65%);
  pointer-events: none;
}

/* Eyebrow row */
.timer-card__eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);
  margin-bottom: var(--gap-xs);
}
.eyebrow-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--txt-mid);
}
.update-pip {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: box-shadow var(--t-fast);
}
.update-pip--actual { background: var(--clr-orange); }
.update-pip--visual { background: var(--clr-yellow); }

/* Animate pip when timer updates */
.update-pip.blink {
  animation: pipBlink 0.35s ease forwards;
}
@keyframes pipBlink {
  0%   { transform: scale(1);   opacity: 1; }
  40%  { transform: scale(2.2); opacity: 1; box-shadow: 0 0 10px currentColor; }
  100% { transform: scale(1);   opacity: 1; }
}
.update-pip--actual.blink { box-shadow: 0 0 12px var(--clr-orange); }
.update-pip--visual.blink { box-shadow: 0 0 12px var(--clr-yellow); }

/* Frequency label */
.timer-card__frequency {
  font-size: 0.72rem;
  color: var(--txt-lo);
  margin-bottom: var(--gap-sm);
}
.timer-card__frequency strong { color: var(--txt-mid); font-weight: 600; }

/* Timer display */
.timer-display {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--txt-hi);
  line-height: 1;
  margin: var(--gap-md) 0;
  transition: color var(--t-fast);
  position: relative;
}
.timer-display.tick-flash {
  animation: tickFlash 0.4s ease forwards;
}
@keyframes tickFlash {
  0%   { color: var(--txt-hi); }
  30%  { color: var(--clr-yellow-light); text-shadow: 0 0 22px rgba(255,209,102,0.6); }
  100% { color: var(--txt-hi); text-shadow: none; }
}

/* Sub-label */
.timer-card__sub {
  font-size: 0.72rem;
  color: var(--txt-lo);
  line-height: 1.5;
}

/* ── VS Divider ─────────────────────────────────────────────── */
.timers-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-sm);
}
.divider-track {
  flex: 1;
  width: 1px;
  background: var(--glass-border);
  min-height: 28px;
}
.divider-pill {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--txt-lo);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  padding: 4px 9px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════
   DIFF RIBBON
   ════════════════════════════════════════════════════════════ */
.diff-ribbon {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  padding: var(--gap-md) var(--gap-lg);
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
}
.diff-ribbon__label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--txt-lo);
  flex-shrink: 0;
  width: 28px;
}
.diff-ribbon__track {
  flex: 1;
  height: 6px;
  border-radius: 100px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.diff-ribbon__bar {
  height: 100%;
  border-radius: 100px;
  width: 0%;
  background: linear-gradient(90deg, var(--clr-orange), var(--clr-yellow));
  transition: width var(--t-mid);
}
.diff-ribbon__value {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--clr-yellow);
  flex-shrink: 0;
  width: 38px;
  text-align: right;
}
.diff-ribbon__cap {
  font-size: 0.65rem;
  color: var(--txt-lo);
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   CONTROLS
   ════════════════════════════════════════════════════════════ */
.controls {
  display: flex;
  justify-content: center;
  gap: var(--gap-md);
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: 13px var(--gap-xl);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-mid), opacity var(--t-fast), background var(--t-mid);
  position: relative;
  overflow: hidden;
  backdrop-filter: var(--glass-blur);
  outline: none;
}
.btn:focus-visible { outline: 2px solid rgba(255,255,255,0.6); outline-offset: 3px; }
.btn:active:not(:disabled) { transform: scale(0.94); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

/* Shine sweep on hover */
.btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  transition: left var(--t-mid);
}
.btn:hover:not(:disabled)::after { left: 150%; }
.btn:hover:not(:disabled)        { transform: translateY(-2px); }

.btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Start */
.btn--start {
  background: linear-gradient(135deg, var(--clr-orange), var(--clr-orange-light));
  color: #fff;
  box-shadow: 0 4px 20px var(--clr-orange-glow);
}
.btn--start:hover:not(:disabled) {
  box-shadow: 0 8px 32px var(--clr-orange-glow);
}

/* Pause */
.btn--pause {
  background: rgba(255,255,255,0.12);
  color: var(--txt-hi);
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.btn--pause:hover:not(:disabled) {
  background: rgba(255,255,255,0.2);
}

/* Reset */
.btn--reset {
  background: rgba(255,255,255,0.07);
  color: var(--txt-mid);
  border: 1px solid rgba(255,255,255,0.14);
}
.btn--reset:hover:not(:disabled) {
  background: rgba(220,38,38,0.22);
  border-color: rgba(220,38,38,0.45);
  color: #fca5a5;
}

/* ════════════════════════════════════════════════════════════
   TIMELINE SECTION
   ════════════════════════════════════════════════════════════ */
.timeline-section {
  padding: var(--gap-xl);
  border-radius: var(--radius-xl);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-lg);
  flex-wrap: wrap;
  gap: var(--gap-sm);
}
.section-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--txt-hi);
}
.section-legend {
  display: flex;
  gap: var(--gap-md);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--txt-mid);
}
.legend-pip {
  display: inline-block;
  width: 24px;
  height: 3px;
  border-radius: 100px;
}
.legend-pip--actual { background: var(--clr-orange); box-shadow: 0 0 6px var(--clr-orange-glow); }
.legend-pip--visual { background: var(--clr-yellow); box-shadow: 0 0 6px var(--clr-yellow-glow); }

.canvas-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(0,0,0,0.18);
}
canvas#timelineCanvas {
  display: block;
  width: 100%;
  height: 180px;
}

/* ════════════════════════════════════════════════════════════
   EXPLANATION PANEL
   ════════════════════════════════════════════════════════════ */
.explainer {
  padding: var(--gap-xl);
  border-radius: var(--radius-xl);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}
.explainer__header {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  margin-bottom: var(--gap-md);
}
.explainer__icon  { font-size: 1.4rem; }
.explainer__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--txt-hi);
}
.explainer__lead {
  font-size: 0.88rem;
  color: var(--txt-mid);
  margin-bottom: var(--gap-lg);
  line-height: 1.75;
}
.explainer__lead em {
  color: var(--clr-yellow-light);
  font-style: normal;
  font-weight: 600;
}

.explainer__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap-md);
}
.explainer__card {
  padding: var(--gap-lg) var(--gap-md);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  transition: background var(--t-mid);
}
.explainer__card:hover { background: rgba(255,255,255,0.08); }
.explainer__card-icon  { font-size: 1.3rem; margin-bottom: var(--gap-sm); }
.explainer__card h3    {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--txt-hi);
  margin-bottom: var(--gap-xs);
  letter-spacing: -0.2px;
}
.explainer__card p {
  font-size: 0.78rem;
  color: var(--txt-mid);
  line-height: 1.65;
}
.explainer__card code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--clr-orange-light);
  background: rgba(255,107,53,0.12);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ════════════════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════════════════ */
.app-footer {
  padding: var(--gap-lg) 0 var(--gap-xl);
  text-align: center;
  font-size: 0.72rem;
  color: var(--txt-lo);
  letter-spacing: 0.4px;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
  .app-container { gap: var(--gap-lg); }

  /* Stack timer cards vertically */
  .timers-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .timers-divider {
    flex-direction: row;
    padding: 0 var(--gap-lg);
  }
  .divider-track { min-height: unset; width: 100%; height: 1px; }

  .explainer__grid { grid-template-columns: 1fr; }

  .controls { gap: var(--gap-sm); }
  .btn { flex: 1; justify-content: center; min-width: 90px; padding: 12px var(--gap-md); }

  canvas#timelineCanvas { height: 140px; }
}

@media (max-width: 420px) {
  .timer-display {
    font-size: 2rem;
    letter-spacing: 1.5px;
  }
  .logo-name  { font-size: 1.2rem; }
  .app-header { gap: var(--gap-sm); flex-wrap: wrap; }
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
