/* ========================================================================
   thedevice.css — The Device identity, standalone.
   Deliberately does NOT import the parent site's styles.css. This page
   lives in the app's own cosmos (PastelColors.swift / DeviceFonts.swift):
   deep purple starfields, a refractive glass pyramid, pastel brick UI.

   Type system mirrors the app: Orbitron (display), Cormorant Garamond
   (mystical prose), Space Mono (readouts), Inter Tight (utility body).

   Contrast contract (verified pairs; do not deviate without re-checking):
   - ink #F2EDF5 on #140A26 15.6:1; lavender #D9CCF2 on #140A26 11.4:1
   - accent text #A98FD1 on #140A26 5.6:1 (AA); decorative purples
     (#592E8C, #8059A6) are never used as body-copy text
   - pastel fills carry #261447 ink (worst pair mint/lemon > 9:1;
     lavender #C9B5FF vs #261447 7.9:1) — never white-on-pastel
   ======================================================================== */

:root {
  --dv-bg:       #140A26;
  --dv-surface:  #1D1035;
  --dv-deep:     #261447;
  --dv-purple:   #592E8C;
  --dv-purple-2: #8059A6;
  --dv-ink:      #F2EDF5;   /* foggyWhite */
  --dv-ink-2:    #D9CCF2;   /* mysticalText */
  --dv-accent:   #A98FD1;   /* text-safe lavender-purple */
  --dv-rule:     rgba(169, 143, 209, 0.22);
  --dv-glow:     rgba(201, 181, 255, 0.4);
  /* pastel bricks */
  --dv-pink: #FFB5C2; --dv-lav: #C9B5FF; --dv-mint: #99F5D1; --dv-peach: #FFCCA3;
  --dv-sky: #ADD9FF; --dv-lemon: #FFF7A6; --dv-coral: #FFA1A1; --dv-lilac: #DEB5FF;
  --dv-brick-ink: #261447;
  /* trophies */
  --dv-silver: #C9CDD6; --dv-gold: #E8C56A; --dv-platinum: #DDE3EA; --dv-diamond: #BDE8F2;
  --orbitron: 'Orbitron', 'Inter Tight', sans-serif;
  --cormorant: 'Cormorant Garamond', Georgia, serif;
  --smono: 'Space Mono', ui-monospace, monospace;
  --sans: 'Inter Tight', system-ui, -apple-system, sans-serif;
  --col: 900px;
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--dv-bg);
  color: var(--dv-ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--dv-lav); color: var(--dv-brick-ink); }

img { max-width: 100%; height: auto; display: block; }

a { color: var(--dv-accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--dv-ink); }

a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--dv-lav);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -52px;
  background: var(--dv-lav); color: var(--dv-brick-ink);
  font-family: var(--smono); font-size: 0.875rem;
  padding: 10px 18px; border-radius: 6px; text-decoration: none;
  z-index: 10001; transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

/* ---------- Starfield (three fixed layers; JS parallax, CSS drift) ---------- */

.starlayer {
  position: fixed; inset: -60px;
  pointer-events: none;
  background-repeat: repeat;
  z-index: 0;
  will-change: transform;
}
.starlayer.s1 {
  background-image: radial-gradient(1px 1px at 12px 18px, rgba(217, 204, 242, 0.9), transparent 55%),
                    radial-gradient(1px 1px at 74px 96px, rgba(217, 204, 242, 0.6), transparent 55%),
                    radial-gradient(1.5px 1.5px at 130px 40px, rgba(255, 255, 255, 0.85), transparent 55%),
                    radial-gradient(1px 1px at 168px 140px, rgba(217, 204, 242, 0.5), transparent 55%);
  background-size: 190px 190px;
  animation: drift-a 160s linear infinite;
}
.starlayer.s2 {
  background-image: radial-gradient(1px 1px at 40px 60px, rgba(201, 181, 255, 0.7), transparent 55%),
                    radial-gradient(1.5px 1.5px at 110px 20px, rgba(255, 255, 255, 0.6), transparent 55%),
                    radial-gradient(1px 1px at 220px 120px, rgba(201, 181, 255, 0.45), transparent 55%);
  background-size: 260px 260px;
  animation: drift-b 240s linear infinite;
}
.starlayer.s3 {
  background-image: radial-gradient(2px 2px at 80px 80px, rgba(255, 255, 255, 0.9), transparent 55%),
                    radial-gradient(1.5px 1.5px at 200px 30px, rgba(189, 232, 242, 0.7), transparent 55%);
  background-size: 340px 340px;
  animation: drift-c 320s linear infinite;
}
@keyframes drift-a { to { background-position: -190px 190px; } }
@keyframes drift-b { to { background-position: 260px -260px; } }
@keyframes drift-c { to { background-position: -340px -340px; } }

main, header.mast, footer.foot { position: relative; z-index: 1; }

/* ---------- The cosmos — real James Webb plates under the kinetic stars.
   A deep-field base, a drifting nebula glow blended on top, and a plum
   veil that keeps every text surface at its verified contrast. ---------- */
.cosmos { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.cosmos .webb-base {
  position: absolute; inset: -4%; width: 108%; height: 108%;
  object-fit: cover;
  filter: brightness(0.5) saturate(0.85);
  opacity: 0.55;
}
.cosmos .webb-glow {
  position: absolute; inset: -12%; width: 124%; height: 124%;
  object-fit: cover;
  mix-blend-mode: screen;
  opacity: 0.15;
  filter: saturate(1.15) brightness(0.85);
  animation: webb-drift 140s ease-in-out infinite alternate;
}
@keyframes webb-drift {
  from { transform: translate3d(-1.6%, -1%, 0) scale(1); }
  to { transform: translate3d(1.6%, 1.2%, 0) scale(1.07); }
}
.cosmos::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(20, 10, 38, 0.62),
    rgba(20, 10, 38, 0.72) 42%,
    rgba(20, 10, 38, 0.88) 100%);
}

/* ---------- Type ---------- */

h1, h2 {
  font-family: var(--orbitron);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  line-height: 1.15;
  margin: 0;
  color: var(--dv-ink);
  text-shadow: 0 0 26px var(--dv-glow);
}
h1 { font-size: clamp(2rem, 5.6vw, 3.4rem); }
h2 { font-size: clamp(1.25rem, 2.8vw, 1.85rem); }

.oracle-voice {
  font-family: var(--cormorant);
  font-weight: 500;
  font-size: clamp(1.35rem, 2.8vw, 1.7rem);
  line-height: 1.5;
  color: var(--dv-ink-2);
}
.oracle-voice em { font-style: italic; }

.lede {
  font-family: var(--cormorant); font-weight: 500;
  font-size: 1.3rem; line-height: 1.55;
  color: var(--dv-ink-2); max-width: 600px;
}

.readout {
  font-family: var(--smono); font-size: 0.75rem;
  letter-spacing: 0.08em; text-transform: lowercase;
  color: var(--dv-accent);
}

.microline { font-family: var(--smono); font-size: 0.75rem; letter-spacing: 0.06em; color: var(--dv-ink-2); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 28px;
  font-family: var(--smono); font-weight: 700; font-size: 0.875rem;
  letter-spacing: 0.06em;
  text-decoration: none; cursor: pointer;
  border-radius: 8px;
  background: var(--dv-lav); color: var(--dv-brick-ink);
  border: none;
  box-shadow: 0 0 28px rgba(201, 181, 255, 0.35);
}
.btn:hover { background: #D9CBFF; color: var(--dv-brick-ink); }
.btn-ghost {
  background: transparent; color: var(--dv-accent);
  border: 1px solid var(--dv-rule); box-shadow: none;
}
.btn-ghost:hover { border-color: var(--dv-accent); color: var(--dv-accent); }

/* ---------- Masthead ---------- */

.mast {
  display: flex; align-items: center; gap: 14px;
  max-width: 1080px; margin: 0 auto;
  padding: 16px clamp(16px, 4vw, 32px);
}
.mast .mark {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--orbitron); font-weight: 600; font-size: 0.9375rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--dv-ink); text-decoration: none;
}
.mast .mark img { width: 34px; height: 34px; border-radius: 8px; }
.mast .mast-cta { margin-left: auto; }
.mast .mast-cta .btn { min-height: 44px; padding: 10px 20px; }

/* ---------- Layout ---------- */

.wrap { max-width: var(--col); margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }

/* ---------- Hero + the pyramid ---------- */

.hero { padding: clamp(28px, 6vw, 60px) 0 clamp(20px, 4vw, 44px); text-align: center; }
.hero h1 { margin-top: 10px; }
.hero .tagline { margin: 18px auto 0; max-width: 560px; }
.hero .cta-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 30px; align-items: center; }
.hero .disclaimer {
  margin: 22px auto 0; max-width: 520px;
  font-family: var(--smono); font-size: 0.6875rem; letter-spacing: 0.05em;
  color: var(--dv-ink-2); opacity: 0.85;
}

.pyramid-shrine { margin: clamp(20px, 4vw, 40px) auto 0; }
.pyramid-btn {
  display: inline-block;
  background: none; border: none; padding: 12px; cursor: pointer;
  border-radius: 16px;
}
/* The pyramid is the app's own art (poster render of the 15 stones);
   a radial mask feathers its dark plate into the page cosmos. */
.pyramid-btn img.glass {
  display: block; width: min(320px, 72vw); height: auto;
  -webkit-mask-image: radial-gradient(96% 88% at 50% 52%, #000 46%, transparent 70%);
  mask-image: radial-gradient(96% 88% at 50% 52%, #000 46%, transparent 70%);
}
.pyramid-btn .glass { transition: filter 0.4s ease; }
.pyramid-btn:hover .glass { filter: drop-shadow(0 0 34px rgba(201, 181, 255, 0.65)) brightness(1.08); }
.pyramid-btn.consulting .glass { animation: pyramid-pulse 1.1s ease; }
@keyframes pyramid-pulse {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(201, 181, 255, 0.4)); }
  45% { filter: drop-shadow(0 0 52px rgba(201, 181, 255, 0.95)); }
}
.pyramid-hint {
  font-family: var(--smono); font-size: 0.75rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--dv-accent);
  margin-top: 6px;
}

/* the reading output */
.reading {
  max-width: 620px; margin: 26px auto 0;
  min-height: 118px;
}
.reading .inputs {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px;
  font-family: var(--smono); font-size: 0.75rem; letter-spacing: 0.08em;
  color: var(--dv-accent);
}
.reading .inputs .sep { color: var(--dv-purple-2); }
.reading .oracle-line {
  margin-top: 16px;
  font-family: var(--cormorant); font-style: italic; font-weight: 500;
  font-size: clamp(1.3rem, 3vw, 1.65rem); line-height: 1.5;
  color: var(--dv-ink);
  min-height: 2.4em;
}

/* ---------- Section scaffolding ---------- */

.sect { padding-top: clamp(60px, 10vw, 110px); }
.sect .sect-head { text-align: center; max-width: 640px; margin: 0 auto; }
.sect .sect-head .readout { display: block; margin-bottom: 12px; }
.sect .sect-head .lede { margin: 14px auto 0; }

/* ---------- Instruments ---------- */

.instruments {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px; margin-top: 36px;
}
.instrument {
  background: linear-gradient(165deg, var(--dv-surface), var(--dv-deep));
  border: 1px solid var(--dv-rule); border-radius: 14px;
  padding: 26px 24px 28px;
  text-align: center;
}
.instrument .glyph { margin: 0 auto 16px; width: 64px; height: 64px; }
.instrument .glyph svg { width: 100%; height: 100%; }
.instrument .i-name {
  font-family: var(--orbitron); font-weight: 600; font-size: 0.9375rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--dv-ink); margin: 0 0 6px;
}
.instrument .i-scope { display: block; margin-bottom: 12px; }
.instrument p { margin: 0; font-size: 0.9375rem; color: var(--dv-ink-2); }

/* ---------- The Daily Challenge (Simon demo) ---------- */

.challenge-board {
  max-width: 460px; margin: 34px auto 0;
  background: linear-gradient(170deg, var(--dv-surface), var(--dv-deep));
  border: 1px solid var(--dv-rule); border-radius: 18px;
  padding: clamp(20px, 4vw, 34px);
}
.brick-pyramid { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.brick-row { display: flex; gap: 8px; justify-content: center; }
.brick {
  width: clamp(44px, 10vw, 58px); height: clamp(44px, 8vw, 48px);
  border: none; border-radius: 8px; cursor: pointer;
  opacity: 0.42;
  transition: opacity 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.brick:hover { opacity: 0.65; }
.brick.lit {
  opacity: 1;
  transform: scale(1.06);
  box-shadow: 0 0 22px var(--dv-glow);
}
.brick:disabled { cursor: default; }
.brick.b-pink { background: var(--dv-pink); } .brick.b-lav { background: var(--dv-lav); }
.brick.b-mint { background: var(--dv-mint); } .brick.b-peach { background: var(--dv-peach); }
.brick.b-sky { background: var(--dv-sky); } .brick.b-lemon { background: var(--dv-lemon); }
.brick.b-coral { background: var(--dv-coral); } .brick.b-lilac { background: var(--dv-lilac); }

.challenge-board.shake { animation: board-shake 0.4s ease; }
@keyframes board-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); } 65% { transform: translateX(6px); }
}

.challenge-status {
  margin-top: 20px; text-align: center;
  font-family: var(--smono); font-size: 0.8125rem; letter-spacing: 0.04em;
  color: var(--dv-ink-2);
  min-height: 2.6em;
}
.challenge-controls { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }

/* trophy shelf */
.trophies {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  margin-top: 30px;
}
.trophy {
  font-family: var(--smono); font-size: 0.75rem; letter-spacing: 0.06em;
  color: var(--dv-brick-ink);
  border-radius: 999px; padding: 7px 16px;
}
.trophy.t-silver { background: var(--dv-silver); }
.trophy.t-gold { background: var(--dv-gold); }
.trophy.t-platinum { background: var(--dv-platinum); }
.trophy.t-diamond { background: var(--dv-diamond); }
.trophy-note { text-align: center; margin-top: 14px; font-size: 0.875rem; color: var(--dv-ink-2); }

/* ---------- What feeds a reading ---------- */

.feeds {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  margin-top: 32px; max-width: 640px; margin-left: auto; margin-right: auto;
}
.feed-chip {
  font-family: var(--smono); font-size: 0.8125rem; letter-spacing: 0.05em;
  color: var(--dv-ink-2);
  background: var(--dv-surface);
  border: 1px solid var(--dv-rule); border-radius: 999px;
  padding: 9px 18px;
}

/* ---------- Signature + screenshots ---------- */

.sig-note {
  max-width: 560px; margin: 20px auto 0; text-align: center;
  font-size: 0.875rem; color: var(--dv-ink-2);
}
.shot-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px; margin-top: 36px;
}
.shot-row img {
  border-radius: 18px;
  border: 1px solid var(--dv-rule);
}

/* ---------- Pricing ---------- */

.plans {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px; margin-top: 36px; max-width: 720px; margin-left: auto; margin-right: auto;
}
.plan {
  background: linear-gradient(165deg, var(--dv-surface), var(--dv-deep));
  border: 1px solid var(--dv-rule); border-radius: 14px;
  padding: 26px 24px;
}
.plan .p-name {
  font-family: var(--orbitron); font-weight: 600; font-size: 0.9375rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  margin: 0 0 4px; color: var(--dv-ink);
}
.plan .p-price { display: block; margin-bottom: 14px; }
.plan ul { list-style: none; margin: 0; padding: 0; }
.plan li { position: relative; padding-left: 20px; font-size: 0.9375rem; color: var(--dv-ink-2); }
.plan li + li { margin-top: 9px; }
.plan li::before {
  content: ""; position: absolute; left: 0; top: 0.52em;
  width: 8px; height: 8px; transform: rotate(45deg);
  background: var(--dv-purple-2);
}
.plans-note { text-align: center; margin-top: 18px; font-size: 0.8125rem; color: var(--dv-ink-2); }

/* ---------- Final CTA ---------- */

.final { text-align: center; padding: clamp(56px, 10vw, 104px) 0 clamp(28px, 5vw, 52px); }
.final h2 { margin-bottom: 10px; }
.final .oracle-voice { margin: 0 0 26px; }
.final .microline { margin-top: 16px; }

/* ---------- App Store badge ---------- */

.store-badge {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--dv-ink); color: var(--dv-bg);
  border-radius: 12px; padding: 10px 20px;
  text-decoration: none; min-height: 52px;
}
.store-badge:hover { background: #FFFFFF; color: var(--dv-bg); }
.store-badge svg { width: 26px; height: 26px; fill: currentColor; }
.store-badge .lbl { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.store-badge .lbl .t { font-size: 0.6875rem; }
.store-badge .lbl .b { font-family: var(--sans); font-weight: 600; font-size: 1.0625rem; }

/* ---------- Footer ---------- */

.foot { margin-top: clamp(40px, 7vw, 72px); border-top: 1px solid var(--dv-rule); }
.foot .foot-inner {
  max-width: var(--col); margin: 0 auto;
  padding: 32px clamp(16px, 4vw, 32px) 48px;
  display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center;
  font-family: var(--smono); font-size: 0.75rem; letter-spacing: 0.04em;
  color: var(--dv-ink-2);
}
.foot .foot-credit { flex-basis: 100%; opacity: 0.8; }
.foot .foot-links { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-left: auto; }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .starlayer { animation: none !important; }
  .pyramid-btn.consulting .glass { animation: none; }
  .cosmos .webb-glow { animation: none; }
  .challenge-board.shake { animation: none; }
  .brick, .brick.lit { transition: none; transform: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
