/* =====================================================================
   rayla.uk — Moonshadow design system
   A Rayla (The Dragon Prince) fan shrine.

   Palette is built around lavender/violet + teal-navy + silver on a
   near-black "moonlit" ground, with one icy highlight accent.

   Contrast was checked against WCAG AA (4.5:1 body, 3:1 large/UI):
     --ink      #e7e4f2  on --bg #0c0a14  -> ~15.4:1  (AAA)
     --ink-soft #b9b4cf  on --bg #0c0a14  -> ~8.6:1   (AAA)
     --ink-dim  #918cab  on --bg #0c0a14  -> ~5.2:1   (AA)
     --violet   #c7b6f5  on --bg #0c0a14  -> ~9.6:1   (link text, AAA)
     --moon     #9fe9df  on --bg #0c0a14  -> ~11.5:1  (accent, AAA)
   Pairs on the slightly lighter card ground (--panel #15131f) stay >= 4.5:1.
   ===================================================================== */

/* ---- Design tokens -------------------------------------------------- */
:root {
  /* Ground */
  --bg:          #0c0a14;   /* near-black, faint violet */
  --bg-2:        #100d1b;   /* section alt ground */
  --panel:       #15131f;   /* card ground */
  --panel-2:     #1b1828;   /* raised card / hover */
  --line:        #2a2740;   /* hairline borders */
  --line-strong: #3a3658;

  /* Ink */
  --ink:      #e7e4f2;      /* primary text */
  --ink-soft: #b9b4cf;      /* secondary text */
  --ink-dim:  #918cab;      /* muted / meta (AA, use >= 16px) */

  /* Character hues */
  --violet:      #c7b6f5;   /* lavender — links, highlights */
  --violet-deep: #8b6fd6;   /* deeper violet — accents on light */
  --teal:        #2f5d73;   /* teal-navy — outfit */
  --teal-deep:   #16283a;
  --moon:        #9fe9df;   /* icy moon highlight (use sparingly) */
  --silver:      #cdd3e0;

  /* Functional */
  --link:        var(--violet);
  --link-hover:  #ffffff;
  --focus:       var(--moon);

  /* Type */
  --font-display: "Cinzel", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem,   0.96rem + 0.2vw, 1.08rem);
  --step-1:  clamp(1.2rem, 1.12rem + 0.4vw, 1.45rem);
  --step-2:  clamp(1.45rem, 1.3rem + 0.75vw, 1.95rem);
  --step-3:  clamp(1.75rem, 1.5rem + 1.25vw, 2.6rem);
  --step-4:  clamp(2.1rem, 1.7rem + 2vw, 3.5rem);

  /* Space + structure */
  --wrap: 72rem;
  --measure: 68ch;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255,255,255,0.03) inset,
            0 18px 40px -24px rgba(0,0,0,0.8);
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

/* ---- Reset / base -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

body {
  min-height: 100%;
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(139,111,214,0.16), transparent 60%),
    radial-gradient(900px 600px at 8% 0%, rgba(47,93,115,0.16), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-wrap: balance;
}

p, li { text-wrap: pretty; }

a {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
  transition: color 0.18s var(--ease), text-decoration-color 0.18s var(--ease);
}
a:hover { color: var(--link-hover); text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---- Layout helpers ----------------------------------------------- */
.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.measure { max-width: var(--measure); }
.center { text-align: center; margin-inline: auto; }
.stack > * + * { margin-top: 1rem; }
.lede { font-size: var(--step-1); color: var(--ink-soft); }
.eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: var(--step--1);
  color: var(--moon);
}

.skip-link {
  position: absolute;
  left: 1rem; top: -120%;
  z-index: 100;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ---- Header / nav -------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: var(--step-1);
  letter-spacing: 0.08em;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-mark { width: 26px; height: 26px; color: var(--violet); flex: none; }
.brand-tld { color: var(--violet); }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.8rem;
  cursor: pointer;
}

.primary-nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  align-items: center;
}
.primary-nav a {
  display: inline-block;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.primary-nav a:hover { color: var(--ink); background: var(--panel); }
.primary-nav a[aria-current="page"] {
  color: var(--bg);
  background: var(--violet);
  font-weight: 600;
}

@media (max-width: 880px) {
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
    padding: 0.75rem 0;
  }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; align-items: stretch; gap: 0.1rem; }
  .primary-nav .wrap { width: min(100% - 2.5rem, var(--wrap)); }
  .primary-nav a { padding: 0.7rem 0.8rem; font-size: var(--step-0); }
}

/* ---- Hero ---------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3rem, 8vw, 6rem);
  border-bottom: 1px solid var(--line);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: clamp(1.5rem, 5vw, 3.5rem);
  align-items: center;
}
.hero h1 {
  font-size: var(--step-4);
  margin-top: 0.6rem;
}
.hero .lede { margin-top: 1.1rem; max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.8rem; }
.hero-art { justify-self: center; width: min(100%, 360px); }
@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { order: -1; width: min(72%, 280px); }
}

/* ---- Buttons ------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.btn-primary { background: var(--violet); color: #1a132c; font-weight: 600; }
.btn-primary:hover { background: #d8cbff; color: #1a132c; }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--violet); color: var(--ink); background: var(--panel); }
.btn:hover { transform: translateY(-2px); }

/* ---- Sections ------------------------------------------------------ */
.section { padding-block: clamp(2.75rem, 7vw, 5rem); }
.section--alt { background: var(--bg-2); border-block: 1px solid var(--line); }
.section-head { max-width: 60ch; margin-bottom: 2rem; }
.section-head h2 { font-size: var(--step-3); }
.section-head .eyebrow { display: block; margin-bottom: 0.6rem; }

.prose { max-width: var(--measure); }
.prose h2 { font-size: var(--step-2); margin-top: 2.5rem; }
.prose h3 { font-size: var(--step-1); margin-top: 1.8rem; color: var(--violet); }
.prose p + p { margin-top: 1rem; }
.prose ul, .prose ol { margin-top: 1rem; padding-left: 1.3rem; }
.prose li + li { margin-top: 0.4rem; }
.prose strong { color: var(--ink); }

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-block: clamp(2rem, 5vw, 3.5rem);
  color: var(--violet-deep);
}
.divider::before, .divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}
.divider svg { width: 22px; height: 22px; flex: none; }

/* ---- Cards / grids ------------------------------------------------- */
.grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: var(--line-strong); background: var(--panel-2); }
.card h3 { font-size: var(--step-1); margin-bottom: 0.5rem; }
.card .meta { color: var(--ink-dim); font-size: var(--step--1); }
.card-icon { width: 34px; height: 34px; color: var(--violet); margin-bottom: 0.9rem; }

.facts { columns: 2; column-gap: 1.4rem; }
.facts li { break-inside: avoid; margin-bottom: 0.9rem; }
@media (max-width: 620px) { .facts { columns: 1; } }

/* ---- Stat strip ---------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 1.4rem;
}
.stat { text-align: center; min-width: 0; }
.stat dt { font-size: var(--step--1); color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.12em; }
.stat dd {
  font-family: var(--font-display);
  font-size: var(--step-1);
  line-height: 1.2;
  color: var(--violet);
  margin-top: 0.3rem;
  overflow-wrap: break-word;
}

/* ---- Profile (definition list) ------------------------------------ */
.profile {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 1.5rem;
}
.profile dt { color: var(--ink-dim); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.08em; padding-top: 0.15rem; }
.profile dd { color: var(--ink); }
@media (max-width: 540px) {
  .profile { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .profile dd { margin-bottom: 0.8rem; }
}

/* ---- Timeline (Arc) ----------------------------------------------- */
.timeline { position: relative; margin-top: 2rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 14px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--violet), var(--teal));
}
.tl-item { position: relative; padding-left: 3.2rem; padding-bottom: 2.2rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: 6px; top: 4px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--violet);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 18%, transparent);
}
.tl-item h3 { font-size: var(--step-1); color: var(--ink); }
.tl-book { color: var(--moon); font-size: var(--step--1); letter-spacing: 0.14em; text-transform: uppercase; font-family: var(--font-display); }

/* ---- Quote cards --------------------------------------------------- */
.quotes-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.quote {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-left: 3px solid var(--violet);
  border-radius: var(--radius);
  padding: 1.5rem 1.4rem 1.3rem;
}
.quote blockquote {
  font-size: var(--step-1);
  line-height: 1.4;
  font-style: italic;
  color: var(--ink);
}
.quote .attribution { display: block; margin-top: 0.9rem; color: var(--ink-soft); font-size: var(--step--1); font-style: normal; }
.quote .attribution .ctx { color: var(--ink-dim); }
.quote::before {
  content: "\201C";
  position: absolute;
  top: -0.1em; right: 0.3em;
  font-family: var(--font-display);
  font-size: 4rem;
  color: color-mix(in srgb, var(--violet) 22%, transparent);
  line-height: 1;
}

/* ---- Gallery ------------------------------------------------------- */
.gallery-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
figure.plate {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
figure.plate:hover { transform: translateY(-3px); border-color: var(--violet); }
figure.plate .art {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(120% 100% at 50% 0%, var(--teal-deep), var(--bg) 82%);
}
figure.plate .art svg { width: 56%; height: 56%; color: var(--violet); }
figure.plate .art img { width: 100%; height: 100%; object-fit: cover; }
figure.plate .art--contain img { object-fit: contain; padding: 0.75rem; }
/* Portrait-ratio stills: bias the crop toward the face/top of frame */
figure.plate .art--top img { object-position: 50% 18%; }
figure.plate figcaption { padding: 0.85rem 1rem; }
figure.plate figcaption b { display: block; color: var(--ink); font-family: var(--font-display); font-size: var(--step-0); }
figure.plate figcaption span { color: var(--ink-dim); font-size: var(--step--1); }

/* ---- Featured artists (link-out cards) ----------------------------- */
.artists-grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}
a.artist-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
a.artist-card:hover { transform: translateY(-3px); border-color: var(--violet); background: var(--panel-2); }
.artist-card .thumb {
  display: block;
  aspect-ratio: 4 / 3;
  margin: -0.3rem -0.3rem 0.6rem;
  border-radius: calc(var(--radius) - 5px);
  overflow: hidden;
  background: radial-gradient(120% 100% at 50% 0%, var(--teal-deep), var(--bg) 82%);
}
.artist-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
}
a.artist-card:hover .artist-go { color: var(--link-hover); }
.artist-card .badge {
  align-self: flex-start;
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--moon);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}
.artist-card .name { font-family: var(--font-display); font-size: var(--step-1); color: var(--ink); }
.artist-card .work { color: var(--ink-soft); font-size: var(--step--1); flex: 1; }
.artist-go {
  margin-top: 0.3rem;
  color: var(--violet);
  font-size: var(--step--1);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--violet) 45%, transparent);
}

/* ---- Callout ------------------------------------------------------- */
.callout {
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--moon);
  background: color-mix(in srgb, var(--teal-deep) 50%, var(--panel));
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.3rem;
  color: var(--ink-soft);
  font-size: var(--step--1);
}
.callout b { color: var(--ink); }

/* ---- Page header (interior pages) --------------------------------- */
.page-head {
  padding-block: clamp(2.5rem, 6vw, 4rem);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(700px 300px at 90% -40%, rgba(159,233,223,0.10), transparent 60%),
    var(--bg-2);
}
.page-head h1 { font-size: var(--step-4); margin-top: 0.5rem; }
.page-head .lede { margin-top: 1rem; }

/* ---- Footer -------------------------------------------------------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  padding-block: 2.5rem;
  color: var(--ink-dim);
  font-size: var(--step--1);
}
.footer-inner { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; align-items: flex-start; }
.footer-moons { display: flex; gap: 0.4rem; color: var(--violet-deep); margin-bottom: 0.8rem; }
.footer-moons svg { width: 16px; height: 16px; }
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--ink); }

body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1 0 auto; }

/* ---- Motion preferences ------------------------------------------- */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.in { opacity: 1; transform: none; transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .btn:hover, .card:hover, figure.plate:hover { transform: none; }
}
