/* Fifth Ace: the home page, the contact and privacy pages and the 404 page.
   Everything visual comes from house-rules (tokens.css, controls.css, components.css), in both themes. This file only positions and lays out: it
   sets no colour except through a token, and never restyles a .btn or a form field (tests/house-rules.test.mjs fails it if it does).
   The old Wildcard Services pages (the Canvas incident archive) keep styles.css and main.js; nothing here depends on them. */

/* The accent is Wildcard Purple. Focus is --lilac: pale on the dark theme, purple on the light, so the ring shows on both. */
:root { --accent: var(--purple); --accent-hover: var(--purple-hover); --on-accent: #fff; --focus: var(--lilac); }
:root[data-theme="dark"] { color-scheme: dark; }
/* The home page's background (the Wildcard hero's: two corner glows and a dot grid). Names of its own, tuned for each theme. */
:root { --bg-glow-a: rgba(85, 0, 136, .40); --bg-glow-b: rgba(51, 0, 79, .60); --bg-dot: rgba(240, 238, 245, .30); }
:root[data-theme="light"] { --bg-glow-a: rgba(124, 44, 176, .26); --bg-glow-b: rgba(85, 0, 136, .15); --bg-dot: rgba(85, 0, 136, .38); }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--ink); color: var(--text);
  font: 400 1rem/1.6 var(--font-body); -webkit-font-smoothing: antialiased; overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--lilac); }
h1, h2, h3 { font-family: var(--font-display); margin: 0; }
:focus-visible { outline: 2px solid var(--lilac); outline-offset: 3px; border-radius: 6px; }
main:focus { outline: none; }

.wrap { width: min(100% - 48px, 1180px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; padding: 8px 14px; border-radius: var(--radius-xs); background: var(--text); color: var(--ink); }
.skip:focus { left: 8px; }
.muted { color: var(--text-2); }

/* ---------- background: glows and dots behind the hero and the cards, at 65%, fading out below the cards */
.stage { position: relative; isolation: isolate; }
.bg {
  position: absolute; z-index: -1; top: 0; left: 0; right: 0; height: var(--stage-h, 1500px); overflow: hidden; opacity: .65; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 90px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 90px), transparent);
}
.bg::before {
  content: ""; position: absolute; inset: 0; background-image: radial-gradient(var(--bg-dot) 1.2px, transparent 1.4px); background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 60% 40%, #000 20%, transparent 75%); mask-image: radial-gradient(ellipse 70% 70% at 60% 40%, #000 20%, transparent 75%);
}
/* Each glow is a box twice the size of its old radii, centred on its corner. fifthace.js sets --nx and --ny (-1 to 1, the mouse's place in the window), and
   the two glows move in opposite directions by different amounts, so they seem to sit at different depths. */
.glow { position: absolute; background: radial-gradient(ellipse closest-side, var(--glow-colour), transparent 60%); will-change: transform; }
.glow--a { --glow-colour: var(--bg-glow-a); width: 1800px; height: 1000px; left: 85%; top: 20%;
  transform: translate(-50%, -50%) translate(calc(var(--nx, 0) * -70px), calc(var(--ny, 0) * -40px)); }
.glow--b { --glow-colour: var(--bg-glow-b); width: 1400px; height: 800px; left: 5%; top: 90%;
  transform: translate(-50%, -50%) translate(calc(var(--nx, 0) * 90px), calc(var(--ny, 0) * 50px)); }

/* ---------- header */
.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; padding: 24px 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 1.5rem; line-height: 1.2; }
.brand img { width: 60px; height: auto; }
.nav { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px; font-weight: 500; }
.nav a:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); text-decoration: none; }
.nav a:not(.btn):hover { color: var(--lilac); }
.theme-toggle {
  display: none; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--radius-md);
  background: var(--wash); color: var(--text); box-shadow: 0 0 0 1px var(--line-strong) inset; cursor: pointer;
}
.theme-toggle:hover { background: var(--wash-hover); }
.js .theme-toggle { display: inline-grid; }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="dark"] .theme-toggle .i-moon, :root[data-theme="light"] .theme-toggle .i-sun { display: none; }

/* ---------- hero */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 24px; padding: 64px 0 96px; }
.hero img { width: 300px; max-width: 80%; height: auto; }
.hero h1 { font-size: clamp(2.5rem, 6vw, 4rem); font-weight: 700; line-height: 1.08; letter-spacing: -.015em; max-width: 820px; }
.hero p { margin: 0; font-size: 1.25rem; color: var(--text-2); max-width: 640px; }
.acts { display: flex; flex-wrap: wrap; gap: 12px 14px; }
.hero .acts { justify-content: center; margin-top: 8px; }

/* ---------- the deck: a playing card's 5:7, flipping to a preview of the app */
.deck { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 40px; padding-bottom: 96px; }
.flip { width: 100%; max-width: 500px; justify-self: center; perspective: 1800px; scroll-margin-top: 24px; transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.js .flip { cursor: pointer; }
.js .flip a, .js .flip button { cursor: pointer; }
/* Picking a card up: it lifts, takes a pale ring, a deeper shadow and a purple glow (the Wildcard cards' hover). Pointers that can hover only. */
@media (hover: hover) {
  .flip:hover { transform: translateY(-6px); }
  .flip:hover .face {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--lilac) 40%, transparent) inset, 0 34px 60px -28px var(--shade), 0 0 50px -20px color-mix(in srgb, var(--purple-bright) 70%, transparent);
  }
}
.flip__inner { display: grid; aspect-ratio: 5 / 7; transform-style: preserve-3d; transition: transform .6s ease; }
.flip.is-flipped .flip__inner { transform: rotateY(180deg); }
.face {
  grid-area: 1 / 1; position: relative; isolation: isolate; display: flex; flex-direction: column; gap: 16px; padding: 72px 44px 64px;
  border-radius: var(--radius-lg); background: var(--slate); box-shadow: 0 0 0 1px var(--line-strong) inset;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: box-shadow .35s cubic-bezier(.2, .8, .2, 1);
}
/* clip, not hidden: hidden would stop the card growing to fit its text on a narrow phone */
.face--front { overflow: clip; }
.face--back { transform: rotateY(180deg); padding: 28px 32px 36px; gap: 18px; }
.face h2 { font-size: 2.75rem; font-weight: 700; line-height: 1.05; }
.face p { margin: 0; }
.tagline { font-size: 1.375rem; font-weight: 600; line-height: 1.3; }
.pip { position: absolute; font-size: 2rem; font-weight: 700; line-height: 1; color: var(--lilac); }
.pip--tl { top: 22px; left: 26px; }
.watermark { position: absolute; z-index: -1; top: -9%; right: -13%; height: 54%; background: var(--lilac); opacity: .11; transform: rotate(7deg); pointer-events: none;
  -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; }
/* The app's logo, large and cut off by the card's edges, like the cards in the portal's menu. The card clips it; the text stays above it. */
.watermark--ante { aspect-ratio: 1; -webkit-mask-image: url(/assets/ante-mark.svg); mask-image: url(/assets/ante-mark.svg); }
.watermark--cardea { aspect-ratio: 76 / 56; -webkit-mask-image: url(/assets/cardea-mark.svg); mask-image: url(/assets/cardea-mark.svg); }
.pip--br { bottom: 22px; right: 26px; transform: rotate(180deg); }
.checks { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 12px; }
.checks li { display: flex; align-items: center; gap: 12px; }
.checks svg { width: 20px; height: 20px; flex: none; color: var(--lilac); fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.face .acts { margin-top: auto; padding-top: 12px; }
/* Without JavaScript a card cannot flip, so the buttons that flip it are not shown (js-flag.js adds .js) */
[data-flip] { display: none; }
.js [data-flip] { display: inline-flex; }

.back-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.back-head .name { display: flex; align-items: baseline; gap: 10px; font-weight: 600; font-size: 1.25rem; }
.back-head .name b { font-size: 1.5rem; color: var(--lilac); }
.back-head .name small { font-size: var(--fs-label); font-weight: 500; letter-spacing: .14em; color: var(--text-2); }
/* The preview is a picture of the app, not the app: nothing in it takes a click, and it is hidden from assistive technology (a sentence says what it shows).
   When a real screenshot is ready, put an <img alt="..."> where .preview is and delete the sentence: the card keeps its shape. */
.preview { display: flex; flex-direction: column; gap: 18px; pointer-events: none; user-select: none; }
.panel { display: flex; flex-direction: column; gap: 16px; padding: 24px; border-radius: var(--radius-md); background: var(--ink); box-shadow: 0 0 0 1px var(--line-strong) inset; }
.panel--row { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 20px 24px; gap: 12px; }
.meta { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-small); color: var(--text-2); }
.bar { height: 6px; border-radius: 3px; background: var(--line-strong); }
.bar span { display: block; width: 17%; height: 6px; border-radius: 3px; background: var(--purple); }
.question { font-size: 1.375rem; font-weight: 600; line-height: 1.35; }
.answers { display: flex; flex-wrap: wrap; gap: 10px; }
.taps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 104px; gap: 12px; }
.fake-link { color: var(--lilac); text-decoration: underline; }
.fake-label { font-weight: 600; }
.fake-row { display: flex; gap: 10px; }
.fake-input { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--steel); color: var(--fog); }

/* ---------- principles, about */
.principles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 32px; padding: 48px 0 96px; border-top: 1px solid var(--line-strong); }
.principles h3 { margin: 0 0 8px; font-size: 1.25rem; font-weight: 600; }
.principles p { margin: 0; color: var(--text-2); }
.about { display: flex; flex-direction: column; gap: 12px; padding: 48px; margin-bottom: 72px; border-radius: var(--radius-lg); background: var(--blue-gray); }
.about h2 { font-size: 2rem; font-weight: 700; }
.about p { margin: 0; font-size: 1.125rem; color: var(--text-2); max-width: 760px; }

/* ---------- footer */
.sitefoot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 28px 0 40px; border-top: 1px solid var(--line-strong); font-size: .9rem; color: var(--text-2); }
.sitefoot nav { display: flex; flex-wrap: wrap; gap: 0 24px; }
.sitefoot a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-2); }
.sitefoot a:hover { color: var(--lilac); }

/* ---------- inner pages: contact, privacy, 404 */
.page { max-width: 760px; margin-inline: auto; padding: 32px 0 96px; }
.page h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; line-height: 1.1; letter-spacing: -.015em; margin-bottom: 16px; }
.page > p { color: var(--text-2); font-size: 1.125rem; }
.placeholder { padding: 24px; border-radius: var(--radius-md); background: var(--blue-gray); font-weight: 600; }

.contact-form { display: grid; gap: 20px; margin-top: 32px; padding: 32px; border-radius: var(--radius-lg); background: var(--slate); box-shadow: 0 0 0 1px var(--line-strong) inset; }
.contact-form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 20px; }
.contact-form fieldset { margin: 0; }
.contact-form .topics { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.contact-form .trap { position: absolute; left: -9999px; }
.contact-form .turnstile:empty { display: none; }
.contact-form .status { margin: 0; }
.thanks { margin-top: 32px; padding: 32px; border-radius: var(--radius-lg); background: var(--slate); box-shadow: 0 0 0 1px var(--line-strong) inset; }
.thanks h2 { font-size: 1.75rem; margin-bottom: 8px; }
.thanks p { margin: 0 0 20px; color: var(--text-2); }
.thanks h2:focus { outline: none; }
.direct { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 24px; color: var(--text-2); }
.notfound { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 20px; padding: 48px 0 96px; }
.notfound img { width: 200px; max-width: 60%; height: auto; }
.notfound h1 { font-size: clamp(2.25rem, 6vw, 3.5rem); font-weight: 700; line-height: 1.1; }
.notfound p { margin: 0; color: var(--text-2); font-size: 1.125rem; max-width: 520px; }

@media (max-width: 640px) {
  .wrap { width: min(100% - 32px, 1180px); }
  .face { padding: 76px 28px 56px; }
  .face--back { padding: 24px 20px 28px; }
  .about { padding: 32px 24px; }
  .hero { padding: 32px 0 64px; }
  .contact-form, .thanks { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* no 3D and no animation: the faces swap instantly, and the one turned away is hidden */
  .flip__inner { transition: none; transform: none !important; }
  .flip { transition: none; }
  .flip:hover { transform: none; }
  .face--back { transform: none; }
  .face[inert] { visibility: hidden; }
}
