/* ---------- Tokens (carried over from the original Carrd theme) ---------- */
:root {
  --bg: #1d2025;
  --card: #2e445b;
  --card-deep: #263a4f;
  --text: #ffffff;
  --text-muted: #c4cfdb;
  --text-faint: #b3b3b3;
  --line: rgba(255, 255, 255, 0.22);
  --accent: #1ccbd6;
  --icon: #8ac9fb;

  --font-display: "Raleway", system-ui, sans-serif;
  --font-body: "Source Sans 3", "Source Sans Pro", system-ui, sans-serif;

  --radius: 0.5rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --max: 74rem;
  --header-h: 3.75rem;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.85;
  letter-spacing: 0.015em;
  min-height: 100vh;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
ul { list-style: none; padding: 0; }
a { color: inherit; }
p a { color: var(--icon); text-underline-offset: 0.2em; transition: color 0.2s; }
p a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--accent); color: var(--bg); padding: 0.5rem 1rem;
  border-radius: var(--radius); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ---------- Typography ---------- */
.title {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.45em;
  font-size: 1.25rem;
  line-height: 1.375;
  margin-right: -0.45em; /* offsets trailing letter-spacing */
}
.title--xl { font-size: clamp(1.6rem, 5vw, 2.25rem); letter-spacing: 0.3em; margin-right: -0.3em; }
.title--sm { font-size: 1rem; }

.eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.75rem;
  line-height: 1.9;
  color: var(--text-muted);
}
.eyebrow span { white-space: nowrap; }
.greeting { font-size: 1.15rem; }
.lede { color: var(--text-muted); max-width: 46rem; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.nav {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter);
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.nav__brand {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.35em; font-size: 0.8rem; text-decoration: none;
}
.nav__links { display: flex; gap: 0.25rem; }
.nav__links a {
  display: block; padding: 0.5rem 0.75rem;
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.2em; font-size: 0.65rem; text-decoration: none;
  color: var(--text-muted); border-radius: var(--radius);
  transition: color 0.2s;
}
.nav__links a:hover, .nav__links a[aria-current="true"] { color: var(--accent); }
.nav__toggle {
  display: none; background: none; border: 0; color: var(--text);
  width: 2.75rem; height: 2.75rem; margin-right: -0.5rem; cursor: pointer;
  border-radius: var(--radius);
}
.nav__toggle svg { width: 1.5rem; height: 1.5rem; margin: auto; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }

@media (max-width: 52rem) {
  .nav__toggle { display: grid; }
  .nav__links {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 0.5rem var(--gutter) 1rem;
    display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__links a { padding: 0.85rem 0; font-size: 0.75rem; }
}

/* ---------- Layout ---------- */
main {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.5rem) var(--gutter) 0;
  display: grid; gap: clamp(1.25rem, 3vw, 2.5rem);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1.5rem 3rem -1.5rem rgba(0, 0, 0, 0.5);
}
.card--padded { padding: clamp(2rem, 6vw, 4.5rem) clamp(1.25rem, 6vw, 4.5rem); }
.card--padded > * + * { margin-top: 1rem; }
.card--narrow { width: 100%; max-width: 48rem; justify-self: center; }

.card--split { display: grid; grid-template-columns: 1fr 1fr; min-height: 34rem; }
.card--reverse .card__media { order: 2; }
.card__media { position: relative; background: var(--card-deep); }
.card__media img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
}
/* Shows the whole image, letterboxed over a blurred copy of itself */
.card__media--contain { overflow: hidden; }
.card__media--contain::before {
  content: ""; position: absolute; inset: -2rem;
  background: var(--backdrop) center / cover;
  filter: blur(24px) saturate(1.1);
}
.card__media--contain img { object-fit: contain; z-index: 1; }
.card__body {
  padding: clamp(2rem, 5vw, 4.5rem) clamp(1.25rem, 5vw, 4rem);
  display: flex; flex-direction: column; justify-content: center; gap: 1rem;
}

@media (max-width: 52rem) {
  .card--split { grid-template-columns: 1fr; min-height: 0; }
  .card--reverse .card__media { order: 0; }
  .card__media { aspect-ratio: 4 / 3; }
  .card--hero .card__media { aspect-ratio: 4 / 4.25; }
  .card__media--contain { aspect-ratio: auto; }
  .card__media--contain::before { display: none; }
  .card__media--contain img { position: static; height: auto; }
}

/* ---------- Buttons ---------- */
.buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: 0 1.1rem 0 calc(1.1rem + 0.25em);
  font-family: var(--font-display); font-weight: 700; font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 0.25em; text-decoration: none;
  color: var(--text); background: transparent;
  border: 1px solid var(--line); border-radius: 0.25rem;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background-color 0.25s;
}
.button:hover { color: var(--accent); border-color: var(--accent); }
.button--solid { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.button--solid:hover { background: transparent; color: var(--accent); }
.button[disabled] { opacity: 0.6; cursor: progress; }

.socials { display: flex; gap: 0.25rem; margin-left: -0.6rem; }
.socials a {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%;
  transition: background-color 0.2s;
}
.socials svg { width: 1.25rem; height: 1.25rem; fill: var(--icon); transition: fill 0.2s; }
.socials a:hover svg { fill: var(--accent); }

.badge {
  align-self: flex-start;
  font-family: var(--font-display); font-weight: 700; font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 0.25em;
  color: var(--accent); border: 1px solid currentColor; border-radius: 999px;
  padding: 0.35rem 0.9rem 0.35rem calc(0.9rem + 0.25em);
}

/* ---------- Books ---------- */
.covers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6rem; margin: 0.5rem 0; }
.covers a { display: block; border-radius: 0.25rem; overflow: hidden; transition: transform 0.25s, box-shadow 0.25s; }
.covers a:hover { transform: translateY(-4px); box-shadow: 0 0.75rem 1.5rem -0.75rem rgba(0, 0, 0, 0.6); }
.covers img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }

/* ---------- Quotes ---------- */
.quotes {
  columns: 3 18rem; column-gap: 1rem;
  margin-top: 2rem !important;
}
.quotes li {
  break-inside: avoid;
  background: var(--card-deep);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.25rem 1.25rem 1.1rem;
  margin-bottom: 1rem;
}
.quotes blockquote { font-style: italic; line-height: 1.7; }
.quotes blockquote::before { content: "\201C"; }
.quotes blockquote::after { content: "\201D"; }
.quotes cite {
  display: block; margin-top: 0.6rem; font-style: normal;
  font-family: var(--font-display); font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.2em; color: var(--icon);
}
.quotes cite::before { content: "\2014\00a0"; }

/* ---------- Roaming gallery ---------- */
.gallery {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem; margin-top: 2rem !important;
}
@media (min-width: 48rem) { .gallery { grid-template-columns: repeat(4, 1fr); } }
.gallery button {
  display: block; width: 100%; padding: 0; border: 0; background: var(--card-deep);
  cursor: zoom-in; overflow: hidden; border-radius: 0.25rem;
}
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform 0.5s, opacity 0.3s; }
.gallery button:hover img { transform: scale(1.04); }

.lightbox {
  border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh;
  width: 100vw; height: 100vh;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgba(10, 12, 15, 0.92); }
.lightbox img { max-width: min(92vw, 80rem); max-height: 86vh; width: auto; border-radius: 0.25rem; }
.lightbox__close {
  position: fixed; top: 0.75rem; right: 0.75rem;
  width: 3rem; height: 3rem; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 1.75rem; line-height: 1; cursor: pointer;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.2); }

/* ---------- Contact ---------- */
.form { display: grid; gap: 1.25rem; margin-top: 2rem !important; }
.form__row { display: grid; gap: 0.5rem; }
.form label {
  font-family: var(--font-display); font-weight: 700; font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 0.27em; color: var(--text-muted);
}
.form input, .form textarea {
  width: 100%; font: inherit; font-size: 1rem; /* 16px avoids iOS zoom on focus */
  color: var(--text); background: var(--card-deep);
  border: 1px solid var(--line); border-radius: 0.25rem;
  padding: 0.7rem 1rem; line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form textarea { resize: vertical; min-height: 9rem; }
.form input:focus, .form textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent);
}
.form input[aria-invalid="true"], .form textarea[aria-invalid="true"] { border-color: #ff8a8a; }
.form .button { justify-self: start; min-width: 12rem; }
.form__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__status { min-height: 1.5em; font-size: 0.95rem; color: var(--text-muted); }
.form__status.is-error { color: #ff9f9f; }
.form__done { margin-top: 2rem !important; padding: 1.5rem; border: 1px solid var(--accent); border-radius: var(--radius); }
.form__done > * + * { margin-top: 0.5rem; }

@media (max-width: 30rem) {
  .form .button { justify-self: stretch; }
}

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--max); margin: 0 auto;
  padding: 2.5rem var(--gutter) 3rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
  font-size: 0.875rem; color: var(--text-faint);
}
.back-to-top { text-decoration: none; transition: color 0.2s; }
.back-to-top:hover { color: var(--accent); }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(1.5rem); transition: opacity 0.8s ease, transform 0.8s ease; }
  .reveal.is-visible { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
