/* php-frameworks.php - the page's own pictures. The shared hero, section rhythm and closing band
   come from svc-pages.css; everything here is a shape only this page has: a decision tree built
   on details/summary, a comparison table that restacks into one card per framework, a diff
   beside a five-step stair, two lanes a migration crosses, and two link rows. */

.fw-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.fw-actions.is-center { justify-content: center; }
.fw-vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── 1. The decision tree ───────────────────────────────────────────────────
   Native <details>: it opens with no script, find-in-page reaches a closed branch, and the
   `name` attribute keeps one sibling open at a time where the browser supports it. */
.fw-tree { max-width: 900px; }
.fw-q { display: flex; align-items: center; gap: 14px; margin: 0 0 8px; font-family: var(--font-display, inherit); font-size: clamp(22px, 2.4vw, 30px); font-weight: 700; line-height: 1.25; color: var(--text-strong); letter-spacing: -0.015em; }
html[dir="rtl"] .fw-q { letter-spacing: 0; }
.fw-q-n { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--copper-ink); color: var(--copper-ink); font-family: var(--font-mono); font-size: 16px; font-weight: 600; }
.fw-q.is-sub { font-size: clamp(18px, 1.8vw, 21px); margin: 6px 0 4px; }
.fw-q.is-sub .fw-q-n { width: 28px; height: 28px; font-size: 14px; }

.fw-node > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 16px; padding: 18px 4px; border-top: 1px solid var(--line); color: var(--text-strong); font-family: var(--font-display, inherit); font-size: clamp(18px, 1.9vw, 22px); font-weight: 600; line-height: 1.35; min-height: 44px; }
.fw-node > summary::-webkit-details-marker { display: none; }
.fw-node > summary::marker { content: ''; }
.fw-tree > .fw-node:last-of-type > summary { border-bottom: 1px solid var(--line); }
.fw-tree > .fw-node[open]:last-of-type > summary { border-bottom: 0; }
.fw-node.is-leaf > summary { font-family: inherit; font-size: 16.5px; padding: 14px 4px; }
.fw-node > summary:focus-visible { outline: 2px solid var(--copper-ink); outline-offset: 2px; border-radius: 6px; }

/* the chevron: points along the reading direction while closed, down when open */
.fw-chev { flex: none; width: 9px; height: 9px; border-top: 1.8px solid currentColor; border-right: 1.8px solid currentColor; transform: rotate(45deg); transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1); color: var(--copper-ink); margin-inline: 4px 2px; }
html[dir="rtl"] .fw-chev { transform: rotate(-135deg); }
.fw-node[open] > summary .fw-chev { transform: rotate(135deg); }
.fw-node[open] > summary { color: var(--copper-ink); }

/* an open branch hangs from a rail on the start edge */
.fw-body { margin-inline-start: 8px; padding: 4px 0 22px; padding-inline-start: clamp(18px, 3vw, 30px); border-inline-start: 1px solid var(--line-strong, var(--line)); }
.fw-node:not(.is-leaf) > .fw-body > .fw-node:last-child > summary { border-bottom: 1px solid var(--line); }
@keyframes fw-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.fw-node[open] > .fw-body { animation: fw-in 220ms cubic-bezier(0.16, 1, 0.3, 1); }

.fw-pick { border-inline-start-color: var(--copper-ink); padding-top: 10px; padding-bottom: 26px; }
.fw-pick-k { margin: 0 0 6px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
html[dir="rtl"] .fw-pick-k { letter-spacing: 0; text-transform: none; font-size: 13px; font-family: inherit; }
.fw-pick-name { margin: 0 0 10px; font-family: var(--font-display, inherit); font-size: clamp(26px, 3vw, 36px); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; color: var(--text-strong); }
html[dir="rtl"] .fw-pick-name:not([translate="no"]) { letter-spacing: 0; line-height: 1.3; }
.fw-pick-why { margin: 0 0 10px; max-width: 62ch; font-size: 15.5px; line-height: 1.7; color: var(--text); }
.fw-pick-also { margin: 0 0 10px; max-width: 62ch; font-size: 14.5px; line-height: 1.65; color: var(--text-2); padding-inline-start: 14px; border-inline-start: 2px solid var(--line-strong, var(--line)); }
.fw-go { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; font-weight: 600; color: var(--copper-ink); text-decoration: none; min-height: 44px; }
.fw-go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1); }
html[dir="rtl"] .fw-go svg { transform: scaleX(-1); }
.fw-go:focus-visible { outline: 2px solid var(--copper-ink); outline-offset: 3px; border-radius: 4px; }

/* ── 2. The matrix ────────────────────────────────────────────────────────
   modern.css turns every bare table into a scrolling block; this one is a real table again. */
.fw-matrix { display: table; width: 100%; max-width: 100%; overflow: visible; border-collapse: collapse; font-size: 14.5px; }
.fw-matrix thead th { text-align: start; vertical-align: bottom; padding: 0 18px 14px 0; padding-inline: 0 18px; font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--line-strong, var(--line)); }
html[dir="rtl"] .fw-matrix thead th { letter-spacing: 0; text-transform: none; font-size: 13px; font-family: inherit; }
.fw-matrix tbody th { text-align: start; vertical-align: top; width: 14%; padding: 18px 0; padding-inline-end: 18px; font-family: var(--font-display, inherit); font-size: 18px; font-weight: 700; color: var(--text-strong); border-bottom: 1px solid var(--line); }
.fw-matrix td { vertical-align: top; padding: 18px 0; padding-inline-end: 18px; line-height: 1.6; color: var(--text-2); border-bottom: 1px solid var(--line); }
.fw-matrix td:nth-of-type(2)[translate="no"] { font-family: var(--font-mono); font-size: 13.5px; color: var(--text); }
.fw-matrix td:last-child { padding-inline-end: 0; }
.fw-note { margin: 22px 0 0; max-width: 72ch; font-size: 14.5px; line-height: 1.65; color: var(--text-muted); }

/* ── 3. Rescue: the diff and the stair ─────────────────────────────────────
   The diff is a dark object in both themes, like an editor; its colours are pinned here. */
.fw-rescue { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.fw-diff { margin: 0; min-width: 0; }
.fw-diff-bar { direction: ltr; padding: 11px 16px; background: #1D1928; border: 1px solid rgba(255, 255, 255, .12); border-bottom: 0; border-radius: 16px 16px 0 0; }
.fw-diff-bar span { font-family: var(--font-mono); font-size: 12px; color: #ADA3C8; }
.fw-diff pre { margin: 0; padding: 14px 0; background: #15121E; border: 1px solid rgba(255, 255, 255, .12); border-radius: 0 0 16px 16px; box-shadow: var(--shadow-2, 0 20px 50px rgba(0, 0, 0, .48)); overflow-x: auto; overscroll-behavior-x: contain; text-align: left; direction: ltr; font-family: var(--font-mono); font-size: 13px; line-height: 1.75; }
.fw-diff code { font: inherit; display: block; min-width: max-content; word-break: normal; }
.fw-diff .d-del, .fw-diff .d-add { display: block; white-space: pre; padding: 0 18px; }
.fw-diff .d-del { color: #F0A49C; background: rgba(224, 107, 96, .12); }
.fw-diff .d-add { color: #8FE0CF; background: rgba(111, 203, 187, .12); }
.fw-diff figcaption { margin: 14px 4px 0; font-size: 14px; line-height: 1.6; color: var(--text-2); }

.fw-stair { list-style: none; margin: 0; padding: 0; }
.fw-stair li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; margin-inline-start: calc(var(--s) * 26px); padding: 14px 0 16px; padding-inline-start: 16px; border-inline-start: 2px solid var(--line-strong, var(--line)); border-top: 1px solid var(--line); }
.fw-stair li:last-child { border-inline-start-color: var(--patina-ink); }
.fw-stair-n { font-family: var(--font-mono); font-size: 12.5px; color: var(--copper-ink); padding-top: 3px; font-feature-settings: 'zero' 1; }
.fw-stair h3 { font-size: 16.5px; margin: 0 0 5px; color: var(--text-strong); line-height: 1.3; }
.fw-stair p { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--text-2); }

/* ── 4. Migration: two lanes ──────────────────────────────────────────────── */
.fw-mig { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.fw-lanes { margin: 0; }
.fw-lanes-head, .fw-lanes li { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) minmax(88px, .9fr); align-items: center; column-gap: 10px; }
.fw-lanes-head { padding-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--text-strong); text-align: center; line-height: 1.3; }
.fw-lanes ul { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.fw-lanes li { border-top: 1px solid var(--line); min-height: 54px; }
.fw-lanes code { font-family: var(--font-mono); font-size: 13px; color: var(--text-strong); background: none; overflow-wrap: anywhere; word-break: normal; text-align: start; }
.fw-lane { position: relative; align-self: stretch; min-height: 54px; }
.fw-lane::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px solid var(--line-strong, var(--line)); }
.fw-dot { position: absolute; top: 50%; left: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--text-muted); }
.fw-lane.is-new .fw-dot { background: var(--patina-ink); }
.st-testing .fw-lane.is-new .fw-dot { background: var(--bg-alt); border: 2px solid var(--copper-ink); box-sizing: border-box; }
.fw-st { font-size: 13px; font-weight: 600; text-align: end; color: var(--text-muted); }
.st-moved .fw-st { color: var(--patina-ink); }
.st-testing .fw-st { color: var(--copper-ink); }
.fw-lanes figcaption { margin: 12px 0 0; font-size: 13px; color: var(--text-muted); }

.fw-conf { padding: clamp(20px, 2.6vw, 28px); border: 1px solid var(--line); border-radius: 18px; background: var(--bg); }
.fw-conf-k { margin: 0 0 14px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--copper-ink); }
html[dir="rtl"] .fw-conf-k { letter-spacing: 0; text-transform: none; font-size: 13px; font-family: inherit; }
.fw-conf pre { margin: 0 0 16px; padding: 16px; background: var(--well); border-radius: 12px; font-size: 12.5px; line-height: 1.75; overflow-x: auto; text-align: left; direction: ltr; }
.fw-conf pre code { font: inherit; font-family: var(--font-mono); color: var(--text); white-space: pre; word-break: normal; }
.fw-conf .c-dim { color: var(--text-muted); }
.fw-conf > p:last-child { margin: 0; font-size: 14.5px; line-height: 1.65; color: var(--text-2); }

/* ── 5. Link rows ─────────────────────────────────────────────────────────── */
.fw-links { border-top: 1px solid var(--line); }
.fw-link { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr) auto; align-items: center; gap: 10px 28px; padding: 24px 0; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.fw-link-k { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
html[dir="rtl"] .fw-link-k:not([translate="no"]) { letter-spacing: 0; text-transform: none; font-size: 13px; font-family: inherit; }
.fw-link-t { font-size: 16px; color: var(--text-strong); }
.fw-link-go { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--copper-ink); white-space: nowrap; }
.fw-link-go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1); }
html[dir="rtl"] .fw-link-go svg { transform: scaleX(-1); }
.fw-link:focus-visible { outline: 2px solid var(--copper-ink); outline-offset: 4px; border-radius: 4px; }

@media (hover: hover) and (pointer: fine) {
    .fw-node > summary:hover { color: var(--copper-ink); }
    .fw-link:hover .fw-link-go svg, .fw-go:hover svg { transform: translateX(4px); }
    html[dir="rtl"] .fw-link:hover .fw-link-go svg, html[dir="rtl"] .fw-go:hover svg { transform: scaleX(-1) translateX(4px); }
}

/* ── widths ───────────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
    .fw-rescue, .fw-mig { grid-template-columns: minmax(0, 1fr); }
    .fw-conf { max-width: 620px; }
}
@media (max-width: 900px) {
    /* one card per framework: every column stays, each labelled by its own heading */
    .fw-matrix, .fw-matrix tbody, .fw-matrix tr, .fw-matrix th, .fw-matrix td { display: block; width: auto; }
    .fw-matrix thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .fw-matrix tbody tr { border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px 8px; margin-bottom: 12px; background: var(--bg); }
    .fw-matrix tbody th { border: 0; padding: 0 0 10px; font-size: 20px; }
    .fw-matrix td { display: grid; grid-template-columns: minmax(104px, 32%) minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 0; border-top: 1px solid var(--line); }
    .fw-matrix td::before { content: attr(data-label); font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); padding-top: 3px; line-height: 1.4; }
    html[dir="rtl"] .fw-matrix td::before { font-family: var(--font-body, inherit); letter-spacing: 0; text-transform: none; font-size: 13px; }
    .fw-link { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
@media (max-width: 640px) {
    .fw-stair li { margin-inline-start: calc(var(--s) * 10px); }
    .fw-lanes-head, .fw-lanes li { grid-template-columns: minmax(0, 1.25fr) 56px 56px minmax(72px, .9fr); column-gap: 6px; }
    .fw-lanes-head { font-size: 11.5px; }
    .fw-body { margin-inline-start: 4px; padding-inline-start: 16px; }
}
@media (max-width: 480px) {
    .fw-matrix td { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
@media (max-width: 720px) {
    .fw-actions .btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .fw-node[open] > .fw-body { animation: none; }
    .fw-chev, .fw-go svg, .fw-link-go svg { transition: none; }
    .fw-link:hover .fw-link-go svg, .fw-go:hover svg { transform: none; }
    html[dir="rtl"] .fw-link:hover .fw-link-go svg, html[dir="rtl"] .fw-go:hover svg { transform: scaleX(-1); }
}
