/* ==========================================================================
   Sub-page sections (vds, dedicated, locations, cli, contact, 404).
   Shared pieces (nav, hero grid, stage, terminal, CTA, footer) live in style.css.
   Colours, sizes and motion come from tokens.css only.
   ========================================================================== */

/* ---------- Split: text on one side, a fragment or picture on the other ---------- */
.split { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: center; }
.split-text { grid-column: 1 / span 5; }
.split > figure { grid-column: 7 / -1; margin: 0; }
.split-flip > figure { grid-column: 1 / span 6; grid-row: 1; }
.split-flip .split-text { grid-column: 8 / -1; grid-row: 1; }
.split-text p { margin-top: 24px; max-width: 46ch; }
.split-cta { margin-top: 32px !important; }

/* ---------- Product fragments ([data-ui]) ---------- */
.frag { background: var(--surface); border-radius: var(--r-ui-lg); padding: 24px 28px; font-size: 15px; }
.frag-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.frag-head b { font-size: 17px; }
.frag-stats { margin: 20px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.frag-stats dt { color: var(--muted); font-size: 13px; }
.frag-stats dd { margin: 4px 0 0; font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.spark { display: block; width: 100%; height: 160px; }
.spark .area { fill: var(--accent); opacity: .16; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark .cap { fill: none; stroke: var(--ui-border); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.snap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.snap-list li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 16px; background: var(--surface-2); border-radius: var(--r-ui); }
.snap-list li div { display: flex; flex-direction: column; gap: 2px; }
.snap-list li.new { animation: flash .5s var(--ease-out); }
.drives { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drive { background: var(--surface-2); border-radius: var(--r-ui); padding: 16px; display: grid; gap: 8px; }
.raid-line { margin-top: 16px; color: var(--muted); }
.raid-line b { color: var(--ink); font-weight: 500; }
.net-frag pre { margin: 0; font-size: 14px; line-height: 1.8; color: var(--term-text); white-space: pre; overflow-x: auto; }
.net-frag .p, .net-frag .ok { color: var(--accent); }
.net-frag .ink { color: var(--ink); }
.net-frag .dim { color: var(--term-dim); }
.term .warn { color: var(--ui-warn); }

/* ---------- Tables (real tables keep their row lines) ---------- */
.table-wrap { overflow-x: auto; }
.plan-table, .ref-table { width: 100%; border-collapse: collapse; font-size: var(--t-body); }
.plan-table { min-width: 820px; }
.plan-table th, .plan-table td, .ref-table th, .ref-table td { padding: 22px 16px; text-align: left; border-bottom: 1px solid var(--ui-line); vertical-align: middle; }
.plan-table thead th, .ref-table thead th { color: var(--muted); font-weight: 400; font-size: var(--t-small); padding-top: 0; }
.plan-table tbody th { font-size: var(--t-lead); font-weight: 500; letter-spacing: -0.015em; white-space: nowrap; }
.plan-table tbody th small { display: block; font-size: var(--t-small); font-weight: 400; color: var(--accent); letter-spacing: 0; }
.plan-table .num { font-size: var(--t-lead); font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-table .num small { font-size: var(--t-small); color: var(--muted); }
.plan-table td:last-child { text-align: right; }
.plan-table tr.is-pick { background: var(--surface); }
.ref-table td:first-child { white-space: nowrap; width: 34%; }
.ref-table code { font-size: 15px; color: var(--accent); }
.after-table { margin-top: 24px; max-width: 60ch; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Rows: a list set large, name at one end, detail at the other ---------- */
.rows-wrap, .faq { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: start; }
.rows-wrap > h2, .faq > h2 { grid-column: 1 / span 4; position: sticky; top: calc(var(--nav-h) + 32px); }
.rows { grid-column: 5 / -1; list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; padding: 22px 24px; font-size: var(--t-lead); letter-spacing: -0.01em; }
.rows li:nth-child(odd) { background: var(--surface); }
.rows li > :last-child { font-size: var(--t-body); text-align: right; letter-spacing: 0; }

/* ---------- FAQ ---------- */
.faq-list { grid-column: 5 / -1; display: grid; gap: 8px; }
.faq details { background: var(--surface); }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 24px; padding: 24px 28px; font-size: var(--t-lead); letter-spacing: -0.01em; transition: color var(--t-hover) ease; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--accent); flex: none; transition: transform var(--t-ui) var(--ease-out); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--accent-strong); }
.faq details p { padding: 0 28px 28px; max-width: 62ch; }

/* ---------- Dedicated: machines as full-width bands ---------- */
.machines { display: grid; gap: 8px; }
.machine { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: center; background: var(--surface); padding: 40px; }
.machine.is-pick { background: var(--surface-2); }
.m-name { grid-column: 1 / span 4; }
.m-name h3 { font-size: var(--t-h2); font-weight: 500; letter-spacing: -0.035em; line-height: 1.04; }
.m-name p { margin-top: 10px; color: var(--muted); }
.machine.is-pick .m-name p { color: var(--accent); }
.m-specs { grid-column: 5 / span 5; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.m-specs dt { color: var(--muted); font-size: var(--t-small); }
.m-specs dd { margin: 2px 0 0; }
.m-buy { grid-column: 10 / -1; display: flex; flex-direction: column; align-items: flex-end; gap: 16px; }
.m-price { font-size: var(--t-h2); font-weight: 500; letter-spacing: -0.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.m-price small { font-size: var(--t-body); color: var(--muted); letter-spacing: 0; font-weight: 400; }

/* ---------- Timeline (order shown by position, not numbers) ---------- */
.steps-line h2 { margin-bottom: 56px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.timeline li { padding-top: 28px; position: relative; }
.timeline li::before { content: ''; position: absolute; top: 0; left: 0; right: calc(-1 * var(--gap)); height: 6px; background: var(--surface-3); }
.timeline li:first-child::before { background: var(--accent); }
.timeline li:last-child::before { right: 0; }
.timeline b { display: block; font-size: var(--t-lead); font-weight: 500; letter-spacing: -0.01em; margin-bottom: 10px; }
.timeline p { max-width: 30ch; }
@media (prefers-reduced-motion: no-preference) {
  .js .timeline li::before { transform: scaleX(0); transform-origin: left; transition: transform 900ms var(--ease-expo); transition-delay: var(--d, 0ms); }
  .js .timeline li.is-in::before { transform: none; }
}

/* ---------- Pictures ---------- */
.photo-frame { margin: 0; aspect-ratio: 4 / 5; overflow: hidden; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Locations ---------- */
.globe {
  --cut: 0px;
  grid-column: 6 / -1; grid-row: 1 / span 2; align-self: end;
  margin: 0 calc(-1 * var(--bleed)) 0 0;
}
.globe img { width: 100%; height: auto; mix-blend-mode: lighten; }
.loc-hero .hero-title { grid-column: 1 / span 6; position: relative; z-index: 1; }
.nearest { margin-top: 40px; background: var(--surface); padding: 24px 28px 28px; }
.nearest-city { font-size: var(--t-lead); line-height: 1.4; margin-bottom: 6px; }
.nearest-city b { font-weight: 600; }
.nearest .btn { margin-top: 20px; }
.code { color: var(--accent); font-size: var(--t-small); letter-spacing: 0; font-weight: 400; }

.gallery {
  list-style: none; margin: 0; padding: 0 0 16px; display: flex; gap: 16px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-color: var(--surface-3) transparent;
}
.city { flex: 0 0 clamp(260px, 25vw, 360px); scroll-snap-align: start; scroll-margin-top: calc(var(--nav-h) + 24px); }
.city img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.city h3 { margin-top: 18px; font-size: var(--t-lead); font-weight: 500; letter-spacing: -0.015em; }
.city p { margin: 8px 0 12px; }
.city:target h3 { color: var(--accent); }

/* ---------- CLI playground ---------- */
.try { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 0; background: var(--surface-3); padding: 10px 14px; cursor: pointer; transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
.chip code { font-size: var(--t-small); color: var(--ink); }
.chip:hover { background: var(--hover); }
.chip:active { transform: scale(0.97); }
.stage:has(.play) { height: auto; padding-bottom: 0; }
.term.play pre { min-height: 0; height: 320px; overflow-y: auto; white-space: pre-wrap; padding-bottom: 8px; }
.play-line { display: flex; align-items: center; gap: 10px; padding: 8px 24px 28px; font-family: var(--font-code); font-size: 14px; }
.play-line label { white-space: nowrap; }
.play-line .dir { color: var(--term-dir); }
.play-line .p { color: var(--accent); }
.play-line input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--ink); font-family: var(--font-code); font-size: 14px; caret-color: var(--accent); }
.play-line input:focus { outline: none; }
.play:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.play-line input::placeholder { color: var(--term-dim); }

/* ---------- Contact ---------- */
.contact-hero .lede { max-width: 40ch; margin-top: 28px; }
.write { padding-top: clamp(72px, 8vw, 120px); }
.write-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: start; }
.write-form { grid-column: 1 / span 6; display: grid; gap: 28px; }
.write-form fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.write-form fieldset[hidden] { display: none; }
.write-form legend, .field label { display: block; width: 100%; margin-bottom: 10px; color: var(--muted); font-size: var(--t-small); }
.write-form fieldset label { position: relative; cursor: pointer; }
.write-form fieldset input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.write-form fieldset span { display: block; padding: 12px 16px; background: var(--surface); transition: background-color var(--t-hover) ease, color var(--t-hover) ease; }
.write-form fieldset label:hover span { background: var(--surface-3); }
.write-form fieldset input:checked + span { background: var(--accent); color: var(--accent-ink); }
.write-form fieldset input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--ui-border); border-radius: var(--r-page);
  font-size: 16px; transition: border-color var(--t-hover) ease;
}
.field textarea { resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--ui-border-hover); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.write-form .btn { justify-self: start; }
.form-note { font-size: var(--t-small); margin-top: -12px; }
.mail-frag { grid-column: 8 / -1; position: sticky; top: calc(var(--nav-h) + 32px); margin: 0; padding: 0; overflow: hidden; }
.mail-head { background: var(--surface-2); padding: 20px 28px; display: grid; gap: 6px; }
.mail-head .mut { display: inline-block; width: 72px; }
.mail-body { margin: 0; padding: 24px 28px 32px; font-family: var(--font); font-size: 16px; line-height: 1.6; white-space: pre-wrap; min-height: 280px; }
.strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.strip img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.strip span { display: block; margin-top: 10px; }

/* ---------- 404 ---------- */
.lost .lost-links { margin-top: 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.lost { padding-bottom: var(--section); }

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
  .split-text, .split > figure, .split-flip > figure, .split-flip .split-text { grid-column: 1 / -1; grid-row: auto; }
  .split > figure { margin-top: 40px; }
  .split-flip > figure { margin: 0 0 40px; }
  .rows-wrap > h2, .faq > h2 { grid-column: 1 / -1; position: static; margin-bottom: 32px; }
  .rows, .faq-list { grid-column: 1 / -1; }
  .m-name, .m-specs, .m-buy { grid-column: 1 / -1; }
  .m-specs { margin: 28px 0; }
  .m-buy { flex-direction: row; justify-content: space-between; align-items: center; }
  .timeline { grid-template-columns: 1fr 1fr; row-gap: 40px; }
  .timeline li:nth-child(2)::before { right: 0; }
  .globe { grid-column: 1 / -1; grid-row: 3; margin: 32px calc(-1 * var(--m)) 0; }
  .loc-hero .hero-title { grid-column: 1 / -1; }
  .write-form, .mail-frag { grid-column: 1 / -1; }
  .mail-frag { position: static; margin-top: 48px; }
  .strip { grid-template-columns: repeat(3, 1fr); row-gap: 24px; }
}

/* ---------- Phone ---------- */
@media (max-width: 720px) {
  .frag { padding: 20px; }
  .frag-stats { grid-template-columns: 1fr 1fr; }
  .drives { grid-template-columns: 1fr; }
  .rows li { flex-direction: column; gap: 4px; padding: 18px 20px; }
  .rows li > :last-child { text-align: left; }
  .faq summary { padding: 20px; }
  .faq details p { padding: 0 20px 22px; }
  .machine { padding: 28px 20px; }
  .m-buy { flex-direction: column; align-items: flex-start; }
  .timeline { grid-template-columns: 1fr; }
  .timeline li::before { right: 0 !important; }
  .ref-table td:first-child { white-space: normal; }
  .ref-table th, .ref-table td { padding: 16px 10px; }
  .gallery { gap: 12px; }
  .city { flex-basis: 78vw; }
  .term.play pre { height: 260px; }
  .stage:has(.play) .term-wrap { width: calc(100vw - 16px); }
  .strip { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Locations: motion and the nearest city ---------- */
.city.is-near h3 { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .js .globe.shutter img { transform: scale(1.1); transition: transform 1600ms var(--ease-soft) 150ms; }
  .js .globe.shutter.is-in img { transform: none; }
}

/* ---------- Plan table becomes stacked rows on a phone ---------- */
@media (max-width: 720px) {
  .plan-table { min-width: 0; }
  .plan-table thead { display: none; }
  .plan-table, .plan-table tbody, .plan-table tr, .plan-table th, .plan-table td { display: block; }
  .plan-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; padding: 24px 20px; border-bottom: 1px solid var(--ui-line); }
  .plan-table th, .plan-table td { padding: 0; border: 0; }
  .plan-table tbody th { grid-column: 1 / -1; }
  .plan-table td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: var(--t-small); }
  .plan-table td:last-child { grid-column: 1 / -1; text-align: left; }
  .plan-table td:last-child .btn { width: 100%; }
}

/* ---------- Picture band (one deliberate rest per page) ---------- */
.band-figure { margin: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: end; }
.band-figure img { grid-column: 1 / span 8; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.band-figure figcaption { grid-column: 9 / -1; padding-bottom: 8px; }
.band-title { font-size: var(--t-h2); font-weight: 500; letter-spacing: -0.035em; line-height: 1.04; margin-bottom: 20px; }

/* ---------- 404: picture links ---------- */
#elsewhere h2 { margin-bottom: 40px; }
.go-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.go-tiles a { display: block; text-decoration: none; }
.go-tiles img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; transition: transform 600ms var(--ease-out); }
.go-tiles a > img { display: block; }
.go-tiles li { overflow: hidden; }
.go-tiles span { display: block; padding: 16px 0 0; font-size: var(--t-lead); background: var(--ground); position: relative; transition: color var(--t-hover) ease; }
.go-tiles a:hover span { color: var(--accent); }
@media (hover: hover) and (pointer: fine) { .go-tiles a:hover img { transform: scale(1.03); } }

@media (max-width: 900px) {
  .band-figure img, .band-figure figcaption { grid-column: 1 / -1; }
  .band-figure figcaption { padding-top: 28px; }
  .go-tiles { grid-template-columns: 1fr 1fr; row-gap: 24px; }
  .m-specs { margin-bottom: 44px; }
}
@media (prefers-reduced-motion: no-preference) {
  .js .go-tiles li[data-reveal] img { transform: scale(1.08); transition: transform 1400ms var(--ease-soft); transition-delay: var(--d, 0ms); }
  .js .go-tiles li[data-reveal].is-in img { transform: none; }
}

/* Pictures with a crop ratio: the height attribute must not win over aspect-ratio */
.city img, .strip img, .go-tiles img, .band-figure img { height: auto; }
/* The globe sits in the middle of a wide black frame: crop it square so it fills its column */
.globe img { aspect-ratio: 1 / 1; object-fit: cover; height: auto; }
.globe { align-self: center; }
@media (max-width: 900px) { .globe img { aspect-ratio: 4 / 3; } }
.globe { grid-column: 7 / -1; }
@media (max-width: 900px) { .globe { grid-column: 1 / -1; } }
