@layer reset, base, components, states, responsive;

@font-face {
  font-family: "Satoshi";
  src: url("./assets/fonts/Satoshi-Variable.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Satoshi";
  src: url("./assets/fonts/Satoshi-VariableItalic.woff2") format("woff2");
  font-weight: 300 900;
  font-style: italic;
  font-display: swap;
}

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

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

  body,
  h1,
  h2,
  p,
  ol,
  fieldset {
    margin: 0;
  }

  ol {
    padding: 0;
    list-style: none;
  }

  button,
  input {
    font: inherit;
  }

  button {
    color: inherit;
  }

  [hidden] {
    display: none !important;
  }
}

@layer base {
  :root {
    --paper: #f4ecdc;
    --paper-light: #fffaf0;
    --paper-deep: #e9dbc2;
    --ink: #211d18;
    --ink-soft: #5d5145;
    --line: #bda98c;
    --ember: #9f361f;
    --ember-dark: #742312;
    --saffron: #dd8e21;
    --sun: #f1af35;
    --white: #fffdf8;
    --shadow: 0 1.5rem 4rem rgb(62 37 18 / 10%);
    --radius: 1.5rem;
    --sans: "Satoshi", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --accent: Iowan Old Style, Baskerville, "Times New Roman", serif;
  }

  html {
    min-width: 20rem;
    background: var(--paper);
    font-synthesis: none;
    overflow-x: clip;
    scroll-behavior: smooth;
  }

  body {
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--ink);
    background: linear-gradient(135deg, var(--paper-light), var(--paper) 48%, var(--paper-deep));
    font-family: var(--sans);
    line-height: 1.5;
  }

  body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    background-image: radial-gradient(rgb(33 29 24 / 13%) 0.045rem, transparent 0.055rem);
    background-size: 0.35rem 0.35rem;
    content: "";
    opacity: 0.12;
    pointer-events: none;
  }

  h1,
  h2 {
    font-family: var(--sans);
    font-weight: 650;
    letter-spacing: -0.045em;
    line-height: 0.98;
    text-wrap: balance;
  }

  h1 {
    font-size: clamp(3.2rem, 7vw, 6.75rem);
  }

  h1 em {
    color: var(--ember);
    font-family: var(--accent);
    font-style: italic;
    font-weight: 400;
  }

  h2 {
    font-size: clamp(2rem, 3vw, 3rem);
  }

  button,
  summary,
  label,
  input {
    -webkit-tap-highlight-color: transparent;
  }

  :focus-visible {
    outline: 0.2rem solid var(--ink);
    outline-offset: 0.25rem;
  }

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

  .skip-link {
    position: fixed;
    z-index: 20;
    top: max(0.75rem, env(safe-area-inset-top));
    left: max(0.75rem, env(safe-area-inset-left));
    min-height: 2.75rem;
    padding: 0.65rem 1rem;
    translate: 0 -200%;
    color: var(--white);
    background: var(--ink);
    border-radius: 0.25rem;
    font-weight: 700;
  }

  .skip-link:focus {
    translate: 0;
  }
}

@layer components {
  .app-shell {
    width: min(100%, 88rem);
    min-height: calc(100vh - 5rem);
    min-height: calc(100dvh - 5rem);
    margin-inline: auto;
    padding:
      max(1.25rem, env(safe-area-inset-top))
      max(1.25rem, env(safe-area-inset-right))
      2rem
      max(1.25rem, env(safe-area-inset-left));
  }

  .screen {
    min-height: calc(100vh - 8rem);
    min-height: calc(100dvh - 8rem);
  }

  .hero {
    position: relative;
    height: 200vh;
    margin-top: calc(-1 * max(1.25rem, env(safe-area-inset-top)));
    margin-inline: calc(50% - 50vw);
  }

  .hero-scene {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow: clip;
    isolation: isolate;
    background: linear-gradient(150deg, var(--paper-light), #eab35f 58%, var(--paper-deep));
  }

  /* Pointer parallax: each plane shifts by --mx/--my scaled to its depth. */
  .hero-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center bottom;
    opacity: 0;
    transform-origin: center bottom;
    transition: opacity 900ms ease, transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
  }

  .hero-layer.is-loaded {
    opacity: 1;
  }

  .hero-sky {
    z-index: 0;
    opacity: 1;
    transform: translate3d(calc(var(--mx, 0) * -0.35rem), calc(var(--my, 0) * -0.25rem), 0);
  }

  .hero-far {
    z-index: 1;
    mix-blend-mode: multiply;
    transform: translate3d(calc(var(--mx, 0) * -0.8rem), calc(var(--my, 0) * -0.5rem), 0);
  }

  .hero-mid {
    z-index: 3;
    mix-blend-mode: multiply;
    transform: translate3d(calc(var(--mx, 0) * -1.4rem), calc(var(--my, 0) * -0.9rem), 0);
  }

  .hero-fg {
    z-index: 6;
    filter: blur(1.2px);
    mix-blend-mode: multiply;
    transform: translate3d(calc(var(--mx, 0) * -2.4rem), calc(var(--my, 0) * -1.5rem), 0);
  }

  .hero-mist {
    position: absolute;
    left: -12%;
    width: 124%;
    pointer-events: none;
    -webkit-mask: radial-gradient(closest-side, #000 35%, transparent 96%);
    mask: radial-gradient(closest-side, #000 35%, transparent 96%);
  }

  .hero-mist-far {
    z-index: 4;
    bottom: 16%;
    height: 36%;
    opacity: 0.38;
  }

  .hero-mist-near {
    z-index: 7;
    bottom: -6%;
    height: 34%;
    opacity: 0.3;
    transform: translate3d(calc(var(--mx, 0) * -2rem), calc(var(--my, 0) * -1.2rem), 0);
    transition: transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .hero-mist-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    mix-blend-mode: screen;
    animation: mist-drift 80s ease-in-out infinite alternate;
  }

  .hero-mist-near .hero-mist-img {
    animation-duration: 55s;
    animation-direction: alternate-reverse;
  }

  .hero-beams {
    position: absolute;
    z-index: 5;
    inset: -15%;
    background: repeating-conic-gradient(
      from 188deg at 76% 52%,
      transparent 0deg 6deg,
      rgb(255 214 109 / 16%) 9deg 11deg,
      transparent 14deg 24deg
    );
    filter: blur(16px);
    mix-blend-mode: screen;
    opacity: 0.75;
    pointer-events: none;
    -webkit-mask: radial-gradient(circle at 76% 52%, #000 0 16%, transparent 52%);
    mask: radial-gradient(circle at 76% 52%, #000 0 16%, transparent 52%);
    animation: beam-sway 24s ease-in-out infinite alternate;
  }

  /* The disc, corona and bloom are painted into the image; screen blend
     keys out its black background so it reads as light, not a sticker. */
  .hero-sun {
    position: absolute;
    z-index: 2;
    right: 2%;
    bottom: 8%;
    width: clamp(16rem, 38vmin, 28rem);
    aspect-ratio: 1;
    mix-blend-mode: screen;
    transform: translate3d(calc(var(--mx, 0) * -1.1rem), calc(var(--my, 0) * -0.7rem), 0);
    transition: transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .hero-sun-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 900ms ease;
    -webkit-mask: radial-gradient(circle, #000 0 18%, transparent 34%);
    mask: radial-gradient(circle, #000 0 18%, transparent 34%);
    animation: sun-breathe 5.5s ease-in-out infinite;
  }

  .hero-sun-img.is-loaded {
    opacity: 1;
  }

  @keyframes sun-breathe {
    50% {
      filter: brightness(1.14);
    }
  }

  .hero-scene .masthead {
    position: relative;
    z-index: 8;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: min(100%, 88rem);
    height: 100%;
    margin-inline: auto;
    padding:
      max(1.25rem, env(safe-area-inset-top))
      max(1.25rem, env(safe-area-inset-right))
      clamp(4rem, 32vh, 22rem)
      max(1.25rem, env(safe-area-inset-left));
  }

  .masthead-copy {
    max-width: 52rem;
    margin-inline: auto;
    text-align: center;
  }

  /* Scrubbed sunrise: scroll position drives the scene, reversibly. */
  @supports (animation-timeline: scroll()) {
    .hero-sun {
      animation: hero-sun-rise linear both;
      animation-timeline: scroll();
      animation-range: 0 90vh;
    }

    .hero-sky {
      animation: hero-sky-dawn linear both;
      animation-timeline: scroll();
      animation-range: 0 100vh;
    }

    .hero-far {
      animation: layer-settle-far linear both;
      animation-timeline: scroll();
      animation-range: 0 100vh;
    }

    .hero-mid {
      animation: layer-settle-mid linear both;
      animation-timeline: scroll();
      animation-range: 0 100vh;
    }

    .hero-fg {
      animation: layer-settle-fg linear both;
      animation-timeline: scroll();
      animation-range: 0 100vh;
    }

    .hero-mist {
      animation: mist-rise linear both;
      animation-timeline: scroll();
      animation-range: 10vh 100vh;
    }

    .hero-beams {
      animation:
        beam-sway 24s ease-in-out infinite alternate,
        beams-in linear both;
      animation-timeline: auto, scroll();
      animation-range: normal, 30vh 100vh;
    }

    .masthead-copy {
      animation: hero-copy-drift linear both;
      animation-timeline: scroll();
      animation-range: 25vh 95vh;
    }
  }

  @keyframes hero-sun-rise {
    from {
      translate: 0 24vh;
      scale: 0.92;
    }

    to {
      translate: 0 0;
      scale: 1;
    }
  }

  @keyframes hero-sky-dawn {
    from {
      scale: 1.07;
      filter: brightness(0.94) saturate(1.08);
    }

    to {
      scale: 1;
      filter: none;
    }
  }

  @keyframes layer-settle-far {
    from {
      translate: 0 2.5vh;
      scale: 1.04;
    }

    to {
      translate: 0 0;
      scale: 1;
    }
  }

  @keyframes layer-settle-mid {
    from {
      translate: 0 7vh;
      scale: 1.1;
    }

    to {
      translate: 0 0;
      scale: 1;
    }
  }

  @keyframes layer-settle-fg {
    from {
      translate: 0 13vh;
      scale: 1.22;
    }

    to {
      translate: 0 0;
      scale: 1;
    }
  }

  @keyframes mist-rise {
    from {
      translate: 0 6vh;
    }

    to {
      translate: 0 0;
    }
  }

  @keyframes mist-drift {
    from {
      translate: -3% 0;
    }

    to {
      translate: 3% 0;
    }
  }

  @keyframes beam-sway {
    from {
      rotate: -1.6deg;
    }

    to {
      rotate: 1.6deg;
    }
  }

  @keyframes beams-in {
    from {
      opacity: 0;
    }

    to {
      opacity: 0.75;
    }
  }

  @keyframes hero-copy-drift {
    to {
      translate: 0 -7vh;
      opacity: 0;
    }
  }

  .setup-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(20rem, 0.72fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: start;
    padding-top: clamp(2.5rem, 8vh, 6rem);
    scroll-margin-top: 1rem;
  }

  .wordmark {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    text-decoration: none;
  }

  .wordmark-lockup {
    display: block;
    width: 9rem;
    height: auto;
  }

  .wordmark-icon-cloud {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 900ms ease-out;
  }

  @media (hover: hover) and (pointer: fine) {
    .wordmark-icon:hover .wordmark-icon-cloud {
      transform: rotate(1turn);
    }
  }

  .hero .wordmark-lockup {
    width: clamp(11rem, 15vw, 13rem);
  }

  .hero .wordmark {
    align-self: flex-start;
    min-height: auto;
  }

  .section-label,
  .session-position {
    color: var(--ember-dark);
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.17em;
    text-transform: uppercase;
  }

  a.button-primary.jump-to-settings {
    min-height: 2.75rem;
    margin-top: 2.25rem;
    padding: 0.55rem 1rem;
    background: rgb(116 35 18 / 56%);
    border-color: rgb(255 253 248 / 45%);
    box-shadow: 0 0.35rem 1rem rgb(33 29 24 / 14%);
    backdrop-filter: blur(6px);
    text-decoration: none;
  }

  a.button-primary.jump-to-settings:hover {
    background: rgb(33 29 24 / 70%);
    border-color: rgb(255 253 248 / 58%);
  }

  .rhythm {
    align-self: start;
    width: min(100%, 47rem);
  }

  .rhythm-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--line);
  }

  .rhythm-label {
    color: var(--ink-soft);
    font-size: 0.9rem;
    text-align: right;
  }

  .daily-marks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1rem, 4vw, 4rem);
    padding-top: 1.1rem;
  }

  .mark-item {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 0.65rem;
  }

  .sun-mark {
    position: relative;
    grid-column: 1 / -1;
    width: min(100%, 15rem);
    aspect-ratio: 1;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    isolation: isolate;
  }

  .sun-mark::before {
    position: absolute;
    z-index: -1;
    inset: 4%;
    background: repeating-conic-gradient(
      from 4deg,
      rgb(159 54 31 / 52%) 0deg 2deg,
      transparent 2deg 13deg,
      rgb(221 142 33 / 38%) 13deg 16deg,
      transparent 16deg 29deg
    );
    border-radius: 50%;
    content: "";
    -webkit-mask: radial-gradient(circle, transparent 0 55%, #000 56% 100%);
    mask: radial-gradient(circle, transparent 0 55%, #000 56% 100%);
    animation: sun-turn 48s linear infinite;
  }

  .sun-mark::after {
    position: absolute;
    inset: 15%;
    border: 1px solid rgb(116 35 18 / 28%);
    border-radius: 50%;
    content: "";
  }

  .sun-mark-second::before {
    animation-direction: reverse;
    animation-duration: 62s;
    opacity: 0.55;
  }

  .sun-core {
    position: absolute;
    inset: 25%;
    display: block;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 50%;
    box-shadow: inset 0 0 0 0.55rem rgb(255 250 240 / 38%);
    transition: background-color 350ms ease, border-color 350ms ease, box-shadow 350ms ease;
  }

  .sun-mark.is-next .sun-core {
    background: radial-gradient(circle, var(--saffron) 0 10%, transparent 11%);
    border: 0.16rem solid var(--ember);
    box-shadow: 0 0 0 0.5rem rgb(221 142 33 / 10%), 0 0 2rem rgb(221 142 33 / 22%);
  }

  .sun-mark.is-complete .sun-core,
  .sun-mark[data-complete="true"] .sun-core {
    background: var(--ink);
    border-color: var(--ink);
    box-shadow: inset 0 0 0 0.42rem var(--sun), 0 0 0 0.5rem rgb(33 29 24 / 8%);
  }

  .sun-mark.is-complete::before,
  .sun-mark[data-complete="true"]::before {
    opacity: 0.95;
  }

  .mark-number {
    color: var(--ember-dark);
    font-family: var(--sans);
    font-size: 0.9rem;
    font-weight: 650;
  }

  .mark-name {
    font-size: 0.8rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .practice-card {
    align-self: start;
    padding: clamp(1.35rem, 3vw, 2.5rem);
    background: rgb(255 250 240 / 76%);
    border: 1px solid rgb(116 35 18 / 18%);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(0.8rem);
  }

  .card-heading {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
  }

  .card-heading h2 {
    margin-top: 0.55rem;
  }

  .duration-fieldset {
    min-width: 0;
    padding: 1.5rem 0;
    border: 0;
  }

  .duration-fieldset legend {
    width: 100%;
    margin-bottom: 0.8rem;
    font-size: 0.82rem;
    font-weight: 750;
  }

  .duration-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .duration-option {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    min-height: 5rem;
    padding: 0.8rem;
    background: rgb(255 253 248 / 55%);
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    cursor: pointer;
  }

  .duration-option:has(input:checked) {
    background: var(--ink);
    color: var(--white);
    border-color: var(--ink);
  }

  .duration-option:has(input:focus-visible) {
    outline: 0.2rem solid var(--ember);
    outline-offset: 0.2rem;
  }

  .duration-option input {
    grid-row: 1 / 3;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0 0.7rem 0 0;
    accent-color: var(--saffron);
  }

  .duration-value {
    font-family: var(--sans);
    font-size: 2rem;
    font-weight: 650;
    line-height: 1;
  }

  .duration-note {
    align-self: start;
    color: var(--ink-soft);
    font-size: 0.75rem;
  }

  .duration-option:has(input:checked) .duration-note {
    color: var(--paper-deep);
  }

  .settings {
    border-top: 1px solid var(--line);
  }

  .setting {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-height: 4.25rem;
    padding-block: 0.7rem;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
  }

  .setting input {
    flex: 0 0 auto;
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--ember);
  }

  .setting span {
    display: grid;
  }

  .setting strong {
    font-size: 0.86rem;
  }

  .setting small {
    color: var(--ink-soft);
    font-size: 0.75rem;
  }

  .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-width: 2.75rem;
    min-height: 3.25rem;
    padding: 0.75rem 1.2rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.025em;
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, translate 160ms ease-out, scale 160ms ease-out;
  }

  /* Touch fires sticky false hovers, so the lift is pointer-gated. */
  @media (hover: hover) and (pointer: fine) {
    .button:hover {
      translate: 0 -0.12rem;
    }
  }

  /* ponytail: screen changes are synchronous, so "pending" is press feedback only. */
  .button:active {
    translate: 0;
    scale: 0.98;
  }

  .button-primary {
    color: var(--white);
    background: var(--ember-dark);
    border-color: var(--ember-dark);
  }

  .button-primary:hover {
    background: var(--ink);
    border-color: var(--ink);
  }

  .button-secondary {
    color: var(--ink);
    background: transparent;
    border-color: var(--ink);
  }

  .button-quiet {
    color: var(--ink-soft);
    background: transparent;
    border-color: transparent;
    text-decoration: underline;
    text-underline-offset: 0.25rem;
  }

  .button:disabled {
    opacity: 0.48;
    cursor: not-allowed;
    translate: none;
  }

  .button-arrow {
    font-size: 1.2rem;
    font-weight: 400;
  }

  #start {
    width: 100%;
    margin-top: 1.5rem;
  }

  .settle-note {
    margin-top: 0.7rem;
    color: var(--ink-soft);
    font-size: 0.78rem;
    text-align: center;
  }

  .session-screen {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 2rem;
  }

  /* Restarts whenever the screen's display flips from none. */
  .session-screen,
  .complete-screen {
    animation: screen-arrive 450ms cubic-bezier(0.23, 1, 0.32, 1) both;
  }

  @keyframes screen-arrive {
    from {
      translate: 0 0.8rem;
      opacity: 0;
    }
  }

  .session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
  }

  .wordmark-quiet {
    min-height: auto;
  }

  .session-body {
    display: grid;
    grid-template-columns: minmax(17rem, 0.85fr) minmax(18rem, 1fr);
    align-items: center;
    gap: clamp(2rem, 8vw, 8rem);
    width: min(100%, 65rem);
    margin-inline: auto;
  }

  .still-field {
    position: relative;
    width: min(100%, 28rem);
    aspect-ratio: 1;
    margin-inline: auto;
  }

  .still-orbit,
  .still-centre {
    position: absolute;
    border-radius: 50%;
  }

  .still-orbit {
    border: 1px solid var(--line);
  }

  .still-orbit::before,
  .still-orbit::after {
    position: absolute;
    width: 0.65rem;
    height: 0.65rem;
    background: var(--ember);
    border-radius: 50%;
    content: "";
  }

  .still-orbit-outer {
    inset: 3%;
    animation: sun-turn 55s linear infinite;
  }

  .still-orbit-outer::before {
    top: 13%;
    right: 11%;
  }

  .still-orbit-outer::after {
    bottom: 5%;
    left: 26%;
    width: 0.35rem;
    height: 0.35rem;
    background: var(--saffron);
  }

  .still-orbit-inner {
    inset: 17%;
    animation: sun-turn 38s linear infinite reverse;
  }

  .still-orbit-inner::before {
    bottom: -0.3rem;
    left: 48%;
    background: var(--saffron);
  }

  .still-orbit-inner::after {
    top: 20%;
    left: 4%;
    width: 0.3rem;
    height: 0.3rem;
  }

  .still-centre {
    inset: 35%;
    background: radial-gradient(circle at 35% 30%, #ffd46d, var(--saffron) 58%, var(--ember));
    box-shadow: 0 0 0 0.8rem rgb(221 142 33 / 10%), 0 0 5rem rgb(221 142 33 / 32%);
  }

  /* The breathe glow is painted once here; the animation only fades it. */
  .still-centre::before {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 1.2rem rgb(221 142 33 / 14%), 0 0 6.5rem rgb(221 142 33 / 44%);
    content: "";
    opacity: 0;
  }

  .session-copy {
    max-width: 32rem;
  }

  .session-copy h1 {
    margin-top: 0.7rem;
  }

  .instruction {
    max-width: 28rem;
    min-height: 3rem;
    margin-top: 1.25rem;
    color: var(--ink-soft);
    font-family: var(--sans);
    font-size: clamp(1.1rem, 2vw, 1.4rem);
  }

  .remaining {
    display: block;
    margin-top: 2rem;
    font-family: var(--sans);
    font-size: clamp(2rem, 5vw, 4.5rem);
    font-variant-numeric: tabular-nums;
    line-height: 1;
  }

  progress {
    display: block;
    width: min(100%, 25rem);
    height: 0.48rem;
    margin-top: 1.25rem;
    overflow: hidden;
    color: var(--ember);
    background: var(--line);
    border: 0;
    border-radius: 999px;
    accent-color: var(--ember);
  }

  progress::-webkit-progress-bar {
    background: var(--line);
  }

  progress::-webkit-progress-value {
    background: var(--ember);
    border-radius: 999px;
  }

  progress::-moz-progress-bar {
    background: var(--ember);
    border-radius: 999px;
  }

  .session-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--line);
  }

  .complete-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 52rem;
    margin-inline: auto;
    text-align: center;
  }

  .complete-mark {
    position: relative;
    display: grid;
    width: min(56vw, 17rem);
    aspect-ratio: 1;
    margin-bottom: 2rem;
    place-items: center;
    background: repeating-conic-gradient(
      rgb(159 54 31 / 64%) 0 2deg,
      transparent 2deg 15deg,
      rgb(221 142 33 / 50%) 15deg 18deg,
      transparent 18deg 30deg
    );
    border-radius: 50%;
    animation: sun-turn 58s linear infinite;
  }

  .complete-mark::after {
    position: absolute;
    inset: 20%;
    background: var(--paper);
    border-radius: 50%;
    content: "";
  }

  .complete-mark span {
    z-index: 1;
    width: 32%;
    aspect-ratio: 1;
    background: var(--ink);
    border: 0.45rem solid var(--sun);
    border-radius: 50%;
  }

  .complete-screen h1 {
    margin-top: 0.85rem;
  }

  .complete-copy {
    max-width: 37rem;
    margin-top: 1.5rem;
    color: var(--ink-soft);
    font-family: var(--sans);
    font-size: clamp(1.1rem, 2vw, 1.4rem);
  }

  #again {
    margin-top: 2rem;
  }

  .care-note {
    width: min(100%, 88rem);
    margin-inline: auto;
    padding:
      0
      max(1.25rem, env(safe-area-inset-right))
      max(1.25rem, env(safe-area-inset-bottom))
      max(1.25rem, env(safe-area-inset-left));
  }

  .care-note details {
    width: min(100%, 42rem);
    color: var(--ink-soft);
    font-size: 0.75rem;
  }

  .care-note summary {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    color: var(--ink);
    font-weight: 750;
    cursor: pointer;
  }

  .care-note-copy {
    display: grid;
    gap: 0.6rem;
    padding: 0.75rem 0 0.25rem;
    border-top: 1px solid var(--line);
    line-height: 1.55;
  }

  @keyframes sun-turn {
    to {
      rotate: 1turn;
    }
  }
}

@layer states {
  .session-screen.is-paused .still-orbit {
    animation-play-state: paused;
  }

  .session-screen.is-settling .still-centre {
    animation: still-breathe 5.5s ease-in-out infinite;
  }

  .session-screen.is-settling .still-centre::before {
    animation: still-breathe-glow 5.5s ease-in-out infinite;
  }

  @keyframes still-breathe {
    50% {
      scale: 1.07;
    }
  }

  @keyframes still-breathe-glow {
    50% {
      opacity: 1;
    }
  }

  .session-screen.is-resting .still-orbit {
    animation-duration: 100s;
    opacity: 0.55;
  }

  .session-screen.is-resting .remaining,
  .session-screen.is-resting progress {
    display: none;
  }
}

@layer responsive {
  @media (max-width: 62rem) {
    .setup-body {
      grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.8fr);
    }

    .session-body {
      gap: 2rem;
    }
  }

  @media (max-width: 47rem) {
    .app-shell {
      min-height: auto;
    }

    .screen {
      min-height: calc(100dvh - 6rem);
    }

    .setup-body {
      display: block;
      padding-top: 0;
    }

    .hero-sun {
      right: -22%;
      bottom: 18%;
      width: 22rem;
      opacity: 0.72;
    }

    .rhythm,
    .practice-card {
      margin-top: 3rem;
    }

    .sun-mark {
      width: min(100%, 12rem);
    }

    .session-body {
      grid-template-columns: 1fr;
      align-content: center;
      gap: 1rem;
    }

    .still-field {
      width: min(68vw, 19rem);
    }

    .session-copy {
      margin-inline: auto;
      text-align: center;
    }

    progress {
      margin-inline: auto;
    }
  }

  @media (max-width: 28rem) {
    h1 {
      font-size: clamp(2.8rem, 15vw, 4rem);
    }

    .app-shell {
      padding-right: max(1rem, env(safe-area-inset-right));
      padding-left: max(1rem, env(safe-area-inset-left));
    }

    .rhythm-heading {
      display: block;
    }

    .rhythm-label {
      margin-top: 0.25rem;
      text-align: left;
    }

    .daily-marks {
      gap: 0.65rem;
    }

    .sun-mark {
      width: min(100%, 9rem);
    }

    .mark-item {
      display: block;
      text-align: center;
    }

    .mark-name,
    .mark-number {
      display: block;
    }

    .mark-number {
      margin-bottom: 0.15rem;
    }

    .practice-card {
      margin-inline: -0.25rem;
      border-radius: 1rem;
    }

    .duration-options {
      grid-template-columns: 1fr;
    }

    .duration-option {
      min-height: 4.25rem;
    }

    .session-header {
      align-items: flex-start;
    }

    .session-position {
      max-width: 7rem;
      text-align: right;
    }

    .session-actions {
      align-items: stretch;
      flex-direction: column;
    }

    .session-actions .button,
    #again {
      width: 100%;
    }
  }

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

    /* Gentler, not zero: colour and opacity cues stay, movement goes. */
    .hero-layer,
    .hero-sun-img,
    .sun-core {
      transition-duration: 200ms !important;
    }

    /* Scroll-driven animations ignore duration, so remove them outright. */
    .hero-sun,
    .hero-sun-img,
    .hero-sky,
    .hero-far,
    .hero-mid,
    .hero-fg,
    .hero-mist,
    .hero-mist-img,
    .hero-beams,
    .masthead-copy,
    .still-centre {
      animation: none !important;
    }


    .button:hover {
      translate: none;
    }
  }

  @media (prefers-contrast: more) {
    :root {
      --ink-soft: #352d26;
      --line: #655545;
      --ember: #852610;
      --ember-dark: #621807;
    }

    .practice-card,
    .duration-option,
    .sun-core,
    .still-orbit {
      border-width: 2px;
    }
  }

  @media (forced-colors: active) {
    body,
    .practice-card,
    .duration-option,
    .button,
    .still-centre,
    .complete-mark,
    .complete-mark span,
    .sun-core {
      color: CanvasText;
      background: Canvas;
      box-shadow: none;
      forced-color-adjust: auto;
    }

    .still-orbit::before,
    .still-orbit::after {
      background: Highlight;
    }

    .sun-mark::before,
    .hero-beams,
    .hero-mist {
      display: none;
    }

    .sun-mark.is-next .sun-core,
    .sun-mark.is-complete .sun-core,
    .sun-mark[data-complete="true"] .sun-core {
      border: 0.45rem solid Highlight;
    }

    progress {
      border: 1px solid CanvasText;
    }
  }
}
