/* Edit section — our changes, loaded after css/home-edit-retouch.css + css/home-edit.css + css/sep-b.css.
   Markup: edit/section.html · scripts: edit/js/edit-chapters.js (copy, demos), edit/js/edit-one.js (mode + title).
   One block: the photo with the app's inspector panel floating over it (glass selector Light & Color | Geometry
   on top), the words on the right: big, few. */

.edx { --display: "SF Pro Display", "SF Pro", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; }

/* The sheet's top space, as the Stacking sheet's: less than the home default, the title sits close to the edge. */
.sb-slot > .cx.edx { padding-top: clamp(48px, 5vw, 80px); }

/* ---------- Title: the Stacking title's twin. Tilted inside a crop frame, it levels and the frame lets go. ---------- */

.edx-open { margin: 0 auto clamp(56px, 7vw, 104px); text-align: center; font-family: var(--display); }
.edx-word {
  position: relative;
  width: fit-content;
  margin: 0 auto;
  font-size: clamp(60px, 12.4vw, 196px);    /* section titles: Stacking, Editing, Retouching share it */
  font-weight: 700;
  letter-spacing: -0.04em;                  /* 2026-11-17: was -0.055em */
  line-height: 1;
  white-space: nowrap;
}
.edx-word__text {
  display: block;
  padding: 0 0.04em 0.1em;
  color: var(--text);
  will-change: transform;
}
/* The crop frame: level, corner handles and thirds, around the tilted word; it fades as the word levels. */
.edx-word__crop {
  position: absolute; inset: -0.06em -0.12em -0.02em;
  border: 0.012em solid rgba(255, 255, 255, 0.55);
  opacity: 0;
  pointer-events: none;
}
.edx-word__crop i { position: absolute; width: 0.16em; height: 0.16em; border: 0 solid #fff; }
.edx-word__crop i:nth-child(1) { left: -0.03em; top: -0.03em; border-width: 0.035em 0 0 0.035em; }
.edx-word__crop i:nth-child(2) { right: -0.03em; top: -0.03em; border-width: 0.035em 0.035em 0 0; }
.edx-word__crop i:nth-child(3) { left: -0.03em; bottom: -0.03em; border-width: 0 0 0.035em 0.035em; }
.edx-word__crop i:nth-child(4) { right: -0.03em; bottom: -0.03em; border-width: 0 0.035em 0.035em 0; }
.edx-word__crop b { position: absolute; background: rgba(255, 255, 255, 0.28); }
.edx-word__crop b:nth-of-type(1), .edx-word__crop b:nth-of-type(2) { top: 0; bottom: 0; width: 0.008em; }
.edx-word__crop b:nth-of-type(3), .edx-word__crop b:nth-of-type(4) { left: 0; right: 0; height: 0.008em; }
.edx-word__crop b:nth-of-type(1) { left: 33.33%; } .edx-word__crop b:nth-of-type(2) { left: 66.67%; }
.edx-word__crop b:nth-of-type(3) { top: 33.33%; } .edx-word__crop b:nth-of-type(4) { top: 66.67%; }

/* Scroll motion (2026-11-16, phone perf pass): the styles above are the end state (level, bright, no frame). Only
   transform and opacity move, so nothing is repainted while it animates. Same run as the Stacking title: from once
   the whole word is on screen (its bottom at 90 % of the screen) until its top is a quarter of the way down, eased
   (cubic-bezier(1/3, 0, 2/3, 1) = smoothstep). Scroll timelines where the browser has them (Safari 26, Chrome 115+);
   elsewhere edit-one.js holds the animations paused and sets their time on scroll. */
@keyframes edx-text { from { opacity: 0.38; transform: rotate(-7deg) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes edx-crop { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .edx-word__text { animation: edx-text 1s cubic-bezier(0.3333, 0, 0.6667, 1) both; }
  .edx-word__crop { animation: edx-crop 1s cubic-bezier(0.3333, 0, 0.6667, 1) both; }
  @supports (animation-timeline: view()) {
    .edx-word { view-timeline: --edx-word block; }
    .edx-word__text, .edx-word__crop {
      animation-duration: auto;
      animation-timeline: --edx-word;
      animation-range-start: entry calc(100% + 10dvh);
      animation-range-end: cover 75dvh;
    }
  }
}

.edx-lede {
  margin-top: clamp(20px, 2.4vw, 36px);
  font-size: clamp(20px, 2vw, 30px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--muted);
}
.edx-lede span { color: var(--text); }

/* ---------- The block: visual (photo + floating panel) | words ---------- */

.edx-block {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  align-items: start;                       /* the words start on the photo's top edge */
  gap: clamp(32px, 4.4vw, 72px);
  max-width: 1280px;
  margin: 0 auto;
}
.edx-visual { position: relative; aspect-ratio: 1600 / 1067; min-width: 0; }
.edx-mode { position: absolute; inset: 0; }
.edx[data-mode="color"] [data-mode-pane="geo"],
.edx[data-mode="geo"] [data-mode-pane="color"] { display: none; }

/* Light & Color: the photo fills the visual. The panel takes the empty green on the left (the ladybird and
   the stick sit right of centre); Replay, the hint and the band go right. */
.edx .eda__photo { position: absolute; inset: 0; }
.edx .eda__stage { height: 100%; }
.edx .eda__hint { left: auto; right: 112px; }
.edx .eda__band { left: auto; right: 12px; }

/* Geometry: the dark editing canvas fills the visual; the photo sits right of the panel (edit-chapters.js layout). */
.edx .eda__stage--geo { position: absolute; inset: 0; aspect-ratio: auto; }

/* The panel: the inspector's card floating over the photo, selector on top. */
.edx-panel {
  position: absolute; left: 14px; top: 14px; bottom: 14px; z-index: 4;   /* full height, same 14px inset on every side */
  width: clamp(240px, 33%, 264px);
  overflow: auto;
  padding: 10px 12px 12px;
  border-radius: 20px;
  font-size: 12px;
  scrollbar-width: none;
}
.edx-panel::-webkit-scrollbar { display: none; }
.edx .edx-panel.c-glass { background: linear-gradient(180deg, #181b1ae6, #0f1110f0); border-color: #ffffff2e; box-shadow: inset 0 1px 0 #ffffff1f, 0 18px 50px #00000080; }
.edx-seg { margin-bottom: 8px; }
.edx-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; padding: 0 8px; }
.edx-seg svg { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }

/* Light & Color controls, compacted for the panel. */
.edx-panel .eda__ghead { min-height: 26px; margin-bottom: 2px; }
.edx-panel .eda__pad { height: 46px; margin: 2px 0 4px; }
.edx-panel .eda__rows--two { gap: 0 14px; }
.edx-panel .eda__val { min-width: 0; padding-left: 4px; }
.edx-panel .eda__row label { font-size: 11.5px; }
.edx-panel .eda__group--light { margin-top: 8px; padding: 6px 0 0; border-left: 0; border-top: 1px solid #ffffff14; }

/* Geometry cards, one under the other. */
.edx-panel .eda__card { padding: 8px 10px 10px; }
.edx-panel .eda__card + .eda__card { margin-top: 8px; }
.edx-panel .eda__ratios { gap: 5px; }
.edx-panel .eda__ratios { gap: 4px; }
.edx-panel .eda__ratio { min-height: 44px; padding: 5px 0; font-size: 9.5px; letter-spacing: -0.01em; }
/* Four to a row, not five: "Freeform" (43 px at 9.5 px) did not fit a fifth of the narrow panel (35–40 px tiles,
   2026-11-17). Three rows of 4 + 4 + 2, each a little lower so the card grows by ~20 px, not a full row. */
@media (min-width: 961px) {          /* the narrow side panel only; below this it is wide enough for five */
  .edx-panel .eda__ratios { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .edx-panel .eda__ratio { min-height: 0; padding: 4px 0 5px; gap: 3px; }
  .edx-panel .eda__ratio i { height: 14px; }
}

/* ---------- The words: big, few ---------- */

.edx-text { min-width: 0; font-family: var(--display); }
.edx[data-mode="color"] [data-copy="geo"],
.edx[data-mode="geo"] [data-copy="color"] { display: none; }
.edx-title { margin: -0.1em 0 0; font-size: clamp(40px, 4.8vw, 72px); font-weight: 700; letter-spacing: -0.045em; line-height: 0.96; }   /* cap height on the photo's top edge */
.edx-line { margin-top: clamp(10px, 1.2vw, 16px); font-size: clamp(18px, 1.55vw, 22px); font-weight: 500; letter-spacing: -0.012em; line-height: 1.3; color: var(--muted); }
.edx-points { margin: clamp(24px, 2.8vw, 36px) 0 0; padding: 0; list-style: none; }
.edx-points li {
  padding: 14px 0;
  border-top: 1px solid #ffffff17;
  font-size: clamp(18px, 1.6vw, 22px);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.edx-points li:last-child { border-bottom: 1px solid #ffffff17; }
.edx-copy { animation: edx-in .4s ease; }
@keyframes edx-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Narrow: words above, the photo, the panel under it ---------- */

@media (max-width: 960px) {
  .edx-block { grid-template-columns: minmax(0, 1fr); max-width: 720px; gap: 28px; }
  .edx-text { order: -1; }
  .edx-visual { aspect-ratio: auto; }
  .edx-mode { position: static; }
  .edx .eda__photo { position: relative; }
  .edx .eda__stage { height: auto; }
  .edx .eda__stage--geo { position: relative; aspect-ratio: 1600 / 1150; }
  .edx-panel { position: static; width: auto; max-height: none; margin-top: 10px; }
  .edx-panel .eda__ratio { font-size: 11px; }
}

@media (max-width: 640px) {
  .edx .eda__hint { display: none; }          /* no room beside Replay; the demo hands over without it */
}

@media (prefers-reduced-motion: reduce) {
  .edx-copy { animation: none; }
}
