/* ── Aether case study: the media that sits between the sections ─────────────
   Six small pictures of the product and the problem, drawn in HTML rather than
   recorded, in the same Obsidian-dark surface the hero film uses. The markup
   in the page is each picture's finished state; assets/js/aether-media.js arms
   them and plays the pieces in when a picture scrolls into view. Without the
   script, or with reduced motion, they simply sit finished.

   They stay dark in both themes: they are pictures of a dark app. */

/* .case-media.case-live, and .case-live.am-* below: the page's own
   placeholder rule (.case-media, in the page's <style>) comes later in the
   cascade, so these need the extra class to win. */
.case-media.case-live {
  --am-bg: #1e1e1e;
  --am-bg-2: #262626;
  --am-bg-3: #181818;
  --am-border: #363636;
  --am-text: #dadada;
  --am-muted: #a3a3a3;
  --am-faint: #6b6b6b;
  --am-accent: hsl(254, 80%, 72%);
  --am-accent-soft: hsla(254, 80%, 72%, 0.22);
  --am-hit: rgba(255, 208, 0, 0.28);
  --am-ease: cubic-bezier(0.22, 1, 0.36, 1);

  display: block;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--am-bg);
  color: var(--am-text);
  text-align: left;
  font-family: Inter, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  /* a grid item: without this a long unbroken line would widen the column */
  min-width: 0;
}

.case-live > * { min-width: 0; }

/* pictures, not page: nothing in them can be selected or hovered */
.case-live,
.case-live * {
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}

/* the mono label in a picture's corner */
.am-tag {
  font-family: var(--mono-font, Consolas, 'SF Mono', monospace);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--am-faint);
}

/* ---------------------------------------------------------- stepping ----- */
/* Armed by the script: every step starts hidden and rises in when its turn
   comes. Unarmed, everything is simply there. */
.case-live.is-armed [data-step] {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 420ms var(--am-ease), transform 520ms var(--am-ease);
}

.case-live.is-armed [data-step].is-on {
  opacity: 1;
  transform: none;
}

/* leaving for the next loop: all out together, quickly */
.case-live.is-armed.is-resetting [data-step] {
  transition: opacity 260ms ease;
  opacity: 0;
}

.am-caret {
  display: inline-block;
  width: 1.5px;
  height: 1.1em;
  margin-left: 1px;
  vertical-align: -0.18em;
  background: var(--am-text);
  animation: am-blink 1s steps(1) infinite;
}

@keyframes am-blink { 50% { opacity: 0; } }

/* ------------------------------------------------------------- graph ----- */
.case-live.am-graph { position: relative; }

.am-graph canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.am-graph-stat {
  position: absolute;
  left: 28px;
  bottom: 26px;
  z-index: 1;
}

.am-graph-num {
  display: block;
  font-size: 64px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.am-graph-sub {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--am-muted);
}

.am-graph .am-tag {
  position: absolute;
  top: 22px;
  left: 28px;
  z-index: 1;
}

/* a soft floor under the number so it reads over the nodes */
.am-graph::before {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 45%;
  background: linear-gradient(to top, var(--am-bg) 8%, transparent);
  z-index: 1;
  pointer-events: none;
}

/* ------------------------------------------------------------ search ----- */
.case-live.am-search {
  display: flex;
  flex-direction: column;
  padding: 22px 24px 20px;
}

.am-search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--am-border);
  border-radius: 6px;
  background: var(--am-bg-2);
  font-size: 14px;
}

.am-search-field svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--am-faint);
}

.am-search-count {
  margin: 14px 0 6px;
  font-size: 11px;
  color: var(--am-faint);
}

.am-results {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.am-result {
  min-width: 0;
  padding: 9px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.am-result-file {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  font-weight: 600;
}

.am-result-file span {
  font-weight: 400;
  font-size: 11px;
  color: var(--am-faint);
}

.am-result-line {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--am-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-result-line mark {
  padding: 0 2px;
  border-radius: 2px;
  background: var(--am-hit);
  color: var(--am-text);
}

.am-search-foot {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--am-border);
  font-size: 12.5px;
  color: var(--am-text);
}

.am-search-foot span { color: var(--am-faint); }

/* --------------------------------------------------------- retrieval ----- */
.case-live.am-retrieve {
  display: flex;
  flex-direction: column;
  padding: 22px 24px 20px;
}

.am-question {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin: 12px 0 0;
  padding: 9px 14px;
  border: 1px solid var(--am-border);
  border-radius: 10px;
  background: var(--am-bg-2);
  font-size: 14px;
}

.am-question svg {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--am-muted);
}

/* the drop from the question to what it pulled back */
.am-thread {
  margin: 0 0 0 21px;
  padding: 12px 0 10px 16px;
  border-left: 1px solid var(--am-border);
  font-size: 11px;
  color: var(--am-faint);
}

.am-chunks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  flex: 1;
  align-content: start;
}

.am-chunk {
  padding: 10px 12px 11px;
  border: 1px solid var(--am-border);
  border-radius: 8px;
  background: #211f2b;
  border-color: #3a3650;
}

.am-chunk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--am-accent);
}

.am-score {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono-font, Consolas, 'SF Mono', monospace);
  font-weight: 400;
  color: var(--am-muted);
}

.am-score i {
  display: block;
  width: 44px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.am-score i::before {
  content: '';
  display: block;
  width: var(--s);
  height: 100%;
  background: var(--am-accent);
}

.am-chunk p {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
}

.am-chunk mark {
  padding: 0 2px;
  border-radius: 2px;
  background: var(--am-accent-soft);
  color: #fff;
}

.am-retrieve-foot {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--am-muted);
}

/* ------------------------------------------------ ask / answer stills ----- */
.case-live.am-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 28px 26px;
}

/* the note the sheet is opened over: there, but out of focus */
.am-note {
  position: absolute;
  inset: 0;
  padding: 44px 40px;
  filter: blur(1.2px);
  opacity: 0.8;
}

.am-note h4 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.am-note p {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--am-muted);
}

.am-note .am-note-meta { font-size: 11px; color: var(--am-faint); }

/* the dimming that rises behind the sheet */
.am-sheet::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.62) 38%, rgba(0, 0, 0, 0) 88%);
  z-index: 1;
}

.am-sheet > .am-tag {
  position: absolute;
  top: 22px;
  left: 28px;
  z-index: 2;
  color: var(--am-muted);
}

.am-sheet-body { position: relative; z-index: 2; }

.am-answer {
  margin: 0 0 12px;
  padding: 0 4px;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.005em;
}

.am-cite {
  display: inline-block;
  min-width: 15px;
  margin-left: 3px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--am-accent-soft);
  color: var(--am-accent);
  font-size: 10px;
  line-height: 15px;
  text-align: center;
  vertical-align: 0.35em;
}

.am-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.am-pills li {
  padding: 3px 10px;
  border-radius: 999px;
  background: #2c2c2c;
  font-size: 11.5px;
  color: var(--am-muted);
}

.am-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 8px 0 14px;
  border: 1px solid var(--am-border);
  border-radius: 12px;
  background: rgba(38, 38, 38, 0.92);
  font-size: 14px;
}

.am-bar > svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--am-muted);
}

.am-bar-q {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.am-send {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  background: #e8e8e8;
  color: #1e1e1e;
}

.am-send svg { width: 13px; height: 13px; }

.am-keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
  margin: 9px 0 0;
  font-size: 11px;
  color: var(--am-faint);
}

.am-keys kbd {
  margin-right: 5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: #2f2f2f;
  color: var(--am-muted);
  font: 10px var(--mono-font, Consolas, 'SF Mono', monospace);
}

/* ----------------------------------------------------------- watcher ----- */
.case-live.am-watch {
  display: flex;
  flex-direction: column;
  padding: 20px 18px 18px;
}

.am-watch-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--am-border);
  font-size: 12px;
  color: var(--am-muted);
}

.am-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5);
  animation: am-pulse 2s ease-out infinite;
}

@keyframes am-pulse {
  70%, 100% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); }
}

.am-events {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.am-event {
  padding: 13px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.am-event-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--mono-font, Consolas, 'SF Mono', monospace);
  font-size: 10px;
  color: var(--am-faint);
}

.am-verb {
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--am-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.am-verb.is-del { background: rgba(248, 113, 113, 0.14); color: #f0a0a0; }
.am-verb.is-new { background: rgba(74, 222, 128, 0.12); color: #8fdcab; }

.am-event-file {
  margin: 6px 0 2px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-event-out {
  margin: 0;
  font-size: 11.5px;
  color: var(--am-accent);
}

.am-watch-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--am-text);
}

.am-watch-foot svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: #4ade80;
}

/* ------------------------------------------------------ small screens ----- */
@media (max-width: 1024px) {
  .case-live.am-search,
  .case-live.am-retrieve { padding: 18px 16px 16px; }
  .case-live.am-sheet { padding: 0 16px 18px; }
  .case-live.am-sheet { min-height: 380px; }
  .am-note { padding: 40px 20px; }
  .am-sheet > .am-tag { left: 16px; top: 18px; }
  .am-graph-num { font-size: 48px; }
  .am-graph-stat { left: 18px; bottom: 18px; }
  .am-graph .am-tag { left: 18px; top: 18px; }
  .am-answer { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .am-caret,
  .am-dot { animation: none; }
}

/* ═══════════════════════════════════════════ the design-decision pictures ═ */

/* skeleton text: a stack of bars standing in for lines of a note */
.am-lines {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.am-lines i {
  display: block;
  width: var(--w, 100%);
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.13);
}

.am-lines i:first-child { height: 8px; background: rgba(255, 255, 255, 0.26); margin-bottom: 4px; }

/* ----------------------------------------------- chat panel vs. the bar --- */
.case-live.am-compare {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-content: center;
  padding: 28px;
}

.am-win {
  position: relative;
  display: flex;
  height: 250px;
  border: 1px solid var(--am-border);
  border-radius: 8px;
  background: var(--am-bg-2);
  overflow: hidden;
}

.am-win > .am-lines { flex: 1; padding: 18px 16px; min-width: 0; }

.am-win-chat {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 42%;
  padding: 14px 10px 10px;
  border-left: 1px solid var(--am-border);
  background: var(--am-bg-3);
}

.am-bub {
  width: 82%;
  height: 26px;
  border-radius: 8px 8px 8px 2px;
  background: rgba(255, 255, 255, 0.09);
}

.am-bub.is-me {
  align-self: flex-end;
  width: 64%;
  height: 18px;
  border-radius: 8px 8px 2px 8px;
  background: var(--am-accent-soft);
}

.am-chat-in {
  margin-top: auto;
  height: 22px;
  border: 1px solid var(--am-border);
  border-radius: 6px;
}

.am-win-bar {
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid #4a4a4a;
  border-radius: 9px;
  background: #2e2e2e;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.am-win-bar svg { width: 11px; height: 11px; flex: none; color: var(--am-muted); }
.am-win-bar span { width: 46%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.22); }

.am-opt-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 3px;
  font-size: 13px;
  font-weight: 600;
}

.am-opt-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--am-muted);
}

.am-chip {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.am-chip.is-no { background: rgba(248, 113, 113, 0.14); color: #f0a0a0; }
.am-chip.is-yes { background: var(--am-accent-soft); color: var(--am-accent); }

/* the rejected option sits back */
.am-opt:first-child .am-win { opacity: 0.55; }

/* ---------------------------------------------------- hold space cue ----- */
.am-cue {
  margin: 0 0 10px 4px;
  font-size: 11px;
  color: var(--am-muted);
}

.am-cue kbd {
  margin-right: 7px;
  padding: 2px 14px;
  border: 1px solid #4a4a4a;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #2a2a2a;
  color: var(--am-text);
  font: 10px var(--mono-font, Consolas, 'SF Mono', monospace);
}

/* -------------------------------------------------------------- tilt ----- */
.case-live.am-tilt { position: relative; }

.am-tilt > .am-tag { position: absolute; top: 22px; left: 28px; }

.am-tilt-scene {
  position: absolute;
  inset: 56px 44px 64px;
}

.am-tilt-ghost {
  position: absolute;
  inset: 0;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 6px;
}

/* The app itself. Same move as the plugin makes on Obsidian: pivot on the
   top edge, three degrees back. The picture is about 0.38 of a real window,
   so the perspective distance is scaled by the same amount (900px to 340px)
   and the narrowing at the bottom is in true proportion. */
.am-tilt-app {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 24% 1fr;
  border: 1px solid var(--am-border);
  border-radius: 6px;
  background: var(--am-bg-2);
  overflow: hidden;
  transform-origin: 50% 0;
  transform: perspective(340px) rotateX(-3deg);
}

.am-tilt-side { padding: 18px 12px; border-right: 1px solid var(--am-border); background: var(--am-bg-3); }
.am-tilt-side i:first-child { height: 5px; background: rgba(255, 255, 255, 0.13); margin: 0; }
.am-tilt-note { padding: 20px 26px; }
.am-tilt-note i[style*="--w: 0"] { background: none; height: 3px; }

.case-live.is-armed .am-tilt-app[data-step],
.case-live.is-armed.is-resetting .am-tilt-app[data-step] {
  opacity: 1;
  transform: perspective(340px) rotateX(0deg);
  transition: transform 700ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.case-live.is-armed .am-tilt-app[data-step].is-on { transform: perspective(340px) rotateX(-3deg); }

/* the dim that arrives with the tilt */
.am-tilt-dim {
  position: absolute;
  inset: 40% 0 0;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent);
}

.case-live.is-armed .am-tilt-dim[data-step] { transform: none; transition: opacity 700ms ease; }

.am-tilt-bar {
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 16px;
  min-height: 34px;
  font-size: 12.5px;
  color: var(--am-faint);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.am-tilt-label {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 22px;
  margin: 0;
  font-size: 12px;
  color: var(--am-muted);
}

/* -------------------------------------------------- progressive blur ----- */
.case-live.am-blur {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 28px 26px;
}

.am-blur-note {
  position: absolute;
  inset: 0;
  padding: 52px 64px 0 36px;
  overflow: hidden;
}

.am-blur-note h4 { margin: 0 0 10px; font-size: 18px; font-weight: 700; }
.am-blur-note p { margin: 0 0 10px; font-size: 12.5px; line-height: 1.6; color: var(--am-muted); }

/* Siblings, each a little stronger and starting a little lower than the last,
   each faded in by its own mask - so the blur builds down the picture with no
   edge anywhere. The same construction the plugin uses. */
.am-blur-l {
  position: absolute;
  inset: 0;
  -webkit-backdrop-filter: blur(var(--b));
  backdrop-filter: blur(var(--b));
  -webkit-mask-image: linear-gradient(to bottom, transparent var(--from), #000 calc(var(--from) + 22%));
  mask-image: linear-gradient(to bottom, transparent var(--from), #000 calc(var(--from) + 22%));
}

.am-blur-dim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.66) 0%, rgba(0, 0, 0, 0.5) 36%, rgba(0, 0, 0, 0) 78%);
}

.am-blur-scale {
  position: absolute;
  top: 20%;
  bottom: 22%;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font: 9px var(--mono-font, Consolas, 'SF Mono', monospace);
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--am-muted);
}

.am-blur-scale span { writing-mode: vertical-rl; }

.am-blur-scale i {
  flex: 1;
  width: 2px;
  border-radius: 1px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.12), var(--am-accent));
}

.am-blur > .am-tag { position: absolute; top: 22px; left: 36px; color: var(--am-muted); }
.am-blur .am-sheet-body { padding-right: 28px; }

/* ------------------------------------------------- insert as callout ----- */
.case-live.am-insert { position: relative; padding: 56px 36px 30px; }

.am-insert > .am-tag { position: absolute; top: 22px; left: 36px; }

.am-doc h4 { margin: 0 0 4px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.am-doc p { margin: 0 0 12px; font-size: 13px; line-height: 1.6; }
.am-doc .am-doc-meta { font-size: 11px; color: var(--am-faint); }

.am-callout {
  margin: 0 0 14px;
  padding: 11px 14px 12px;
  border-radius: 6px;
  background: rgba(233, 151, 63, 0.1);
}

.am-callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #e9973f;
}

.am-callout-title svg { width: 15px; height: 15px; flex: none; }
.am-callout p { margin: 0 0 8px; }
.am-callout .am-callout-src { margin: 0; font-size: 12px; color: var(--am-muted); }
.am-callout-src b { font-weight: 400; color: var(--am-accent); }

@media (max-width: 1024px) {
  .case-live.am-compare { padding: 18px 16px; gap: 12px; }
  .am-win { height: 200px; }
  .am-tilt-scene { inset: 52px 22px 76px; }
  .am-tilt > .am-tag, .am-insert > .am-tag { left: 18px; top: 18px; }
  .am-tilt-label { left: 18px; right: 18px; bottom: 16px; }
  .case-live.am-blur { padding: 0 16px 18px; }
  .am-blur-note { padding: 48px 44px 0 18px; }
  .am-blur > .am-tag { left: 18px; top: 18px; }
  .case-live.am-insert { padding: 50px 18px 22px; }
}
