:root {
  --paper: #f4f1eb;
  --ink: #121212;
  --muted: #77736c;
  --line: #d5d1ca;
  --accent: #e8681f;
  --accent-dark: #c94f0e;
  --orb: #e7e1d8;
  --progress: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 72% 33%, rgba(255, 255, 255, 0.52), transparent 28rem),
    var(--paper);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.site-header {
  height: 88px;
  padding: 0 clamp(24px, 4.5vw, 72px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  color: var(--ink);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.07em;
  text-decoration: none;
}

.sound-toggle {
  border: 0;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-family: "Courier New", monospace;
  font-size: 12px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 99px;
  background: var(--accent);
  transition: background 180ms ease;
}

.switch-dot {
  position: absolute;
  width: 20px;
  height: 20px;
  top: 3px;
  right: 3px;
  border-radius: 50%;
  background: var(--paper);
  transition: transform 180ms ease;
}

.sound-toggle[aria-checked="false"] .switch {
  background: #b8b4ad;
}

.sound-toggle[aria-checked="false"] .switch-dot {
  transform: translateX(-20px);
}

.hero {
  min-height: 628px;
  padding: 68px clamp(24px, 5.3vw, 84px) 58px;
  display: grid;
  grid-template-columns: minmax(360px, 0.88fr) minmax(500px, 1.12fr);
  align-items: center;
  gap: clamp(44px, 7vw, 112px);
  border-bottom: 1px solid var(--line);
}

.hero-copy h1 {
  max-width: 600px;
  margin: 0;
  font-size: clamp(72px, 7.7vw, 120px);
  line-height: 0.83;
  letter-spacing: -0.075em;
  font-weight: 800;
}

.hero-copy p {
  margin: 34px 0 48px;
  font-family: "Courier New", monospace;
  font-size: clamp(15px, 1.35vw, 19px);
  line-height: 1.55;
  letter-spacing: 0.015em;
}

.start-button {
  min-width: min(100%, 410px);
  padding: 27px 40px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-size: clamp(20px, 1.8vw, 27px);
  font-weight: 700;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.start-button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.start-button:active {
  transform: translateY(2px);
}

.start-button[data-running="true"] {
  color: var(--accent);
  background: transparent;
}

.breathing {
  --phase-color: var(--muted);
  position: relative;
  width: min(100%, 540px);
  aspect-ratio: 1;
  margin-inline: auto;
}

.breathing-ring {
  position: absolute;
  inset: 11%;
  display: grid;
  place-items: center;
}

.progress {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.progress circle {
  fill: none;
  stroke-width: 1.25;
}

.progress-track {
  stroke: var(--line);
}

.progress-value {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 301.6;
  stroke-dashoffset: calc(301.6 * (1 - var(--progress)));
}

.breathing-orb {
  width: 52%;
  aspect-ratio: 1;
  border-radius: 48% 52% 55% 45% / 54% 45% 55% 46%;
  background: var(--orb);
  box-shadow: inset 24px -20px 50px rgba(255, 255, 255, 0.36);
  transform: scale(0.84) rotate(-7deg);
  transition: transform 4s linear, border-radius 4s linear, background 600ms ease;
}

.phase-current {
  position: absolute;
  display: grid;
  gap: 7px;
  text-align: center;
  pointer-events: none;
}

.phase-current strong {
  color: var(--phase-color);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 500;
}

.phase-current span {
  color: var(--muted);
  font-family: "Courier New", monospace;
  font-size: 13px;
}

.phase-label {
  position: absolute;
  z-index: 2;
  font-family: "Courier New", monospace;
  font-size: clamp(13px, 1.25vw, 18px);
  transition: color 250ms ease, font-weight 250ms ease;
}

.phase-top,
.phase-bottom {
  left: 50%;
  transform: translateX(-50%);
}

.phase-left,
.phase-right {
  top: 50%;
  transform: translateY(-50%);
}

.phase-top { top: 1%; }
.phase-right { right: 0; }
.phase-bottom { bottom: 1%; }
.phase-left { left: 0; }

.breathing[data-phase="inhale"] {
  --phase-color: var(--accent);
}

.breathing[data-phase="inhale"] .phase-left,
.breathing[data-phase="hold"] .phase-top,
.breathing[data-phase="exhale"] .phase-right,
.breathing[data-phase="pause"] .phase-bottom {
  color: var(--accent);
  font-weight: 700;
}

.breathing[data-phase="inhale"] .breathing-orb {
  transform: scale(1) rotate(4deg);
  border-radius: 54% 46% 45% 55% / 45% 55% 46% 54%;
}

.breathing[data-phase="hold"] .breathing-orb {
  transform: scale(1) rotate(8deg);
}

.breathing[data-phase="exhale"] .breathing-orb {
  transform: scale(0.72) rotate(-8deg);
  border-radius: 43% 57% 52% 48% / 58% 43% 57% 42%;
}

.breathing[data-phase="pause"] .breathing-orb {
  transform: scale(0.72) rotate(-4deg);
}

.rhythm {
  min-height: 270px;
  padding: 54px clamp(24px, 5.3vw, 84px);
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  align-items: center;
  gap: 7vw;
}

.rhythm-mark {
  justify-self: end;
  width: 86px;
  height: 86px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-family: "Courier New", monospace;
  font-size: 18px;
}

.rhythm-copy h2 {
  margin: 0 0 15px;
  font-size: clamp(38px, 4vw, 60px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.rhythm-copy p {
  margin: 0;
  font-family: "Courier New", monospace;
  font-size: clamp(14px, 1.25vw, 18px);
  line-height: 1.5;
}

.site-footer {
  min-height: 96px;
  padding: 30px clamp(24px, 5.3vw, 84px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #e7e3dd;
  background: var(--ink);
  font-family: "Courier New", monospace;
  font-size: 13px;
}

.metrika-pixel {
  position: absolute;
  left: -9999px;
}

:focus-visible {
  outline: 3px solid rgba(232, 104, 31, 0.38);
  outline-offset: 4px;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 54px;
    gap: 48px;
  }

  .hero-copy {
    text-align: center;
  }

  .hero-copy h1 {
    margin-inline: auto;
    font-size: clamp(64px, 15vw, 104px);
  }

  .hero-copy p {
    margin: 28px 0 34px;
  }

  .breathing {
    max-width: 560px;
  }
}

@media (max-width: 560px) {
  .site-header {
    height: 70px;
  }

  .wordmark {
    font-size: 28px;
  }

  .hero {
    min-height: 0;
    padding-block: 44px 40px;
    gap: 36px;
  }

  .hero-copy h1 {
    font-size: clamp(58px, 20vw, 82px);
  }

  .hero-copy p {
    max-width: 290px;
    margin-inline: auto;
    font-size: 14px;
  }

  .start-button {
    min-width: 0;
    width: 100%;
    padding: 21px 24px;
  }

  .breathing {
    width: 100%;
  }

  .breathing-ring {
    inset: 13%;
  }

  .phase-label {
    font-size: 12px;
  }

  .rhythm {
    min-height: 0;
    padding-block: 54px 60px;
    grid-template-columns: 1fr;
    gap: 28px;
    text-align: center;
  }

  .rhythm-mark {
    justify-self: center;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
