/* ==========================================================================
   Clocked-Out Co-work — focus timer
   Styles for timer.html. Requires style.css.

   Theming is driven by one attribute on <body>: data-mode="focus|break|overtime".
   The JS only ever sets that attribute; all colour decisions live here.
   ========================================================================== */

.timer-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 1s ease, color 1s ease;
}

.timer {
  width: 100%;
  max-width: 1200px;
  padding: 0 var(--gutter);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: relative;
  z-index: 1;
  text-align: center;
}

/* --------------------------------------------------------------- parts -- */

.timer__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.75rem, 5vw, 4rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.9;
  margin-bottom: 1.5rem;
  transition: color 1s ease;
}

.timer__display {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(4rem, 15vw, 16rem);
  line-height: 1;
  margin-bottom: 0.5rem;
  font-variant-numeric: tabular-nums;
  user-select: none;
  transition: color 1s ease, transform 0.2s ease;
}

.timer__status {
  font-size: clamp(1.1rem, 2.4vw, 2rem);
  font-weight: 500;
  color: var(--sage);
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  transition: color 0.3s ease;
}

.timer__quote-slot {
  height: clamp(6rem, 12vh, 9rem);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 900px;
  margin-bottom: 2rem;
}

.timer__quote {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: clamp(1.15rem, 2.6vw, 2rem);
  color: var(--sage);
  opacity: 0;
  transition: opacity 2s ease-in-out, color 1s ease;
}

.timer__quote.is-visible {
  opacity: 1;
}

.timer__quote cite {
  display: inline-block;
  margin-top: 0.6rem;
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 500;
  font-size: 0.62em;
  opacity: 0.7;
}

/* ---------------------------------------------------------------- dial --
   Time Timer style disc. One custom property drives it: --progress, 0–1,
   the share of the session still remaining. 1 = full terracotta disc,
   0 = empty. The disc is mirrored (scaleX) so the wedge drains
   counter-clockwise, which is what makes the minute numbers read correctly.
   ------------------------------------------------------------------------ */

.dial {
  position: relative;
  width: min(44vh, 74vw, 27rem);
  aspect-ratio: 1;
  margin-bottom: 1rem;
  --progress: 1;
  --dial-fill: var(--terracotta);
  --dial-empty: #fff;
}

.dial__disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--dial-empty);
  background-image: conic-gradient(
    var(--dial-fill) 0turn calc(var(--progress) * 1turn),
    var(--dial-empty) calc(var(--progress) * 1turn) 1turn
  );
  transform: scaleX(-1);
  box-shadow: 0 10px 34px rgba(42, 37, 32, 0.16);
}

.dial__face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--ink);
  pointer-events: none;
}

.dial__ticks {
  opacity: 0.85;
}

.dial__nums {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  fill: var(--ink);
}

.dial__hub {
  fill: var(--ink);
}

/* Break mode: sage page, so the disc drains to cream and drains in sage. */
.timer-page[data-mode="break"] .dial {
  --dial-fill: var(--ink);
  --dial-empty: var(--cream);
}

.timer-page[data-mode="break"] .dial__face,
.timer-page[data-mode="break"] .dial__nums {
  color: var(--ink);
  fill: var(--ink);
}

/* Which readout is showing is decided entirely by data-style on <body>. */
.timer-page[data-style="digital"] .dial {
  display: none;
}

.timer-page[data-style="dial"] .timer__display {
  font-size: clamp(1.6rem, 4vw, 3rem);
  margin-bottom: 0.25rem;
}

/* Quotes show in both styles; the slot just gets tighter next to the dial. */
.timer-page[data-style="dial"] .timer__quote-slot {
  height: clamp(4.5rem, 9vh, 7rem);
  margin-bottom: 1.25rem;
}

.timer-page[data-style="dial"] .timer__quote {
  font-size: clamp(1rem, 2vw, 1.5rem);
}

.timer-page[data-style="dial"] .timer__title {
  font-size: clamp(1.2rem, 3vw, 2rem);
  margin-bottom: 0.9rem;
}

.field__hint {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-70);
  line-height: 1.5;
}

/* ------------------------------------------------------------ controls -- */

.timer__controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(1rem, 2vw, 2rem);
}

.tbtn {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 2vw, 1.7rem);
  font-weight: 600;
  padding: 0.9em 2em;
  border-radius: 1.6rem;
  border: 4px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.12s ease,
    opacity 0.2s ease;
}

.tbtn:active:not(:disabled) {
  transform: scale(0.95);
}

.tbtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tbtn:focus-visible {
  outline: 4px solid var(--terracotta);
  outline-offset: 3px;
}

.tbtn--primary {
  background: var(--terracotta);
  color: var(--cream);
  box-shadow: 0 6px 18px rgba(42, 37, 32, 0.14);
}

.tbtn--primary:hover:not(:disabled) {
  background: #b8502f;
}

.tbtn--dark {
  background: var(--ink);
  color: var(--cream);
  box-shadow: 0 6px 18px rgba(42, 37, 32, 0.14);
}

.tbtn--dark:hover:not(:disabled) {
  background: #000;
}

.tbtn--ghost {
  background: transparent;
  border-color: var(--sage);
  color: var(--sage);
}

.tbtn--ghost:hover:not(:disabled) {
  background: var(--sage);
  color: var(--cream);
}

.timer__hints {
  position: absolute;
  bottom: 1.5rem;
  width: 100%;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: clamp(0.9rem, 1.6vw, 1.15rem);
  color: var(--sage);
  opacity: 0.85;
  transition: color 1s ease;
}

kbd {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 500;
  padding: 0.15em 0.5em;
  margin: 0 0.15em;
  border-radius: 5px;
  background: rgba(42, 37, 32, 0.1);
}

/* --------------------------------------------------------- top-right ui -- */

.timer__tools {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 20;
}

.icon-btn {
  background: none;
  border: 0;
  padding: 4px;
  cursor: pointer;
  color: var(--ink-70);
  transition: color 0.2s ease;
  line-height: 0;
}

.icon-btn:hover {
  color: var(--terracotta);
}

.icon-btn:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 2px;
  border-radius: 8px;
}

.icon-btn svg {
  width: clamp(1.75rem, 3vw, 2.25rem);
  height: clamp(1.75rem, 3vw, 2.25rem);
}

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------- modes -- */

/* Break: the whole page goes sage, text goes cream. */
.timer-page[data-mode="break"] {
  background: var(--sage);
  color: var(--cream);
}

.timer-page[data-mode="break"] .timer__status,
.timer-page[data-mode="break"] .timer__quote,
.timer-page[data-mode="break"] .timer__hints {
  color: var(--cream);
}

.timer-page[data-mode="break"] .icon-btn {
  color: var(--cream-70);
}

.timer-page[data-mode="break"] kbd {
  background: rgba(247, 240, 227, 0.18);
}

/* Overtime: cream page, but the clock runs terracotta. */
.timer-page[data-mode="overtime"] .timer__display,
.timer-page[data-mode="overtime"] .timer__status {
  color: var(--terracotta);
}

/* Focus finished, sitting at zero. */
.timer__display.is-finished {
  animation: pulse-finish 2s infinite ease-in-out;
}

@keyframes pulse-finish {
  0% {
    transform: scale(1);
    color: var(--terracotta);
  }
  50% {
    transform: scale(1.05);
    color: var(--mustard);
  }
  100% {
    transform: scale(1);
    color: var(--terracotta);
  }
}

/* ------------------------------------------------------------- settings -- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(42, 37, 32, 0.6);
  backdrop-filter: blur(8px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal__panel {
  background: var(--cream);
  color: var(--ink);
  border-radius: 1.5rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  text-align: left;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-20) transparent;
}

.modal__panel::-webkit-scrollbar {
  width: 8px;
}
.modal__panel::-webkit-scrollbar-track {
  background: rgba(42, 37, 32, 0.05);
  border-radius: 8px;
}
.modal__panel::-webkit-scrollbar-thumb {
  background: var(--ink-20);
  border-radius: 8px;
}
.modal__panel::-webkit-scrollbar-thumb:hover {
  background: rgba(42, 37, 32, 0.4);
}

.modal__close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: var(--cream);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-70);
  line-height: 0;
  padding: 4px;
}

.modal__close:hover {
  color: var(--terracotta);
}

.modal__title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--ink-16);
}

.fieldset {
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid var(--ink-16);
  border-radius: 1rem;
  padding: 1.5rem;
  margin: 0 0 1.5rem;
}

.fieldset legend {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--terracotta);
  padding: 0 0.5rem;
}

.field {
  margin-bottom: 1.25rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field > label,
.field__label {
  display: block;
  font-weight: 600;
  font-size: 1.02rem;
  margin-bottom: 0.5rem;
}

.field__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.field__value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--sage);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .field-grid {
    grid-template-columns: 1fr;
  }
}

select {
  width: 100%;
  padding: 0.7rem;
  border: 2px solid var(--ink-20);
  border-radius: 0.7rem;
  background: var(--cream);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

select:focus {
  outline: none;
  border-color: var(--terracotta);
}

input[type="range"] {
  width: 100%;
  height: 12px;
  border-radius: 8px;
  background: var(--ink-20);
  appearance: none;
  cursor: pointer;
  accent-color: var(--terracotta);
}

.radio-row {
  display: flex;
  gap: 1.25rem;
  padding-top: 0.35rem;
}

.radio-row label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 1.02rem;
}

input[type="radio"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--terracotta);
}

.btn-outline {
  width: 100%;
  margin-top: 0.5rem;
  background: rgba(42, 37, 32, 0.05);
  border: 2px solid var(--ink);
  color: var(--ink);
  padding: 0.8rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.btn-outline:hover {
  background: var(--ink);
  color: var(--cream);
}

/* ------------------------------------------------------------ home link -- */

.timer__home {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 20;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: inherit;
  opacity: 0.75;
  white-space: nowrap;
}

.timer__home:hover {
  opacity: 1;
}

.timer__home .out {
  color: var(--terracotta);
}

.timer-page[data-mode="break"] .timer__home .out {
  color: var(--cream);
}

/* On short screens, drop the quote slot and hints so the clock always fits. */
@media (max-height: 700px) {
  .timer__quote-slot {
    display: none;
  }
  .timer__hints {
    display: none;
  }
}
