/* Phone shell and portfolio controls. The embedded app owns its interface styles. */

.ca-device {
  --w: 414px;                 /* the width the app is laid out at, then scaled */
  --h: 896px;
  --k: 1;                     /* scale factor, written by js/chatair.js */

  /* src/shared/theme/colors.ts */
  --bg: #0d1014;
  --surface: #151a20;
  --raised: #1b222b;
  --line: #2a3440;
  --line-soft: #202833;
  --ink: #eef2f6;
  --muted: #8d98a7;
  --dim: #687486;
  --accent: #00a3ff;
  --success: #00c781;
  --warning: #ffb84d;
  --input: #10161d;
  --self: #101b1a;

  /* The client is a native app: it uses the platform's face, not the portfolio's mono. */
  --face: -apple-system, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Sized by width, never squashed: the client's proportions are the point. */
  width: min(100%, 330px);
  margin-inline: auto;
  perspective: 1400px;
  perspective-origin: 50% 45%;
}

.chatair-preview { display: flex; flex-direction: column; }

.ca-display { display: flex; justify-content: center; width: 100%; }

/* ── the phone ────────────────────────────────────────────
   Two nested transforms so they cannot fight: the outer one follows the pointer, the
   inner one keeps its own slow drift. Both idle at rest. */

.ca-tilt {
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
  will-change: transform;
}
.ca-device[data-live="true"] .ca-tilt { transition-duration: .12s; }

.ca-sway { transform-style: preserve-3d; }
.ca-device[data-live="true"] .ca-sway { animation: ca-sway 7s ease-in-out infinite; }
.ca-device[data-controls="true"] .ca-sway { animation-play-state: paused; }

@keyframes ca-sway {
  0%, 100% { transform: translate3d(0, 0, 0) rotateZ(0deg); }
  33%      { transform: translate3d(0, -6px, 22px) rotateZ(-.35deg); }
  66%      { transform: translate3d(0, 4px, 10px) rotateZ(.3deg); }
}

.ca-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 414 / 896;
  border-radius: calc(56px * var(--k));
  padding: calc(11px * var(--k));
  background: linear-gradient(150deg, #3b444e, #14171b 42%, #0a0c0f 70%, #2c343d);
  box-shadow:
    0 0 0 1px #00000080,
    0 calc(26px * var(--k)) calc(50px * var(--k)) -14px #000000a6,
    0 calc(6px * var(--k)) calc(14px * var(--k)) -6px #00000073;
  transform-style: preserve-3d;
  transition: box-shadow .45s cubic-bezier(.2, .8, .2, 1);
}
.ca-device[data-live="true"] .ca-shell {
  box-shadow:
    0 0 0 1px #00000080,
    0 calc(40px * var(--k)) calc(74px * var(--k)) -16px #000000bf,
    0 calc(10px * var(--k)) calc(22px * var(--k)) -8px #00000080,
    0 0 calc(70px * var(--k)) -18px color-mix(in oklab, var(--accent) 60%, transparent);
}

/* The screen sits below the bezel surface, so a highlight can run across the glass. */
.ca-viewport {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: calc(45px * var(--k));
  background: var(--bg);
  box-shadow: inset 0 0 0 1px #ffffff14;
}

.ca-scale {
  width: var(--w);
  height: var(--h);
  transform: scale(var(--k));
  transform-origin: top left;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  font-family: var(--face);
  color: var(--ink);
  text-align: left;
}
.ca-scale > img { width: var(--w); height: var(--h); object-fit: cover; display: block; }

/* Glass, not gloss: one wide band that only shows while the phone is being looked at. */
.ca-sheen {
  position: absolute;
  inset: calc(11px * var(--k));
  border-radius: calc(45px * var(--k));
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(107deg, transparent 34%, #ffffff12 47%, #ffffff05 55%, transparent 66%);
  transition: opacity .45s ease;
}
.ca-device[data-live="true"] .ca-sheen { opacity: 1; }

/* ── the phone's own chrome ───────────────────────────── */

.ca-os {
  flex: 0 0 auto;
  height: 54px;
  padding: 0 30px 0 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: 600 15px/1 var(--face);
  color: #fff;
  letter-spacing: .2px;
}
.ca-os-right { display: flex; align-items: center; gap: 6px; }

/* ── the strip of screens under the phone ─────────────── */

.ca-screens {
  display: flex;
  gap: 6px;
  margin: 0 0 8px;
  flex-wrap: wrap;
}
.ca-screens button {
  padding: 6px 10px;
  border: 1px solid var(--edge, #2a3440);
  border-radius: 6px;
  background: none;
  font: inherit;
  font-size: 10px;
  color: var(--dim, #687486);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.ca-screens button:hover { color: var(--fg, #eef2f6); }
.ca-screens button[aria-pressed="true"] {
  color: #eef2f6;
  border-color: #00a3ff;
  background: color-mix(in srgb, #00a3ff 12%, transparent);
}

.ca-caption {
  margin: 0 0 12px;
  font-size: 10px;
  line-height: 1.6;
  color: var(--dim, #687486);
}

@media (prefers-reduced-motion: reduce) {
  .ca-tilt, .ca-shell { transition: none; }
  .ca-device[data-live="true"] .ca-sway { animation: none; }
}

/* ── the long-form project write-up ──────────────────────
   Numbered sections that span both columns of the card, so the phone stays a fixture at
   the top and the reading runs full width underneath it. Modelled on how a product page
   paces itself: a short read, one detail pulled out of it, then the screenshot that
   belongs to that read — never a gallery with captions bolted on. */

.card .deep {
  grid-column: 1 / -1;
  order: 3;
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid var(--line, #2a3440);
}

/* The section tabs. Sticky, because the whole point is being able to leave a section
   without scrolling back up to the index first. */
.deep-nav {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  gap: 4px;
  margin: 0 0 26px;
  padding: 8px 0;
  overflow-x: auto;
  scrollbar-width: none;
  background: linear-gradient(var(--bg, #101214) 76%, transparent);
  backdrop-filter: blur(6px);
}
.deep-nav::-webkit-scrollbar { display: none; }
.deep-nav button {
  flex: 0 0 auto;
  padding: 8px 13px;
  border: 1px solid var(--edge, #ffffff12);
  border-radius: 7px;
  background: none;
  font: inherit;
  font-size: 11px;
  white-space: nowrap;
  color: var(--dim, #687486);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.deep-nav button:hover { color: var(--fg, #eef2f6); }
.deep-nav button[aria-selected="true"] {
  color: var(--fg, #eef2f6);
  border-color: color-mix(in srgb, var(--proj-ink, #00a3ff) 55%, transparent);
  background: color-mix(in srgb, var(--proj-ink, #00a3ff) 12%, transparent);
}
.deep-nav button:focus-visible { outline: 2px solid var(--proj-ink, #00a3ff); outline-offset: 2px; }

/* The first section in a panel has no rule above it: the tabs already divide. */
.deep-panel > .deep-sec:first-child { padding-top: 0; border-top: 0; }

.deep-sec {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 0 18px;
  padding-bottom: 34px;
}
.deep-sec + .deep-sec { padding-top: 30px; border-top: 1px solid var(--edge, #ffffff12); }

.deep-n {
  grid-row: 1 / 4;
  margin: 0;
  font-size: 11px;
  line-height: 1.7;
  color: var(--dim, #687486);
  font-variant-numeric: tabular-nums;
}
.deep-sec h2 {
  margin: 0 0 12px;
  font-size: clamp(19px, 1.5vw, 24px);
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1.25;
  color: var(--fg, #eef2f6);
}
.deep-body {
  max-width: 62ch;
  margin: 0;
  font-size: 13px;
  line-height: 1.85;
  color: var(--mid, #b0b4b6);
}

/* The one line per section that is worth stopping on. */
.deep-hi {
  max-width: 60ch;
  margin: 16px 0 0;
  padding-left: 14px;
  border-left: 2px solid var(--proj-ink, #00a3ff);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--fg, #eef2f6);
}

.deep-shot {
  grid-column: 2;
  margin: 22px 0 0;
}
.deep-shot img {
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--edge, #ffffff12);
  border-radius: 14px;
  box-shadow: 0 22px 44px -26px #000000d9;
}
.deep-shot figcaption {
  max-width: 420px;
  margin-top: 9px;
  font-size: 10px;
  line-height: 1.6;
  color: var(--dim, #687486);
}

.deep-spec {
  margin: 0 0 16px;
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--dim, #687486);
}

.deep-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.deep-table th {
  padding: 0 18px 10px 0;
  text-align: left;
  font-weight: 400;
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim, #687486);
}
.deep-table td {
  padding: 13px 18px 13px 0;
  border-top: 1px solid var(--edge, #ffffff12);
  vertical-align: top;
  line-height: 1.75;
  color: var(--mid, #b0b4b6);
}
.deep-table td:first-child { color: var(--fg, #eef2f6); white-space: nowrap; }
.deep-table td:nth-child(2) { color: var(--proj-ink, #00a3ff); }
.deep-table td:last-child { padding-right: 0; }

.deep-source { margin: 0; padding: 0; list-style: none; display: grid; gap: 16px; }
.deep-source li {
  display: grid;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--mid, #b0b4b6);
}
.deep-source li span { max-width: 62ch; }

@media (max-width: 700px) {
  .deep-sec { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .deep-n { grid-row: auto; margin-bottom: 6px; }
  .deep-shot { grid-column: 1; }
  .deep-table { min-width: 460px; }
}

/* ── hero: release stage and platform spec ───────────────
   A product page has to say what state the product is in before it says anything else,
   otherwise every claim below reads as a shipping promise. */

/* A paragraph inside .project-copy inherits the card's body size, which turns the pill
   into an ellipse. inline-block rather than flex: the box then simply wraps its own text
   instead of negotiating a width with it. */
.card .project-copy .release {
  display: inline-block;
  margin: 0 0 18px;
  padding: 7px 12px 7px 10px;
  border: 1px solid color-mix(in srgb, var(--proj-ink, #00a3ff) 38%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--proj-ink, #00a3ff) 10%, transparent);
  white-space: nowrap;
  font: 400 10px/1 var(--mono, ui-monospace, monospace);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg, #eef2f6);
}
.card .project-copy .release .release-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--proj-ink, #00a3ff);
  box-shadow: 0 0 9px color-mix(in srgb, var(--proj-ink, #00a3ff) 70%, transparent);
}

.card .spec {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.card .spec li {
  padding: 4px 9px;
  border: 1px solid var(--edge, #ffffff12);
  border-radius: 5px;
  font-size: 10px;
  letter-spacing: .02em;
  color: var(--dim, #687486);
}

/* ── where it is now ─────────────────────────────────── */

.deep-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px 34px;
  margin-top: 20px;
}
.deep-cols h3 {
  margin: 0 0 10px;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim, #687486);
}
.deep-status { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.deep-status li {
  position: relative;
  padding-left: 20px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--mid, #b0b4b6);
}
.deep-status li::before {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 11px;
}
/* Done is stated, not celebrated; not-yet is stated, not apologised for. */
.deep-status.done li::before { content: "\2713"; color: var(--proj-ink, #00a3ff); }
.deep-status.todo li::before { content: "\2013"; color: var(--dim, #687486); }

/* ── what it runs on ─────────────────────────────────────
   A plain label-and-value list. Stating what a thing is made of, not arguing for it. */
.deep-spec-list {
  display: grid;
  grid-template-columns: minmax(90px, 130px) minmax(0, 1fr);
  gap: 0;
  margin: 0;
}
.deep-spec-list dt {
  padding: 13px 18px 13px 0;
  border-top: 1px solid var(--edge, #ffffff12);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--dim, #687486);
}
.deep-spec-list dd {
  margin: 0;
  padding: 13px 0;
  border-top: 1px solid var(--edge, #ffffff12);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--fg, #eef2f6);
}
.deep-spec-list dt:first-of-type, .deep-spec-list dt:first-of-type + dd { border-top: 0; }

@media (max-width: 700px) {
  .deep-spec-list { grid-template-columns: minmax(0, 1fr); }
  .deep-spec-list dt { padding-bottom: 2px; border-top: 1px solid var(--edge, #ffffff12); }
  .deep-spec-list dd { padding-top: 0; border-top: 0; }
}

/* The live client reflows at the actual phone width; screenshots keep their native ratio. */

.ca-device[data-interactive] .ca-shell { height: auto; aspect-ratio: 414 / 896; border-radius: 30px; padding: 8px; }
.ca-device[data-interactive] .ca-viewport { border-radius: 23px; }
.ca-device[data-interactive] .ca-scale { width: 100%; height: 100%; transform: none; }
.ca-device[data-interactive] .ca-os { height: 30px; padding-inline: 20px; font-size: 12px; }
.ca-screens button { min-height: 44px; font-size: 12px; }
.tv-log .card .ca-caption { font-size: 12px; margin-block: 0 10px; }
.ca-device[data-interactive] { width: min(100%, var(--phone-width, 390px)); }
.ca-device:not([data-interactive]) { width: min(100%, var(--shot-width, 330px)); }
@media (max-width: 600px) {
  .monitor-stage .tv-log .card[data-project="chatair"] .claim { font-size: 16px; }
  .monitor-stage .tv-log .card[data-project="chatair"] .preview-caption,
  .monitor-stage .tv-log .card[data-project="chatair"] .ca-caption { display: none; }
  .monitor-stage .tv-log .card[data-project="chatair"] { gap: 10px; }
  .ca-screens { gap: 4px; }
  .ca-screens button { padding: 6px 8px; font-size: 11px; }
}

.ca-controls { display: flex; align-items: start; gap: 6px; margin-bottom: 8px; }
.ca-controls .ca-screens { flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; margin: 0; padding-bottom: 2px; scrollbar-width: thin; }
.ca-controls button { flex-shrink: 0; white-space: nowrap; }


.ca-native-app { display: block; width: 100%; flex: 1; min-height: 0; border: 0; background: #0d1014; }
.ca-pause { min-height: 44px; padding: 6px 10px; border: 1px solid var(--edge); border-radius: 6px; background: var(--deck); color: var(--fg); font: inherit; font-size: 12px; cursor: pointer; }
.ca-controls { flex-wrap: wrap; }
.ca-controls .ca-screens { flex-basis: auto; }

/* Give the application a readable column before assigning room to the write-up. */
.monitor-stage .tv-log .card[data-project="chatair"].with-stage {
  grid-template-columns: minmax(0, 1fr) minmax(430px, 46%);
}
.monitor-stage .tv-log .card[data-project="chatair"] > .pin {
  width: 100%; max-width: none; padding-top: 0;
}
.card[data-project="chatair"] .preview-caption { display: none; }
.chatair-preview .ca-caption { display: none; }
.chatair-preview .ca-controls { width: min(100%, 430px); margin: 0 auto 12px; flex-wrap: nowrap; align-items: center; }
.chatair-preview .ca-screens button { padding-inline: 8px; }
@media (max-width: 1000px) {
  .monitor-stage .tv-log .card[data-project="chatair"].with-stage { grid-template-columns: minmax(0, 1fr); }
  .monitor-stage .tv-log .card[data-project="chatair"] > .pin { grid-column: 1; grid-row: auto; }
}
@media (max-width: 600px) {
  .monitor-stage .tv-log .card[data-project="chatair"] .claim { display: none; }
  .chatair-preview .ca-controls { gap: 4px; }
  .chatair-preview .ca-pause { font-size: 11px; padding-inline: 6px; }
}
.card[data-project="chatair"] > .pin { width: 100%; max-width: none; }
@media (min-width: 1001px) {
  .card[data-project="chatair"].with-stage { grid-template-columns: minmax(0, 1fr) minmax(430px, 46%); }
}
@media (max-width: 1000px) {
  .monitor-stage .tv-log .card[data-project="chatair"] .project-copy { display: contents; }
  .monitor-stage .tv-log .card[data-project="chatair"] .project-copy > * { order: 4; }
  .monitor-stage .tv-log .card[data-project="chatair"] .product-name { order: 0; margin-block: 0; }
  .monitor-stage .tv-log .card[data-project="chatair"] .claim { order: 4; }
  .monitor-stage .tv-log .card[data-project="chatair"] > .pin { order: 1; }
}

.ca-pause-glyph { display: none; }
@media (max-width: 600px) {
  .monitor-stage[data-tv-model="plasma"] .project-screen[data-project="chatair"] .tv-log { padding-inline: 8px; }
  .chatair-preview .ca-pause { width: 44px; min-width: 44px; }
  /* Overlay scrollbars are invisible on a phone, so a sliced tab reads as broken
     layout rather than as a strip you can push. The fade is the affordance. */
  .chatair-preview .ca-screens {
    mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent);
    scroll-snap-type: x proximity;
    scroll-padding-inline: 2px;
  }
  .chatair-preview .ca-screens button { scroll-snap-align: start; }
  /* The section tabs scroll the same way and hide their scrollbar outright, so they get
     the same edge fade. On a narrow screen this strip always overflows. */
  .deep-nav {
    mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent);
    scroll-snap-type: x proximity;
    scroll-padding-inline: 2px;
  }
  .deep-nav button { scroll-snap-align: start; }
  .chatair-preview .ca-pause-glyph { display: inline; font-size: 15px; }
  .chatair-preview .ca-pause-label { display: none; }
  .ca-device[data-interactive] .ca-shell { padding: 5px; border-radius: 26px; }
}
