/* The same working window stays in place from the prepared request to the receipt. */
body.session-page {
  --native-max-inset: env(safe-area-max-inset-bottom, unavailable);
  --workspace-safe-top: max(var(--resting-safe-top, var(--safe-top)), env(safe-area-max-inset-top, 0px));
  --workspace-safe-bottom: max(var(--resting-safe-bottom, var(--safe-bottom)), env(safe-area-max-inset-bottom, 0px));
  --landing-width: 1640px;
  --landing-gutter: var(--masthead-gutter);
  --landing-gap: clamp(18px, 2.8svh, 34px);
  color: var(--brand-ink);
}

.session-page #main {
  width: min(calc(100% - 2 * var(--landing-gutter)), var(--landing-width));
  margin-inline: auto;

  position: relative;
  isolation: isolate;
  display: grid;
  grid-template: auto minmax(0, 1fr) / minmax(0, 1fr);
  gap: var(--landing-gap);
  padding-block: clamp(12px, 2.1svh, 26px) clamp(18px, 2.8svh, 35px);
}
.session-page #main::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 1.5% calc(-.8 * var(--landing-gutter)) 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 64% 58% at 100% 55%, #cfdfef 0%, transparent 85%),
    radial-gradient(ellipse 75% 48% at 12% 81%, #d7e3e6 0%, transparent 80%),
    linear-gradient(150deg, var(--page-surface) 12%, #f4f5f8 63%, #e5ecf3);
  mask-image:
    linear-gradient(90deg, transparent, #000 16% 88%, transparent),
    linear-gradient(180deg, transparent 12%, #000 46% 78%, transparent);
  mask-composite: intersect;
}
.landing-intro { min-width: 0; }
.landing-intro h1 {
  max-width: 100%;
  color: var(--brand-ink);
  margin: 0;
  font: 485 clamp(2.9rem, min(4.6vw, 7.2svh), 5.5rem)/.99 var(--identity-type);
  letter-spacing: -.048em;
  text-wrap: balance;
}
.landing-intro > p {
  max-width: 33ch;
  margin-block: clamp(17px, 2.3vw, 32px) clamp(20px, 2.5vw, 34px);
  color: #49515b;
  font: 425 clamp(1rem, 1.18vw, 1.16rem)/1.43 var(--identity-type);
  letter-spacing: -.023em;
  text-wrap: pretty;
}
.landing-action {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: .85em;
  padding: .72em 1.1em;
  border-radius: 100px;
  color: #fff;
  background: var(--brand-ink);
  font: 590 .91rem/1.1 var(--identity-type);
  letter-spacing: -.019em;
  text-decoration: none;
}
.landing-action:hover { background: var(--brand-action); }
.landing-action:focus-visible {
  outline: 2px solid var(--brand-action);
  outline-offset: 3px;
}
.landing-action .handset-action { display: none; }
.landing-actions { display: flex; align-items: center; gap: clamp(12px, 1.5vw, 22px); }
#examples { position: relative; z-index: 8; color: var(--brand-ink); font-family: var(--identity-type); }
#examples summary {
  display: flex; align-items: center; gap: 7px; min-height: 36px;
  font-weight: 520; font-size: .87rem; cursor: pointer; list-style: none;
}
#examples summary::-webkit-details-marker { display: none; }
#examples summary::after {
  content: ""; width: 5px; height: 5px; border: solid currentColor;
  border-width: 0 1.4px 1.4px 0; transform: translateY(-2px) rotate(45deg);
}
#examples[open] summary::after { transform: translateY(1px) rotate(-135deg); }
#examples nav {
  position: absolute; z-index: 9; inset: calc(100% + 3px) 0 auto auto;
  min-width: 180px; padding: 4px; border: 1px solid #c4cdd5; border-radius: 12px;
  background: #fbfcfd; box-shadow: 0 6px 22px rgb(29 44 62 / 14%);
}
#examples a { display: block; padding: 8px 12px; border-radius: 8px; color: inherit; font-size: .9rem; font-weight: 550; text-decoration: none; }
#examples a[aria-current] { background: #e8edf2; }
#examples a:hover { background: #dee6ed; }
#examples small { display: block; margin-top: 2px; color: var(--reader-soft); font-size: .77rem; font-weight: 450; }
#examples :is(summary, a):focus-visible { outline: 2px solid var(--brand-action); outline-offset: 2px; }
#session[data-window="normal"] {
  --glass-edge: 4px;
  height: 100%;
  min-width: 0;
  background: transparent;
}
/* The window rim sits over a stationary gradient, so it needs no live backdrop filter. */
#session[data-window="normal"]::before,
#session[data-window="normal"]::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}
#session[data-window="normal"]::before {
  inset: calc(-1 * var(--glass-edge));
  border: 1px solid rgb(172 189 201 / 44%);
  border-radius: calc(12px + var(--glass-edge));
  background: linear-gradient(146deg, #ffffffd9, #edf2f7c2 49%, #c6d6e2c4);
  box-shadow: inset 0 1px 0 #fff, 0 12px 29px -20px #2d465d66;
}
#session[data-window="normal"]::after {
  inset: calc(3px - var(--glass-edge));
  border-radius: calc(9px + var(--glass-edge));
  border-block: 1px solid rgb(255 255 255 / 65%);
}
#session[data-window="normal"] .workbench {
  width: 100%;
  max-width: none;
  height: 100%;
  padding: 0;
}
#session[data-window="fullscreen"] { background: #fff; }
#session:is([data-window="closed"],[data-window="minimized"]) {
  align-self: center;
  background: transparent;
}
.landing-fallback {
  min-width: 0;
  color: var(--brand-ink);
  font: 400 1rem/1.45 Barlow, sans-serif;
}
.landing-fallback img { display: block; width: 100%; height: auto; border: 1px solid var(--brand-rule); }
.landing-fallback p { margin-top: 12px; }
.landing-fallback a { color: var(--brand-action); }

@media (min-width: 851px) and (min-height: 501px),
       (min-width: 951px) and (max-height: 500px),
       (min-width: 761px) and (max-width: 850px) and (orientation: landscape) and (min-height: 501px) {
  .session-page #main {
    height: clamp(560px, calc(100svh - var(--header) - var(--safe-top) - var(--safe-bottom)), 1100px);
  }
  .landing-intro {
    display: grid;
    grid-template: auto auto / minmax(0, 1fr) minmax(240px, 28%);
    align-content: center;
    align-items: start;
    column-gap: clamp(28px, 5.4vw, 90px);
    row-gap: 12px;
  }
  .landing-intro h1 { grid-row: 1 / 3; align-self: center; }
  .landing-intro h1 span { display: block; }
  .landing-intro > p { margin: 0; max-width: 36ch; align-self: end; }
  .landing-action { justify-self: start; min-height: 38px; padding: .72em 1.25em; }
  #session[data-window="normal"] .working-area { --panel-track: clamp(248px, 27%, 360px); }
}

@media (max-width: 760px), (max-width: 850px) and (orientation: portrait) {
  body.session-page {
    --landing-gap: clamp(14px, 2.2svh, 24px);
    padding-top: var(--workspace-safe-top);
  }
  .session-page #main {
    /* The intro sits above the fold and the browser below it gets nearly a full screen of
       its own, so the sample's conversation and its decision card fit together. */
    grid-template: auto auto / minmax(0, 1fr);
    height: auto;
    min-height: min-content;
    align-items: stretch;
    row-gap: var(--landing-gap);
    padding-block: clamp(13px, 2.2svh, 23px) max(8px, var(--workspace-safe-bottom));
  }
  .landing-intro h1 {
    max-width: 16ch;
    font-size: clamp(2.15rem, 9.7vw, 3.8rem);
    line-height: 1;
  }
  .landing-intro > p {
    max-width: 47ch;
    margin-block: 10px 13px;
    font-size: clamp(.94rem, 3.7vw, 1.13rem);
    line-height: 1.35;
  }
  .landing-action { min-height: 36px; padding: .62em .85em; font-size: .82rem; }
  .landing-action .desktop-action { display: none; }
  .landing-action .handset-action { display: inline; }
  /* svh, not dvh: the frame keeps its size when Safari's toolbars move during scroll. */
  #session[data-window="normal"] {
    height: clamp(540px, calc(100svh - var(--header) - var(--workspace-safe-top) - 16px), 860px);
    min-height: 0;
    margin-inline: calc(7px - var(--landing-gutter));
  }
  #session[data-window="normal"]::before,
  #session[data-window="normal"]::after { display: none; }
  #session[data-window="normal"] .browser-window {
    border: 1px solid #aebac6;
    border-radius: 13px;
    box-shadow: 0 1px 2px rgb(33 51 69 / 9%), 0 5px 18px -14px rgb(33 51 69 / 24%);
  }
  .session-page #main::before {
    inset: 0 calc(-.7 * var(--landing-gutter));
    mask-image:
      linear-gradient(90deg, transparent, #000 10% 90%, transparent),
      linear-gradient(180deg, transparent 15%, #000 46% 86%, transparent);
  }
}
@media (max-width: 760px) and (max-height: 650px) and (orientation: portrait) {
  .session-page #main { row-gap: 12px; padding-block-start: 12px; }
  .landing-intro h1 { max-width: none; font-size: clamp(1.83rem, 8.8vw, 2.35rem); }
  .landing-intro > p { margin-block: 7px 8px; font-size: .9rem; line-height: 1.27; }
  .landing-action { min-height: 32px; }
}

/* In a shallow viewport the text stays beside the phone browser. */
@media (max-width: 950px) and (max-height: 500px) and (orientation: landscape) {
  body.session-page {
    --landing-gap: clamp(14px, 2.7vw, 24px);
    padding-top: var(--workspace-safe-top);
  }
  .session-page #main {
    grid-template: minmax(0, 1fr) / minmax(0, .32fr) minmax(0, .68fr);
    height: calc(100svh - var(--header) - var(--workspace-safe-top));
    min-height: min-content;
    align-items: center;
    gap: var(--landing-gap);
    padding-block: 9px max(8px, var(--workspace-safe-bottom));
  }
  #examples nav { top: auto; bottom: calc(100% + 3px); }
  .landing-intro h1 { max-width: 12ch; font-size: clamp(1.87rem, 4.05vw, 2.8rem); }
  .landing-intro > p {
    max-width: 36ch;
    margin-block: 10px;
    font-size: clamp(.8rem, 1.65vw, .94rem);
    line-height: 1.27;
  }
  .landing-action { min-height: 31px; padding: .55em .65em; font-size: .76rem; gap: .45em; }
  .landing-action .desktop-action { display: none; }
  .landing-action .handset-action { display: inline; }
  #session[data-window="normal"] { height: 100%; margin-inline: 0; }
}
@media (max-width: 620px) and (max-height: 500px) and (orientation: landscape) {
  .landing-intro h1 { font-size: clamp(1.62rem, 4.6vw, 1.8rem); }
  .landing-action .store-browser { display: none; }
}
@media (prefers-reduced-transparency: reduce), (forced-colors: active), print {
  .session-page #main::before,
  #session[data-window="normal"]::before,
  #session[data-window="normal"]::after {
    display: none;
  }
}
