/* php.php - the PHP hub. Three pictures, each its own shape: a release ledger on one spine
   (version | what changed | what it meant for us), a request travelling down a layered stack
   with a floor under it and a branch beside it, and one server running several PHP versions.
   One copper accent, patina only for "live" and "current", flat surfaces, hairlines, figures and
   code in mono. Motion: transform and opacity only, once, on reveal; hover movement only on a
   real pointer; off under reduced motion. */

.ph-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.ph-actions.is-center { justify-content: center; }
.ph-cap { margin: 12px 4px 0; font-size: 12.5px; color: var(--text-muted); text-align: center; }
.ph-src { margin: 18px 0 0; font-size: 13px; color: var(--text-muted); }
figure.ph-pools-fig { margin: 0; }

/* ── 1. The release ledger ─────────────────────────────────────────── */
.ph-log { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.ph-rel { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1.25fr) minmax(0, 1fr); column-gap: clamp(20px, 3vw, 40px); border-top: 1px solid var(--line); }
/* the version column carries the spine: a hairline on its far edge, a node where each row starts */
.ph-ver { position: relative; padding: 22px 0 22px; border-inline-end: 1px solid var(--line-strong); display: flex; flex-direction: column; gap: 4px; }
.ph-ver::after { content: ""; position: absolute; top: 34px; inset-inline-end: -5px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--text-muted); box-sizing: border-box; }
.ph-ver b { font-family: var(--font-mono); font-weight: 600; font-size: clamp(24px, 2.4vw, 32px); line-height: 1.1; color: var(--text-strong); letter-spacing: -0.02em; direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.ph-ver span { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ph-what { padding: 22px 0; }
.ph-what h3 { margin: 0 0 8px; font-size: 19px; line-height: 1.3; color: var(--text-strong); letter-spacing: -0.01em; }
html[dir="rtl"] .ph-what h3 { letter-spacing: 0; line-height: 1.5; }
.ph-what p { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.7; }
.ph-tag { display: inline-block; vertical-align: 2px; margin-inline-start: 8px; font-style: normal; font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--copper-ink); border: 1px solid currentColor; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.ph-tag.is-now { color: var(--patina-ink); }
html[dir="rtl"] .ph-tag { font-family: var(--font-body); letter-spacing: 0; text-transform: none; font-size: 12px; }
.ph-code { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; direction: ltr; justify-content: flex-start; }
html[dir="rtl"] .ph-code { justify-content: flex-end; }
.ph-code code { display: inline-block; font-size: 12.5px; color: var(--text); background: var(--well); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; white-space: nowrap; }
.ph-us { padding: 22px 0; align-self: stretch; }
.ph-us small { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--copper-ink); margin-bottom: 6px; }
html[dir="rtl"] .ph-us small { font-family: var(--font-body); letter-spacing: 0; text-transform: none; font-size: 12.5px; }
.ph-us p { margin: 0; color: var(--text); font-size: 15px; line-height: 1.7; }

.ph-rel.is-break .ph-ver::after { border-color: var(--copper-500); background: var(--copper-500); }
.ph-rel.is-now .ph-ver::after { border-color: var(--patina-500, #35A08F); background: var(--patina-500, #35A08F); }
.ph-rel.is-now .ph-ver b { color: var(--patina-ink); }
/* PHP 6: a dashed spine and a hollow node, the row set in the muted ink */
.ph-rel.is-ghost .ph-ver { border-inline-end-style: dashed; }
.ph-rel.is-ghost .ph-ver b { color: var(--text-muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.ph-rel.is-ghost .ph-what h3 { color: var(--text-2); }
.ph-rel.is-ghost .ph-what p { color: var(--text-muted); }

/* ── 2. The stack ──────────────────────────────────────────────────── */
.ph-map { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 260px); gap: 0 clamp(20px, 3vw, 36px); }
.ph-stack { --pad: 68px; --step: 12px; list-style: none; margin: 0; padding: 0 0 0 var(--pad); position: relative; grid-column: 1; }
html[dir="rtl"] .ph-stack { padding: 0 var(--pad) 0 0; }
/* the request's path: one copper line through every node, down the inline-start edge */
.ph-stack::before { content: ""; position: absolute; top: 30px; bottom: 30px; inset-inline-start: 21px; border-inline-start: 2px solid var(--copper-500); opacity: .6; }
/* each layer steps in a little further than the one above it, so the stack reads as depth */
.ph-layer { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px); gap: 12px clamp(16px, 2.4vw, 28px); align-items: center; padding: 18px clamp(16px, 2vw, 24px); margin: 0 0 10px calc(var(--i) * var(--step)); background: var(--bg); border: 1px solid var(--line); border-radius: 16px; }
html[dir="rtl"] .ph-layer { margin: 0 calc(var(--i) * var(--step)) 10px 0; }
.ph-layer:last-child { margin-bottom: 0; }
/* the node sits on the line, and a hairline branch reaches from it to its layer */
.ph-node { position: absolute; z-index: 1; top: 50%; inset-inline-start: calc(-1px - var(--pad) - var(--i) * var(--step)); width: 44px; height: 44px; margin-top: -22px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-alt); border: 1px solid var(--line-strong); font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--copper-ink); }
.ph-layer::before { content: ""; position: absolute; top: 50%; inset-inline-end: 100%; width: calc(var(--pad) - 44px + var(--i) * var(--step)); border-top: 1px solid var(--line-strong); }
.ph-layer-body h3 { margin: 0 0 4px; font-size: 18px; color: var(--text-strong); }
.ph-layer-body p { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.65; }
.ph-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ph-links a { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text-strong); font-size: 14.5px; font-weight: 600; text-decoration: none; transition: border-color var(--dur-1, 160ms) ease-out, color var(--dur-1, 160ms) ease-out; }
.ph-go { color: var(--copper-ink); transition: transform 200ms var(--ease-out, ease-out); }
html[dir="rtl"] .ph-go { transform: scaleX(-1); }
.ph-links a:focus-visible, .ph-side a:focus-visible { outline: 2px solid var(--patina-300, #6FCBBB); outline-offset: 2px; }

/* beside the stack: Node.js, joined to the runtime and code layers by a dashed bracket */
.ph-side { grid-column: 2; align-self: center; position: relative; padding: 20px 20px 20px 22px; border: 1px dashed var(--line-strong); border-radius: 16px; }
html[dir="rtl"] .ph-side { padding: 20px 22px 20px 20px; }
.ph-side::before { content: ""; position: absolute; top: 50%; inset-inline-end: 100%; width: clamp(20px, 3vw, 36px); border-top: 1px dashed var(--line-strong); }
.ph-side small, .ph-floor small { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
html[dir="rtl"] .ph-side small, html[dir="rtl"] .ph-floor small { font-family: var(--font-body); letter-spacing: 0; text-transform: none; font-size: 12.5px; }
.ph-side p { margin: 0 0 14px; color: var(--text-2); font-size: 14.5px; line-height: 1.65; }
.ph-side a { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text-strong); font-weight: 600; font-size: 14.5px; text-decoration: none; }

/* under the stack: the server, a solid slab the five layers stand on */
.ph-floor { grid-column: 1 / -1; margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px clamp(20px, 3vw, 36px); align-items: center; padding: clamp(18px, 2.4vw, 26px); border-radius: 16px; background: var(--surface); border: 1px solid var(--line-strong); border-top: 3px solid var(--copper-500); }
.ph-floor h3 { margin: 0 0 4px; font-size: 20px; color: var(--text-strong); }
.ph-floor p { margin: 0; color: var(--text-2); font-size: 14.5px; line-height: 1.65; }
.ph-floor .ph-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ── 3. Upgrades and the pool table ────────────────────────────────── */
.ph-upgrade { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 540px); gap: clamp(32px, 6vw, 80px); align-items: center; }
.ph-steps { list-style: none; margin: 0; padding: 0; counter-reset: st; }
.ph-steps li { counter-increment: st; display: grid; grid-template-columns: 40px minmax(0, 1fr); padding: 16px 0; border-top: 1px solid var(--line); }
.ph-steps li::before { content: counter(st, decimal-leading-zero); font-family: var(--font-mono); font-size: 13px; color: var(--copper-ink); padding-top: 3px; grid-row: 1 / span 2; }
.ph-steps h3 { margin: 0 0 4px; font-size: 17px; color: var(--text-strong); }
.ph-steps p { margin: 0; grid-column: 2; color: var(--text-2); font-size: 15px; line-height: 1.65; }

.ph-pools { border: 1px solid var(--line-strong); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; }
.ph-pools-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ph-pools-top b { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--copper-ink); }
.ph-pools-top span { font-size: 12.5px; color: var(--text-muted); }
.ph-pools table { width: 100%; border-collapse: collapse; display: table; font-size: 13.5px; }
.ph-pools th { text-align: start; font-family: var(--font-mono); font-weight: 600; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); padding: 10px 18px; border-bottom: 1px solid var(--line); background: transparent; }
html[dir="rtl"] .ph-pools th { font-family: var(--font-body); letter-spacing: 0; text-transform: none; font-size: 12px; }
.ph-pools td { padding: 12px 18px; border-bottom: 1px solid var(--line); color: var(--text); font-family: var(--font-mono); font-size: 13px; white-space: nowrap; background: transparent; }
.ph-pools tr:last-child td { border-bottom: 0; }
.ph-pools td.ph-n { color: var(--text-strong); font-weight: 600; direction: ltr; unicode-bidi: isolate; }
.ph-pools td:first-child { direction: ltr; unicode-bidi: isolate; }
.ph-state { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-body); font-size: 13px; font-weight: 600; }
.ph-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.ph-state.is-live { color: var(--patina-ink); }
.ph-state.is-copy { color: var(--copper-ink); }

/* ── Motion: once, on reveal ───────────────────────────────────────── */
@keyframes ph-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ph-node { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
.ph-rel.revealed .ph-ver::after { animation: ph-node 220ms var(--ease-out, ease-out) both 80ms; }
.ph-map.revealed .ph-layer-body, .ph-map.revealed .ph-layer .ph-links { animation: ph-rise 240ms var(--ease-out, ease-out) both; animation-delay: calc(var(--i) * 60ms); }
.ph-pools-fig.revealed tbody tr { animation: ph-rise 200ms var(--ease-out, ease-out) both; }
.ph-pools-fig.revealed tbody tr:nth-child(2) { animation-delay: 50ms; }
.ph-pools-fig.revealed tbody tr:nth-child(3) { animation-delay: 100ms; }
.ph-pools-fig.revealed tbody tr:nth-child(4) { animation-delay: 150ms; }

@media (hover: hover) and (pointer: fine) {
    .ph-links a:hover, .ph-side a:hover { border-color: var(--copper-500); color: var(--copper-ink); }
    .ph-links a:hover .ph-go, .ph-side a:hover .ph-go { transform: translateX(3px); }
    html[dir="rtl"] .ph-links a:hover .ph-go, html[dir="rtl"] .ph-side a:hover .ph-go { transform: scaleX(-1) translateX(3px); }
    .ph-rel { transition: background-color 160ms ease-out; }
    .ph-rel:hover { background: var(--tint-03); }
}

@media (prefers-reduced-motion: reduce) {
    .ph-rel .ph-ver::after, .ph-map .ph-layer-body, .ph-map .ph-layer .ph-links, .ph-pools-fig tbody tr { animation: none !important; }
    .ph-go { transition: none; }
}

/* ── Widths ────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
    .ph-upgrade { grid-template-columns: minmax(0, 1fr); }
    .ph-pools-fig { max-width: 600px; width: 100%; }
    .ph-map { grid-template-columns: minmax(0, 1fr); }
    .ph-side { grid-column: 1; margin-top: 18px; }
    .ph-side::before { display: none; }
}
@media (max-width: 900px) {
    .ph-rel { grid-template-columns: minmax(0, 110px) minmax(0, 1fr); }
    .ph-us { grid-column: 2; padding-top: 0; }
    .ph-layer { grid-template-columns: minmax(0, 1fr); }
    .ph-layer .ph-links { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
    .ph-floor { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    /* the spine moves to the very edge and the version sits above its row */
    .ph-log { border-inline-start: 1px solid var(--line-strong); border-bottom: 0; }
    .ph-rel { grid-template-columns: minmax(0, 1fr); padding-inline-start: 20px; border-top: 0; position: relative; }
    .ph-rel + .ph-rel { border-top: 1px solid var(--line); }
    .ph-rel.is-ghost { border-inline-start: 0; }
    .ph-ver { border-inline-end: 0; flex-direction: row; align-items: baseline; gap: 12px; padding: 20px 0 0; position: static; }
    .ph-ver::after { top: 30px; inset-inline-end: auto; inset-inline-start: -5px; }
    .ph-what { padding: 10px 0 0; }
    .ph-us { grid-column: 1; padding: 14px 0 20px; }
    .ph-rel.is-ghost .ph-what { padding-bottom: 20px; }
    .ph-stack { --pad: 54px; --step: 0px; }
    .ph-stack::before { inset-inline-start: 17px; }
    .ph-layer { padding: 16px; }
    .ph-node { width: 36px; height: 36px; margin-top: 0; top: 16px; font-size: 12px; }
    .ph-layer::before { top: 34px; width: calc(var(--pad) - 36px); }
    .ph-floor .ph-links { grid-template-columns: minmax(0, 1fr); }
    .ph-pools th, .ph-pools td { padding-inline: 12px; }
    /* the pool name is the column a phone can do without */
    .ph-pools th:nth-child(3), .ph-pools td:nth-child(3) { display: none; }
}
@media (max-width: 720px) {
    .sp-hero .ph-actions .btn, .sp-close .ph-actions .btn { width: 100%; justify-content: center; }
}
@media (pointer: coarse) {
    .ph-links a, .ph-side a { min-height: 44px; }
}

html[dir="rtl"] .ph-pools-top b { font-family: var(--font-mono); }
/* the version figure keeps its Latin order but sits at the start of its column in both directions,
   so in Arabic it does not run up against the spine */
.ph-ver b, .ph-ver span { align-self: flex-start; }
html[dir="rtl"] .ph-rel.is-ghost .ph-ver span { font-family: var(--font-body); }
