/* Pomodoro timer: component styles inherit the site light/dark tokens. */
.pomo-timer {
  --pomo-progress: 100%;
  --pomo-tomato: #d9362e;
  --pomo-tomato-deep: #b92c27;
  --pomo-tomato-soft: #fff0ee;
  --pomo-leaf: #2f7d50;
  --pomo-leaf-soft: #eaf7ef;
  --pomo-long-break: #367f78;
  --pomo-accent: var(--pomo-tomato);
  --pomo-accent-contrast: #fff;
  --pomo-accent-hover: var(--pomo-tomato-deep);
  --pomo-accent-soft: var(--pomo-tomato-soft);
  --pomo-progress-track: rgba(226, 55, 48, 0.12);
  --pomo-panel: var(--color-bg-surface);
  max-width: 780px;
  margin: 0 auto;
  padding: 112px 24px 80px;
  color: var(--color-text);
}

[data-theme='dark'] .pomo-timer {
  --pomo-tomato: #ff6b61;
  --pomo-tomato-deep: #ff8a82;
  --pomo-tomato-soft: rgba(255, 107, 97, 0.14);
  --pomo-leaf: #65b987;
  --pomo-leaf-soft: rgba(101, 185, 135, 0.16);
  --pomo-long-break: #56a9a0;
  --pomo-accent-contrast: #141414;
  --pomo-accent-hover: var(--pomo-tomato-deep);
  --pomo-progress-track: rgba(255, 255, 255, 0.1);
}

.pomo-timer__header {
  margin-bottom: 28px;
  text-align: center;
}

.pomo-timer__eyebrow {
  margin: 0 0 8px;
  color: var(--pomo-accent);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
}

.pomo-timer__header h1 {
  margin: 0;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 7vw, var(--fs-5xl));
  line-height: var(--lh-tight);
}

.pomo-timer > #pomo-timer {
  display: grid;
  gap: 24px;
  padding: 32px;
  border: 1px solid color-mix(in srgb, var(--pomo-accent) 18%, var(--color-border));
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 50% 0, var(--pomo-accent-soft), transparent 34%),
    var(--pomo-panel);
  box-shadow: 0 24px 64px rgba(64, 24, 20, 0.12), var(--shadow-sm);
}

.pomo-timer > #pomo-timer[data-mode='shortBreak'] {
  --pomo-accent: var(--pomo-leaf);
  --pomo-accent-hover: #24643f;
  --pomo-accent-soft: var(--pomo-leaf-soft);
  --pomo-progress-track: rgba(47, 125, 80, 0.14);
  --pomo-progress-track: color-mix(in srgb, var(--pomo-leaf) 14%, transparent);
}

.pomo-timer > #pomo-timer[data-mode='longBreak'] {
  --pomo-accent: var(--pomo-long-break);
  --pomo-accent-hover: #285f5a;
  --pomo-accent-soft: color-mix(in srgb, var(--pomo-long-break) 14%, transparent);
  --pomo-progress-track: rgba(54, 127, 120, 0.14);
  --pomo-progress-track: color-mix(in srgb, var(--pomo-long-break) 14%, transparent);
}

[data-theme='dark'] .pomo-timer > #pomo-timer[data-mode='shortBreak'] {
  --pomo-accent-hover: #82caa0;
  --pomo-progress-track: rgba(101, 185, 135, 0.16);
}

[data-theme='dark'] .pomo-timer > #pomo-timer[data-mode='longBreak'] {
  --pomo-accent-hover: #72beb6;
  --pomo-progress-track: rgba(86, 169, 160, 0.16);
}

.pomo-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-bg);
}

.pomo-mode,
.pomo-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--color-text);
  background: transparent;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  cursor: pointer;
  transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.pomo-mode[aria-pressed='true'] {
  border-color: var(--pomo-accent);
  color: var(--pomo-accent-contrast);
  background: var(--pomo-accent);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--pomo-accent) 28%, transparent);
}

.pomo-display {
  position: absolute;
  z-index: 1;
  inset: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  border-radius: var(--radius-circle);
}

.pomo-current-mode {
  color: var(--pomo-accent);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-widest);
  text-transform: uppercase;
}

.pomo-time {
  color: var(--color-text);
  font-family: var(--font-family);
  font-feature-settings: 'tnum' 1;
  font-size: clamp(3.4rem, 14vw, 5.75rem);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-light);
  letter-spacing: var(--ls-tight);
  line-height: 0.9;
}

.pomo-progress-shell {
  position: relative;
  justify-self: center;
  width: min(100%, 320px);
  aspect-ratio: 1;
}

.pomo-progress {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-circle);
  background: conic-gradient(var(--pomo-accent) var(--pomo-progress), var(--pomo-progress-track) 0);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--pomo-accent) 14%, transparent), inset 0 0 0 1px var(--color-border);
  transition: background var(--transition-base);
}

.pomo-progress::after {
  position: absolute;
  inset: 16px;
  border-radius: inherit;
  background: var(--pomo-panel);
  content: '';
}

.pomo-rounds {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pomo-round {
  width: 11px;
  height: 11px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-circle);
  background: var(--color-bg);
}

.pomo-round[data-completed] {
  border-color: var(--pomo-accent);
  background: var(--pomo-accent-soft);
}

.pomo-round[aria-current='step'] {
  border-color: var(--pomo-accent);
  background: var(--pomo-accent);
  box-shadow: 0 0 0 4px var(--pomo-accent-soft);
}

.pomo-intention,
.pomo-setting {
  display: grid;
  gap: 8px;
}

.pomo-intention label,
.pomo-setting label,
.pomo-settings > label {
  color: var(--color-text-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

.pomo-intention input,
.pomo-setting input {
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  background: var(--color-bg);
  font: inherit;
}

.pomo-actions {
  display: grid;
  grid-template-columns: 1fr repeat(2, minmax(0, 0.7fr));
  gap: 10px;
}

.pomo-button {
  padding: 10px 16px;
  border-color: var(--color-border);
  background: var(--color-bg);
}

.pomo-button--primary {
  border-color: var(--pomo-accent);
  color: var(--pomo-accent-contrast);
  background: var(--pomo-accent);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--pomo-accent) 24%, transparent);
}

.pomo-mode:hover,
.pomo-button:hover {
  border-color: var(--color-primary);
}

.pomo-button--primary:hover {
  border-color: var(--pomo-accent-hover);
  background: var(--pomo-accent-hover);
}

.pomo-button--quiet {
  min-height: 40px;
  color: var(--color-text-secondary);
  background: transparent;
}

.pomo-history {
  display: grid;
  gap: 20px;
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
}

.pomo-history__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.pomo-history__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pomo-history__header h2,
.pomo-history__header p,
.pomo-history__stats dd,
.pomo-history__stats dt {
  margin: 0;
}

.pomo-history__header h2 {
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--fs-xl);
}

.pomo-history__header p:not(.pomo-history__kicker) {
  margin-top: 5px;
  color: var(--color-text-secondary);
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}

.pomo-history__kicker {
  margin-bottom: 5px !important;
  color: var(--color-text-secondary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
}

.pomo-history__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.pomo-history__stats > div {
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--pomo-panel);
}

.pomo-history__stats dt {
  color: var(--color-text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}

.pomo-history__stats dd {
  margin-top: 4px;
  color: var(--color-text);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: 1;
}

.pomo-history__chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 148px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pomo-history__chart li {
  display: grid;
  grid-template-rows: 22px 92px 20px;
  align-items: end;
  gap: 4px;
  min-width: 0;
  color: var(--color-text-muted);
  font-size: var(--fs-xs);
  text-align: center;
}

.pomo-history__count {
  color: var(--color-text-secondary);
  font-weight: var(--fw-semibold);
}

.pomo-history__bar {
  align-self: end;
  width: min(100%, 34px);
  height: var(--pomo-history-height);
  min-height: 6px;
  margin: 0 auto;
  border-radius: var(--radius-pill) var(--radius-pill) 6px 6px;
  background: linear-gradient(180deg, var(--color-primary), var(--color-primary-dark));
  box-shadow: 0 5px 14px color-mix(in srgb, var(--color-primary) 14%, transparent);
}

.pomo-history__chart time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pomo-mode:focus,
.pomo-button:focus,
.pomo-mode:focus-visible,
.pomo-button:focus-visible,
.pomo-intention input:focus-visible,
.pomo-setting input:focus-visible,
.pomo-settings summary:focus-visible,
.pomo-cta a:focus-visible {
  outline-color: var(--color-focus);
  outline-style: solid;
  outline-width: 3px;
  outline-offset: 3px;
}

.pomo-settings {
  display: grid;
  gap: 18px;
  padding: 0 16px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.pomo-settings summary {
  min-height: 44px;
  padding-top: 13px;
  color: var(--color-text);
  font-weight: var(--fw-semibold);
  cursor: pointer;
}

.pomo-settings > label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.pomo-settings input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

.pomo-cta {
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--pomo-tomato) 16%, var(--color-border));
  background: var(--pomo-tomato-soft);
}

.pomo-cta h2,
.pomo-cta p {
  margin: 0;
}

.pomo-cta h2 {
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--fs-xl);
}

.pomo-cta p {
  margin-top: 8px;
  color: var(--color-text-secondary);
  line-height: var(--lh-relaxed);
}

.pomo-cta a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 16px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  color: #fff;
  background: var(--pomo-tomato);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  text-decoration: none;
}

[data-theme='dark'] .pomo-cta a {
  color: #141414;
}

.pomo-live {
  min-height: 1.5em;
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
  text-align: center;
}

@media (max-width: 419px) {
  .pomo-timer {
    padding: 96px 16px 48px;
  }

  .pomo-timer > #pomo-timer {
    gap: 20px;
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
  }

  .pomo-modes {
    border-radius: var(--radius-md);
  }

  .pomo-mode {
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-xs);
  }

  .pomo-progress-shell {
    width: min(100%, 248px);
  }

  .pomo-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pomo-button--primary {
    grid-column: 1 / -1;
  }

  .pomo-history {
    padding: 18px 14px;
  }

  .pomo-history__header {
    display: grid;
    gap: 12px;
  }

  .pomo-history__actions {
    justify-self: start;
    justify-content: flex-start;
  }

  .pomo-history__chart {
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pomo-progress,
  .pomo-mode,
  .pomo-button { transition: none; }
}
