/* the guide: the cube's room and type, laid out as pages */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); touch-action: manipulation; -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-variant-numeric: lining-nums proportional-nums; font-size: 15px; letter-spacing: 0; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
b { font-weight: 700; }
b.m { font-weight: 500; }

/* ---------- the page ---------- */
.page { max-width: 700px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 92px) 20px 96px; }
p { margin: 0 0 18px; font-size: 16px; line-height: 1.7; text-wrap: pretty; }   /* (pretty: no last line of one word) */
ul { margin: 0 0 18px; padding-left: 1.2em; }
li { font-size: 15px; line-height: 1.6; margin-bottom: 6px; text-wrap: pretty; }
li::marker { color: var(--ink-3); }

.hero { padding-bottom: 8px; }
.title { margin: 0; font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -.01em; text-wrap: balance; }
.lede { margin: 16px 0 0; color: var(--ink-2); }
.vh { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* sections: a name with a line above; inside, each step a heading of its own (its number, or CFOP's letter, before
   the name); everything on one left edge */
.part { margin-top: 104px; }
.part > h2 { margin: 0 0 20px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.step { margin-top: 64px; }
.step > h3 { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; font-size: 18px; font-weight: 600; line-height: 1.3; letter-spacing: -.005em; }
.step > h3 .n { flex: 0 0 auto; min-width: 1em; font-weight: 400; color: var(--ink-3); }

/* ---------- pictures: the cube itself on the page, no frame ---------- */
figure { margin: 0; }
img.pic, svg.pic { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; }
.picbox { position: relative; display: block; }
/* the move, laid on the moving layers: white, its corners rounded, on a soft shadow, so it reads on any sticker */
.pic-arrow { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none;
  fill: #fff; stroke: #fff; stroke-linejoin: round; filter: drop-shadow(0 .5px 1px rgba(0, 0, 0, .35)); }
.nopics .picbox { display: none; }
.nopics-note { margin: 16px 0 0; font-size: 13.5px; color: var(--ink-2); }
figcaption { margin-top: -4px; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); text-align: center; text-wrap: balance; }
/* in a row of pictures, each on a quiet tile: the row starts and ends where the text does, the caption inside, on its left */
.shots figure { padding: 4px 4px 12px; border: 1px solid var(--line-strong); border-radius: 18px; }
.shots figcaption { margin-top: -6px; padding: 0 10px; text-align: left; }
.shots .alg-under { padding: 0 10px; text-align: left; }
figcaption b { display: block; color: var(--ink); font-weight: 500; }
/* every picture the same size, whatever the row: fixed columns, filled from the left */
.shots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 24px 0 28px; }
.pair-pics { display: grid; grid-template-columns: minmax(0, 1fr) 46%; align-items: center; gap: 2px; }
.plan { display: block; }
.plan svg { display: block; width: 100%; height: auto; }
.pll-arrows { stroke: var(--arrow); }
/* ---------- moves: the cube's keys, a wider gap between groups; in text, plain ---------- */
.alg { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0; }
.alg .grp { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.line { white-space: nowrap; font-weight: 600; font-size: .94em; }
.line .sep { display: inline-block; width: .9em; white-space: pre; }   /* (its space kept, so a copied line reads R U R' U') */
.alg-under { margin: 6px 0 0; text-align: center; font-size: 13.5px; white-space: normal; }
.keys-row { margin: 4px 0 12px; }
/* ---------- cases: a card each, picture and plan, the algorithm, how to see it and hold it ---------- */
.cases { display: grid; gap: 14px; margin: 24px 0 28px; }
.case { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; padding: 16px 20px 16px 10px; border: 1px solid var(--line-strong); border-radius: 18px; }
.case.noplan { grid-template-columns: 150px minmax(0, 1fr); }
.case .pics { display: grid; grid-template-columns: minmax(0, 1fr) 44%; align-items: center; gap: 2px; align-self: center; }
.case.noplan .pics { grid-template-columns: 1fr; }
.case .nm { margin: 4px 0 8px; font-size: 18px; font-weight: 500; letter-spacing: -.015em; color: var(--ink); }
.case .from { margin-left: 10px; font-size: 12px; font-weight: 400; color: var(--ink-3); }
.case .say { margin: 10px 0 2px; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.case .say .line { white-space: normal; color: var(--ink); }

/* ---------- all of them ---------- */
.sheet { display: grid; gap: 22px; margin-top: 12px; }
.sheet-part { margin-top: 18px; }
.sheet-part h3 { margin: 0 0 6px; font-size: 18px; font-weight: 600; letter-spacing: -.005em; }
.sheet-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.sheet-row .plan { width: 52px; }
.sheet-row.noplan { grid-template-columns: minmax(0, 1fr); }
.sheet-row .nm { display: block; margin-bottom: 6px; font-size: 15px; font-weight: 500; text-decoration: none; }
.sheet-row .step-n { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: 12px; font-size: 13.5px; text-decoration: none; }
.sheet-row .alg { margin: 0; }
.setup { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.setup .line { white-space: normal; font-weight: 400; color: var(--ink-2); }
.setup > span:first-child { margin-right: 6px; }

/* ---------- the deeper pages ---------- */
.deep-group { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); }
.deep-group h3 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; font-size: 18px; font-weight: 600; letter-spacing: -.005em; }
.deep-group .cnt { font-size: 12px; color: var(--ink-3); }
.deep-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dcase { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; align-items: center; padding: 14px 16px 14px 12px; border: 1px solid var(--line-strong); border-radius: 18px; }
.dcase h4 { margin: 0 0 6px; font-size: 15px; font-weight: 500; }
.dcase .setup { margin: 8px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.dcase .setup .line { white-space: normal; font-weight: 400; color: var(--ink-2); }
.dcase .setup > span:first-child { margin-right: 6px; }
.dcase .or { margin: 12px 0 6px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); line-height: 1.4; }


/* ---------- the end of a page: what stands behind it, and the other pages ---------- */
.foot { margin-top: 72px; padding-top: 20px; border-top: 1px solid var(--line); }
.foot p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.foot .foot-links { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-top: 12px; }
.foot-links a { color: var(--ink); font-size: 15px; }

/* ---------- narrow screens ---------- */
@media (max-width: 760px) {
  .deep-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .page { padding-top: calc(env(safe-area-inset-top, 0px) + 76px); padding-inline: 16px; }
  p { font-size: 15px; }
  .shots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .case { grid-template-columns: minmax(0, 1fr); padding: 10px 16px 18px; }
  .case.noplan { grid-template-columns: 104px minmax(0, 1fr); gap: 10px; padding: 10px 14px 12px 6px; }
  .case .pics { max-width: 320px; }
  .case.noplan .pics { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
/* the guide's bar (the page scrolls under it): the way back */
.bar { position: fixed; z-index: 5; top: 0; left: 0; right: 0; display: flex; align-items: center; padding: 22px 22px 0 20px; padding-top: calc(env(safe-area-inset-top, 0px) + 22px); pointer-events: none; }
/* the page scrolls under it: the room fades the text out before it reaches the way back */
.bar::before { content: ''; position: absolute; inset: 0 0 -26px 0; background: linear-gradient(var(--bg) 62%, transparent); z-index: -1; }
html { scroll-behavior: smooth; }

/* the index: what's in the guide, at its top. One row per section: the section on the left, its parts on the right */
.index { margin: 0; border-bottom: 1px solid var(--line); }
.ix { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 0 24px; padding: 14px 0; border-top: 1px solid var(--line); }
.ix-k { font-size: 15px; font-weight: 500; line-height: 1.45; color: var(--ink); text-decoration: none; }
span.ix-k { color: var(--ink-2); font-weight: 400; }
.ix-v a { display: flex; align-items: baseline; gap: 10px; padding: 1px 0; font-size: 15px; line-height: 1.45; text-decoration: none; }
.ix-v .n { flex: 0 0 1em; color: var(--ink-3); }
.ix-v .c { margin-left: -4px; font-size: 12px; color: var(--ink-3); }
.ix-v.flow { display: flex; flex-wrap: wrap; gap: 0 18px; }
@media (hover: hover) { a.ix-k:hover, .ix-v a:hover > span:not(.n):not(.c) { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; } }
.hero .index { margin-top: 24px; border-bottom: 0; }   /* the groups' own lines follow */
@media (max-width: 560px) {
  .ix { grid-template-columns: minmax(0, 1fr); }
  .ix-v:not(:empty) { margin-top: 4px; }
}
@media (min-width: 1080px) {
  .bar { padding: 30px 30px 0 30px; padding-top: calc(env(safe-area-inset-top, 0px) + 30px); }
}
