/* Homepage only. Fit the default compositions; never bound the height of live text. */
:root {
  --home-editorial-rail:960px;
  --home-fit-room:calc(100vh - var(--mast-anchor,128px));
}
@supports (height:100svh) {
  :root { --home-fit-room:calc(100svh - var(--mast-anchor,128px)); }
}

/* The Café's previous 960px frame is the shared outer rail. Ordinary layouts
   keep the global gutter; narrower media and line lengths are intentional inner sizes. */
body main > :is(#cafe-story,#guide-preview,#how,#from-notes,#on-shift,#reference-library,#learn,#about-hags.has-service-photo,section.hero,section.details,section.closing) {
  padding-inline:max(var(--ed-gutter,6.4%),calc((100% - var(--home-editorial-rail)) / 2));
}
main > section.hero { max-inline-size:none; }

/* The masthead sets root scroll-padding from its measured compact height.
   Do not add a second sticky-header offset on the café or hero anchors. */
#cafe-story {
  --cafe-photo-room:clamp(214px,calc(var(--home-fit-room) - 247px),520px);
  padding-block:clamp(var(--ed-space-2),3svh,var(--ed-space-4));
}
#cafe-story .cafe-story-wrap { max-inline-size:var(--home-editorial-rail); }
#cafe-story .cafe-story-wrap > :is(.cafe-snapshot-tabs,.cafe-context) {
  max-inline-size:calc(var(--cafe-photo-room) * 4 / 3);
  margin-inline:auto;
}
#cafe-story .cafe-story-head {
  margin-block-end:clamp(var(--ed-space-1),1.7svh,var(--ed-space-2));
}
/* Only the active heading contributes layout height, even on desktop. */
#cafe-story .cafe-story-head > .cafe-story-copy { display:none; }
#cafe-choice-photo:checked ~ .cafe-story-head #cafe-story-photo,
#cafe-choice-map:checked ~ .cafe-story-head #cafe-story-map,
#cafe-choice-service:checked ~ .cafe-story-head #cafe-story-service,
#cafe-choice-checklist:checked ~ .cafe-story-head #cafe-story-checklist,
#cafe-choice-library:checked ~ .cafe-story-head #cafe-story-library { display:grid; }
#cafe-story .cafe-story-head h2 {
  font-size:clamp(24px,min(4.1vw,6svh),51px);
  line-height:1.05;
}
#cafe-story .cafe-story-head .eyebrow { margin-block-end:.5em; }
#cafe-story-photo { grid-template-columns:minmax(0,1fr); }
@media(min-width:900px) {
  #cafe-story-photo h2 > span { display:inline; }
}
#cafe-story-photo h2 { text-wrap:balance; }
/* In every state, the photo, trace, hotspots and wipe use the same 4:3 rectangle. */
#cafe-story .cafe-context-scene > img { aspect-ratio:4 / 3;object-fit:contain; }
#cafe-choice-photo:checked ~ .cafe-context .cafe-context-intro {
  padding:clamp(var(--ed-space-2),2.2svh,var(--ed-space-3));
}
#cafe-story .cafe-context-intro h3 { font-size:clamp(20px,3.1svh,32px); }
#cafe-story .cafe-context-intro p { margin-block-start:.4em; }
@media(min-width:701px) {
  #cafe-choice-photo:checked ~ .cafe-context .cafe-context-intro {
    display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);
    column-gap:var(--ed-space-2);align-items:center;
  }
  #cafe-story .cafe-context-intro .cafe-intro-kicker { grid-column:1 / -1;margin-block-start:0; }
  #cafe-story .cafe-context-intro h3 { margin-block:0; }
  #cafe-story .cafe-context-intro h3 + p { margin-block:0; }
}
@media(max-width:700px) {
  #cafe-story { --cafe-photo-room:clamp(184px,calc(var(--home-fit-room) - 220px),375px); }
  #cafe-story .cafe-story-head h2 { font-size:clamp(21px,6.1vw,37px); }
  /* Wrap normally if constrained by height or user zoom. */
  #cafe-story-photo h2 span:nth-child(2) { white-space:normal; }
}
@media(max-height:560px) and (orientation:landscape) {
  #cafe-story { --cafe-photo-room:clamp(205px,calc(var(--home-fit-room) - 202px),330px); }
  #cafe-story .cafe-story-copy { grid-template-columns:minmax(0,1fr);gap:var(--ed-space-1); }
}

/* The landing wordmark reserve remains independent of the hero. Once at the
   hero, shrinking the frame reserves room for controls without scaling text. */
.hero { --hero-art-room:clamp(220px,calc(var(--home-fit-room) - 115px),670px); }
.hero .hero-stage { max-block-size:var(--hero-art-room); }
.hero .hero-stage-device-map { max-inline-size:calc(var(--hero-art-room) * 1.4); }
.hero .hero-stage-device-open { max-inline-size:min(205px,calc(var(--hero-art-room) * .42)); }
.hero .hero-stage-device-library { max-inline-size:calc(var(--hero-art-room) * 1.11); }
@media(max-height:850px) and (min-width:701px) {
  .hero { padding-block:clamp(var(--ed-space-2),3.25svh,var(--ed-space-4)); }
}
@media(max-width:700px) {
  .hero {
    --hero-art-room:clamp(184px,calc(var(--home-fit-room) - 255px),365px);
    padding-block:clamp(var(--ed-space-2),3svh,var(--ed-space-3));
  }
  .hero .hags-hero-product { margin-block-start:var(--ed-space-3); }
  .hero .hero-copy { margin-block-end:0; }
  .hero-stage-picks label { min-block-size:var(--ed-control-target,44px); }
}

/* Compact closed states. Expanded scenarios/tasks keep the original text and grow. */
#guide-preview { padding-block:clamp(var(--ed-space-2),4.4svh,56px); }
#guide-preview .gp-heading { margin-block-end:var(--ed-space-2); }
#guide-preview .gp-eyebrow { margin-block-end:var(--ed-space-1); }
#guide-preview .gp-heading > p { margin-block-start:var(--ed-space-1); }
#guide-preview .shift-scenarios { margin-block-end:var(--ed-space-2); }
#guide-preview .gp-masthead {
  padding-block:var(--ed-space-2);
  padding-inline:clamp(var(--ed-space-2),3vw,28px);
}
#guide-preview .gp-content { padding-block:var(--ed-space-2); }
#guide-preview .gp-deck { margin-block-end:var(--ed-space-2); }
#guide-preview .gp-task label { min-block-size:44px;padding-block:10px;align-items:center; }
#guide-preview .gp-task details { margin-block-end:var(--ed-space-1); }
#guide-preview .gp-task summary { min-block-size:44px;padding-block:10px; }
#guide-preview .gp-progress { padding-block-start:var(--ed-space-1); }
@media(min-width:701px) {
  #guide-preview .shift-scenarios {
    grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--ed-space-1);
  }
  #guide-preview .shift-scenarios > details[data-editorial-disclosure="standard"] {
    border-block-start:1px solid #4d385b55;
  }
  #guide-preview .gp-task {
    display:grid;grid-template-columns:minmax(0,1fr) minmax(0,.7fr);align-items:start;
    column-gap:var(--ed-space-2);
  }
  #guide-preview .gp-task details { margin:0; }
}
@media(max-width:700px) {
  #guide-preview .shift-scenarios { --ed-disclosure-height:44px; }
  #guide-preview .shift-scenarios > details > summary { padding-block:var(--ed-space-1); }
  #guide-preview .gp-masthead { display:flex; }
  #guide-preview .gp-masthead > span { margin:0;text-align:end; }
  #guide-preview .gp-stages > button { min-block-size:44px; }
  #guide-preview .gp-content { padding-block:var(--ed-space-2) var(--ed-space-1); }
}

/* Photo and checklist now read as one composition on wide screens. The phone
   is scaled proportionally, including all of its screen imagery. */
#on-shift {
  --shift-phone-room:clamp(230px,calc(var(--home-fit-room) - 340px),390px);
  padding-block:clamp(var(--ed-space-2),4.4svh,56px);
}
#on-shift .marketing-intro .eyebrow { margin-block-end:var(--ed-space-1); }
#on-shift .shift-proof-open > img {
  inline-size:min(100%,calc(var(--shift-phone-room) * 650 / 1312));
  block-size:auto;
}
@media(min-width:900px) {
  #on-shift > [data-editorial-photo-panel] {
    display:grid;grid-template-columns:minmax(0,.88fr) minmax(0,1.12fr);
    align-items:center;background:var(--hags-indigo-soft,#e9e3ef);
  }
  #on-shift [data-editorial-photo-panel] > .on-shift-field-photo > img {
    aspect-ratio:3 / 2;
  }
  #on-shift [data-editorial-photo-panel] > .shift-proof-card {
    padding:clamp(var(--ed-space-2),2.3vw,var(--ed-space-4));
    column-gap:var(--ed-space-2);
  }
}
@media(max-width:899px) {
  #on-shift [data-editorial-photo-panel] > .on-shift-field-photo > img { aspect-ratio:2.5; }
}
@media(max-width:700px) {
  #on-shift { --shift-phone-room:clamp(188px,calc(var(--home-fit-room) - 365px),285px); }
  #on-shift .shift-proof-card h3 { font-size:clamp(21px,5.4vw,30px); }
}
@media(min-width:345px) and (max-width:700px) {
  #on-shift [data-editorial-photo-panel] > .shift-proof-card {
    grid-template-columns:minmax(0,1.35fr) minmax(0,1fr);gap:var(--ed-space-1);
  }
}

/* Smaller decorative marker; the entire native summary retains its tap area. */
main [data-editorial-disclosure-stack] details[data-editorial-disclosure="standard"] > summary > .editorial-disclosure-mark {
  inline-size:20px;
  block-size:20px;
}
main [data-editorial-disclosure-stack] .editorial-disclosure-mark::before,
main [data-editorial-disclosure-stack] .editorial-disclosure-mark::after {
  width:12px;
}

/* Two semantic desktop lines. Leaving normal wrap enabled lets text zoom
   create extra lines instead of truncating the pitch. */
@media(min-width:900px) {
  body main .closing.section > .closing-pitch {
    max-inline-size:none;
    font-size:clamp(1.7rem,3vw,2.2rem);
  }
  .closing.section > .closing-pitch > span { display:block; }
}

/* Documentary photography: one 1px edge per boundary; a shared exterior
   frame owns abutting edges. UI mockups and trace layers keep their art. */
main { --home-photo-edge-dark:#4d385b80; --home-photo-edge-light:#faf8fc99; }
main .hero-stage[data-editorial-photo-panel="composition"],
main #cafe-story .cafe-context,
main :is(#how,#on-shift,#learn) [data-editorial-photo-panel] {
  border-color:var(--home-photo-edge-dark);
}
main #cafe-story .cafe-context-scene::after { content:""; position:absolute; inset:auto 0 0; border-block-end:1px solid var(--home-photo-edge-dark); z-index:2; pointer-events:none; }
main :is(#how,#learn,#on-shift) [data-editorial-photo-panel] > [data-editorial-frame] > img {
  border-block-end:1px solid var(--home-photo-edge-dark);
}
@media(min-width:900px) {
  main #on-shift [data-editorial-photo-panel] > .on-shift-field-photo > img {
    border-block-start:1px solid var(--home-photo-edge-dark);
    border-inline-end:1px solid var(--home-photo-edge-dark);
  }
}
main #about-hags .editorial-service-photo > img {
  border:1px solid var(--home-photo-edge-light);
}

/* Desktop Juniper stage: use the whole editorial rail, with one media/reading seam.
   The still and its trace/wipe share one 4:3 photo rectangle; selected panels are unchanged. */
@media(min-width:900px) {
  #cafe-story #cafe-choice-photo:checked ~ :is(.cafe-snapshot-tabs,.cafe-context) {
    max-inline-size:none;
  }
  #cafe-story #cafe-choice-photo:checked ~ .cafe-context {
    --cafe-photo-track:clamp(55%,calc(var(--cafe-photo-room) * 4 / 3),67%);
    grid-template-columns:minmax(0,var(--cafe-photo-track)) minmax(0,1fr);
    align-items:stretch;
  }
  #cafe-story #cafe-choice-photo:checked ~ .cafe-context .cafe-context-scene {
    grid-area:1 / 1;
    align-self:start;
  }
  #cafe-story #cafe-choice-photo:checked ~ .cafe-context .cafe-context-scene > img {
    inline-size:100%;
    block-size:auto;
    aspect-ratio:4 / 3;
    object-fit:contain;
  }
  #cafe-choice-photo:checked ~ .cafe-context .cafe-context-intro {
    grid-area:1 / 2;
    display:grid;
    grid-template-columns:minmax(0,1fr);
    align-self:stretch;
    align-content:center;
    gap:var(--ed-space-2);
    padding:clamp(var(--ed-space-3),3vw,44px);
    border-inline-start:1px solid var(--ed-photo-stroke,#4d385b);
  }
  #cafe-story #cafe-choice-photo:checked ~ .cafe-context .cafe-context-intro .cafe-intro-kicker,
  #cafe-story #cafe-choice-photo:checked ~ .cafe-context .cafe-context-intro :is(h3,p) { margin:0; }
  #cafe-story #cafe-choice-photo:checked ~ .cafe-context .cafe-context-intro h3 {
    font-size:clamp(24px,2.55vw,36px);
    line-height:1.12;
    text-wrap:balance;
  }
  #cafe-choice-photo:checked ~ .cafe-context .cafe-context-scene::after { display:none; }
}

/* One external frame for each photo and its related controls/content. */
.hero .hero-stage-field {
  outline:1px solid var(--ed-segment-line,#baa8c3);
  --ed-segment-line:#baa8c3;
}
.hero .hero-stage-field > :is(.hero-stage,.hero-stage-picks) {
  box-sizing:border-box;
  inline-size:100%;
  max-inline-size:none;
  margin:0;
  border:0;
}
#cafe-story .cafe-story-wrap {
  --cafe-compound-max:calc(var(--cafe-photo-room) * 4 / 3);
  display:grid;
  grid-template-columns:minmax(0,1fr);
}
#cafe-story .cafe-story-head { grid-area:1 / 1; }
#cafe-story .cafe-snapshot-tabs { grid-area:2 / 1; }
#cafe-story .cafe-context { grid-area:3 / 1; }
#cafe-story .cafe-story-wrap::after {
  content:"";
  grid-area:2 / 1 / 4;
  inline-size:100%;
  max-inline-size:var(--cafe-compound-max);
  justify-self:center;
  outline:1px solid var(--ed-segment-line,#baa8c3);
  outline-offset:-1px;
  z-index:6;
  pointer-events:none;
}
#cafe-story .cafe-story-wrap > :is(.cafe-snapshot-tabs,.cafe-context) {
  inline-size:100%;
  max-inline-size:var(--cafe-compound-max);
  margin-block:0;
  border:0;
}
#cafe-story .cafe-context-scene::after { display:none; }
#cafe-story #cafe-choice-photo:checked ~ .cafe-context .cafe-context-intro { border:0; }
@media(min-width:900px) {
  #cafe-story .cafe-story-wrap:has(> #cafe-choice-photo:checked) { --cafe-compound-max:100%; }
  #on-shift > [data-editorial-photo-panel] { align-items:stretch; }
  #on-shift [data-editorial-photo-panel] > .on-shift-field-photo {
    position:relative;
    min-inline-size:0;
  }
  #on-shift [data-editorial-photo-panel] > .on-shift-field-photo > img {
    position:absolute;inset:0;
    inline-size:100%;block-size:100%;
    aspect-ratio:auto;object-fit:cover;
  }
}
@media(max-width:899px) {
  #on-shift [data-editorial-photo-panel] > .on-shift-field-photo > img {
    inline-size:100%;max-inline-size:none;
  }
}
main :is(#how,#learn,#on-shift,#about-hags) [data-editorial-photo-panel] > [data-editorial-frame] > img {
  border:0;
}
#learn [data-editorial-photo-panel] > .marketing-learn-detail { border-block-start:0; }
/* Replace earlier per-section tint overrides now that the perimeter owns the edge. */
main :is(#how,#learn,#on-shift,#about-hags) [data-editorial-photo-panel] {
  border-color:var(--ed-photo-stroke);
}

/* Five equal horizontal spaces: both edge gaps and the gaps between
   the four natural-width icon + label groups. Wrap only as a zoom fallback. */
#cafe-story .cafe-snapshot-tabs {
  display:flex;
  flex-wrap:wrap;
  justify-content:space-evenly;
  gap:0;
  padding:0;
}
#cafe-story .cafe-snapshot-tabs > label {
  display:inline-flex;
  flex:0 1 auto;
  inline-size:max-content;
  max-inline-size:100%;
  min-inline-size:0;
  min-block-size:44px;
  align-items:center;
  justify-content:center;
  gap:clamp(3px,.9vw,6px);
  padding:4px 0;
  border:0;
  text-align:start;
}
#cafe-story .cafe-snapshot-tabs > label > span {
  min-inline-size:0;
  white-space:normal;
  overflow-wrap:anywhere;
}
