/* =========================================================
   Countdown Timer — tool-specific styles.
   Layered on /tools/_shared/tool.css.
   ========================================================= */

/* ---------- Display ---------- */
.timer-display {
  text-align: center;
  margin-bottom: var(--space-5);
}

.timer-readout {
  font-size: clamp(72px, 18vw, 160px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  margin: 0 0 var(--space-4);
  transition: color 0.25s ease, transform 0.25s ease;
}

.timer-card[data-state="warning"] .timer-readout {
  color: var(--warning, #d97706);
  animation: timerPulse 1s ease-in-out infinite;
}

.timer-card[data-state="done"] .timer-readout {
  color: var(--accent);
  transform: scale(1.04);
}

@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.025); }
}

/* ---------- Progress bar ---------- */
.timer-progress {
  height: 8px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: var(--space-4);
}
.timer-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.25s linear, background-color 0.25s ease;
}
.timer-card[data-state="warning"] .timer-progress-bar {
  background: var(--warning, #d97706);
}
.timer-card[data-state="done"] .timer-progress-bar {
  background: var(--accent);
}

/* ---------- Meta row (sound + fullscreen) ---------- */
.timer-meta {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.timer-meta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-colors);
}
.timer-meta-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}
.timer-meta-btn[aria-pressed="false"] {
  text-decoration: line-through;
  color: var(--text-subtle);
}
.timer-meta-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ---------- Controls ---------- */
.timer-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.timer-controls .btn {
  font-size: 16px;
  min-height: 52px;
}
@media (min-width: 540px) {
  .timer-controls:has(.timer-control-secondary:not([hidden])) {
    grid-template-columns: 2fr 1fr;
  }
}

/* ---------- Presets ---------- */
.timer-presets,
.timer-custom {
  margin-bottom: var(--space-5);
}
.timer-presets-label,
.timer-custom-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin: 0 0 var(--space-3);
}

.timer-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}
@media (min-width: 540px) {
  .timer-presets-grid {
    grid-template-columns: repeat(8, 1fr);
  }
}
.timer-preset {
  padding: 10px 0;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-colors), transform 0.12s ease;
}
.timer-preset:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.timer-preset.is-active {
  background: var(--accent-soft-bg);
  border-color: var(--accent);
  color: var(--accent);
}
.timer-preset:active { transform: scale(0.97); }

/* ---------- Custom inputs ---------- */
.timer-custom-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.timer-custom-field {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 12px;
  transition: var(--transition-colors);
}
.timer-custom-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.timer-custom-field input {
  width: 56px;
  padding: 8px 0;
  background: transparent;
  border: none;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.timer-custom-field input::-webkit-outer-spin-button,
.timer-custom-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.timer-custom-field input:focus { outline: none; }
.timer-custom-field span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.timer-custom-set {
  margin-left: auto;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}
.btn-link:hover { color: var(--accent-hover); text-decoration: underline; }

/* ---------- Full-screen mode ----------
   When the timer card is the fullscreen element, hide everything inside
   except the display and a minimal exit affordance. The browser handles
   the actual `:fullscreen` styling — we just lay it out. */
.timer-card:fullscreen {
  background: var(--surface);
  padding: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  border: none;
  border-radius: 0;
}
.timer-card:fullscreen .timer-text-header,
.timer-card:fullscreen .timer-presets,
.timer-card:fullscreen .timer-custom {
  display: none;
}
.timer-card:fullscreen .timer-display {
  width: min(90vw, 1400px);
  margin: 0;
}
.timer-card:fullscreen .timer-readout {
  font-size: clamp(120px, 28vw, 360px);
}
.timer-card:fullscreen .timer-progress {
  height: 14px;
}
.timer-card:fullscreen .timer-controls {
  width: min(90vw, 480px);
  margin: 0;
}
