/* ==========================================================
   dannyjordan.uk — modular, dependency-free CSS
   Sections: tokens · base · layout · nav · hero · cards ·
   filters · widgets · footer · effects · motion
   ========================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #fbf8f3;
  --bg-soft: #f4efe6;
  --surface: #ffffff;
  --ink: #1d1b26;
  --ink-soft: #5d5a6b;
  --line: #e7e1d5;
  --accent: #6c5ce7;
  --accent-ink: #ffffff;
  --accent-soft: #ece9fd;
  --pink: #ff7eb6;
  --amber: #ffb84d;
  --mint: #3ecf9b;
  --sky: #4cb8ff;
  --shadow: 0 1px 2px rgb(29 27 38 / 6%), 0 8px 24px -8px rgb(29 27 38 / 12%);
  --shadow-lift: 0 2px 4px rgb(29 27 38 / 8%), 0 24px 48px -16px rgb(108 92 231 / 30%);
  --radius: 20px;
  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #14121c;
  --bg-soft: #1b1826;
  --surface: #211e2f;
  --ink: #f3f1fa;
  --ink-soft: #a9a5bd;
  --line: #322e45;
  --accent: #9b8cff;
  --accent-ink: #14121c;
  --accent-soft: #2b2650;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px -8px rgb(0 0 0 / 50%);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / 30%), 0 24px 48px -16px rgb(155 140 255 / 30%);
  color-scheme: dark;
}

/* Matrix Easter egg re-themes the whole site */
:root[data-theme="matrix"] {
  --bg: #050a07;
  --bg-soft: #08120c;
  --surface: #0b1a11;
  --ink: #c9ffe0;
  --ink-soft: #66b88a;
  --line: #14402a;
  --accent: #2bff88;
  --accent-ink: #03150a;
  --accent-soft: #0d2a1a;
  --shadow: 0 0 0 1px #14402a;
  --shadow-lift: 0 0 24px -4px rgb(43 255 136 / 40%);
  --font-display: var(--font-mono);
  --font-body: var(--font-mono);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font-body);
  overflow-x: hidden;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }
a { color: inherit; }
img, canvas, svg { max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.section { padding-block: clamp(3rem, 8vw, 6rem); }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.6rem 1rem; border-radius: 10px; text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

.eyebrow {
  font: 500 0.78rem/1 var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent);
}
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.section-head h2 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); margin-top: 0.6rem; }
.section-head p { color: var(--ink-soft); max-width: 36ch; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.8rem 1.35rem; border-radius: 999px;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  font-weight: 600; text-decoration: none;
  transition: transform 0.35s var(--spring), background 0.2s, color 0.2s, box-shadow 0.3s;
}
.btn:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: 0 6px 0 var(--ink); }
.btn:active, .btn.is-bouncing { transform: translateY(1px) scale(0.96); box-shadow: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 55%, black); }
.btn--small { padding: 0.5rem 1rem; font-size: 0.9rem; }
.arrow { display: inline-block; transition: transform 0.3s var(--spring); }
a:hover > .arrow, .btn:hover .arrow, .card:hover .arrow { transform: translate(3px, -3px); }

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.nav.is-stuck { border-color: var(--line); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 1rem; }
.logo {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font: 800 1.2rem var(--font-display); text-decoration: none; letter-spacing: -0.03em;
  background: none; border: 0; padding: 0;
}
.logo__mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px;
  background: var(--accent); color: var(--accent-ink); font-size: 1rem;
  transition: transform 0.4s var(--spring);
}
.logo:hover .logo__mark { transform: rotate(-12deg) scale(1.1); }
.nav__links { display: flex; align-items: center; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.nav__links a {
  display: block; padding: 0.5rem 0.9rem; border-radius: 999px;
  text-decoration: none; font-weight: 500; color: var(--ink-soft);
  transition: background 0.2s, color 0.2s;
}
.nav__links a:hover, .nav__links a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.nav__tools { display: flex; gap: 0.4rem; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); font-size: 1.05rem;
  transition: transform 0.3s var(--spring), border-color 0.2s;
}
.icon-btn:hover { transform: translateY(-2px) rotate(-6deg); border-color: var(--accent); }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.menu-toggle { display: none; }

@media (max-width: 760px) {
  .menu-toggle { display: grid; }
  .nav__links {
    position: absolute; inset: 68px 0 auto 0; flex-direction: column; align-items: stretch;
    padding: 0.75rem 1.25rem 1.25rem; background: var(--bg); border-bottom: 1px solid var(--line);
    transform-origin: top; transform: scaleY(0); opacity: 0; pointer-events: none;
    transition: transform 0.3s var(--ease), opacity 0.2s;
  }
  .nav__links.is-open { transform: scaleY(1); opacity: 1; pointer-events: auto; }
  .nav__links a { padding: 0.8rem 1rem; }
}

/* ---------- Hero ---------- */
.hero { padding-block: clamp(3rem, 9vw, 7rem) clamp(2rem, 5vw, 4rem); position: relative; }
.hero__grid { display: grid; gap: 3rem; grid-template-columns: 1.3fr 0.9fr; align-items: center; }
.pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.pill {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.85rem; border-radius: 999px; background: var(--surface);
  border: 1.5px solid var(--line); font: 500 0.82rem var(--font-mono);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 var(--mint); animation: pulse 2s infinite; }
.hero h1 { font-size: clamp(2.8rem, 8vw, 5.6rem); font-weight: 800; letter-spacing: -0.045em; }
.hero h1 .wave { display: inline-block; transform-origin: 70% 80%; animation: wave 2.6s ease-in-out 1s 2; cursor: default; }
.hero h1 .hl {
  background: linear-gradient(transparent 62%, color-mix(in srgb, var(--amber) 70%, transparent) 62% 92%, transparent 92%);
  padding-inline: 0.08em;
}
.tagline { font-size: clamp(1.1rem, 2.4vw, 1.4rem); color: var(--ink-soft); margin-top: 1.5rem; max-width: 34ch; min-height: 2.9em; }
.tagline strong { color: var(--ink); border-bottom: 3px solid var(--pink); }
.caret { display: inline-block; width: 2px; height: 1em; background: var(--accent); margin-left: 2px; vertical-align: -0.12em; animation: blink 1s steps(1) infinite; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }

.hero__art { position: relative; aspect-ratio: 1; max-width: 380px; width: 100%; justify-self: center; }
.blob {
  position: absolute; inset: 6%; background: var(--accent); border-radius: 42% 58% 62% 38% / 45% 40% 60% 55%;
  animation: morph 12s ease-in-out infinite;
}
.sticker {
  position: absolute; display: grid; place-items: center; text-align: center;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 18px;
  box-shadow: 5px 5px 0 var(--ink); padding: 0.8rem 1rem; font: 700 0.95rem/1.2 var(--font-display);
  cursor: grab; user-select: none; touch-action: none;
  transition: box-shadow 0.2s, transform 0.3s var(--spring);
}
.sticker:active { cursor: grabbing; box-shadow: 2px 2px 0 var(--ink); }
.sticker small { display: block; font: 500 0.7rem var(--font-mono); color: var(--ink-soft); margin-top: 0.15rem; }
.sticker--1 { top: 6%; left: 2%; rotate: -6deg; }
.sticker--2 { top: 36%; right: 0; rotate: 5deg; }
.sticker--3 { bottom: 6%; left: 14%; rotate: -3deg; }
.sticker .em { font-size: 1.8rem; display: block; }

@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__art { max-width: 300px; }
}

/* ---------- Cards ---------- */
.grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 960px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid { grid-template-columns: 1fr; } }

.card {
  --tilt-x: 0deg; --tilt-y: 0deg;
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition: transform 0.25s var(--ease), box-shadow 0.3s, border-color 0.3s, opacity 0.35s, scale 0.35s var(--spring);
  will-change: transform;
}
.card:hover { box-shadow: var(--shadow-lift); border-color: var(--accent); }
.card[hidden] { display: none; }
.card.is-leaving { opacity: 0; scale: 0.92; }
.card__media { aspect-ratio: 16 / 9; background: var(--bg-soft); position: relative; border-bottom: 1.5px solid var(--line); overflow: hidden; }
.card__media canvas { display: block; width: 100%; height: 100%; }
.card__body { display: flex; flex-direction: column; gap: 0.7rem; padding: 1.4rem; flex: 1; }
.card__body h3 { font-size: 1.4rem; }
.card__body p { color: var(--ink-soft); font-size: 0.95rem; flex: 1; }
.card__link { font-weight: 600; text-decoration: none; color: var(--accent); width: fit-content; }
.card__link::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.card__link:hover { text-decoration: underline; text-underline-offset: 4px; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag { font: 500 0.72rem var(--font-mono); padding: 0.25rem 0.6rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.tag--live { background: color-mix(in srgb, var(--mint) 22%, transparent); color: #0c7a54; }
:root[data-theme="dark"] .tag--live { color: var(--mint); }

/* Featured Cardstock */
.featured {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; margin-bottom: 2.5rem;
  border-radius: 28px; border: 2px solid var(--ink); background: var(--surface);
  box-shadow: 8px 8px 0 var(--ink); overflow: hidden; position: relative;
  transition: transform 0.35s var(--spring), box-shadow 0.35s var(--spring);
}
.featured:hover { transform: translate(-3px, -3px); box-shadow: 11px 11px 0 var(--ink); }
.featured__body { padding: clamp(1.5rem, 4vw, 2.75rem); display: flex; flex-direction: column; gap: 1rem; align-items: flex-start; }
.featured__body h2 { font-size: clamp(2rem, 5vw, 3.2rem); }
.featured__body p { color: var(--ink-soft); max-width: 46ch; }
.featured__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.4rem; font-size: 0.95rem; }
.featured__list li::before { content: "✓"; color: var(--mint); font-weight: 800; margin-right: 0.6rem; }
.featured__art {
  position: relative; min-height: 280px; background:
    radial-gradient(circle at 20% 20%, var(--pink), transparent 50%),
    radial-gradient(circle at 80% 70%, var(--sky), transparent 55%),
    var(--accent);
  display: grid; place-items: center; overflow: hidden; border-left: 2px solid var(--ink);
}
.fan { position: relative; width: 190px; height: 250px; }
.pcard {
  position: absolute; inset: 0; border-radius: 14px; border: 2px solid var(--ink);
  background: linear-gradient(160deg, #fff 0 35%, var(--c) 35%);
  box-shadow: 4px 4px 0 var(--ink); display: grid; place-items: center; font-size: 3rem;
  transform-origin: 50% 120%; transition: transform 0.5s var(--spring);
  rotate: var(--r);
}
.pcard::after { content: attr(data-price); position: absolute; bottom: 10px; right: 12px; font: 700 0.85rem var(--font-mono); color: var(--ink); background: #fff; padding: 0.1rem 0.5rem; border-radius: 6px; border: 1.5px solid var(--ink); }
.featured:hover .pcard:nth-child(1) { rotate: -22deg; }
.featured:hover .pcard:nth-child(3) { rotate: 22deg; }
.ribbon {
  position: absolute; top: 16px; right: -38px; rotate: 35deg; z-index: 2;
  background: var(--ink); color: var(--bg); font: 500 0.72rem var(--font-mono);
  letter-spacing: 0.1em; padding: 0.3rem 3rem; text-transform: uppercase;
}
@media (max-width: 820px) {
  .featured { grid-template-columns: 1fr; }
  .featured__art { order: -1; min-height: 240px; border-left: 0; border-bottom: 2px solid var(--ink); }
}

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  padding: 0.5rem 1rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 500; transition: transform 0.3s var(--spring), background 0.2s, color 0.2s, border-color 0.2s;
}
.chip:hover { transform: translateY(-2px); border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .count { font: 500 0.75rem var(--font-mono); opacity: 0.6; margin-left: 0.3rem; }

/* ---------- Widgets (mini features) ---------- */
.widgets { display: grid; gap: 1.5rem; grid-template-columns: 1.4fr 1fr; align-items: start; }
@media (max-width: 860px) { .widgets { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); }
.panel h3 { font-size: 1.35rem; margin: 0.5rem 0; }
.panel > p { color: var(--ink-soft); font-size: 0.95rem; }
.toggle-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.2rem 0; align-items: center; }
.toggle-row .sep { width: 1px; height: 24px; background: var(--line); margin-inline: 0.3rem; }
.answer {
  background: var(--bg-soft); border-radius: 14px; padding: 1.1rem 1.2rem; border: 1.5px dashed var(--line);
  font-size: 1.02rem; min-height: 5.2em; transition: opacity 0.2s, transform 0.3s var(--spring);
}
.answer.is-swapping { opacity: 0; transform: translateY(6px); }
.answer b { color: var(--accent); }
.weather-badge { float: right; font: 500 0.75rem var(--font-mono); padding: 0.3rem 0.7rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

.stack { display: grid; gap: 1.5rem; }
.fixture { margin-top: 1rem; padding: 1rem 1.1rem; border-radius: 14px; background: var(--bg-soft); }
.fixture__team { font: 700 1.15rem var(--font-display); transition: opacity 0.25s; }
.fixture__meta { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; color: var(--ink-soft); font-size: 0.88rem; margin-top: 0.3rem; transition: opacity 0.25s; }
.fixture__label { font: 500 0.7rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); margin-bottom: 0.3rem; }

.fun-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; align-items: center; }
.counter { font: 700 1.6rem var(--font-display); min-width: 2ch; }
.hint { font: 400 0.8rem var(--font-mono); color: var(--ink-soft); margin-top: 0.8rem; }
kbd { font: 500 0.78em var(--font-mono); padding: 0.1em 0.45em; border: 1.5px solid var(--line); border-bottom-width: 3px; border-radius: 6px; background: var(--surface); }

/* ---------- Footer ---------- */
.give {
  background: var(--ink); color: var(--bg); border-radius: 28px;
  padding: clamp(1.75rem, 5vw, 3.5rem); position: relative; overflow: hidden;
}
.give h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
.give p { max-width: 56ch; margin-top: 1rem; opacity: 0.8; }
.give__links { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.6rem; }
.give__links a {
  padding: 0.7rem 1.2rem; border-radius: 999px; background: var(--bg); color: var(--ink);
  text-decoration: none; font-weight: 600; transition: transform 0.3s var(--spring), background 0.2s;
}
.give__links a:hover { transform: translateY(-3px) rotate(-1.5deg); background: var(--amber); color: #1d1b26; }
.footer { padding-block: 3rem 4rem; }
.footer__row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1.5rem; }
.socials { display: flex; flex-wrap: wrap; gap: 0.6rem; list-style: none; margin: 0; padding: 0; }
.socials a {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.55rem 1rem; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); text-decoration: none; font-weight: 500;
  transition: transform 0.3s var(--spring), border-color 0.2s;
}
.socials a:hover { transform: translateY(-3px); border-color: var(--accent); }
.footer small { color: var(--ink-soft); font-family: var(--font-mono); }

/* ---------- Effects ---------- */
#matrix-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0; transition: opacity 1s; }
:root[data-theme="matrix"] #matrix-canvas { opacity: 0.35; }
main, .nav, .footer { position: relative; z-index: 1; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; }
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 150; translate: -50% 150%;
  background: var(--ink); color: var(--bg); padding: 0.75rem 1.2rem; border-radius: 999px;
  font-weight: 500; box-shadow: var(--shadow-lift); transition: translate 0.5s var(--spring); max-width: calc(100vw - 2rem);
}
.toast.is-visible { translate: -50% 0; }
.spark {
  position: fixed; pointer-events: none; z-index: 120; font-size: 1.1rem; translate: -50% -50%;
  animation: spark 0.8s var(--ease) forwards;
}

/* Scroll-in reveal */
.reveal { opacity: 0; translate: 0 24px; transition: opacity 0.7s var(--ease), translate 0.7s var(--ease); }
.reveal.is-in { opacity: 1; translate: 0 0; }
.no-js .reveal { opacity: 1; translate: 0 0; }

/* ---------- Keyframes ---------- */
@keyframes pulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes wave { 0%, 60%, 100% { rotate: 0deg; } 10%, 30% { rotate: 14deg; } 20%, 40% { rotate: -8deg; } 50% { rotate: 10deg; } }
@keyframes morph {
  0%, 100% { border-radius: 42% 58% 62% 38% / 45% 40% 60% 55%; rotate: 0deg; }
  50% { border-radius: 60% 40% 40% 60% / 55% 60% 40% 45%; rotate: 12deg; }
}
@keyframes spark { to { opacity: 0; transform: translateY(-46px) scale(1.5) rotate(20deg); } }
@keyframes shake { 0%, 100% { translate: 0; } 25% { translate: -6px 0; } 75% { translate: 6px 0; } }
.shake { animation: shake 0.3s 2; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; translate: 0 0; }
  .card { transform: none !important; }
}

/* Cardstock logo */
.em-img { display: block; width: 44px; height: 44px; border-radius: 11px; margin: 0 auto 0.3rem; }
.featured__logo { width: min(180px, 50%); height: auto; border-radius: 26%; border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); rotate: -6deg; transition: rotate 0.5s var(--spring), scale 0.5s var(--spring); }
.featured:hover .featured__logo { rotate: 4deg; scale: 1.06; }
.logo__mark { object-fit: cover; background: none; }
