/* How it works: the two-page scan animation (pages photographed out of order, a beam finds
   the problems, they fly into an ordered list and get answered), the step cards and the
   "why it's simple" grid. */

/* ----- Scan demo ----- */
.scan-demo { padding-block: clamp(0.5rem, 2vw, 1.5rem) clamp(0.5rem, 2vw, 1.5rem); }
.demo-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.4rem 1.5rem; }
.demo-head h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
.demo-head p { color: var(--muted); }
.scan-stage {
  position: relative; margin-top: 1.4rem;
  display: grid; grid-template-columns: minmax(0, 1.3fr) 64px minmax(0, 1fr); align-items: center; gap: clamp(0.75rem, 2vw, 1.25rem);
  padding: clamp(1rem, 3vw, 2.2rem); border: 1px solid var(--line); border-radius: 28px;
  background: radial-gradient(70% 90% at 25% 30%, rgba(48, 209, 88, 0.08), transparent 70%), var(--surface);
}
.scan-pages { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(10px, 2vw, 22px); }
.sheet { margin: 0; display: grid; gap: 0.6rem; transition: opacity 0.35s ease, transform 0.5s var(--ease); }
html.anim .scan-stage.is-reset .sheet:not(.is-in) { opacity: 0; transform: translateY(18px) rotate(-2deg) scale(0.97); }
.sheet figcaption { display: flex; align-items: center; gap: 0.5rem; font-size: 0.84rem; font-weight: 700; color: var(--muted); }
.shot { padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; }
.paper {
  position: relative; overflow: hidden; aspect-ratio: 8.5 / 11; padding: 9% 7.5%;
  border-radius: 10px; background: #f4f1e9; color: #27302b;
  box-shadow: 0 26px 40px -22px rgba(0, 0, 0, 0.85), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  font-size: clamp(8px, 1.02vw, 12.5px); line-height: 1.3;
}
.sheet[data-page="2"] .paper { transform: rotate(-1.2deg); }
.sheet[data-page="1"] .paper { transform: rotate(1deg); }
.paper-title { display: flex; justify-content: space-between; gap: 0.5em; padding-bottom: 0.6em; border-bottom: 1.5px solid #cfcabd; font-weight: 800; font-size: 1.08em; color: #1f2622; }
.paper-title span { color: #7a8079; font-weight: 700; }
.paper-qs { list-style: none; padding: 0; margin-top: 1em; display: grid; gap: 1.05em; }
.paper-qs li { position: relative; padding: 0.45em 0.5em 1.05em; border-radius: 6px; transition: background-color 0.25s ease, box-shadow 0.25s ease; }
.paper-qs li::after { content: ""; position: absolute; left: 0.5em; right: 0.5em; bottom: 0.4em; border-bottom: 1px dashed #c4bfb1; }
.paper-qs li.is-found { background: rgba(48, 209, 88, 0.17); box-shadow: inset 0 0 0 1.5px #1f9d45; }
.qn { font-weight: 800; margin-right: 0.35em; }
.beam {
  position: absolute; z-index: 2; left: -2%; right: -2%; top: -3em; height: 3em; opacity: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(48, 209, 88, 0), rgba(48, 209, 88, 0.25) 75%, #30d158 calc(100% - 2px), #30d158);
  box-shadow: 0 6px 14px -3px rgba(48, 209, 88, 0.7);
}
.scan-flow { display: grid; place-items: center; height: 100%; }
.scan-flow span { position: relative; width: 100%; height: 2px; background: repeating-linear-gradient(90deg, var(--accent-line) 0 6px, transparent 6px 11px); }
.scan-flow span::after {
  content: ""; position: absolute; right: 0; top: 50%; width: 10px; height: 10px; margin-top: -5px;
  border-top: 2px solid var(--accent); border-right: 2px solid var(--accent); transform: rotate(45deg);
}
.scan-list {
  position: relative; padding: 1rem 1rem 1.1rem; border-radius: 22px; font-family: var(--ios);
  background: #0c1210; border: 1px solid var(--line-2); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9);
}
.sl-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sl-title { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 700; font-size: 1.05rem; }
.sl-glyph { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: #000; color: var(--accent); box-shadow: inset 0 0 0 1px var(--line-2); }
.sl-glyph svg { width: 17px; height: 17px; }
.sl-count { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; font-size: 0.9rem; }
.sl-bar { margin-top: 0.7rem; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.sl-bar span {
  display: block; height: 100%; border-radius: inherit; transform-origin: left center; transform: scaleX(var(--p, 1));
  background: linear-gradient(90deg, #26b06d, var(--accent-2)); transition: transform 0.22s ease;
}
.sl-rows { list-style: none; padding: 0; margin-top: 0.8rem; display: grid; gap: 5px; }
.sl-row {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto 18px; align-items: center; gap: 0.6rem;
  min-height: 34px; padding: 4px 10px 4px 5px; border-radius: 10px; background: rgba(255, 255, 255, 0.035);
}
.sl-n {
  width: 28px; height: 22px; border-radius: 99px; display: grid; place-items: center;
  font-family: var(--ios-round); font-weight: 800; font-size: 0.8rem; color: var(--dim); box-shadow: inset 0 0 0 1px var(--line-2);
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.sl-q { min-width: 0; font-size: 0.82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity 0.25s ease; }
.sl-a { font-family: var(--ios-round); font-weight: 700; color: var(--accent); font-size: 0.9rem; white-space: nowrap; opacity: 0; transform: translateX(-6px); transition: opacity 0.2s ease, transform 0.25s var(--ease); }
.sl-ck { width: 18px; height: 18px; padding: 3px; border-radius: 50%; color: var(--accent-ink); background: var(--accent); opacity: 0; transform: scale(0.4); transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.3, 1.6, 0.5, 1); }
.sl-row.is-placed .sl-n { color: var(--accent); background: rgba(48, 209, 88, 0.15); box-shadow: none; }
.sl-row.is-placed .sl-q { opacity: 1; }
.sl-row.is-solved .sl-a { opacity: 1; transform: none; }
.sl-row.is-solved .sl-ck { opacity: 1; transform: none; }
.sl-done {
  margin-top: 0.8rem; display: flex; align-items: center; justify-content: center; gap: 0.45rem; padding: 0.6rem;
  border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-family: var(--body); font-weight: 800; font-size: 0.95rem;
  opacity: 0; transform: translateY(6px); transition: opacity 0.3s ease, transform 0.35s var(--ease);
}
.sl-done svg { width: 18px; height: 18px; }
.sl-done.is-on { opacity: 1; transform: none; }
.fly-chip {
  position: absolute; z-index: 10; left: 0; top: 0; pointer-events: none;
  min-width: 28px; height: 22px; padding: 0 7px; border-radius: 99px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-family: var(--ios-round); font-weight: 800; font-size: 0.8rem;
  box-shadow: 0 8px 18px -6px rgba(0, 0, 0, 0.7), 0 0 0 3px rgba(48, 209, 88, 0.25);
}
.scan-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem 1rem; margin-top: 1rem; }
.scan-status { color: var(--muted); font-weight: 600; }
html:not(.anim) #scan-replay { display: none; }

@media (max-width: 899.98px) {
  .scan-stage { grid-template-columns: minmax(0, 1fr); }
  .scan-flow { height: 34px; }
  .scan-flow span { width: 2px; height: 100%; background: repeating-linear-gradient(180deg, var(--accent-line) 0 6px, transparent 6px 11px); }
  .scan-flow span::after { right: auto; left: 50%; top: auto; bottom: 0; margin: 0 0 0 -5px; transform: rotate(135deg); }
  .paper { font-size: clamp(7.5px, 2.25vw, 12.5px); }
}
@media (max-width: 479.98px) {
  .scan-stage { padding: 0.9rem; border-radius: 22px; }
  .sheet figcaption { font-size: 0.74rem; gap: 0.35rem; }
  .shot { font-size: 0.64rem; padding: 0.1rem 0.4rem; }
  .sl-row { grid-template-columns: 28px minmax(0, 1fr) auto 16px; gap: 0.45rem; }
  .sl-q { font-size: 0.76rem; }
  .sl-a { font-size: 0.84rem; }
  .sl-ck { width: 16px; height: 16px; }
}

/* ----- Steps ----- */
.steps4 { list-style: none; padding: 0; margin-top: 2.2rem; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.step-card { position: relative; padding: 1.5rem; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.step-n {
  position: absolute; top: 1.25rem; right: 1.25rem; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-family: var(--display); font-weight: 800;
}
.step-n svg { width: 18px; height: 18px; }
.step-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.step-ic svg { width: 25px; height: 25px; }
.step-card h3 { margin-top: 1.1rem; font-size: 1.3rem; }
.step-card p { margin-top: 0.5rem; color: var(--muted); font-size: 0.95rem; }
.step-done { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-soft), transparent 60%), var(--surface); }
@media (max-width: 1023.98px) { .steps4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599.98px) { .steps4 { grid-template-columns: minmax(0, 1fr); } }

/* ----- Why it's simple ----- */
.simple-grid { list-style: none; padding: 0; margin-top: 2.2rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.simple-grid li { padding: 1.35rem; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.simple-grid h3 { margin-top: 0.95rem; font-size: 1.1rem; }
.simple-grid p { margin-top: 0.4rem; color: var(--muted); font-size: 0.95rem; }
@media (max-width: 899.98px) { .simple-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 559.98px) { .simple-grid { grid-template-columns: minmax(0, 1fr); } }

@media (prefers-reduced-motion: reduce) {
  .scan-demo *, .sheet { transition: none !important; animation: none !important; }
}
