/* CalcPro stopwatch — hand-authored CSS, no framework, no webfonts. */

:root {
  color-scheme: light;
  --bg: #f7f6f1;
  --surface: #ffffff;
  --surface-2: #efeee7;
  --text: #111413;
  --text-muted: #58615b;
  --border: #e1dfd5;
  --border-strong: #8f8d82;
  --accent: #0b5f4b;
  --accent-hover: #084435;
  --accent-soft: #e2efe9;
  --accent-contrast: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1060px;
  --font-sans:
    ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #090b0a;
    --surface: #111512;
    --surface-2: #171c19;
    --text: #eef2ee;
    --text-muted: #9aa69e;
    --border: #242b26;
    --border-strong: #667169;
    --accent: #63e6bf;
    --accent-hover: #8af0d2;
    --accent-soft: #0e2a21;
    --accent-contrast: #04150f;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05em 0.35em;
}

button {
  font: inherit;
}

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

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  z-index: 10;
}

.skip-link:focus {
  left: 0.75rem;
  top: 0.75rem;
}

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-header .inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 640;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin-left: auto;
  font-size: 0.86rem;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0;
}

.site-nav a:hover {
  color: var(--accent);
}

.site-nav .nav-out {
  color: var(--accent);
  font-weight: 560;
}

/* ---------- hero ---------- */

.hero {
  padding: clamp(2rem, 5vw, 3.25rem) 0 1.5rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 1.4rem + 3.4vw, 3.4rem);
  margin: 0 0 0.65rem;
  max-width: 20ch;
}

.lede {
  max-width: 62ch;
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* ---------- timer ---------- */

.timer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin: 0.5rem 0 3rem;
}

.timer > * {
  min-width: 0;
}

@media (min-width: 880px) {
  .timer {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: start;
  }
}

.timer-panel {
  padding: 1.35rem;
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
}

.timer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

/* Mode selector */
.mode-selector {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px;
  gap: 2px;
}

.mode-pill {
  background: transparent;
  border: none;
  border-radius: 16px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 540;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 150ms ease;
  line-height: 1.2;
}

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

.mode-pill.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

/* Break room countdown configuration & reminder banner */
.breakroom-banner[hidden] {
  display: none !important;
}

.breakroom-banner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.75rem 0 0.5rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--text);
  animation: fadeIn 200ms ease;
}

.breakroom-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.breakroom-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.breakroom-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.breakroom-title {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.breakroom-presets {
  display: flex;
  gap: 0.35rem;
}

.preset-pill {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 550;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 120ms ease;
}

.preset-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.preset-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

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

.breakroom-config {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.65rem;
}

@media (max-width: 520px) {
  .breakroom-config {
    grid-template-columns: 1fr;
  }
}

.breakroom-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.breakroom-label-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.breakroom-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.breakroom-input {
  box-sizing: border-box;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  padding: 0 0.65rem;
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.breakroom-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.breakroom-number {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
}

.breakroom-text {
  width: 100%;
}

.breakroom-refresh-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 150ms ease;
}

.breakroom-refresh-btn:hover {
  opacity: 0.75;
}

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

.breakroom-display-quote {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

.breakroom-quote-mark {
  font-family: serif;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--accent);
  font-weight: bold;
}

.breakroom-message {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  text-align: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fullscreen-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
}

.fullscreen-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface-2);
}

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

.timer-state {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.timer-state::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}

.timer-state.is-running::before {
  background: var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.timer-time {
  margin: 0.5rem 0 0.4rem;
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 1.1rem + 7vw, 4.6rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timer-help {
  margin: 0 0 1.1rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  max-width: 46ch;
}

.timer-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.timer-buttons .btn {
  flex: 1 1 42%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  text-decoration: none;
  padding: 0 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 540;
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: var(--accent-contrast);
}

.btn:disabled,
.btn:disabled:hover {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-primary:disabled,
.btn-primary:disabled:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
  opacity: 0.55;
}

/* ---------- fullscreen mode (pure message & time) ---------- */

body.is-fullscreen {
  overflow: hidden;
}

body.is-fullscreen #timer-panel {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: clamp(1.5rem, 5vw, 4rem);
  background: var(--bg);
  border: none;
  border-radius: 0;
  box-sizing: border-box;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Hide all clutter: mode pills, input forms, buttons, help text, borders */
body.is-fullscreen #timer-panel .mode-selector,
body.is-fullscreen #timer-panel .breakroom-header,
body.is-fullscreen #timer-panel .breakroom-config,
body.is-fullscreen #timer-panel .timer-buttons,
body.is-fullscreen #timer-panel .timer-help {
  display: none !important;
}

/* Position exit button cleanly at the top right corner */
body.is-fullscreen #timer-panel .timer-header {
  position: absolute;
  top: clamp(1rem, 3vw, 2rem);
  right: clamp(1rem, 3vw, 2rem);
  left: auto;
  width: auto;
  margin: 0;
  z-index: 10;
}

body.is-fullscreen #timer-panel .fullscreen-btn {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.85rem;
  opacity: 0.55;
  transition: opacity 150ms ease, background 150ms ease;
}

body.is-fullscreen #timer-panel .fullscreen-btn:hover,
body.is-fullscreen #timer-panel .fullscreen-btn:focus-visible {
  opacity: 1;
}

/* Pure message display in fullscreen: no box, no border, no background */
body.is-fullscreen #timer-panel .breakroom-banner {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 0 clamp(1.2rem, 3vw, 2.5rem) !important;
  max-width: 900px;
  width: 100%;
  text-align: center;
}

body.is-fullscreen #timer-panel .breakroom-display-quote {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(0.4rem, 1.5vw, 0.8rem);
}

body.is-fullscreen #timer-panel .breakroom-quote-mark {
  font-family: serif;
  font-size: clamp(2rem, 5vw, 4rem);
  color: var(--accent);
  line-height: 1;
  user-select: none;
}

body.is-fullscreen #timer-panel .breakroom-message {
  font-size: clamp(1.35rem, 3.2vw, 2.7rem);
  font-weight: 550;
  color: var(--text);
  line-height: 1.35;
  letter-spacing: -0.02em;
  max-width: 32ch;
  margin: 0;
  text-align: center;
}

/* State indicator in fullscreen */
body.is-fullscreen #timer-panel .timer-state {
  font-size: clamp(0.85rem, 1.6vw, 1.15rem);
  letter-spacing: 0.15em;
  margin-bottom: 0.5rem;
  user-select: none;
}

/* Giant, clean time display in fullscreen */
body.is-fullscreen #timer-panel .timer-time {
  font-size: clamp(4.5rem, 18vw, 15rem);
  font-weight: 600;
  margin: 0;
  line-height: 0.98;
  letter-spacing: -0.04em;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: transform 120ms ease;
}

body.is-fullscreen #timer-panel .timer-time:active {
  transform: scale(0.98);
}

/* Subtle shortcut hint at bottom */
.fullscreen-hint {
  display: none;
}

body.is-fullscreen #timer-panel .fullscreen-hint {
  display: block;
  position: absolute;
  bottom: clamp(1rem, 2.5vw, 2rem);
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 1.4vw, 0.88rem);
  color: var(--text-muted);
  opacity: 0.55;
  letter-spacing: 0.04em;
  user-select: none;
  transition: opacity 150ms ease;
}

body.is-fullscreen #timer-panel:hover .fullscreen-hint {
  opacity: 0.9;
}

/* ---------- laps ---------- */

.lap-panel {
  min-height: 200px;
  padding: 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.lap-heading {
  margin: 0 0 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lap-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  max-width: 46ch;
}

.lap-table-wrap {
  max-height: 19rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.lap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.lap-table th,
.lap-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.lap-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lap-table tbody th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
}

.lap-table tbody tr:last-child th,
.lap-table tbody tr:last-child td {
  border-bottom: 0;
}

/* ---------- prose ---------- */

.prose {
  max-width: 72ch;
  padding-bottom: 3rem;
}

.prose h2 {
  margin: 2.4rem 0 0.7rem;
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.55rem);
}

.prose h3 {
  margin: 1.8rem 0 0.5rem;
  font-size: 1rem;
}

.prose p {
  margin: 0 0 0.9rem;
}

.prose ul {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.prose li {
  margin-bottom: 0.45rem;
}

.prose .note {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 0.9rem;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.data-table caption {
  caption-side: top;
  text-align: left;
  padding: 0 0 0.45rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
}

.data-table thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.data-table tbody th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
}

.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td {
  border-bottom: 0;
}

/* ---------- faq ---------- */

details {
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 0;
}

summary {
  cursor: pointer;
  font-weight: 560;
  list-style-position: outside;
}

summary:hover {
  color: var(--accent);
}

details[open] summary {
  margin-bottom: 0.5rem;
}

details p {
  margin: 0;
  color: var(--text-muted);
}

/* ---------- related links ---------- */

.link-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  margin-top: 0.5rem;
}

.link-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 150ms ease;
}

.link-card:hover {
  border-color: var(--accent);
}

.link-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.link-note {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- legal pages ---------- */

.legal {
  padding: clamp(2rem, 4vw, 3rem) 0 1rem;
  max-width: 72ch;
}

.legal h1 {
  font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem);
  margin: 0 0 0.6rem;
}

.legal .updated {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.legal h2 {
  margin: 2rem 0 0.6rem;
  font-size: 1.2rem;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.5rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-footer .inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
}

.site-footer p {
  margin: 0;
  max-width: 62ch;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.footer-nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
