/* qubba.ai/systems: the gear world with the six systems sliding over it, the process on paper,
   our own catalog as a world, limits, questions and a closing world. Works as plain flow with no
   JavaScript; systems.js only adds drift when GSAP is present and motion is allowed. */

/* ===== Stage: the gear world pins (CSS sticky) while the six systems panel slides over it ===== */
.sys-stage { position: relative; }
.sys-world { background: var(--bg); }
.sys-world picture { position: absolute; inset: 0; }
.sys-plate { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; will-change: transform; }
.sys-hero-plate { object-position: 72% 50%; transform-origin: 70% 50%; }
.sys-hero-shade { background: linear-gradient(to top, rgba(10, 11, 13, .9) 0%, rgba(10, 11, 13, .35) 48%, rgba(10, 11, 13, .2) 100%), linear-gradient(to right, rgba(10, 11, 13, .55), transparent 55%); }
.sys-hero-copy { padding-inline: max(var(--gutter), calc((100% - 1360px) / 2)); gap: 1.1rem; }
/* Sized by width and by height, so the script word, the word, the line and the buttons always fit under the nav */
/* margin-bottom 0 keeps the full ink padding under the word, so descenders (y, g) never touch the line below */
.sys-giant { font-size: clamp(4rem, min(19vw, 34svh), 22rem); margin-left: calc(-.04em - var(--ink-x)); margin-bottom: 0; }
.sys-hero-giant { transform-origin: 0% 100%; }
.sys-hero-line { color: var(--ink); max-width: 46ch; }
@media (prefers-reduced-motion: no-preference) {
  .sys-hero-copy > * { animation: sys-rise 1.1s var(--ease) backwards; }
  .sys-hero-copy > :nth-child(2) { animation-delay: .08s; }
  .sys-hero-copy > :nth-child(3) { animation-delay: .2s; }
  .sys-hero-copy > :nth-child(4) { animation-delay: .3s; }
}
/* translate, not transform, and fill backwards only: once finished the animation lets go, so systems.js can drift and fade the word */
@keyframes sys-rise { from { opacity: 0; translate: 0 28px; } to { opacity: 1; translate: 0 0; } }

/* ===== Six systems: big type on hairline rules, no boxes ===== */
.sys-six { background: rgba(10, 11, 13, .9); }
.sys-head { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 1.5rem clamp(2rem, 6vw, 6rem); align-items: end; }
.sys-head h2, .sys-process h2 { font-size: clamp(2.8rem, 6.5vw, 6rem); font-weight: 600; line-height: 1.02; letter-spacing: -.035em; }
.sys-head em, .sys-limits em { color: var(--gold); }
.sys-list { list-style: none; margin: clamp(3rem, 8vh, 5rem) 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: clamp(1.5rem, 3vw, 3.5rem); }
.sys-list li { position: relative; display: grid; align-content: start; gap: .85rem; padding: 1.5rem 0 clamp(2.25rem, 5vh, 3.5rem); border-top: 1px solid var(--line-soft); }
.sys-list li::before { content: ""; position: absolute; top: -1px; left: 0; width: 2.75rem; height: 1px; background: var(--gold); }
.sys-n { font-size: .875rem; font-weight: 600; color: var(--gold); font-variant-numeric: tabular-nums; }
.sys-list h3 { font-size: clamp(1.85rem, 2.9vw, 3rem); font-weight: 600; line-height: 1.02; letter-spacing: -.035em; }
.sys-list p { color: var(--ink-2); max-width: 32ch; }
.sys-aside { margin-top: 1.5rem; color: var(--ink-2); }
.sys-link, .sys-aside a { color: var(--gold); text-decoration: underline; text-underline-offset: .25em; text-decoration-thickness: 1px; }
.sys-link:hover { text-decoration-thickness: 2px; }
.sys-strip { padding-bottom: clamp(3rem, 8vh, 6rem); }

/* ===== How a project runs: four steps on paper, each word with its script ===== */
.sys-process { padding: clamp(4.5rem, 11vw, 9rem) 0; background: var(--paper); color: var(--paper-ink); }
.sys-process h2 { max-width: 12ch; margin-bottom: clamp(3rem, 7vw, 5rem); }
.sys-process h2 em { color: #766039; }
.sys-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid #a79d8a; }
.sys-steps li { position: relative; padding: 1.5rem clamp(1rem, 2vw, 2rem) 0 0; }
.sys-steps li::before { content: ""; position: absolute; top: -4px; left: 0; width: 7px; height: 7px; border-radius: 50%; background: #766039; }
.sys-step-n { color: #66563b; font-size: .9rem; font-variant-numeric: tabular-nums; }
.sys-steps h3 { margin: 1.5rem 0 1rem; font-size: clamp(1.9rem, 2.9vw, 3.2rem); font-weight: 600; line-height: 1.02; letter-spacing: -.04em; }
.sys-step-script { display: block; margin-bottom: .1em; font-family: var(--script); font-weight: 400; font-size: .52em; line-height: 1.3; letter-spacing: 0; color: #766039; }
.sys-steps p { color: #4a4438; font-size: 1rem; max-width: 34ch; }

/* ===== Worlds further down: the catalog example and the closing call ===== */
.sys-world-alt { height: auto; min-height: 640px; min-height: clamp(600px, 92svh, 1000px); display: grid; }
.sys-example-plate { object-position: 50% 45%; filter: saturate(.3) sepia(.35) brightness(.8); }
.sys-example-shade { background: linear-gradient(to top, rgba(10, 11, 13, .95) 0%, rgba(10, 11, 13, .55) 45%, rgba(10, 11, 13, .35) 100%); }
.sys-alt-copy { position: relative; inset: auto; padding-top: calc(var(--nav-h) + 2rem); padding-inline: max(var(--gutter), calc((100% - 1360px) / 2)); }
.sys-alt-copy .line { color: var(--ink); max-width: 46ch; }

/* The catalog, from records to an order: dots on one line, as in the marketing service maps */
.sys-example-notes { padding: clamp(3rem, 8vh, 5rem) 0 clamp(4rem, 10vh, 7rem); border-bottom: 1px solid var(--line-soft); }
.sys-example-grid { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 2rem clamp(2rem, 6vw, 6rem); align-items: start; }
.sys-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; }
.sys-flow li { position: relative; min-width: 0; padding: 1.25rem 1rem 0 0; border-top: 1px solid var(--line); }
.sys-flow li::before { content: ""; position: absolute; top: -4px; left: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.sys-flow strong { display: block; font-family: var(--display); font-size: clamp(1.4rem, 2.2vw, 2rem); font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.sys-flow span { display: block; margin-top: .6rem; color: var(--ink-2); font-size: .95rem; max-width: 22ch; }
.sys-note { color: var(--mute); font-size: .95rem; max-width: 40ch; padding-top: 1.25rem; }

/* ===== Limits ===== */
.sys-limits-line { margin-top: 1.25rem; max-width: 30ch; }
.sys-limits .ledger-row h3 { font-weight: 600; }

/* ===== Further reading under the questions ===== */
.sys-reading { margin-top: 2.5rem; }
.sys-reading h3 { font-size: .9rem; font-family: var(--sans); font-weight: 500; letter-spacing: 0; color: var(--mute); }
.sys-reading ul { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: .5rem 2rem; }
.sys-reading a { color: var(--gold); text-decoration: underline; text-underline-offset: .25em; text-decoration-thickness: 1px; }
.sys-reading a:hover { text-decoration-thickness: 2px; }
.faq p a { color: var(--gold); }

/* ===== Closing world: the gold ring, the word centred under it ===== */
.sys-close { border-top: 1px solid var(--line-soft); }
.sys-close-plate { object-position: 50% 50%; }
.sys-close-shade { background: linear-gradient(to top, rgba(10, 11, 13, .88) 0%, rgba(10, 11, 13, .2) 55%, rgba(10, 11, 13, .1) 100%); }
.sys-close-copy { justify-items: center; text-align: center; }
.sys-close-copy .giant { margin-left: calc(-1 * var(--ink-x)); margin-right: calc(-1 * var(--ink-x)); }
.sys-close-copy .scene-actions { justify-content: center; }

/* ===== Tablet ===== */
@media (max-width: 1100px) {
  .sys-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sys-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 0; gap: 3rem 0; }
  .sys-steps li { border-top: 1px solid #a79d8a; }
}
@media (max-width: 900px) {
  .sys-head, .sys-example-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ===== Phone: plain flow, nothing pins ===== */
@media (max-width: 700px) {
  .sys-world { position: relative; height: 100vh; height: 100svh; min-height: 620px; }
  .sys-hero-plate { object-position: 84% 50%; }
  .sys-giant { white-space: nowrap; font-size: clamp(3.2rem, 21vw, 6.5rem); }
  .sys-hero-copy { padding-bottom: 2.5rem; }
  .sys-hero-copy .scene-actions, .sys-alt-copy .scene-actions { flex-direction: column; align-items: stretch; }
  .sys-hero-copy .btn, .sys-alt-copy .btn { justify-content: center; }
  .sys-six { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .sys-list { grid-template-columns: minmax(0, 1fr); }
  .sys-list li { grid-template-columns: 2.5rem minmax(0, 1fr); column-gap: .75rem; padding-bottom: 1.75rem; }
  .sys-list .sys-n { grid-row: 1 / span 2; padding-top: .45rem; }
  .sys-list h3 { font-size: clamp(1.7rem, 8vw, 2.2rem); }
  .sys-steps { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
  .sys-steps h3 { font-size: clamp(2.2rem, 11vw, 2.8rem); margin-top: 1rem; }
  .sys-step-script { font-size: clamp(1.5rem, 7vw, 1.9rem); }
  .sys-flow { grid-template-columns: minmax(0, 1fr); border-left: 1px solid var(--line); margin-left: 3px; }
  .sys-flow li { border-top: 0; padding: 0 0 1.75rem 1.5rem; }
  .sys-flow li::before { top: .55rem; left: -4px; }
  .sys-world-alt { min-height: 560px; min-height: clamp(560px, 88svh, 760px); }
}

/* Reduced motion: no entrance, no drift (systems.js also stands down) */
@media (prefers-reduced-motion: reduce) {
  .sys-hero-copy > * { animation: none; }
}
