/* The landing page: the browser window is the screen. A Mac's notch hangs from its top edge and does
   what the app's does (site.js); under it, a few lines. Every colour, length, font and spring is a
   token of the app's base.css, which the build puts beside this file. No glass, no backdrop: the
   notch is the one object on the page, black on the page's light ground (the page is light only:
   data-theme="light" on <html>). */

/* ---------- one screen: the notch at its top edge, the words at its bottom ---------- */
.screen {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100svh;
  padding: calc(var(--control) * 15) var(--space-6) var(--space-5);
}
.stage {
  position: absolute;
  inset: 0 0 auto;
  --notch-w: calc(var(--control) * 6.5);
  --notch-h: calc(var(--control) + var(--space-1));
  --wing: calc(var(--control) * 3);
  display: flex;
  justify-content: center;
  height: calc(var(--control) * 14.5);
  overflow: hidden;
}

/* The island's size as drawn, animated by the browser: each springs on its own, so it grows like a
   drop, down first and then out (the app's dock.css). */
@property --island-w { syntax: "<length>"; inherits: false; initial-value: 0; }
@property --island-h { syntax: "<length>"; inherits: false; initial-value: 0; }

/* One box as large as the chat, its largest state; what is seen of it is its clip, hanging from the
   top centre. */
.island {
  position: relative;
  flex: none;
  width: calc(var(--control) * 23);
  height: calc(var(--control) * 14);
  margin: 0;
  background: var(--notch);
  --island-w: var(--notch-w);
  --island-h: var(--notch-h);
  clip-path: inset(0 calc((100% - var(--island-w)) / 2) calc(100% - var(--island-h)) calc((100% - var(--island-w)) / 2) round 0 0 min(var(--island-h) / 2, var(--radius-l)) min(var(--island-h) / 2, var(--radius-l)));
  /* Gathering back into the notch: it rises first and narrows a moment later, on the soft spring. */
  transition: --island-h var(--dur-soft) var(--ease-soft), --island-w var(--dur-soft) var(--ease-soft) calc(var(--lag) * 1.5);
  transform-origin: 50% 0;
}
/* Growing: down first, out a moment later, a little past its size and back. */
.island:is([data-state="peek"], [data-state="open"]) {
  transition: --island-h var(--dur-bouncy) var(--ease-bouncy), --island-w var(--dur-bouncy) var(--ease-bouncy) var(--lag);
}

/* Each state's content keeps its size and place while the clip changes around it. */
.layer { position: absolute; top: 0; left: 50%; translate: -50% 0; color: var(--text); }
.layer { transform-origin: 50% 0; animation: layer-pop var(--dur-bouncy) var(--ease-bouncy) calc(var(--lag) * 2) backwards, layer-fade calc(var(--dur-fade) * 2) var(--ease) calc(var(--lag) * 3) backwards; }
.layer.leaving { animation: layer-out var(--dur-out) var(--ease) forwards; }
@keyframes layer-pop { from { transform: scale(var(--pop)); } }
@keyframes layer-fade { from { opacity: 0; filter: var(--blur-in); } }
@keyframes layer-out { to { opacity: 0; } }

/* Idle: the notch with a wing each side, the dot left of it and the words right; nothing under it. */
.wings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(var(--notch-w) + var(--wing) * 2);
  height: var(--notch-h);
  padding-inline: var(--space-3);
  font-size: var(--text-s);
  white-space: nowrap;
}
.wing-text { color: var(--muted); }

/* Peek: one line under the notch's band. */
.peek {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: calc(var(--control) * 13.5);
  padding: var(--notch-h) var(--space-4) 0;
  height: calc(var(--notch-h) + var(--control) + var(--space-2));
  white-space: nowrap;
}
.peek-title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: var(--medium); }
.peek-body { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: var(--text-s); }
.peek-label { flex: none; color: var(--warn); font-size: var(--text-s); font-weight: var(--medium); }

/* Open: the app's dock as it is now (D0038, D0040): the session shown as its own switch, another one
   at work as a chip, the stream, the card that waits, a quiet reply. */
.panel { display: flex; flex-direction: column; width: calc(var(--control) * 16); padding-top: var(--notch-h); }
.head { display: flex; align-items: center; gap: var(--space-1); min-width: 0; padding: var(--space-2) var(--space-2) var(--space-1); white-space: nowrap; }
.switch { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; height: var(--control); padding-inline: var(--space-2); border-radius: var(--radius-pill); background: var(--hover); font-weight: var(--medium); }
.switch-title, .chip-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.glyph { flex: none; width: var(--text-m); height: var(--text-m); color: var(--muted); }
.chevron { flex: none; width: var(--space-3); height: var(--space-3); fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.chip { display: inline-flex; align-items: center; gap: var(--space-1); min-width: 0; max-width: calc(var(--control) * 4); padding-inline: var(--space-2); color: var(--muted); font-size: var(--text-s); }
.head-end { flex: none; margin-left: auto; padding-inline: var(--space-2); color: var(--muted); font-size: var(--text-s); }
.stream { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-2) var(--space-4) var(--space-3); }
.stream p { margin: 0; }
.you { align-self: flex-end; max-width: 85%; padding: var(--space-1) var(--space-3); border-radius: var(--radius-m); background: var(--bubble); }
.step { color: var(--muted); font-size: var(--text-s); line-height: var(--leading-tight); }
.step + .step { margin-top: calc(var(--space-2) - var(--space-3)); }
.step span { margin-right: var(--space-2); color: var(--text); }
.approval-actions .button { pointer-events: none; }
/* Allow, pressed: down a little and back, on the gentle spring. */
.approval-actions [data-press] { transition: transform var(--dur-gentle) var(--ease-gentle); }
.approval-actions [data-press][data-pressed] { transform: scale(var(--squash)); }
.approval[data-state="allow"] .approval-actions { display: none; }
.reply { margin: 0 var(--space-3) var(--space-3); padding: var(--space-1) var(--space-3); border: var(--hairline) solid var(--line); border-radius: var(--radius-m); background: var(--surface); color: var(--muted); }

/* Chat (D0042): the same island grown large, the sessions by workspace beside the conversation. */
.chat { display: flex; width: calc(var(--control) * 23); height: calc(var(--control) * 13.5); padding-top: var(--notch-h); }
.side { flex: none; width: calc(var(--control) * 7); padding: var(--space-3) var(--space-2); border-right: var(--hairline) solid var(--line); }
.side p { margin: 0; }
.side-head { padding: var(--space-2) var(--space-2) var(--space-1); color: var(--muted); font-size: var(--text-xs); font-weight: var(--medium); letter-spacing: var(--track-caps); text-transform: uppercase; }
.side-row { display: flex; align-items: center; gap: var(--space-2); min-width: 0; height: var(--control); padding-inline: var(--space-2); border-radius: var(--radius-s); color: var(--muted); font-size: var(--text-s); white-space: nowrap; }
.side-row span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-row[aria-current="true"] { background: var(--selected); color: var(--text); }
.conv { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-3) var(--space-5) 0; }
.conv p { margin: 0; }
.conv-title { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--medium); }
.conv .reply { margin: auto 0 var(--space-4); }

/* ---------- the words: a caption at the screen's bottom left; the links at its bottom right ---------- */
.bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-6); }
.page { flex: 0 1 calc(var(--measure) * 0.75); min-width: 0; }
.name { display: flex; align-items: center; gap: var(--space-2); margin: 0; font-size: var(--text-l); font-weight: var(--medium); line-height: var(--leading-tight); }
/* The Ledge beside the name, in the text's colour: black on light, white on dark, never a status colour (D0044). */
.name .mark { width: calc(var(--text-l) * 1.5); height: calc(var(--text-l) * 1.5); flex: none; }
.line { margin: var(--space-2) 0 var(--space-5); font-size: calc(var(--text-l) * 1.5); line-height: var(--leading-tight); letter-spacing: var(--track-l); }

.keys { display: grid; margin: 0 0 var(--space-5); border-top: var(--hairline) solid var(--line); }
.keys > div { display: flex; align-items: center; gap: var(--space-4); padding-block: var(--space-3); border-bottom: var(--hairline) solid var(--line); }
.keys dt { display: flex; gap: var(--space-1); flex: none; width: calc(var(--control) * 5); }
.keys dd { margin: 0; }
.hover { color: var(--muted); font-size: var(--text-s); }
.keys kbd { font-size: var(--text-s); }

.install { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3); border: var(--hairline) solid var(--line); border-radius: var(--radius-m); }
.install-line { flex: 1; min-width: 0; padding-block: var(--space-1); overflow-wrap: anywhere; }
.copy { flex: none; }
.fine { margin: var(--space-3) 0 0; }

.foot { display: flex; flex: none; gap: var(--space-4); }
.foot a { color: var(--muted); }

/* A phone: the notch's dock is wider than the screen, so it is drawn smaller. */
@media (max-width: 760px) {
  .screen { padding: calc(var(--control) * 12) var(--space-4) var(--space-5); }
  .bottom { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 500px) {
  .island { scale: 0.82; }
  .stage { height: calc(var(--control) * 11.5); }
  .keys dt { width: calc(var(--control) * 4.5); }
}
/* Reduced motion: the shape changes at once and the content only fades. */
@media (prefers-reduced-motion: reduce) {
  .layer { animation: layer-fade var(--dur-fade) var(--ease-gentle) !important; }
  .layer.leaving { animation: layer-out var(--dur-out) var(--ease) forwards !important; }
}
