/*
 * Full-screen reading rhythm and wide-display refinement.
 * Loaded after every component stylesheet so this file owns page-level rhythm.
 */

:root {
  --section-space: clamp(56px, 8svh, 104px);
  --layout-gap: clamp(32px, 3.6vw, 88px);
  --heading-gap: clamp(32px, 5svh, 64px);
  --copy-gap: clamp(20px, 2.6svh, 32px);
}

/* The chip screen sizes itself from its stage (container units); only the body
   copy beside it still follows the reading scale below. */
@media screen and (min-width: 651px) {
  .hardware-journey .body { font-size: var(--type-body); }
}

/* Every editorial chapter owns at least one full screen; on desktop each is
   exactly one viewport. Long scroll-driven stories keep natural height. */
:is(
  #reviews,
  #creator-reviews,
  #experience,
  #storage,
  #getting-started,
  #models,
  #questions,
  #aios-agents,
  #aios-create
) {
  min-height: 100svh;
  display: grid;
  align-items: center;
}
@media screen and (min-width: 801px) {
  html {
    scroll-padding-top: 0;
  }
  :is(
    #top,
    #beyond,
    #hardware,
    #reviews,
    #creator-reviews,
    #experience,
    #storage,
    .aios-open,
    #aios-agents,
    #aios-create,
    #getting-started,
    #models,
    #questions,
    #contact
  ) {
    scroll-snap-align: start;
  }
}
@media screen and (max-height: 879px) {
  #experience { padding-block: clamp(24px, 5svh, 40px); }
}
@media screen and (min-width: 801px) and (max-width: 900px) {
  #creator-reviews { padding-block: clamp(24px, 4svh, 40px); }
}

/* The AIOS chapter opener and its first capability share one screen. */
#tools > .shell { padding-top: 0; }
.aios-open {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
  padding-block: 24px 22px;
}
#tools .aios-intro {
  padding-block: 0 clamp(56px, 9.2svh, 96px);
  align-items: end;
}
#aios-models {
  min-height: 0;
  padding-block: clamp(56px, 8.6svh, 88px) 0;
  border-top: 1px solid var(--dark-line);
}
:is(#aios-agents, #aios-create) {
  min-height: 100svh;
  padding-block: clamp(56px, 7svh, 88px);
}

/* The hardware lead-in owns exactly one screen; the pinned journey is a
   separate stop, so no part of the model peeks into the intro. */
@media screen and (min-width: 801px) and (min-height: 700px) {
  #hardware { padding-top: 0; }
  #hardware .hardware-intro {
    height: 100vh;
    height: 100svh;
    min-height: 0;
    margin-bottom: 0;
  }
}
@media screen and (min-width: 801px) {
  .hardware-journey { scroll-snap-align: start; }

  /* The lead-in is a full screen; let the film and headline take the room
     instead of parking a 1280px island in the middle of a wide window. */
  .hardware-intro {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
    gap: var(--layout-gap);
  }
  .hardware-intro-copy h2 {
    font-size: clamp(3.25rem, 1rem + min(4vw, 8svh), 7rem);
  }
  .hardware-intro-lead {
    font-size: clamp(1.375rem, 1rem + min(.9vw, 1.4svh), 1.8rem);
  }
  .assembly-film { width: min(100%, 78svh, 760px); }
}
@media screen and (min-width: 801px) and (max-height: 699px) {
  .assembly-film { width: min(100%, 62svh, 560px); }
}

/* Keep paired editorial material on one optical baseline. */
.demo-wall { align-items: stretch; }
.demo-tile { display: flex; flex-direction: column; }
.demo-tile-media { flex: none; }
.demo-tile-copy { flex: 1; }
/* Content-led spacing: headings breathe before media, while paired data stays
   aligned inside its own chapter. */
.section-heading {
  margin-bottom: clamp(40px, 6svh, 72px);
}
.demo-tile-copy {
  gap: var(--copy-gap);
  padding-top: clamp(28px, 3svh, 40px);
}
.press-heading {
  margin-bottom: clamp(40px, 6svh, 72px);
}

/* Paired storage media and specifications share one hard bottom edge. */
@media screen and (min-width: 961px) {
  .storage-video { aspect-ratio: 4 / 3; }
  .storage-figure { align-self: end; }
}
@media screen and (min-width: 801px) {
  .press-story {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
    align-items: center;
  }
}

/* Keep the authored Hermes and ComfyUI proportions as they scale. */
@media screen and (min-width: 801px) {
  #aios-agents .hc,
  #aios-create .cf-stage {
    height: auto;
  }
  #aios-create .cf-stage { aspect-ratio: 16 / 10; }
}

/* Desktop chapters fill their screen from the height they are given. Fixed
   460px media and 27rem copy were sized for a 1600px window; laptops below
   that showed a thumbnail beside a full page of margin. */
@media screen and (min-width: 1200px) and (min-height: 640px) {
  .storage-title,
  .storage-giant { grid-column: 1 / 6; }
  .storage-figure { grid-column: 6 / 13; }
  .storage-video { aspect-ratio: 16 / 9; }
  .storage-figure { width: min(100%, calc(min(54svh, 720px) * 16 / 9)); }
  .storage-giant { font-size: clamp(8rem, min(17vw, 29svh), 19rem); }
  .storage-specs dd { font-size: clamp(1.4rem, 1.5vw, 2.1rem); }
  .storage-stage { gap: clamp(36px, 5.5svh, 64px); }

  #aios-agents .aios-feature { grid-template-columns: minmax(0, 1.22fr) minmax(0, .78fr); }
  #aios-create .aios-feature { grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); }
  #aios-create .cf-stage { width: min(100%, calc(min(68svh, 780px) * 1.6)); }
  #aios-create .aios-copy h3,
  #aios-agents .aios-copy h3,
  #aios-models .aios-copy h3 {
    font-size: clamp(2.5rem, 1.1rem + min(2.4vw, 4svh), 4rem);
  }
  .aios-copy > p {
    font-size: clamp(1.25rem, .95rem + min(.55vw, 1.1svh), 1.6rem);
  }

  .faq-stack { grid-auto-rows: minmax(clamp(112px, 15svh, 160px), auto); }
  .faq-item > summary {
    grid-template-columns: 64px 7px minmax(0, 1fr) auto;
    font-size: clamp(20px, 1.05rem + .55vw, 26px);
  }
  .faq-item > .faq-answer { max-width: 46ch; }
  .faq-count { font-size: clamp(160px, 14vw, 240px); }
  .faq-lead { max-width: 30ch; }

  .creator-review-card--lead .creator-review-thumb { min-height: 0; }

  #getting-started .demo {
    width: 100%;
    max-width: calc(min(58svh, 1000px) * 5 / 3);
    justify-self: end;
  }

  .models .model-card { padding: clamp(20px, 1.8vw, 28px); }
  .models .model-specs b,
  .models .model-specs span,
  .models .model-specs .model-spec-label {
    font-size: clamp(.8125rem, .75rem + .2vw, .9375rem);
  }
}








/* Tablet/phone: full-height where it fits, natural height where content needs room. */
@media screen and (max-width: 800px) {
  :root { --section-space: clamp(40px, 5.8svh, 64px); }
  #tools .aios-intro { align-items: center; }
  #aios-agents .hc,
  #aios-create .cf-stage { height: auto; }
  #aios-create .cf-stage { aspect-ratio: 4 / 3; }
}

/* Wide displays use extra room for scale and proportion, not just wider gutters. */
@media screen and (min-width: 1600px) {
  :root {
    --gutter: clamp(64px, 4vw, 144px);
    /* Type tokens keep the fluid curve from :root; only the room they sit in
       grows here, so crossing 1600px is no longer a step change. */
    --type-scene: clamp(4rem, min(4vw, 10svh), 7.5rem);
  }

  .story-intro-copy { width: min(1400px, 52vw); }
  .story-intro h1 { font-size: clamp(192px, min(8.5vw, 25svh), 240px); }
  .story-why { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .story-why-copy { max-width: 44ch; }
  .story-world-copy { max-width: min(44ch, 48vw); }
  .story-result-copy { width: min(44ch, calc(100% - var(--edge) * 2)); }
  .story-why-image { max-width: 1200px; }

  .aios-intro,
  .aios-feature,
  .aios-task-layout {
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    column-gap: var(--layout-gap);
  }
  .aios-intro > div:last-child > p,
  .aios-copy > p:not(.aios-memory),
  .aios-steps li { font-size: var(--type-lead); }
  .aios-steps li { grid-template-columns: 2ch minmax(0, 1fr); column-gap: .75em; }
  .aios-memory strong { font-size: var(--type-lead); }

  .press-story { grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); }
  .press-photo img { max-height: 62svh; object-fit: contain; }
  .press-tab-name { font-size: var(--type-lead); }
  .press-publication { font-size: var(--type-subhead); }
  .press-quote p { font-size: clamp(1.5rem, min(1.9vw, 3.2svh), 2.5rem); }

  .storage-specs dd { font-size: clamp(1.6rem, 1.4vw, 2rem); }
  .button { font-size: var(--type-detail); }
  .site-footer { font-size: clamp(.9375rem, .89rem + .08vw, 1rem); }
  .model-grid { column-gap: var(--layout-gap); }
  .models .model-card { padding: clamp(32px, 1.9vw, 56px); }
  .models .model-memory { min-height: clamp(82px, 6vw, 108px); }
  .models .model-memory-value { font-size: clamp(3rem, 2.7vw, 4.5rem); }
  .models .model-memory b,
  .models .model-memory span,
  .models .model-specs b,
  .models .model-specs span,
  .models .model-specs .model-spec-label { font-size: clamp(.875rem, .75rem + .18vw, 1rem); }
  .models .model-card .button { min-height: 52px; font-size: var(--type-detail); }
  .box-strip > img { width: min(100%, clamp(400px, 23vw, 720px)); }

  :is(.hardware-pending, .hardware-enhanced) .copy {
    height: calc(var(--type-subhead) + 5em + 32px);
    bottom: clamp(32px, 4svh, 80px);
  }
  .chapter-product-note { width: clamp(300px, 20vw, 600px); }
  .chapter-product-note h2 { font-size: var(--type-body); }
  .chapter-product-note p { font-size: var(--type-detail); }
  .chapter-product-note strong { font-size: var(--type-subhead); }
}


/* Wide but shallow windows need reading space, not compressed chapter handoffs. */
@media screen and (min-width: 1600px) and (max-height: 800px) {
  :root {
    --section-space: clamp(48px, 9svh, 80px);
    --heading-gap: clamp(28px, 5svh, 40px);
    --copy-gap: clamp(18px, 2.8svh, 24px);
  }
  .hardware-journey .body { font-size: 20px; }
  .hardware-journey .qualifier { font-size: 16px; }
  :is(.hardware-pending, .hardware-enhanced) .copy { height: 184px; bottom: 24px; }
}

/* Laptop-height desktop windows still need a clear handoff into hardware when
   the lead-in cannot own a full screen. */
@media screen and (min-width: 801px) and (max-height: 699px) {
  #hardware { padding-top: clamp(56px, 10svh, 88px); }
}

/* Compact only the configuration chapter on short desktop screens. */
/* Keep configuration compact on short desktop screens without compressing
   every other chapter on the page. */
@media screen and (min-width: 801px) and (max-height: 880px) {
  #models {
    --section-space: clamp(16px, 2.4svh, 26px);
    --heading-gap: 24px;
    --copy-gap: 16px;
  }
  .models .model-card { padding: clamp(20px, 1.7vw, 26px); }
  .models .model-heading { margin-bottom: clamp(18px, 2.6svh, 28px); }
  .models .model-purpose { margin-top: 8px; }
  .models .model-memory { min-height: 64px; padding-block: 8px 10px; }
  .models .model-specs li { padding-block: 3px; }
  .models .model-card .button { margin-top: 10px; }
}
/* Short wide screens use the readable fallback: separate full-bleed scenes so
   the next chapter does not arrive as an accidental crop of the previous one. */
@media screen and (min-width: 801px) and (max-height: 599px) {
  .life-showcase {
    padding-block: clamp(32px, 8svh, 64px);
  }
  .life-showcase-sticky {
    display: grid;
    gap: clamp(32px, 8svh, 64px);
    min-height: 0;
  }
  .life-panel {
    min-height: clamp(460px, 118svh, 620px);
  }
}

/* 4K and larger: raise the reading scale and media ceiling deliberately. */
@media screen and (min-width: 2800px) and (min-height: 1400px) {
  :root {
    --shell: 2240px;
    --bleed-shell: 2800px;
    --gutter: clamp(80px, 4vw, 160px);
    --type-body: 1.5rem;
    --type-detail: 1.25rem;
    --type-lead: 2rem;
    --type-section: 8rem;
    --type-subhead: 5.5rem;
    --section-space: 120px;
    --layout-gap: 96px;
    --heading-gap: 64px;
    --copy-gap: 32px;
  }
  .story-intro h1 { font-size: clamp(240px, 8vw, 320px); }
  .models .model-card { padding: 56px; }
  .models .model-memory { min-height: 120px; }
  .models .model-memory-value { font-size: 5.5rem; }
  .models .model-memory b,
  .models .model-memory span,
  .models .model-specs b,
  .models .model-specs span,
  .models .model-specs .model-spec-label { font-size: 1.125rem; }
  .models .model-specs li { padding-block: 9px; }
  .models .model-card .button { min-height: 60px; }
  .press-quote p { font-size: 2.5rem; }
  #aios-create .cf-stage { height: 1100px; }
  #getting-started .aios-task-tabs button,
  #getting-started .step-list { font-size: 1.25rem; }
}

/* Full-screen chapters size their lead visual from the room the viewport
   gives them, so a 1440p or 4K display fills the screen instead of centering
   a small island. Kept last so it beats the component defaults. */
@media screen and (min-width: 1200px) and (min-height: 640px) {
  .storage-figure { width: min(100%, calc(min(54svh, 720px) * 16 / 9)); }
  .storage-giant { font-size: clamp(8rem, min(17vw, 29svh), 19rem); }
  #aios-create .cf-stage { width: min(100%, calc(min(68svh, 780px) * 1.6)); }
}

/* Wide screens at laptop height need their margins back: the enlarged cards
   would otherwise push the configuration chapter past one screen. */
@media screen and (min-width: 1600px) and (min-height: 641px) and (max-height: 940px) {
  #models {
    --section-space: clamp(40px, 5svh, 56px);
    --heading-gap: 28px;
  }
}

/* Wide screens give the capability plates the larger share of the pair so the
   visual can fill a 1440p chapter instead of stranding half a screen. */
@media screen and (min-width: 1600px) and (min-height: 640px) {
  #aios-create .aios-feature { grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); }
  #aios-agents .aios-feature { grid-template-columns: minmax(0, 1.22fr) minmax(0, .78fr); }
  .faq-stack { grid-auto-rows: minmax(clamp(120px, 16svh, 168px), auto); }
}

@media screen and (min-width: 1200px) and (max-height: 800px) {
  #models {
    --section-space: clamp(12px, 2svh, 20px);
    --heading-gap: 14px;
  }
  .models .model-heading { margin-bottom: 14px; }
  .models .model-card { padding: 18px; }
  .models .model-purpose { margin-top: 8px; }
  .models .model-memory { min-height: 56px; padding-block: 6px 8px; }
  .models .model-specs li { padding-block: 2px; }
  .models .model-card .button { margin-top: 10px; }
}
