@layer reset, base, components, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html:focus-within { scroll-behavior: smooth; }
  body { margin: 0; }
  img { max-width: 100%; height: auto; display: block; }
  input, button { font: inherit; }
  a { color: inherit; }
}

@layer base {
  :root {
    color-scheme: dark;
    --hue: 320;
    --paper: #060914;
    --paper-2: #0a1230;
    --ink: hsl(215 40% 96%);
    --muted: hsl(215 22% 78% / 0.78);
    --border: hsl(215 22% 78% / 0.18);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
    --radius: 18px;
    --accent: hsl(var(--hue) 92% 62%);
    --accent-2: hsl(calc(var(--hue) + 120) 92% 62%);
    --accent-3: hsl(calc(var(--hue) + 240) 92% 62%);
    --surface: hsl(228 40% 11% / 0.78);
    --surface-2: hsl(228 40% 12% / 0.88);
    --surface-solid: hsl(228 42% 10%);
    --max: 1100px;
  }

  body {
    font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    color: var(--ink);
    background:
      radial-gradient(1000px 600px at 15% 15%, hsl(var(--hue) 92% 62% / 0.20), transparent 62%),
      radial-gradient(850px 550px at 85% 25%, hsl(calc(var(--hue) + 120) 92% 62% / 0.18), transparent 62%),
      radial-gradient(900px 640px at 55% 92%, hsl(calc(var(--hue) + 240) 92% 62% / 0.16), transparent 64%),
      linear-gradient(135deg, var(--paper), var(--paper-2));
    min-height: 100svh;
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.45;
    background-image:
      linear-gradient(to right, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 54px 54px;
    mix-blend-mode: overlay;
  }

  body::after {
    content: "";
    position: fixed;
    inset: -20%;
    pointer-events: none;
    opacity: 0.55;
    filter: blur(44px) saturate(150%);
    background:
      radial-gradient(900px 600px at 18% 22%, hsl(var(--hue) 92% 62% / 0.22), transparent 60%),
      radial-gradient(900px 700px at 82% 35%, hsl(calc(var(--hue) + 120) 92% 62% / 0.20), transparent 60%),
      radial-gradient(900px 700px at 55% 88%, hsl(calc(var(--hue) + 240) 92% 62% / 0.18), transparent 62%);
    mix-blend-mode: screen;
    transform: translate3d(0, 0, 0);
    animation: auroraDrift 18s ease-in-out infinite alternate;
  }

  @keyframes auroraDrift {
    0% { transform: translate3d(-2%, -2%, 0) rotate(-1deg) scale(1.05); }
    50% { transform: translate3d(2.5%, 1.5%, 0) rotate(1.4deg) scale(1.10); }
    100% { transform: translate3d(-1%, 2.5%, 0) rotate(-0.8deg) scale(1.06); }
  }

  @media (prefers-reduced-motion: reduce) {
    html:focus-within { scroll-behavior: auto; }
    body::after { animation: none; }
  }

  ::selection {
    background: hsl(var(--hue) 92% 62% / 0.28);
  }

  h1, h2, h3 {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    letter-spacing: -0.02em;
    margin: 0;
  }

  p { margin: 0; }

  :where(a):focus-visible,
  :where(button):focus-visible,
  :where(input):focus-visible {
    outline: 3px solid hsl(calc(var(--hue) + 120) 92% 62% / 0.35);
    outline-offset: 2px;
  }
}

@layer components {
  .skip {
    position: absolute;
    left: -999px;
    top: 10px;
    padding: 10px 12px;
    border-radius: 999px;
    background: var(--surface-solid);
    color: var(--ink);
    z-index: 10;
  }
  .skip:focus { left: 12px; }

  .wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 20px clamp(16px, 3vw, 28px) 54px;
    position: relative;
  }

  .topbar {
    position: sticky;
    top: 10px;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 16px 24px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background:
      radial-gradient(240px 120px at 15% 30%, hsl(var(--hue) 92% 62% / 0.20), transparent 60%),
      radial-gradient(260px 140px at 85% 10%, hsl(calc(var(--hue) + 120) 92% 62% / 0.18), transparent 62%),
      var(--surface-2);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.38);
    transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1);
  }

  .brand {
    display: flex;
    flex-direction: column;
    font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
    gap: 2px;
  }
  .brandLink {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--ink);
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
  }
  .brandLink:hover { text-decoration: underline; }
  .brandLink:focus-visible { text-decoration: underline; }
  .brand strong {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.015em;
  }
  .brand span {
    font-size: 13px;
    color: var(--muted);
  }

  .nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .nav a {
    padding: 10px 14px;
    border-radius: 999px;
    font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    transition: background 0.15s ease-out;
  }
  .nav a:hover, .nav a:focus-visible {
    background: rgba(255, 255, 255, 0.08);
  }

  .hero {
    margin-top: 22px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 18px;
    align-items: stretch;
  }

  .panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
      radial-gradient(500px 260px at 18% 18%, hsl(var(--hue) 92% 62% / 0.10), transparent 55%),
      var(--surface);
    box-shadow: var(--shadow);
    overflow: clip;
  }

  .panelInset { padding: clamp(18px, 2.4vw, 28px); }

  .heroTitle {
    font-size: clamp(38px, 4.6vw, 60px);
    line-height: 0.98;
  }

  .kicker {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 12px;
  }

  .kickerDot {
    width: 9px;
    height: 9px;
    border-radius: 99px;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.65), transparent 55%), var(--accent);
    box-shadow:
      0 0 0 4px hsl(var(--hue) 92% 62% / 0.18),
      0 0 18px hsl(var(--hue) 92% 62% / 0.45);
  }

  .lede {
    margin-top: 14px;
    font-size: 18px;
    line-height: 1.55;
    color: hsl(215 40% 96% / 0.92);
    max-width: 68ch;
  }

  .ctaRow {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    background: hsl(228 42% 10% / 0.70);
  }

  .btnPrimary {
    background:
      radial-gradient(220px 120px at 20% 20%, rgba(255, 255, 255, 0.25), transparent 55%),
      linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #070914;
    border-color: hsl(215 22% 78% / 0.16);
    box-shadow:
      0 14px 30px hsl(var(--hue) 92% 62% / 0.22),
      0 10px 24px rgba(0, 0, 0, 0.28);
  }

  .btnGhost:hover { background: rgba(255, 255, 255, 0.08); }
  .btn:active { transform: translateY(1px); }

  .photoCard {
    position: relative;
    padding: 16px;
    display: grid;
    gap: 12px;
    align-content: start;
  }

  .photoFrame {
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid var(--border);
    background: hsl(228 42% 10% / 0.55);
    overflow: hidden;
    transform: rotate(-1.2deg);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  }

  .photoFrame img {
    aspect-ratio: 4 / 5;
    object-fit: cover;
    width: 100%;
  }

  .photoCaption {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    color: var(--muted);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }

  .strip {
    margin-top: 16px;
    border-radius: calc(var(--radius) + 8px);
    border: 1px solid var(--border);
    background:
      radial-gradient(500px 220px at 14% 30%, hsl(var(--hue) 92% 62% / 0.22), transparent 60%),
      radial-gradient(520px 240px at 80% 10%, hsl(calc(var(--hue) + 120) 92% 62% / 0.18), transparent 60%),
      linear-gradient(135deg, hsl(228 42% 10% / 0.72), hsl(228 42% 12% / 0.72));
    padding: 14px;
    display: grid;
    gap: 10px;
  }

  .stripRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }

  .strip h2 { font-size: 16px; }

  .strip p {
    color: hsl(215 40% 96% / 0.90);
    font-size: 14px;
    line-height: 1.5;
  }

  .signup {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
  }

  .field {
    min-width: 210px;
    flex: 1;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-solid);
    color: var(--ink);
  }

  .note { color: var(--muted); font-size: 13px; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; }

  .section {
    margin-top: 22px;
    display: grid;
    gap: 12px;
  }

  .sectionHeader {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
  }

  .sectionHeader h2 { font-size: 22px; }
  .sectionHeader p { color: var(--muted); font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; }

  .shelf {
    display: grid;
    gap: 12px;
  }

  .shelfRow {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 1fr);
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
  }

  .bookCard {
    scroll-snap-align: start;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.42);
    overflow: clip;
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 290px;
  }

  .cover {
    height: 255px;
    background:
      radial-gradient(200px 140px at 22% 18%, rgba(255, 255, 255, 0.22), transparent 58%),
      conic-gradient(from 210deg at 50% 50%, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
  }

  .cover img {
    width: auto !important;
    height: 100% !important;
    max-height: 100% !important;
    max-width: none !important;
    flex: 0 0 auto;
    transform: none !important;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(0, 0, 0, 0.08);
  }

  .coverPlaceholder {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    background: rgba(0, 0, 0, 0.10);
    display: grid;
    align-content: center;
    padding: 14px;
    color: rgba(255, 255, 255, 0.92);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  }

  .coverPlaceholder strong { font-size: 16px; }
  .coverPlaceholder span { font-size: 12px; opacity: 0.85; margin-top: 6px; }

  .bookBody { padding: 14px; display: grid; gap: 10px; }
  .bookBody h3 { font-size: 18px; }
  .bookMeta { color: var(--muted); font-size: 13px; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; }
  .bookActions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

  .prose {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.65;
    color: hsl(215 40% 96% / 0.92);
  }
  .prose p { margin: 0 0 12px; }
  .prose ul { margin: 0 0 12px; padding-left: 20px; }
  .prose li { margin: 6px 0; }
  .prose hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
  .prose h2 { margin: 16px 0 10px; font-size: 20px; }
  .prose h3 { margin: 14px 0 8px; font-size: 18px; }
  .prose a { color: var(--accent-2); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

  .crumbs {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    color: var(--muted);
    font-size: 13px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }

  .crumbs a { text-decoration: none; color: hsl(215 40% 96% / 0.88); }
  .crumbs a:hover { text-decoration: underline; }

  footer {
    margin-top: 30px;
    color: var(--muted);
    font-size: 12px;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
  }

  @media (max-width: 920px) {
    .hero { grid-template-columns: 1fr; }
    .topbar { position: static; border-radius: var(--radius); }
  }
}

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