/* ==========================================================================
   Shared Room Window-Stack Architecture & 3D Device Screens
   Matches main portfolio light/dark tokens + sticky window deck presentation
   ========================================================================== */

@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/onest-latin.woff2') format('woff2');
}

:root {
  --bg: #E8E4E0;
  --fg: #1A1818;
  --card: #F3F0EC;
  --card-2: #EAE5DF;
  --card-line: rgba(26, 24, 24, 0.10);
  --muted: rgba(26, 24, 24, 0.68);
  --muted-2: rgba(26, 24, 24, 0.46);
  --accent: #6B4F4F;
  --accent-soft: rgba(107, 79, 79, 0.12);
  --room: #FBFAF8;
  --shadow: 0 24px 64px -18px rgba(26, 24, 24, 0.18), 0 6px 20px -4px rgba(26, 24, 24, 0.06);
  --nav-h: 70px;
  --font-sans: 'Onest', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Onest', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Onest', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --e-out: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-mode="dark"] {
  --bg: #151313;
  --fg: #EDE9E4;
  --card: #211E1E;
  --card-2: #2A2626;
  --card-line: rgba(237, 233, 228, 0.10);
  --muted: rgba(237, 233, 228, 0.72);
  --muted-2: rgba(237, 233, 228, 0.45);
  --accent: #C9A69C;
  --accent-soft: rgba(201, 166, 156, 0.14);
  --room: #1B1818;
  --shadow: 0 28px 72px -18px rgba(0, 0, 0, 0.62), 0 6px 20px rgba(0, 0, 0, 0.32);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.55;
  overflow-x: clip;
  transition: background-color 0.35s ease, color 0.35s ease;
}

img, video, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }

/* Entry Portal Curtain */
.glow {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, rgba(251, 250, 248, 0.85), var(--bg) 72%);
  opacity: 0;
  transition: opacity 0.65s var(--e-out);
}
html[data-mode="dark"] .glow {
  background: radial-gradient(circle at 50% 42%, rgba(45, 38, 36, 0.85), var(--bg) 72%);
}
html.entering .glow { opacity: 1; }

/* Room Top Navigation (.rn) */
.rn {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 clamp(14px, 3vw, 40px);
  background: rgba(232, 228, 224, 0.84);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-line);
  transition: background-color 0.35s ease, border-color 0.35s ease;
}
html[data-mode="dark"] .rn {
  background: rgba(21, 19, 19, 0.84);
}

.rn__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.rn__back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s var(--e-out), opacity 0.2s ease;
}
.rn__back:hover { transform: translateY(-1px); opacity: 0.92; }
.rn__back svg { width: 14px; height: 14px; flex-shrink: 0; }

.rn__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0.86;
  padding: 6px 4px;
}

.rn__links {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.rn__links::-webkit-scrollbar { display: none; }

.rn__link {
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.rn__link:hover { color: var(--fg); background: var(--accent-soft); }
.rn__link.is-active {
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--card-line);
  font-weight: 600;
}

.rn__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.rn__time {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--card-line);
  white-space: nowrap;
}

.rn__mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--card-line);
  background: var(--card);
  color: var(--fg);
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.rn__mode:hover { transform: scale(1.05); }
.rn__mode svg { width: 15px; height: 15px; }

.rn__cta {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--fg);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.rn__cta:hover { background: var(--fg); color: var(--bg); }

.rn__burger {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--card-line);
  background: var(--card);
  font-size: 12.5px;
  font-weight: 600;
}
.rn__burger svg { width: 15px; height: 15px; }

/* Mobile Room Menu Drawer */
.rn__panel {
  position: fixed;
  inset: var(--nav-h) 0 0 0;
  z-index: 75;
  background: var(--bg);
  padding: 20px 18px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s var(--e-out);
}
.rn__panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.rn__pitem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--card-line);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}
.rn__pitem.is-active {
  border-color: var(--accent);
  font-weight: 600;
}
.rn__pitem small { font-size: 11px; color: var(--muted); }
.rn__psep { height: 1px; background: var(--card-line); margin: 8px 0; }

/* Intro Banner */
.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 clamp(14px, 3.6vw, 40px);
}

.intro {
  padding: clamp(28px, 4.5vw, 56px) 0 clamp(22px, 3vw, 38px);
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.9fr);
  gap: clamp(18px, 3vw, 40px);
  align-items: end;
}

.intro__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
}
.intro__eyebrow::before {
  content: '';
  width: 18px;
  height: 1.5px;
  background: var(--accent);
}

.intro__h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 4.1vw, 54px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.intro__h1 em {
  font-family: var(--font-sans);
  font-style: normal;
  font-weight: 800;
  color: var(--accent);
}

.intro__sub {
  margin: 14px 0 0;
  font-size: clamp(14.5px, 1.25vw, 17px);
  line-height: 1.6;
  color: var(--muted);
  max-width: 58ch;
}

.intro__side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--card-line);
}
.intro__meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-2);
  font-weight: 600;
}
.intro__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.intro__pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--card-line);
  font-weight: 500;
}
.intro__action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  margin-top: 2px;
  transition: transform 0.2s var(--e-out);
}
.intro__action:hover { transform: translateY(-1px); }

/* ==========================================================================
   Sticky Stacked Windows (.stack -> .card)
   ========================================================================== */

.stack {
  position: relative;
  padding-bottom: 10vh;
}

.card {
  position: sticky;
  top: calc(var(--nav-h) + 14px + var(--i, 0) * 14px);
  margin-bottom: 6vh;
  border-radius: 28px;
  background: var(--card);
  border: 1px solid var(--card-line);
  box-shadow: var(--shadow);
  transform-origin: 50% 0%;
  will-change: transform;
  overflow: hidden;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.card__dim {
  position: absolute;
  inset: 0;
  background: #0B0A0A;
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.06s linear;
}

.card__in {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(22px, 3.6vw, 48px);
  padding: clamp(26px, 3.8vw, 50px);
  min-height: min(calc(100vh - var(--nav-h) - 104px), 660px);
}

.card.flip .card__in {
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
}
.card.flip .card__info { order: 2; }

.card__info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.card__win {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  margin-bottom: 14px;
}
.card__win-dots {
  display: inline-flex;
  gap: 4px;
}
.card__win-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.65;
}

.card__h {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(24px, 2.5vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
}

.card__p {
  margin: 12px 0 0;
  font-size: clamp(14px, 1.12vw, 16px);
  line-height: 1.6;
  color: var(--muted);
}

.card__points {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card__points li {
  position: relative;
  padding-left: 16px;
  font-size: 13.5px;
  color: var(--fg);
  opacity: 0.88;
}
.card__points li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 600;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}
.tag {
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--card-line);
  color: var(--muted);
}

.card__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  background: var(--fg);
  color: var(--bg);
  transition: transform 0.2s var(--e-out), opacity 0.2s ease;
}
.btn:hover { transform: translateY(-1px); opacity: 0.92; }
.btn--ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--card-line);
}
.btn--ghost:hover { background: var(--accent-soft); opacity: 1; }

/* Staggered info reveal inside .card */
.card__info > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s var(--e-out), transform 0.55s var(--e-out);
}
.card.seen .card__info > * {
  opacity: 1;
  transform: none;
}
.card.seen .card__info > *:nth-child(2) { transition-delay: 50ms; }
.card.seen .card__info > *:nth-child(3) { transition-delay: 100ms; }
.card.seen .card__info > *:nth-child(4) { transition-delay: 150ms; }
.card.seen .card__info > *:nth-child(5) { transition-delay: 200ms; }
.card.seen .card__info > *:nth-child(6) { transition-delay: 250ms; }

/* ==========================================================================
   3D Device Stage (.stage -> .mon / .phone)
   ========================================================================== */

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  perspective: 1900px;
  perspective-origin: 50% 42%;
  padding: 10px 0 18px;
  min-width: 0;
}

.stage::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 74%;
  height: 22px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.24) 0%, transparent 72%);
  pointer-events: none;
}
html[data-mode="dark"] .stage::after {
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.52) 0%, transparent 72%);
}

/* 3D Desktop Monitor (.mon) */
.mon {
  width: 100%;
  max-width: 640px;
  transform: rotateY(-13deg) rotateX(3.5deg);
  transition: transform 0.7s var(--e-out);
}
.card.flip .mon {
  transform: rotateY(13deg) rotateX(3.5deg);
}
.card:hover .mon {
  transform: rotateY(-7deg) rotateX(2deg);
}
.card.flip:hover .mon {
  transform: rotateY(7deg) rotateX(2deg);
}

.mon__body {
  position: relative;
  border-radius: 16px;
  padding: 11px;
  background: linear-gradient(145deg, #2d2b2c 0%, #171516 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    0 24px 52px -14px rgba(0, 0, 0, 0.40),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.mon__body::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 17px;
  background: linear-gradient(90deg, rgba(190, 185, 180, 0.36), transparent 16%, transparent 84%, rgba(190, 185, 180, 0.32));
  z-index: -1;
  pointer-events: none;
}

.mon__screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  overflow: hidden;
  background: #0B101B;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #EDF2F7;
}

.mon__screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(122deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.02) 32%, transparent 54%);
  pointer-events: none;
  z-index: 12;
}

.mon__neck {
  width: 15%;
  height: 26px;
  margin: 0 auto;
  background: linear-gradient(90deg, #98938D, #DBD7D1 45%, #ACA7A1 80%, #7F7B76);
  box-shadow: inset 0 4px 6px rgba(0, 0, 0, 0.25);
}

.mon__foot {
  width: 34%;
  height: 7px;
  margin: 0 auto;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #D5D0CA 0%, #8E8A84 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
}

/* 3D Titanium Phone (.phone) */
.phone {
  --w: clamp(190px, calc((100svh - var(--nav-h) - 230px) * 0.52), 268px);
  width: var(--w);
  position: relative;
  transform: rotateY(-17deg) rotateX(4.5deg) rotateZ(0.9deg);
  transition: transform 0.7s var(--e-out);
}
.card.flip .phone {
  transform: rotateY(17deg) rotateX(4.5deg) rotateZ(-0.9deg);
}
.card:hover .phone {
  transform: rotateY(-9deg) rotateX(2.5deg);
}
.card.flip:hover .phone {
  transform: rotateY(9deg) rotateX(2.5deg);
}

.phone__body {
  position: relative;
  border-radius: 34px;
  padding: 9px;
  background: linear-gradient(145deg, #433F3D 0%, #1A1818 55%, #2D2A29 100%);
  border: 1px solid rgba(255, 255, 255, 0.20);
  box-shadow:
    0 26px 56px -14px rgba(0, 0, 0, 0.48),
    inset 0 1px 1px rgba(255, 255, 255, 0.25);
}

.phone__btn {
  position: absolute;
  width: 3px;
  border-radius: 2px;
  background: rgba(210, 205, 200, 0.45);
}
.phone__btn--p { right: -3px; top: 26%; height: 13%; }
.phone__btn--v1 { left: -3px; top: 20%; height: 9%; }
.phone__btn--v2 { left: -3px; top: 32%; height: 9%; }

.phone__screen {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 18.6;
  border-radius: 25px;
  overflow: hidden;
  background: #0A0E17;
  color: #F2F5FA;
}

.phone__screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.11) 0%, transparent 45%);
  pointer-events: none;
  z-index: 12;
}

.island {
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 30%;
  height: 13px;
  border-radius: 999px;
  background: #040404;
  z-index: 14;
}

.sbar {
  position: absolute;
  top: 6px;
  left: 14px;
  right: 14px;
  z-index: 13;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}

/* ==========================================================================
   Inside Screen Media, Controls & Reusable Mini-OS Workspace UI
   ========================================================================== */

.scr-media {
  position: relative;
  width: 100%;
  height: 100%;
  background: #090D16;
}
.mon__screen[data-scr-panels] .scr-media {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.28s ease;
}
.mon__screen[data-scr-panels] .scr-media.is-active {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

.mon__screen.is-video::after {
  display: none;
}

.mon__vid {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #05070E;
  display: block;
}

.scr-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scr-img--top { object-position: 50% 0%; }
.scr-img--contain { object-fit: contain; background: #0A0F1E; }

.scr-dock {
  position: relative;
  z-index: 8;
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.scr-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--card-line);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.scr-tab {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.scr-tab:hover { color: var(--fg); }
.scr-tab.is-on {
  background: var(--fg);
  color: var(--bg);
}

.scr-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--card-line);
}
.scr-pill i.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
  animation: scrPulse 1.6s ease-in-out infinite;
}

/* Mini App Chrome inside Screens */
.scr-app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #0D121F;
  color: #E7ECF5;
  font-size: clamp(9.5px, 0.95vw, 11.5px);
  overflow: hidden;
}

.scr-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 11px;
  background: #141B2D;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.scr-dots {
  display: flex;
  gap: 4px;
}
.scr-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}
.scr-dots span:nth-child(1) { background: #F87171; }
.scr-dots span:nth-child(2) { background: #FBBF24; }
.scr-dots span:nth-child(3) { background: #34D399; }

.scr-url {
  flex: 1;
  max-width: 62%;
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scr-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.14);
  color: #6EE7B7;
  white-space: nowrap;
}

.scr-body {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

/* Auto-scrolling inner frame for screens (`data-autoscroll`) */
.scr-scroll {
  display: flex;
  flex-direction: column;
  gap: 7px;
  will-change: transform;
}

/* Pause animations cleanly when card is off-screen */
.card:not(.is-visible) .scr-anim,
.card:not(.is-visible) * {
  animation-play-state: paused !important;
}
.card.is-visible .scr-anim {
  animation-play-state: running;
}

@keyframes scrPulse {
  0%, 100% { opacity: 0.45; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.1); }
}

@keyframes scrScanY {
  0% { transform: translateY(-20%); opacity: 0.1; }
  15% { opacity: 0.85; }
  85% { opacity: 0.85; }
  100% { transform: translateY(420%); opacity: 0.1; }
}

@keyframes scrFlowX {
  0% { stroke-dashoffset: 48; }
  100% { stroke-dashoffset: 0; }
}

.scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(180deg, transparent, rgba(56, 189, 248, 0.16), transparent);
  pointer-events: none;
  z-index: 3;
  animation: scrScanY 4.5s linear infinite;
}

/* Footer & Bottom Navigation Ring */
.room-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0 36px;
  border-top: 1px solid var(--card-line);
}
.room-pager__group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sf {
  border-top: 1px solid var(--card-line);
  padding: 32px 0 42px;
  background: var(--bg);
}
.sf__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.sf__h {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: clamp(20px, 2.2vw, 28px);
  letter-spacing: -0.02em;
}
.sf__p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  max-width: 54ch;
}
.sf__meta {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--card-line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted-2);
}

/* Scroll Progress To-Top Ring */
.totop {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 65;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--card-line);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s var(--e-out);
}
.totop.is-shown {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.totop svg.ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.totop svg.ring circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-dasharray: 113.1;
  stroke-dashoffset: calc(113.1 * (1 - var(--p, 0)));
}
.totop span {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1024px) {
  .rn__links, .rn__time, .rn__cta { display: none; }
  .rn__burger { display: inline-flex; }
}

@media (max-width: 899.98px) {
  :root { --nav-h: 60px; }

  .rn { padding: 0 14px; }
  .rn__brand { display: none; }

  .intro {
    grid-template-columns: 1fr;
    padding: 20px 0 18px;
    gap: 14px;
  }
  .intro__side {
    padding: 14px 16px;
    border-radius: 16px;
  }

  .stack { padding-bottom: 6vh; }

  .card {
    top: calc(var(--nav-h) + 8px + var(--i, 0) * 10px);
    margin-bottom: 4.5vh;
    border-radius: 22px;
  }

  .card__in,
  .card.flip .card__in {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 15px 15px 18px;
    min-height: auto;
  }

  .card .stage {
    order: -1;
    padding: 2px 0 14px;
  }
  .card.flip .card__info {
    order: 0;
  }

  .mon,
  .card.flip .mon,
  .card:hover .mon,
  .card.flip:hover .mon {
    transform: rotateY(-7deg) rotateX(2.5deg);
    max-width: 100%;
  }
  .mon__body {
    border-radius: 12px;
    padding: 6px;
  }
  .mon__screen {
    border-radius: 6px;
    aspect-ratio: 16 / 10;
  }
  .mon__neck { height: 15px; }
  .mon__foot { height: 5px; }

  .phone,
  .card.flip .phone,
  .card:hover .phone,
  .card.flip:hover .phone {
    --w: clamp(148px, 42vw, 186px);
    transform: rotateY(-10deg) rotateX(3deg);
  }
  .phone__body {
    border-radius: 24px;
    padding: 6px;
  }
  .phone__screen {
    border-radius: 18px;
    aspect-ratio: 9 / 17;
  }
  .island { height: 10px; top: 5px; }
  .sbar { font-size: 7.5px; top: 4px; left: 10px; right: 10px; }

  .card__win {
    font-size: 10px;
    padding: 4px 9px;
    margin-bottom: 9px;
  }
  .card__h {
    font-size: clamp(20px, 5.4vw, 25px);
  }
  .card__p {
    margin-top: 8px;
    font-size: 13.5px;
    line-height: 1.5;
  }
  .card__points {
    margin-top: 10px;
    gap: 4px;
  }
  .card__points li {
    font-size: 12.5px;
  }
  .tags {
    margin-top: 11px;
    gap: 5px;
  }
  .tag {
    font-size: 10.5px;
    padding: 3px 8px;
  }
  .card__btns {
    margin-top: 13px;
    gap: 8px;
  }
  .btn {
    padding: 8px 14px;
    font-size: 12.5px;
  }

  .scr-dock { margin-top: 9px; gap: 6px; }
  .scr-tab { padding: 4px 9px; font-size: 10px; }
  .scr-pill { padding: 4px 9px; font-size: 10px; }
}

@media (max-width: 374.98px) {
  .rn__back span { font-size: 12px; }
  .card__in, .card.flip .card__in { padding: 12px 12px 15px; gap: 12px; }
  .card__h { font-size: 19px; }
  .card__p { font-size: 12.5px; }
  .phone { --w: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .mon, .phone, .card__info > * {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
  .card__dim { opacity: 0 !important; }
  *, *::before, *::after { animation-duration: 0.01ms !important; }
}
