/* ============================================================================
   capability-story.css  |  eugeny.com Capabilities
   ----------------------------------------------------------------------------
   Loaded after motion.css, by instincts.html only. Composes two additions from
   the approved Capabilities proposal around the existing sections:

     1. .cs-stage  Vision in conversation. An editorial column, a conversation
                   window working on the site's own landscape, and a print of a
                   detail from it. Sits inside the existing Vision section.
     2. .cs-modes  Text, image, video and voice on the pale blue band. Closes the
                   senses chapter after the Media section.

   World: warm ivory paper, deep ink blue, denim, one terracotta accent. Flat
   surfaces, hard edges, Fraunces display against system UI. No gradients.

   Motion: words arriving on entry, one caret, quiet hover. Transform and
   opacity only, and every part of it stops under prefers-reduced-motion.
   ========================================================================== */

/* ---------------------------------------------------------------- vision --- */

.cs-stage {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.5fr) minmax(0, .76fr);
  align-items: start;
  gap: clamp(18px, 2.6vw, 40px);
  margin-top: clamp(22px, 2.6vw, 32px);
}

.cs-stage-lead .ch-kicker { margin-bottom: 10px; }

.cs-stage-title {
  max-width: 15ch;
  margin: 0 0 10px;
  font-family: var(--ch-display);
  font-size: clamp(1.45rem, 2vw, 1.92rem);
  font-weight: 600;
  letter-spacing: -.014em;
  line-height: 1.1;
  color: var(--ch-ink);
}

.cs-stage-body {
  max-width: 33ch;
  margin: 0;
  font-size: .94rem;
  line-height: 1.58;
  color: var(--ch-body);
}

.cs-stage-notes {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.cs-stage-notes li {
  position: relative;
  padding-left: 17px;
  font-size: .9rem;
  line-height: 1.42;
  color: var(--ch-label);
}

.cs-stage-notes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .46em;
  width: 6px;
  height: 6px;
  background: var(--ch-ink);
}

/* Conversation window ---------------------------------------------------- */

.cs-chat {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--ch-line);
  border-radius: 14px;
  background: var(--ch-frame);
}

.cs-chat-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 1px 3px 11px;
  border-bottom: 1px solid var(--ch-line);
}

.cs-chat-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--ch-ink);
  color: var(--ch-ivory-2);
}

.cs-chat-mark .ch-ic { width: 15px; height: 15px; }

.cs-chat-name {
  font-family: var(--ch-display);
  font-size: .97rem;
  font-weight: 600;
  letter-spacing: -.008em;
  color: var(--ch-ink);
}

.cs-thread {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 13px 0 0;
  list-style: none;
}

.cs-turn {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
}

.cs-turn--plate,
.cs-turn--compose { gap: 0; }

.cs-bubble {
  max-width: 40ch;
  margin: 0;
  padding: 9px 13px;
  border: 1px solid var(--ch-line);
  border-radius: 12px 12px 12px 3px;
  background: var(--ch-ivory-2);
  font-size: .875rem;
  line-height: 1.5;
  color: var(--ch-slate);
}

.cs-bubble--reply {
  border-color: rgba(27, 47, 92, .1);
  border-radius: 3px 12px 12px 12px;
  background: var(--ch-side);
}

.cs-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--ch-ink);
  color: var(--ch-ivory-2);
}

.cs-avatar .ch-ic { width: 14px; height: 14px; }

.cs-plate-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: 58% 46%;
  border: 1px solid var(--ch-line);
  border-radius: 10px;
}

/* Composer row: the thread continuing, drawn, never a control. */
.cs-turn--compose {
  align-items: center;
  padding: 7px 7px 7px 12px;
  border: 1px solid var(--ch-line);
  border-radius: 999px;
  background: var(--ch-ivory-2);
}

.cs-clip { width: 15px; height: 15px; color: var(--ch-label); }

.cs-compose {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 10px;
  overflow: hidden;
  font-size: .82rem;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--ch-label);
}

.cs-caret {
  display: inline-block;
  width: 2px;
  height: .95em;
  margin-left: 3px;
  vertical-align: -.1em;
  background: var(--ch-orange);
  animation: cs-blink 1.15s steps(1) infinite;
}

.cs-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--ch-ink);
  color: var(--ch-ivory-2);
}

.cs-send .ch-ic { width: 13px; height: 13px; }

/* Print of a detail ----------------------------------------------------- */

.cs-print { margin: 6px 0 0; rotate: -2deg; }

.cs-print-cap {
  max-width: 15ch;
  margin: 0 auto 12px;
  font-family: var(--ch-display);
  font-size: clamp(1rem, 1.3vw, 1.14rem);
  font-style: italic;
  font-weight: 500;
  line-height: 1.24;
  text-align: center;
  color: var(--ch-ink);
}

.cs-print-frame {
  display: block;
  padding: 9px 9px 30px;
  border: 1px solid var(--ch-line);
  background: var(--ch-ivory-2);
}

.cs-print-frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 60% 38%;
}

/* Authored entrance. Without the script, everything is simply visible. */
.cs-stage.is-armed .cs-turn { opacity: 0; }

.cs-stage.is-armed.is-live .cs-turn {
  animation: cs-arrive .58s var(--ch-ease) both;
  animation-delay: calc(80ms + var(--i, 0) * 120ms);
}

@keyframes cs-arrive {
  from { opacity: 0; translate: 0 10px; }
  to   { opacity: 1; translate: 0 0; }
}

@keyframes cs-blink {
  0%, 55%   { opacity: 1; }
  56%, 100% { opacity: 0; }
}

/* ------------------------------------------------------------- modalities --- */

.cs-modes {
  padding: clamp(42px, 4.8vw, 68px) 0;
  background: var(--ch-band);
  color: var(--ch-band-ink);
}

.cs-modes-head {
  display: grid;
  gap: 10px;
  max-width: 58ch;
}

.cs-modes-head h2 {
  margin: 0;
  font-family: var(--ch-display);
  font-size: clamp(1.75rem, 3vw, 2.58rem);
  font-weight: 600;
  letter-spacing: -.016em;
  line-height: 1.05;
  color: var(--ch-ink);
}

.cs-modes-stand {
  max-width: 46ch;
  margin: 0;
  font-size: .98rem;
  line-height: 1.5;
  color: var(--ch-ink-2);
}

.cs-mode-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(16px, 1.9vw, 28px);
  margin-top: clamp(24px, 3vw, 40px);
}

.cs-mode {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
}

@media (min-width: 901px) {
  .cs-mode + .cs-mode {
    padding-left: clamp(16px, 1.9vw, 28px);
    border-left: 1px solid rgba(27, 47, 92, .18);
  }
}

.cs-mode-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-family: var(--ch-ui);
  font-size: .75rem;
  font-weight: 650;
  letter-spacing: .16em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--ch-label);
}

.cs-mode-label .ch-ic { width: 17px; height: 17px; color: var(--ch-ink); }

.cs-mode h3 {
  margin: 1px 0 0;
  font-family: var(--ch-display);
  font-size: clamp(1.12rem, 1.4vw, 1.38rem);
  font-weight: 600;
  letter-spacing: -.012em;
  line-height: 1.14;
  color: var(--ch-ink);
  max-width: 18ch;
}

.cs-mode-body {
  margin: 0;
  font-size: .865rem;
  line-height: 1.52;
  color: var(--ch-slate);
}

.cs-caption {
  margin: 0;
  font-size: .78rem;
  line-height: 1.35;
  color: var(--ch-label);
}

/* Demos ----------------------------------------------------------------- */

.cs-demo {
  position: relative;
  display: grid;
  margin-top: 3px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--ch-line);
  border-radius: 10px;
  background: var(--ch-ivory-2);
}

.cs-demo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 1. Text: four words arriving on a card. */
.cs-demo--lines { align-content: center; padding: 18px 15px; }

.cs-lines {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-lines li {
  font-family: var(--ch-display);
  font-size: .92rem;
  line-height: 1.18;
  color: var(--ch-label);
}

.cs-lines li:last-child {
  margin-top: 3px;
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--ch-ink);
  opacity: 1;
}

.cs-lines li:last-child::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: .9em;
  margin-left: 4px;
  vertical-align: -.08em;
  background: var(--ch-orange);
  animation: cs-blink 1.15s steps(1) infinite;
}

.cs-modes.is-armed .cs-lines li { opacity: 0; }

.cs-modes.is-armed.is-live .cs-lines li {
  animation: cs-lines-in .5s var(--ch-ease) both;
  animation-delay: calc(120ms + var(--d, 0ms));
}

@keyframes cs-lines-in {
  from { opacity: 0; translate: 0 8px; }
  to   { opacity: var(--o, .5); translate: 0 0; }
}

.cs-modes.is-armed.is-live .cs-lines li:last-child {
  animation-name: cs-lines-strong;
}

@keyframes cs-lines-strong {
  from { opacity: 0; translate: 0 8px; }
  to   { opacity: 1; translate: 0 0; }
}

/* 2. Image: the illustration, with three quiet tools beside it. */
.cs-demo--image {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  padding: 7px;
}

.cs-demo--image img {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  object-position: 62% 62%;
}

.cs-chips {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
}

.cs-chips span {
  display: grid;
  place-items: center;
  width: 30px;
  border: 1px solid var(--ch-line);
  border-radius: 6px;
  background: var(--ch-card);
  color: var(--ch-ink);
}

.cs-chips .ch-ic { width: 14px; height: 14px; }

/* 3. Video: one framed shot, playing. */
.cs-demo--video {
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 7px 7px 0;
}

.cs-video-frame {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
}

.cs-video-frame img {
  width: 100%;
  height: 100%;
  object-position: 76% 44%;
}

.cs-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.cs-play::after {
  content: "";
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ch-ivory-2);
  box-shadow: 0 0 0 1px rgba(27, 47, 92, .12);
}

.cs-play::before {
  content: "";
  position: absolute;
  z-index: 1;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid var(--ch-ink);
  translate: 2px 0;
}

.cs-track {
  position: relative;
  height: 3px;
  margin: 10px 2px 11px;
  border-radius: 2px;
  background: rgba(27, 47, 92, .18);
}

.cs-track::before {
  content: "";
  position: absolute;
  inset: 0 64% 0 0;
  border-radius: 2px;
  background: var(--ch-ink);
}

.cs-track::after {
  content: "";
  position: absolute;
  top: -2px;
  left: 36%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ch-orange);
}

/* 4. Voice: the rendered waveform, playing while it is on screen. */
.cs-demo--voice { background: var(--ch-card); }

.cs-demo--voice .ch-motion-still,
.cs-demo--voice .ch-motion-still img {
  width: 100%;
  height: 100%;
}

.cs-demo--voice .ch-motion-still img { object-fit: contain; }

/* ------------------------------------------------------------- responsive --- */

@media (max-width: 1080px) {
  .cs-stage { grid-template-columns: minmax(0, .84fr) minmax(0, 1.4fr); }

  .cs-stage-lead { order: 1; }
  .cs-chat { order: 2; }

  .cs-print {
    order: 3;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 20ch) auto;
    align-items: center;
    justify-content: start;
    gap: clamp(20px, 3vw, 36px);
    rotate: 0deg;
  }

  .cs-print-cap { margin: 0; max-width: none; text-align: left; }
  .cs-print-frame { width: min(100%, 250px); }
}

@media (max-width: 900px) {
  .cs-mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 22px; }
  .cs-mode:nth-child(3) { border-left: 0; padding-left: 0; }
}

@media (max-width: 860px) {
  .cs-stage { grid-template-columns: minmax(0, 1fr); gap: 26px; }

  .cs-stage-lead,
  .cs-chat,
  .cs-print { order: 0; grid-column: auto; }

  .cs-stage-body { max-width: 52ch; }
  .cs-bubble { max-width: none; }
  .cs-print { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 0; }
  .cs-print-frame { width: min(100%, 230px); }
  .cs-stage-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; }
}

@media (max-width: 560px) {
  .cs-mode-grid { grid-template-columns: minmax(0, 1fr); gap: 26px; }

  .cs-mode + .cs-mode {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid rgba(27, 47, 92, .18);
    padding-top: 24px;
  }

  .cs-chat { padding: 10px; }
  .cs-stage-notes { grid-template-columns: minmax(0, 1fr); }
  .cs-demo { aspect-ratio: 4 / 3; }
}

@media (prefers-reduced-motion: reduce) {
  .cs-stage.is-armed .cs-turn,
  .cs-modes.is-armed .cs-lines li { opacity: 1; }

  .cs-stage.is-armed.is-live .cs-turn,
  .cs-modes.is-armed.is-live .cs-lines li { animation: none; }

  .cs-caret,
  .cs-lines li:last-child::after { animation: none; }
}
