/* apps.css: owned by the works worker (065/004), design package §8a (Web and desktop). */

/*
  One MacBook (the kit's .mac, devices.css), 860px wide on wide screens, showing a macOS
  desktop: the menu bar, the NOCTS desktop app's window on its new-chat screen, and a dock.
  Inside the device everything is in the kit's --mac-u (one point of the 1512 × 982 screen),
  placed with physical left and top as the kit does: the device never mirrors.

  The live eyes (eyes.js): .apps__live lies exactly over the screenshot, a size container one
  screenshot wide, so --apps-px is one CSS pixel of the 1440 × 900 capture at any width. It holds
  the plate (the same screen with the mark hidden) and the mark redrawn where the app draws it:
  the app's 168px hero symbol, at (781, 261). It shows only while eyes.js runs it; without JS
  and with reduced motion the screenshot's own mark is the still, fully drawn mark.
*/

.apps__sub {
  margin-block-start: 1.25rem;
}

/* ---------- The MacBook ---------- */
.apps__device {
  width: 100%;
  margin: 3.5rem auto 0;
}
@media (min-width: 1024px) and (orientation: landscape) {
  .apps__device {
    width: min(860px, 100%);
  }
}

/* The desktop under the menu bar, and the app's window on it. */
.apps__desk {
  background: var(--surface-1);
}
.apps__window {
  /* The new-chat screenshot's top edge is the same as composer-models' (sampled). */
  --mac-bar: var(--mac-bar-composer-models);
  inset: auto;
  top: calc(14.7 * var(--mac-u));
  left: calc(126 * var(--mac-u));
  width: calc(1260 * var(--mac-u));
  height: calc(825.5 * var(--mac-u));
}

/* ---------- The live eyes ---------- */
.apps__live {
  --apps-px: calc(100cqw / 1440);
  position: absolute;
  top: calc(38 * var(--mac-u));
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  overflow: hidden;
  container-type: inline-size;
  pointer-events: none;
}
.apps__live[data-eyes] {
  display: block;
}
.apps__plate {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
}
.apps__eyes {
  position: absolute;
  top: calc(261 * var(--apps-px));
  left: calc(781 * var(--apps-px));
  width: calc(168 * var(--apps-px));
  height: calc(100.348 * var(--apps-px));
  overflow: visible;
  color: var(--gold);
  filter: drop-shadow(0 0 calc(20 * var(--apps-px)) var(--apps-glow-near))
    drop-shadow(0 0 calc(64 * var(--apps-px)) var(--apps-glow-far));
}

/*
  The app's `alive` motion, ported from src/styles/nocts-mark.css (work/063) with its paths,
  timings and curves unchanged: the rings draw in, the pupils pop, then a glance and, eight
  seconds later, a blink, on one 16s cycle. data-mark-motion is 'wait' (ready, not drawn yet)
  until the section is in view, then 'alive'. While the section is offscreen the loop pauses
  (data-eyes="paused"); a hidden tab pauses it through base.css's [data-paused].
*/
.apps__eyes[data-mark-motion] [data-mark-part^='ring'] {
  stroke-dasharray: 1;
}
.apps__eyes [data-mark-part='eye'],
.apps__eyes [data-mark-part='pop'] {
  transform-box: fill-box;
  transform-origin: center;
}
.apps__eyes[data-mark-motion='wait'] [data-mark-part^='ring'] {
  stroke-dashoffset: 1;
}
.apps__eyes[data-mark-motion='wait'] [data-mark-part='pop'] {
  transform: scale(0);
}
.apps__eyes[data-mark-motion='alive'] [data-mark-part='ring-o'] {
  animation: apps-mark-draw 0.8s cubic-bezier(0.65, 0, 0.35, 1) 0.15s both;
}
.apps__eyes[data-mark-motion='alive'] [data-mark-part='ring-c'] {
  animation: apps-mark-draw 0.8s cubic-bezier(0.65, 0, 0.35, 1) 0.3s both;
}
.apps__eyes[data-mark-motion='alive'] [data-mark-part='pop'] {
  animation: apps-mark-pop 0.38s cubic-bezier(0.3, 1.6, 0.5, 1) 0.85s both;
}
.apps__eyes[data-mark-motion='alive'] [data-mark-part='pupil'] {
  animation: apps-mark-idle-look 16s linear 1.3s infinite;
}
.apps__eyes[data-mark-motion='alive'] [data-mark-part='eye'] {
  animation: apps-mark-idle-blink 16s linear 1.3s infinite;
}
.apps__live[data-eyes='paused'] .apps__eyes * {
  animation-play-state: paused;
}

@keyframes apps-mark-draw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes apps-mark-pop {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}
/* From the resting glance to the left and back: about a second away. */
@keyframes apps-mark-idle-look {
  0%,
  24% {
    transform: translate(2px, -2px);
    animation-timing-function: cubic-bezier(0.25, 0.9, 0.3, 1);
  }
  25.5%,
  32% {
    transform: translate(-4px, 0.5px);
    animation-timing-function: cubic-bezier(0.25, 0.9, 0.3, 1);
  }
  33.5%,
  100% {
    transform: translate(2px, -2px);
  }
}
/* A 0.24s blink, at three quarters of the cycle. */
@keyframes apps-mark-idle-blink {
  0%,
  74.5% {
    transform: scaleY(1);
    animation-timing-function: ease-in-out;
  }
  75.03% {
    transform: scaleY(0.06);
    animation-timing-function: ease-in-out;
  }
  76%,
  100% {
    transform: scaleY(1);
  }
}

/* ---------- The dock: decorative, kept as mocked ----------
   48pt app tiles at the mockup's 1440-wide desktop, in --mac-u (x 1.05). The NOCTS icon is the
   desktop app's own, with the running dot under it; the others are the official marks,
   unmodified, on their tiles. */
.apps__dock {
  position: absolute;
  top: calc(871.5 * var(--mac-u));
  left: 50%;
  display: flex;
  gap: calc(10.5 * var(--mac-u));
  padding: calc(8.4 * var(--mac-u));
  border: 1px solid color-mix(in srgb, var(--ivory) 14%, transparent);
  border-radius: calc(21 * var(--mac-u));
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
  translate: -50% 0;
}
.apps__app {
  position: relative;
  display: grid;
  place-items: center;
  width: calc(50.4 * var(--mac-u));
  height: calc(50.4 * var(--mac-u));
  border-radius: 22.5%;
  background: var(--apps-tile-light);
}
.apps__app > img {
  width: 62%;
  height: 62%;
  object-fit: contain;
}
.apps__app--whatsapp {
  background: var(--apps-tile-whatsapp);
}
.apps__app--nocts {
  background: none;
}
.apps__app--nocts > img {
  width: 100%;
  height: 100%;
}
.apps__app--nocts::after {
  content: '';
  position: absolute;
  top: calc(100% + 3.15 * var(--mac-u));
  left: 50%;
  width: calc(4.2 * var(--mac-u));
  height: calc(4.2 * var(--mac-u));
  border-radius: 50%;
  background: color-mix(in srgb, var(--ivory) 80%, transparent);
  translate: -50% 0;
}

/* ---------- The buttons: one row, stacked full width on narrow screens ----------
   Open in the browser is the gold action; the downloads are the shared ghost buttons
   (layout.css), live since the desktop app shipped (065/027). Download for macOS opens the Mac
   chooser, below. */
/* Positioned so it paints over the Mac's drop-shadow (.dev-shadow, 40px down and 110px of blur),
   which reaches this row. Unpositioned, the gold and Windows buttons sat under it at about half
   brightness, while the positioned Mac chooser did not. */
.apps__cta {
  position: relative;
  margin-block-start: 2.5rem;
}
.apps__arrow {
  display: inline-block;
  transform: scaleX(var(--dir));
}
@media (max-width: 720px) {
  .apps__cta {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ---------- The Mac chooser (the owner's option B, 2026-10-21, #108) ----------
   Download for macOS is a <details> (downloads.js): its summary is the ghost button with a small
   ▾ after the label, a flex box so it fills the row when the buttons stack. Its panel drops 8px
   under it, aligned to the button's inline-start edge, and lies over whatever follows; nothing
   on the way clips it (html and body clip only sideways). Two rows, Apple silicon and Intel,
   each a download. No motion: the panel shows and hides at once. */
.apps__mac {
  position: relative;
}
.apps__mac-button {
  display: flex;
  list-style: none;
}
.apps__mac-button::-webkit-details-marker {
  display: none;
}
/* The ▾, drawn rather than typed: no face the page loads has U+25BE. */
.apps__caret {
  inline-size: 0.4em;
  block-size: 0.27em;
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
/* Under .apps__mac so it outweighs base.css's ul[role='list'] padding. */
.apps__mac > .apps__mac-panel {
  position: absolute;
  inset-block-start: calc(100% + 8px);
  inset-inline-start: 0;
  z-index: 2;
  inline-size: min(300px, 100vw - 2 * var(--gutter));
  margin: 0;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--ivory) 13%, transparent);
  border-radius: 16px;
  background: var(--surface-2);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--night) 45%, transparent);
  text-align: start;
}
.apps__mac-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 11px;
  color: var(--ivory);
  text-decoration: none;
  transition: background-color var(--dur-1) var(--ease-out);
}
.apps__mac-link:hover,
.apps__mac-link:focus-visible {
  background: color-mix(in srgb, var(--ivory) 6%, transparent);
}
.apps__mac-title {
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.25rem;
}
.apps__mac-note {
  color: var(--text-muted);
  font-size: var(--fs-caption);
  line-height: 1.0625rem;
}
