/*
  One Step: a demo site for an ADHD coach.

  Idea:    a calm paper page with one dark "table" in the middle. Thoughts land
           on the table as coloured notes; then two notes, then one, then a dial.
  Colour:  warm paper, slate table, one coral accent. The notes carry the colour.
  Type:    Rubik for everything you read, Playpen Sans Hebrew (handwriting) on the notes.
  Motion:  little and slow. Nothing moves by itself except the dial.
*/

:root {
  --paper: #f6f1e7;
  --card: #fffdf8;
  --ink: #1d2733;
  --ink-soft: #55606d;
  --table: #1f2d3a;
  --table-2: #263746;
  --on-table: #f6f1e7;
  --on-table-soft: #b9c6d2;
  --coral: #ff6b57;
  --coral-deep: #c53a26;
  --line: rgba(29, 39, 51, 0.16);
  --text: 'Rubik', system-ui, sans-serif;
  --hand: 'Playpen Sans Hebrew', 'Rubik', system-ui, sans-serif;
  --gutter: clamp(1rem, 4vw, 3.5rem);
}

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

html {
  background: var(--paper);
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.6;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
em { font-style: normal; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--coral-deep);
  outline-offset: 3px;
}
h2:focus, .cheer:focus { outline: none; }

.sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ribbon-bar {
  position: sticky;
  top: 0;
  z-index: 6;
  padding: 0.4rem var(--gutter);
  background: var(--ink);
  color: var(--paper);
  font-size: 0.875rem;
  text-align: center;
}
.ribbon-bar a:focus-visible { outline-color: var(--coral); }

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem var(--gutter) 0;
}
.brand { color: var(--ink-soft); }
.brand strong { margin-inline-end: 0.45em; color: var(--ink); font-weight: 700; font-size: 1.35rem; }
.lang { padding: 0.5rem 0; text-underline-offset: 0.3em; }

/* ---------- Hero ---------- */

.hero {
  display: grid;
  gap: 1rem;
  justify-items: center;
  max-inline-size: 52rem;
  margin-inline: auto;
  padding: clamp(2rem, 6vw, 4rem) var(--gutter) 2rem;
  text-align: center;
}
h1 {
  font-weight: 700;
  font-size: clamp(2.1rem, 7vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 em { display: block; color: var(--coral-deep); }
.lede { max-inline-size: 44ch; color: var(--ink-soft); font-size: 1.125rem; text-wrap: pretty; }

/* A tangle that becomes one straight line: the whole idea in one stroke. */
.untangle { inline-size: min(100%, 30rem); block-size: auto; overflow: visible; }
[dir='rtl'] .untangle { transform: scaleX(-1); }
.untangle path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  animation: draw 2.4s cubic-bezier(0.6, 0, 0.2, 1) 0.2s both;
}
.untangle circle { fill: var(--coral); animation: land 0.4s ease-out 2.5s both; transform-origin: 560px 60px; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes land { from { opacity: 0; scale: 0.3; } to { opacity: 1; scale: 1; } }

/* ---------- The tool ---------- */

.tool {
  max-inline-size: 46rem;
  margin-inline: auto;
  padding: 0 var(--gutter) 3rem;
}

.stepper {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}
.stepper li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.85rem 0.3rem 0.35rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}
[dir='rtl'] .stepper li { padding: 0.3rem 0.35rem 0.3rem 0.85rem; }
.stepper span {
  display: inline-grid;
  place-items: center;
  inline-size: 1.7rem;
  block-size: 1.7rem;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.875rem;
}
.stepper [aria-current] { background: var(--ink); color: var(--paper); font-weight: 500; }
.stepper [aria-current] span { border-color: var(--coral); background: var(--coral); color: var(--ink); }

.board {
  padding: clamp(1.25rem, 4vw, 2.25rem);
  border-radius: 1.6rem;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.07) 1px, transparent 1.5px) 0 0 / 22px 22px,
    linear-gradient(160deg, var(--table-2), var(--table));
  color: var(--on-table);
  box-shadow: 0 24px 50px -22px rgba(29, 39, 51, 0.55);
}
.board :focus-visible { outline-color: var(--coral); }

.phase { display: grid; gap: 1rem; justify-items: center; text-align: center; }
.phase h2 { font-size: clamp(1.5rem, 5vw, 2.1rem); line-height: 1.15; font-weight: 700; text-wrap: balance; }
.sub { max-inline-size: 36ch; color: var(--on-table-soft); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 3.1rem;
  padding: 0.6rem 1.5rem;
  border: 2px solid currentColor;
  border-radius: 0.9rem;
  background: transparent;
  color: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, translate 0.15s ease;
}
.btn:hover { translate: 0 -2px; }
.btn:active { translate: 0 0; }
.btn-main { border-color: var(--coral); background: var(--coral); color: var(--ink); font-weight: 700; }
.btn-main:hover { background: #ff8171; border-color: #ff8171; }
.btn-wide { inline-size: min(100%, 22rem); }
.btn-quiet { min-block-size: 2.75rem; padding-inline: 0.9rem; border-color: transparent; text-decoration: underline; text-underline-offset: 0.3em; font-weight: 400; }
.btn[aria-disabled='true'] { opacity: 0.55; }

.add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.6rem; inline-size: 100%; }
.add input, .field input {
  inline-size: 100%;
  min-block-size: 3.1rem;
  padding: 0.5rem 1rem;
  border: 2px solid transparent;
  border-radius: 0.9rem;
  background: var(--card);
  color: var(--ink);
}
.add input::placeholder, .field input::placeholder { color: #6b7682; }
.add-note { min-block-size: 1.5em; margin-top: -0.4rem; color: #ffd3cc; font-size: 0.9375rem; }

.ideas { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; }
.idea, .chip {
  min-block-size: 2.75rem;
  padding: 0.35rem 1rem;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.idea { color: var(--on-table-soft); font-size: 0.9375rem; border-style: dashed; }
.idea::before { content: '+ '; }
.idea:hover { color: var(--on-table); background: rgba(255, 255, 255, 0.07); }

/* ---------- Notes ---------- */

.pile {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 0.5rem 0.35rem;
  inline-size: 100%;
  min-block-size: 8.5rem;
  padding-block: 0.6rem;
}
/* Room for the remove button above the words. */
.pile .note { padding-top: 2.3rem; }
.pile-empty { align-self: center; color: var(--on-table-soft); }

.note {
  --tilt: 0;
  position: relative;
  display: grid;
  place-items: center;
  inline-size: 8.4rem;
  min-block-size: 7rem;
  padding: 1.3rem 0.7rem 0.8rem;
  border: 0;
  border-radius: 2px 2px 14px 2px;
  background: var(--note, #ffe27a);
  color: var(--ink);
  font-family: var(--hand);
  font-size: 1.0625rem;
  line-height: 1.3;
  text-align: center;
  rotate: calc(var(--tilt) * 1deg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 10px 14px -8px rgba(0, 0, 0, 0.55);
}
/* A strip of tape holds each note down. */
.note::before {
  content: '';
  position: absolute;
  top: -0.45rem;
  left: 50%;
  inline-size: 3.2rem;
  block-size: 1.05rem;
  translate: -50% 0;
  rotate: calc(var(--tilt) * -0.6deg);
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.note[data-colour='0'] { --note: #ffe27a; }
.note[data-colour='1'] { --note: #ffb8c9; }
.note[data-colour='2'] { --note: #aedcff; }
.note[data-colour='3'] { --note: #bfeec8; }
.note[data-colour='4'] { --note: #ffcf9f; }
.note-text { max-inline-size: 100%; overflow-wrap: anywhere; }
.note.is-new { animation: drop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes drop {
  from { opacity: 0; scale: 1.25; translate: 0 -1.2rem; }
  to { opacity: 1; scale: 1; translate: 0 0; }
}
.note-remove {
  position: absolute;
  top: 0;
  inset-inline-end: 0;
  display: grid;
  place-items: center;
  inline-size: 2.5rem;
  block-size: 2.5rem;
  border: 0;
  background: transparent;
  color: rgba(29, 39, 51, 0.6);
  font-family: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.note-remove:hover { color: var(--ink); }
.note :focus-visible, .note:focus-visible { outline-color: var(--ink); outline-offset: -4px; }
.count { color: var(--on-table-soft); font-size: 0.9375rem; min-block-size: 1.5em; }

.note-big {
  inline-size: 100%;
  max-inline-size: 14rem;
  min-block-size: 10.5rem;
  padding: 1.6rem 1rem 1.1rem;
  font-size: clamp(1.1rem, 4.4vw, 1.45rem);
  font-weight: 600;
}
button.note { cursor: pointer; transition: translate 0.15s ease, box-shadow 0.15s ease; }
button.note:hover { translate: 0 -5px; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 20px 22px -10px rgba(0, 0, 0, 0.6); }
button.note:focus-visible { outline: 3px solid var(--coral); outline-offset: 4px; }

.duel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  gap: 0.6rem;
  inline-size: 100%;
  max-inline-size: 34rem;
  padding-block: 0.8rem;
}
.duel-or { color: var(--on-table-soft); font-size: 0.9375rem; }
.progress { color: var(--on-table-soft); font-size: 0.9375rem; }
.quiet-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.2rem 0.8rem; }

/* ---------- One step ---------- */

.one-note { display: grid; justify-items: center; inline-size: 100%; padding-top: 0.5rem; }
.one-note .note-big { max-inline-size: 16rem; min-block-size: 6.5rem; }
.setup, .running, .finished { display: grid; gap: 1rem; justify-items: center; inline-size: 100%; }
.field { display: grid; gap: 0.4rem; inline-size: min(100%, 26rem); text-align: start; }
.field span { color: var(--on-table-soft); }
.lengths { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.chip[aria-pressed='true'] { border-color: var(--coral); background: var(--coral); color: var(--ink); font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 0.55rem; min-block-size: 2.75rem; color: var(--on-table-soft); cursor: pointer; }
.check input { inline-size: 1.25rem; block-size: 1.25rem; accent-color: var(--coral); }

.step-now { font-family: var(--hand); font-size: 1.2rem; max-inline-size: 30ch; overflow-wrap: anywhere; }
.dial { inline-size: min(100%, 17rem); block-size: auto; filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.4)); }
.dial-rim { fill: #121c26; }
.dial-face { fill: var(--card); }
.dial-ticks line { stroke: rgba(29, 39, 51, 0.3); stroke-width: 1.5; stroke-linecap: round; }
.dial-ticks .is-long { stroke: rgba(29, 39, 51, 0.6); stroke-width: 2.5; }
.dial-wedge { fill: #e04a34; transition: fill 0.3s ease; }
.dial-hub { fill: var(--ink); }
.is-paused .dial-wedge { fill: #7d858e; }
.left { font-size: 1.35rem; font-weight: 500; }
.run-actions, .finish-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }

.cheer { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 700; line-height: 1.2; text-wrap: balance; }
.finished { padding-block: 0.5rem; }
.finished .cheer::before {
  content: '✓';
  display: grid;
  place-items: center;
  inline-size: 3.4rem;
  block-size: 3.4rem;
  margin: 0 auto 0.8rem;
  border-radius: 50%;
  background: #bfeec8;
  color: var(--ink);
  font-size: 1.8rem;
}

.done-wrap { margin-top: 1.4rem; text-align: center; }
.done-wrap h3 { font-size: 1rem; color: var(--ink-soft); font-weight: 500; }
.done-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; margin-top: 0.5rem; }
.done-list li {
  padding: 0.25rem 0.85rem;
  border-radius: 999px;
  background: #dcefe0;
  font-family: var(--hand);
  font-size: 0.9375rem;
  text-decoration: line-through;
  text-decoration-color: rgba(29, 39, 51, 0.45);
  overflow-wrap: anywhere;
}
.done-list li::before { content: '✓ '; display: inline-block; text-decoration: none; }
.private { margin-top: 1.1rem; color: var(--ink-soft); font-size: 0.9375rem; text-align: center; }
.fallback { padding: 1.5rem; text-align: center; }

/* ---------- About, call, footer ---------- */

.about {
  display: grid;
  gap: 1rem;
  max-inline-size: 68rem;
  margin-inline: auto;
  padding: 1rem var(--gutter) 3rem;
}
.about article { padding: 1.4rem; border: 1.5px solid var(--line); border-radius: 1.2rem; background: var(--card); }
.about h2 { margin-bottom: 0.35rem; font-size: 1.3rem; line-height: 1.25; }
.about p { color: var(--ink-soft); }

.call {
  display: grid;
  gap: 1.2rem;
  justify-items: center;
  max-inline-size: 46rem;
  margin-inline: auto;
  padding: 2rem var(--gutter) 4rem;
  text-align: center;
}
.call h2 { font-size: clamp(1.6rem, 5vw, 2.4rem); line-height: 1.15; text-wrap: balance; }
.asks { display: grid; gap: 1rem; }
.chips { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem; }
.chips h3 { flex-basis: 100%; font-size: 1rem; font-weight: 500; color: var(--ink-soft); }
.call .chip[aria-pressed='true'] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.call .btn-main:focus-visible { outline-color: var(--ink); }
.disclaimer {
  max-inline-size: 46ch;
  margin-top: 0.6rem;
  padding-top: 1rem;
  border-top: 1.5px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.foot {
  display: grid;
  gap: 1.5rem;
  justify-items: center;
  padding: 4rem var(--gutter) 5rem;
  background: var(--table);
  color: var(--on-table);
  text-align: center;
}
.foot p { font-weight: 700; font-size: clamp(1.5rem, 4.2vw, 2.3rem); line-height: 1.2; max-inline-size: 24ch; text-wrap: balance; }
.foot :focus-visible { outline-color: var(--coral); }

/* ---------- Sheet ---------- */

dialog {
  inline-size: min(31rem, calc(100vw - 2rem));
  padding: 1.8rem;
  border: 0;
  border-radius: 1.4rem;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5);
}
dialog::backdrop { background: rgba(29, 39, 51, 0.66); }
dialog h2 { font-size: 1.5rem; line-height: 1.2; }
.bubble {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  background: #dcefe0;
  white-space: pre-line;
  text-align: start;
  overflow-wrap: anywhere;
}
.sheet-note { margin-bottom: 1.5rem; color: var(--ink-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }

@media (min-width: 44rem) {
  .about { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .asks { grid-template-columns: repeat(2, auto); gap: 2.5rem; }
  .note { inline-size: 9.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .untangle path, .untangle circle, .note.is-new { animation: none; }
  .btn, button.note, .idea, .chip, .dial-wedge { transition: none; }
  .btn:hover, button.note:hover { translate: none; }
}

.ideas:empty { display: none; }
