/* Spit — Landing Page Styles
   Colors mirror spit/Features/Common/TableBackground.swift and CardView.swift.
   Structure follows the Abyss website (nav, legal pages, footer). */

:root {
  --felt-top: #0D5238;      /* Color(0.05, 0.32, 0.22) */
  --felt-bottom: #05291F;   /* Color(0.02, 0.16, 0.12) */
  --felt-deep: #031A13;

  --card-face: #FFFFFF;
  --card-red: #CC1A26;      /* Color(0.8, 0.1, 0.15) */
  --card-black: #111111;
  --card-back-0: #29409E;   /* Color(0.16, 0.25, 0.62) */
  --card-back-1: #141F61;   /* Color(0.08, 0.12, 0.38) */

  --border: rgba(255, 255, 255, 0.10);
  --body: rgba(255, 255, 255, 0.86);
  --muted: rgba(255, 255, 255, 0.55);
  --dim: rgba(255, 255, 255, 0.22);

  --accent: #FFD54A;        /* selection yellow from CardView */
  --accent-soft: rgba(255, 213, 74, 0.45);

  --radius-card: 20px;

  --space-xs: 6px;
  --space-s: 10px;
  --space-m: 16px;
  --space-l: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  --space-screen-h: 24px;

  --font-rounded: ui-rounded, -apple-system, "SF Pro Rounded", "SF Pro Display", "Helvetica Neue", Inter, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  background: var(--felt-deep);
}

body {
  min-height: 100vh;
  font-family: var(--font-rounded);
  color: var(--body);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.55;
}

/* Felt table on a fixed layer — iOS Safari ignores background-attachment: fixed */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 50% 30%, rgba(255, 255, 255, 0.10), transparent 70%),
    linear-gradient(180deg, var(--felt-top) 0%, var(--felt-bottom) 55%, var(--felt-deep) 100%);
}

/* Subtle felt grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.8;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* === Layout === */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-screen-h);
  position: relative;
  z-index: 1;
}

.container-narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 var(--space-screen-h);
  position: relative;
  z-index: 1;
}

/* === Nav === */

.nav {
  padding: var(--space-l) 0;
  position: relative;
  z-index: 10;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.brand-card {
  width: 18px;
  height: 25px;
  border-radius: 4px;
  background: var(--card-face);
  color: var(--card-red);
  font-size: 13px;
  line-height: 25px;
  text-align: center;
  transform: rotate(-8deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.nav-links {
  display: flex;
  gap: var(--space-l);
  font-size: 13px;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.85);
}

.nav-links a:hover {
  color: #ffffff;
  opacity: 1;
}

/* === Hero === */

.hero {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xxl);
  text-align: center;
}

.eyebrow {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: #ffffff;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  margin-bottom: var(--space-xl);
  opacity: 0;
  animation: fadeUp 0.7s ease-out 0.1s forwards;
}

/* Fanned cards — mirrors the fan in MenuView */
.fan {
  position: relative;
  height: clamp(130px, 22vw, 180px);
  margin: 0 auto var(--space-l);
  width: 100%;
  max-width: 360px;
}

.card {
  --w: clamp(72px, 12vw, 96px);
  position: absolute;
  left: 50%;
  bottom: 0;
  width: var(--w);
  height: calc(var(--w) * 1.4);
  margin-left: calc(var(--w) / -2);
  border-radius: calc(var(--w) * 0.13);
  background: var(--card-face);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transform-origin: 50% 100%;
  transform: translateX(0) rotate(0);
  opacity: 0;
  animation: deal 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
  color: var(--card-black);
}

.card.red {
  color: var(--card-red);
}

.card .rank {
  position: absolute;
  top: 8%;
  left: 10%;
  font-weight: 800;
  font-size: calc(var(--w) * 0.3);
  line-height: 1;
  text-align: center;
}

.card .rank small {
  display: block;
  font-size: 0.7em;
  margin-top: 2px;
}

.card .pip {
  position: absolute;
  right: 10%;
  bottom: 10%;
  font-size: calc(var(--w) * 0.55);
  line-height: 1;
}

.card:nth-child(1) { --rot: -24deg; --x: -36px; animation-delay: 0.20s; }
.card:nth-child(2) { --rot: -12deg; --x: -18px; animation-delay: 0.28s; }
.card:nth-child(3) { --rot:   0deg; --x:   0px; animation-delay: 0.36s; }
.card:nth-child(4) { --rot:  12deg; --x:  18px; animation-delay: 0.44s; }
.card:nth-child(5) { --rot:  24deg; --x:  36px; animation-delay: 0.52s; }

@keyframes deal {
  from {
    opacity: 0;
    transform: translate(0, 40px) rotate(0);
  }
  to {
    opacity: 1;
    transform: translateX(var(--x)) rotate(var(--rot));
  }
}

.fan:hover .card {
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.wordmark {
  font-size: clamp(76px, 16vw, 152px);
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  margin-bottom: var(--space-m);
  opacity: 0;
  animation: fadeScale 0.9s cubic-bezier(0.2, 0.9, 0.3, 1) 0.5s forwards;
}

.tagline {
  font-size: clamp(20px, 2.8vw, 26px);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  max-width: 620px;
  margin: 0 auto;
  opacity: 0;
  animation: fadeUp 0.7s ease-out 0.75s forwards;
}

.hero-sub {
  font-size: 16px;
  color: var(--muted);
  max-width: 480px;
  margin: var(--space-m) auto 0;
  opacity: 0;
  animation: fadeUp 0.7s ease-out 0.9s forwards;
}

.hero-phones {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(12px, 4vw, 40px);
  margin-top: var(--space-xxl);
  opacity: 0;
  animation: fadeUp 0.9s ease-out 1.05s forwards;
}

.hero-phones .phone {
  flex: 0 1 250px;
  min-width: 0;
}

.hero-phones .phone:first-child,
.hero-phones .phone:last-child {
  flex-basis: 210px;
  transform: translateY(24px);
  opacity: 0.85;
}

/* === Phone mockup (raw simulator screenshots, frame drawn in CSS) === */

.phone {
  width: 100%;
  max-width: 250px;
  /* Fixed bezel: percentage padding would resolve against the parent's width */
  --bezel: 9px;
  --screen-radius: 32px;
  border-radius: calc(var(--screen-radius) + var(--bezel));
  padding: var(--bezel);
  background: #0b0d0c;
  box-shadow:
    0 0 0 1.5px rgba(255, 255, 255, 0.14),
    0 30px 60px rgba(0, 0, 0, 0.45),
    0 10px 20px rgba(0, 0, 0, 0.25);
  position: relative;
}

.phone img {
  width: 100%;
  height: auto;
  aspect-ratio: 1206 / 2622;
  display: block;
  border-radius: var(--screen-radius);
}

/* === Feature Rows (alternating) === */

.feature-rows {
  padding-top: var(--space-xxl);
  padding-bottom: var(--space-xxl);
}

.feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: clamp(32px, 6vw, 80px);
  padding: var(--space-xxl) 0;
}

.feature-row > * {
  min-width: 0;
}

.feature-row-media {
  display: flex;
  justify-content: center;
  position: relative;
}

.feature-row-media::before {
  content: "";
  position: absolute;
  inset: 10% 0;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.12), transparent 65%);
  filter: blur(40px);
  z-index: -1;
}

.feature-row .phone {
  max-width: 260px;
}

.feature-row.reversed .feature-row-media {
  order: 2;
}

.feature-row-text {
  max-width: 460px;
}

.section-eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-s);
}

.feature-row-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: #ffffff;
  margin-bottom: var(--space-m);
}

.feature-row-body {
  font-size: 16px;
  line-height: 1.65;
  margin-bottom: var(--space-l);
}

.feature-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}

.feature-bullets li {
  position: relative;
  padding-left: 24px;
  font-size: 15px;
}

.feature-bullets li::before {
  content: "♦";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 13px;
  color: var(--accent);
}

.feature-bullets li:nth-child(2)::before { content: "♠"; }
.feature-bullets li:nth-child(3)::before { content: "♥"; }
.feature-bullets li:nth-child(4)::before { content: "♣"; }

/* === Verse (microcopy between sections) === */

.verse {
  padding-top: clamp(40px, 8vw, 100px);
  padding-bottom: clamp(40px, 8vw, 100px);
  text-align: center;
}

.verse p {
  font-size: clamp(24px, 4.6vw, 44px);
  font-weight: 300;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.9);
}

/* === Mini features === */

.mini-features {
  padding-top: var(--space-xxl);
  padding-bottom: var(--space-xxl);
}

.section-head {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.section-title {
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.mini-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-m);
}

.mini-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-l);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.mini-card:hover {
  transform: translateY(-4px) rotate(-0.5deg);
  border-color: var(--accent-soft);
}

.mini-icon {
  width: 40px;
  height: 56px;
  border-radius: 7px;
  background: var(--card-face);
  color: var(--card-black);
  display: grid;
  place-items: center;
  font-size: 22px;
  margin-bottom: var(--space-m);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transform: rotate(-6deg);
}

.mini-icon.red {
  color: var(--card-red);
}

.mini-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: var(--space-xs);
}

.mini-card p {
  font-size: 14px;
  color: var(--muted);
}

/* === Reveal on scroll === */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.8s ease,
    transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* === Footer === */

.footer {
  padding: var(--space-xxl) 0 var(--space-xl);
  margin-top: var(--space-xxl);
  position: relative;
  z-index: 1;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
}

.footer-copy {
  font-size: 12px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: var(--space-l);
  font-size: 12px;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--body);
  opacity: 1;
}

/* === Legal pages === */

.legal {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xxl);
}

.legal h1 {
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
  margin-bottom: var(--space-l);
}

.legal .meta {
  font-size: 13px;
  color: var(--muted);
}

.tab-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--space-xl);
}

.tab-switch-item {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 2px;
  position: relative;
  transition: color 0.2s ease;
}

.tab-switch-item:hover {
  color: var(--body);
}

.tab-switch-item.is-active {
  color: #ffffff;
  font-weight: 600;
}

.tab-switch-item.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.tab-switch-sep {
  color: var(--dim);
  user-select: none;
}

.tab-panel {
  animation: fadeUp 0.4s ease-out;
}

.tab-panel[hidden] {
  display: none;
}

.legal h2 {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-m);
  letter-spacing: -0.2px;
}

.legal p,
.legal li {
  font-size: 15px;
  margin-bottom: var(--space-s);
}

.legal ul {
  padding-left: var(--space-l);
  margin-bottom: var(--space-m);
}

.legal .back {
  display: inline-flex;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: var(--space-l);
}

.legal .back:hover {
  color: var(--body);
  opacity: 1;
}

.legal address {
  font-style: normal;
  line-height: 1.7;
}

/* === Animations === */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@keyframes fadeScale {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: none; }
}

/* === Responsive === */

@media (max-width: 880px) {
  .feature-row {
    grid-template-columns: 1fr;
    gap: var(--space-l);
    padding: var(--space-xl) 0;
  }

  .feature-row.reversed .feature-row-media {
    order: 0;
  }

  .feature-row-text {
    margin: 0 auto;
    max-width: 440px;
  }
}

@media (max-width: 600px) {
  :root {
    --space-screen-h: 20px;
  }

  .nav {
    padding: var(--space-m) 0;
  }

  .nav-links {
    gap: var(--space-m);
  }

  .hero {
    padding-top: var(--space-m);
    padding-bottom: var(--space-l);
  }

  .eyebrow {
    margin-bottom: var(--space-l);
  }

  .hero-sub {
    font-size: 15px;
  }

  /* Three overlapping phones instead of one big one */
  .hero-phones {
    gap: 0;
    margin-top: var(--space-xl);
  }

  .hero-phones .phone {
    flex: 0 0 auto;
    --bezel: 6px;
    --screen-radius: 22px;
  }

  .hero-phones .phone:nth-child(2) {
    width: 46vw;
    max-width: 200px;
    z-index: 2;
  }

  .hero-phones .phone:first-child,
  .hero-phones .phone:last-child {
    flex-basis: auto;
    width: 30vw;
    max-width: 140px;
    opacity: 0.75;
    transform: translateY(18px);
  }

  .hero-phones .phone:first-child {
    margin-right: -10vw;
    transform: translateY(18px) rotate(-6deg);
  }

  .hero-phones .phone:last-child {
    margin-left: -10vw;
    transform: translateY(18px) rotate(6deg);
  }

  .verse {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
  }

  .verse p {
    font-size: 26px;
  }

  .feature-rows {
    padding-top: 0;
    padding-bottom: var(--space-l);
  }

  .feature-row {
    gap: var(--space-l);
    padding: var(--space-l) 0;
  }

  .feature-row .phone {
    max-width: 210px;
    --bezel: 7px;
    --screen-radius: 26px;
  }

  .feature-row-title {
    font-size: 28px;
    margin-bottom: var(--space-s);
  }

  .feature-row-body {
    font-size: 15px;
    margin-bottom: var(--space-m);
  }

  .mini-features {
    padding-top: var(--space-l);
  }

  /* Compact 2×2 tiles */
  .mini-features-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-s);
  }

  .mini-card {
    padding: var(--space-m);
    border-radius: 16px;
  }

  .mini-icon {
    width: 30px;
    height: 42px;
    font-size: 17px;
    border-radius: 5px;
    margin-bottom: var(--space-s);
  }

  .mini-card h3 {
    font-size: 15px;
  }

  .mini-card p {
    font-size: 13px;
    line-height: 1.45;
  }

  .footer {
    margin-top: var(--space-l);
  }

  .footer-inner {
    flex-direction: column-reverse;
    text-align: center;
  }

  .legal h2 {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
