/* ==========================================================================
   Emitly — shared stylesheet
   Deep Sapphire palette, lifted verbatim from the app's src/theme.ts.
   Buildless static site: no preprocessor, no imports at runtime.
   ========================================================================== */

:root {
  /* Backgrounds */
  --page:      #050A1A;
  --surface:   #0C1630;
  --elevated:  #14224A;

  /* Borders */
  --border:            #24437E; /* decorative hairline only */
  --border-subtle:     #1B2E52;
  --border-interactive:#456AAF; /* functional edges: focus rings */

  /* Accents */
  --gold:      #E6C766; /* primary — CTAs, headings accents */
  --gold-deep: #C49A3A; /* pressed / gradient end */
  --on-gold:   #08111F; /* text on gold fills */
  --starlight: #7FB0EE; /* secondary accent — labels, rings */
  --highlight: #CFE0FA; /* subtle cool highlight */

  /* Text */
  --text-primary:   #EAF1FC;
  --text-secondary: #A7BCE0;
  --text-muted:     #7C93C0;

  /* Functional */
  --destructive: #E27C7C;

  /* Radius */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-full: 9999px;

  /* Fonts */
  --font-serif: 'Cinzel', Georgia, serif;
  --font-sans:  'Inter', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', monospace;

  /* Layout */
  --content-max: 72rem;   /* ~1152px wide sections */
  --prose-max:   45rem;   /* ~720px readable legal column */
  --gutter:      clamp(1rem, 4vw, 2rem);
}

/* --------------------------------------------------------------------------
   Reset / base
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--highlight);
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--text-primary);
  line-height: 1.2;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Accessibility helpers
   -------------------------------------------------------------------------- */

/* Visible focus indicator on every interactive element (WCAG 2.4.7 / 1.4.11) */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--border-interactive);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Skip link — first focusable element, revealed on focus */
.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100%;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-interactive);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.skip-link:focus {
  top: 0.75rem;
}

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

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

.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1 0 auto;
}

/* --------------------------------------------------------------------------
   Site header
   -------------------------------------------------------------------------- */

.site-header {
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  padding: 0.25rem;
  border-radius: var(--radius-md);
}

.brand:hover {
  color: inherit;
}

.brand__logo {
  width: 4.6875rem;
  height: auto;
}

.brand__name {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   Site footer
   -------------------------------------------------------------------------- */

.site-footer {
  position: relative;
  margin-top: 4rem;
  padding-block: 2.5rem;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
}

.site-footer a {
  color: var(--text-secondary);
}

.site-footer a:hover {
  color: var(--highlight);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer__links a,
.footer__contact {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem; /* 44px target */
}

.footer__copyright {
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Buttons (store CTAs)
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.25rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  text-decoration: none;
  text-align: left;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

/* "Coming soon" store buttons — deliberately non-active treatment */
.btn--store {
  background: var(--surface);
  border-color: var(--border-interactive);
  color: var(--text-secondary);
  cursor: default;
  justify-content: center;
}

.btn--store:hover {
  color: var(--text-primary);
  background: var(--elevated);
}

.btn__label {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.25;
}

.btn__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--starlight);
}

.btn__store {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section {
  padding-block: clamp(1.75rem, 4vw, 2.75rem); /* reduced ~1/3 for tighter body-to-cards */
}

.section__title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 0 0 1rem;
}

/* --------------------------------------------------------------------------
   Star field (CSS only) — decorative, behind hero + footer
   3 layers total: the .starfield element + its ::before + ::after.
   Only opacity/transform animate (GPU-composited). No JS, no per-star nodes.
   -------------------------------------------------------------------------- */

.starfield {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  /* Layer 1 — starlight points */
  background-image:
    radial-gradient(2px 2px   at 12% 22%, var(--starlight), transparent 60%),
    radial-gradient(1.5px 1.5px at 68% 34%, var(--highlight), transparent 60%),
    radial-gradient(1.5px 1.5px at 40% 72%, var(--starlight), transparent 60%),
    radial-gradient(2px 2px   at 88% 62%, var(--highlight), transparent 60%),
    radial-gradient(1.5px 1.5px at 30% 48%, var(--starlight), transparent 60%),
    radial-gradient(1.5px 1.5px at 55% 12%, var(--highlight), transparent 60%);
  background-size: 200px 200px;
  opacity: 0.85;
}

.starfield::before,
.starfield::after {
  content: "";
  position: absolute;
  inset: -10%; /* overscan so drift never reveals an edge */
}

/* Layer 2 — gold points, larger tile, gentle drift */
.starfield::before {
  background-image:
    radial-gradient(2px 2px   at 25% 15%, var(--gold), transparent 60%),
    radial-gradient(1.5px 1.5px at 75% 48%, var(--gold), transparent 60%),
    radial-gradient(1.5px 1.5px at 52% 85%, var(--gold), transparent 60%),
    radial-gradient(1.5px 1.5px at 15% 78%, var(--gold), transparent 60%);
  background-size: 280px 280px;
  opacity: 0.7;
}

/* Layer 3 — faint far points */
.starfield::after {
  background-image:
    radial-gradient(1.5px 1.5px at 8% 55%, var(--highlight), transparent 60%),
    radial-gradient(1.5px 1.5px at 60% 18%, var(--starlight), transparent 60%),
    radial-gradient(1.5px 1.5px at 92% 80%, var(--highlight), transparent 60%),
    radial-gradient(1px 1px     at 35% 90%, var(--starlight), transparent 60%);
  background-size: 340px 340px;
  opacity: 0.55;
}

/* Concentrate density near the hero/footer edge, fade toward content */
.hero .starfield {
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent);
  mask-image: linear-gradient(to bottom, #000 72%, transparent);
}

.site-footer .starfield {
  -webkit-mask-image: linear-gradient(to top, #000 72%, transparent);
  mask-image: linear-gradient(to top, #000 72%, transparent);
}

/* Motion only for users who haven't asked to reduce it.
   Reduced-motion users get the same static field, no animation. */
@media (prefers-reduced-motion: no-preference) {
  .starfield {
    animation: twinkle-a 7s ease-in-out infinite alternate;
  }
  .starfield::before {
    animation: twinkle-b 11s ease-in-out infinite alternate,
               drift 16s ease-in-out infinite alternate;
  }
  .starfield::after {
    animation: twinkle-a 9s ease-in-out infinite alternate;
  }
}

@keyframes twinkle-a {
  from { opacity: 0.55; }
  to   { opacity: 0.9; }
}

@keyframes twinkle-b {
  from { opacity: 0.75; }
  to   { opacity: 0.4; }
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, -10px, 0); }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  text-align: center;
  padding-top: clamp(3rem, 9vw, 6rem);
  padding-bottom: clamp(2rem, 6vw, 4rem); /* reduced ~1/3 for tighter hero-to-body */
}

/* Keep hero + footer content above their star fields */
.hero .container,
.site-footer .container {
  position: relative;
  z-index: 1;
}

.hero__wordmark {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 12vw, 5.5rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  margin: 0;
  color: var(--text-primary);
}

.hero__tagline {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 500;
  color: var(--gold);
  margin: 0.75rem 0 0;
}

.hero__subhead {
  max-width: 40rem;
  margin: 1.5rem auto 0;
  font-size: clamp(1rem, 2.5vw, 1.1875rem);
  color: var(--text-secondary);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 2.5rem;
}

/* --------------------------------------------------------------------------
   "What it is"
   -------------------------------------------------------------------------- */

.intro {
  text-align: center;
}

.intro__body {
  max-width: var(--prose-max);
  margin-inline: auto;
  font-size: clamp(1.0625rem, 2.5vw, 1.25rem);
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Closing line
   -------------------------------------------------------------------------- */

.closing {
  text-align: center;
}

.closing__line {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  font-weight: 600;
  color: var(--gold);
  margin: 0;
}

/* --------------------------------------------------------------------------
   Feature grid
   -------------------------------------------------------------------------- */

.feature-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr; /* mobile: one-up */
  list-style: none; /* no external bullets */
  margin: 0;
  padding: 0;
}

@media (min-width: 40rem) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); } /* tablet: two-up */
}

@media (min-width: 64rem) {
  .feature-grid { grid-template-columns: repeat(4, 1fr); } /* wide: four-up */
}

/* --------------------------------------------------------------------------
   Cards (feature highlights)
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.card__spark {
  display: block;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.card__title {
  font-size: 1.1875rem;
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card__body {
  margin: 0;
  color: var(--text-secondary);
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--on-gold);
  background: var(--gold);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

/* --------------------------------------------------------------------------
   Legal / long-form prose
   -------------------------------------------------------------------------- */

.legal {
  padding-block: clamp(2rem, 5vw, 3.5rem);
}

.legal .container {
  max-width: var(--prose-max); /* ~720px readable column */
}

.legal h1 {
  font-size: clamp(1.875rem, 5vw, 2.5rem);
  margin: 0 0 0.5rem;
}

.legal__meta {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 2rem;
}

.legal h2 {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  margin: 2.5rem 0 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.legal h3 {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.75rem 0 0.5rem;
}

.legal p,
.legal li {
  color: var(--text-primary);
  line-height: 1.7;
}

.legal ul {
  padding-left: 1.5rem;
}

.legal li {
  margin-bottom: 0.5rem;
}

.legal strong {
  color: var(--text-primary);
  font-weight: 600;
}

.legal a {
  color: var(--gold);
}

.legal__intro {
  color: var(--text-secondary);
}

.legal code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.35em;
  color: var(--text-primary);
  word-break: break-all;
}

.legal hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: 2.5rem 0 1.5rem;
}

.legal__note {
  color: var(--text-secondary);
  font-style: italic;
}

/* Sub-processor table */
.legal__table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
}

.legal table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  min-width: 34rem;
}

.legal th,
.legal td {
  text-align: left;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-subtle);
  vertical-align: top;
  line-height: 1.5;
}

.legal thead th {
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* --------------------------------------------------------------------------
   Reduced motion — global safety net (star field gated separately)
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
