/* Redesign, walkthrough workstream.
   Tokens, the layout system and the type atoms live in redesign.css; this file is the
   only stylesheet the walkthrough pages own. See docs/redesign-workstreams.md.

   The guided walkthrough is one full-screen state at a time (screens 02-01 … 02-19):
   a full-bleed photograph, the progress ticks, the step label in small caps, the
   instruction in large serif, and the controls the phase allows. The states are all in
   the DOM and quick_steps_controller.js puts `is-current` on the one that is showing —
   nothing here decides when anything happens. */

.gw {
  /* --gw-offset is the height of the banner above this page, measured by the controller
     so that the state fills the screen on web (a 52px banner) and in the iOS app (none). */
  --gw-progress: 0;
  position: relative;
  height: calc(100dvh - var(--gw-offset, 0px));
  overflow: hidden;
  background: #140f0c;
  color: #fff;
  font-family: var(--rd-sans);
  font-weight: 300;
}

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

.gw :where(p, h1, h2) {
  margin: 0;
}

/* ---------- the state ---------- */

.gw-panel {
  position: absolute;
  inset: 0;
  display: none;
}

.gw-panel.is-current {
  display: block;
}

.gw-panel__photo {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* One scrim for every state: faint at the top so the ticks read on a bright photograph,
   heavy at the foot where the instruction sits. */
.gw-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(26, 19, 15, 0.5) 0%,
    rgba(26, 19, 15, 0) 20%,
    rgba(24, 17, 13, 0.28) 40%,
    rgba(24, 17, 13, 0.78) 62%,
    rgba(20, 14, 11, 0.95) 86%
  );
}

.gw-panel__body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--rd-space-m) var(--rd-gutter) calc(var(--rd-space-l) + env(safe-area-inset-bottom));
}

/* ---------- ticks, phase and count ---------- */

.gw-panel__head {
  flex: none;
}

.gw-ticks {
  display: flex;
  gap: 6px;
}

.gw-ticks__tick {
  flex: 1 1 0;
  height: 1.5px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.34);
}

.gw-ticks__tick.is-lit {
  background: #fff;
}

.gw-panel__headline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--rd-space-s);
  margin-top: var(--rd-space-s);
}

.gw-phase {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.3;
  color: #fff;
}

.gw-count {
  font-family: var(--rd-serif);
  font-weight: 300;
  font-size: 40px;
  line-height: 1;
  color: #fff;
  font-variant-numeric: lining-nums tabular-nums;
}

/* ---------- copy ---------- */

.gw-panel__foot {
  margin-top: auto;
  padding-top: var(--rd-space-l);
}

.gw-step-label {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.3;
  color: var(--rd-label-on-photo);
}

.gw-instruction {
  margin-top: var(--rd-space-s);
  font-family: var(--rd-serif);
  font-weight: 400;
  font-size: 35px;
  line-height: 1.1;
  letter-spacing: -0.005em;
  color: #fff;
  text-wrap: balance;
}

.gw-note {
  margin-top: var(--rd-space-s);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.86);
  text-wrap: pretty;
}

.gw-suggested {
  margin-top: var(--rd-space-s);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

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

.gw-controls {
  display: flex;
  align-items: center;
  gap: var(--rd-space-s);
  margin-top: var(--rd-space-l);
}

.gw-control {
  flex: none;
  white-space: nowrap;
}

.gw-control__icon {
  margin-right: -2px;
  opacity: 0.9;
}

/* ---------- the fifteen minutes ---------- */

.gw-stroke__moments {
  position: absolute;
  inset: 0;
}

.gw-stroke__top {
  position: absolute;
  z-index: 2;
  top: var(--rd-space-m);
  left: var(--rd-gutter);
  right: var(--rd-gutter);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--rd-space-m);
  pointer-events: none;
}

.gw-clock {
  font-family: var(--rd-sans);
  font-weight: 300;
  font-size: 62px;
  line-height: 0.92;
  letter-spacing: 0.01em;
  font-variant-numeric: lining-nums tabular-nums;
  color: #fff;
}

/* the last two minutes: the clock takes the label's warmth, as in screen 02-12 */
.gw-stroke.is-final .gw-clock {
  color: var(--rd-label-on-photo);
}

.gw-stroke.is-paused .gw-clock {
  opacity: 0.5;
}

.gw-orbit {
  flex: none;
  width: 44px;
  height: 44px;
  margin-top: 2px;
}

.gw-orbit__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 1;
}

/* pathLength="1" on the arc, so dashoffset is the elapsed fraction and no circumference
   has to be recomputed here. */
.gw-orbit__arc {
  fill: none;
  stroke: #fff;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: calc(1 - var(--gw-progress, 0));
  transform: rotate(-90deg);
  transform-origin: 22px 22px;
}

.gw-stroke__controls {
  position: absolute;
  z-index: 2;
  left: var(--rd-gutter);
  right: var(--rd-gutter);
  bottom: calc(var(--rd-space-m) + env(safe-area-inset-bottom));
  display: flex;
  gap: var(--rd-space-s);
}

/* the stroking moment keeps its copy clear of the Pause/End pills underneath */
.gw-panel--moment .gw-panel__body {
  padding-bottom: calc(var(--rd-space-2xl) + 50px + env(safe-area-inset-bottom));
}

/* ---------- the error line (the session could not be created at Begin) ---------- */

.gw-error {
  position: absolute;
  z-index: 5;
  left: var(--rd-gutter);
  right: var(--rd-gutter);
  top: calc(var(--rd-space-m) + 40px);
  display: none;
  border-radius: 18px;
  background: var(--rd-sheet);
  padding: var(--rd-space-s) var(--rd-space-m);
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--rd-ink);
}

.gw-error.is-visible {
  display: block;
}

/* ---------- small screens ---------- */

@media (max-width: 340px) {
  .gw-instruction {
    font-size: 30px;
  }

  .gw-clock {
    font-size: 52px;
  }

  .gw-note {
    font-size: 15px;
  }
}

/* short screens: the copy is allowed to scroll rather than be cut off */
@media (max-height: 620px) {
  .gw-panel__foot {
    padding-top: var(--rd-space-m);
  }

  .gw-instruction {
    font-size: 30px;
  }
}
