/* apps.css — "Applications" section (#apps). Loaded after atlas.css.
   Two desktop apps, one row each: the product on a stage in its own theme,
   a short description beside it. No cards inside cards; the only accent is
   --seq-metal, the same gold both products use. */

#apps {
  position: relative;
  padding: clamp(4.4rem, 8vw, 7rem) clamp(1.15rem, 5.4vw, 7vw) clamp(3.4rem, 6vw, 5.4rem);
  background: var(--night-3, #070b12);   /* no-JS fallback */
  color: var(--dark-ink);
}
.flow-js #apps { background: none; }   /* sits on the shared sky layer */

.apps-inner { max-width: 1180px; margin: 0 auto; }

/* ── heading ─────────────────────────────────────────────────────── */
.apps-top { margin-bottom: clamp(3rem, 6vw, 5rem); }
.apps-hed {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4.4vw, 3.9rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -.034em;
  color: var(--dark-ink);
  max-width: 15ch;
  margin-bottom: 1rem;
}
.apps-hed em { font-style: italic; color: var(--seq-metal); }
.apps-sub {
  max-width: 50ch;
  font-size: .98rem;
  line-height: 1.8;
  color: rgba(228, 232, 240, .64);
}

/* ── one app per row ─────────────────────────────────────────────── */
.app-item {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.6rem);
  align-items: center;
}
.app-item + .app-item { margin-top: clamp(4.5rem, 10vw, 8.5rem); }
.app-item--flip { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.app-item--flip .app-media { order: 2; }

/* ── stage: the product sitting in its own theme ─────────────────── */
.app-media { min-width: 0; }
.app-stage {
  position: relative;
  display: grid;
  padding: 6.2% 6.2% 6.6%;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, .07);
  background: #0a0a0c;
  overflow: hidden;
  isolation: isolate;
}
.app-stage-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .7s var(--out);
}
.app-stage-art.is-on { opacity: 1; }

/* DileepKB has a paper theme, so its stage is paper */
.app-stage--paper {
  border-color: rgba(255, 255, 255, .16);
  background:
    radial-gradient(ellipse 70% 60% at 86% 104%, rgba(214, 168, 74, .5) 0%, rgba(214, 168, 74, 0) 70%),
    radial-gradient(ellipse 60% 50% at 6% -6%, rgba(255, 255, 255, .9) 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(158deg, #f5f1e7 0%, #ebe3d1 58%, #e0d2b2 100%);
}

.app-window {
  display: grid;
  border-radius: clamp(6px, .9vw, 11px);
  overflow: hidden;
  background: #0b0c10;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .09),
    0 34px 70px -26px rgba(0, 0, 0, .85),
    0 10px 24px -12px rgba(0, 0, 0, .6);
  transition: transform .8s var(--out), box-shadow .8s var(--out), opacity .45s var(--out);
}
.app-stage[data-theme="light"] .app-window {
  box-shadow:
    0 0 0 1px rgba(40, 28, 6, .16),
    0 34px 70px -28px rgba(74, 52, 12, .55),
    0 10px 24px -12px rgba(74, 52, 12, .3);
}
.app-stage--paper .app-window {
  background: #f6f3ec;
  box-shadow:
    0 0 0 1px rgba(40, 28, 6, .12),
    0 34px 70px -30px rgba(74, 52, 12, .5),
    0 10px 24px -14px rgba(74, 52, 12, .26);
}
.app-shot {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity .55s var(--out);
}
.app-shot.is-on { opacity: 1; }

@media (hover: hover) {
  .app-item:hover .app-window { transform: translateY(-5px); }
}

/* hovering a theme swatch clears the stage so the whole artwork shows */
.app-item .app-stage.is-preview .app-window {
  opacity: 0;
  transform: scale(.965);
}

/* under the stage: screens on the left, themes on the right */
.app-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0 .2rem;
}
.app-views {
  display: flex;
  gap: 1.5rem;
}
.app-view {
  position: relative;
  padding: .35rem 0;
  border: 0;
  background: none;
  font-family: var(--font-ui);
  font-size: .8rem;
  font-weight: 500;
  color: rgba(228, 232, 240, .46);
  cursor: inherit;
  transition: color .25s ease;
}
.app-view::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--seq-metal);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .45s var(--out);
}
.app-view:hover { color: rgba(240, 240, 248, .82); }
.app-view[aria-pressed="true"] { color: var(--dark-ink); }
.app-view[aria-pressed="true"]::after { transform: scaleX(1); }

/* ── copy ────────────────────────────────────────────────────────── */
.app-copy { min-width: 0; }
.app-id { display: flex; align-items: center; gap: .95rem; margin-bottom: 1.35rem; }
.app-icon {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 23%;
  box-shadow: 0 10px 22px -8px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .08);
}
.app-name {
  font-family: var(--font-main);
  font-size: 1.42rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.01em;
  color: var(--dark-ink);
}
.app-name--spaced { letter-spacing: .2em; font-weight: 500; }
.app-name b { font-weight: 600; color: var(--seq-metal); }
.app-kind {
  margin-top: .2rem;
  font-family: var(--font-ui);
  font-size: .78rem;
  line-height: 1.4;
  color: rgba(228, 232, 240, .5);
}
.app-desc {
  max-width: 30ch;
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 1.9vw, 1.6rem);
  line-height: 1.3;
  letter-spacing: -.012em;
  color: rgba(240, 240, 248, .92);
}

.app-points {
  list-style: none;
  margin-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.app-points li {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .72rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-family: var(--font-ui);
  font-size: .88rem;
  line-height: 1.45;
  color: rgba(232, 235, 242, .74);
}
.app-points svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--seq-metal);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-note {
  max-width: 44ch;
  margin-top: 1.1rem;
  font-family: var(--font-ui);
  font-size: .82rem;
  line-height: 1.6;
  color: rgba(228, 232, 240, .5);
}

/* theme swatches (AURUM ships in two) */
.app-themes { display: flex; align-items: center; gap: .6rem; }
.app-themes-label {
  margin-right: .3rem;
  font-family: var(--font-ui);
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(228, 232, 240, .42);
}
.app-theme {
  width: 50px;
  height: 31px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  overflow: hidden;
  background: #111;
  cursor: inherit;
  opacity: .62;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .14);
  transition: opacity .25s ease, box-shadow .25s ease, transform .35s var(--out);
}
.app-theme img { display: block; width: 100%; height: 100%; object-fit: cover; }
.app-theme:hover { opacity: 1; transform: translateY(-1px); }
.app-theme[aria-pressed="true"] {
  opacity: 1;
  box-shadow: 0 0 0 1px #070b12, 0 0 0 2.5px var(--seq-metal);
}
.app-view:focus-visible,
.app-theme:focus-visible { outline: 2px solid var(--seq-metal); outline-offset: 4px; }

/* ── tablets and phones ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-item { grid-template-columns: 1fr; gap: 1.9rem; }
  .app-item--flip .app-media { order: 0; }
  .app-desc { max-width: 34ch; }
}
@media (max-width: 600px) {
  .app-stage { padding: 5% 5% 5.4%; border-radius: 16px; }
  .app-controls { margin-top: .8rem; }
  .app-views { gap: 1.1rem; }
  .app-themes-label { display: none; }
  .app-icon { width: 50px; height: 50px; }
  .app-name { font-size: 1.28rem; }
  .app-desc { font-size: 1.24rem; }
}

@media (prefers-reduced-motion: reduce) {
  .app-window, .app-shot, .app-stage-art, .app-view::after, .app-theme { transition: none; }
  .app-item:hover .app-window,
  .app-item .app-stage.is-preview .app-window { transform: none; }
}
