/* ==========================================================================
   Chris Barker: personal site
   Palette (all text/background pairs meet WCAG 2.1 AAA, ≥ 7:1 on --bg and --surface)
     Primary   #FFB547  warm amber   (10.8:1 on --bg)
     Secondary #5ED3C6  soft teal    (10.5:1 on --bg)
     Tertiary  #FF8F80  coral        ( 8.6:1 on --bg)
     Quaternary #C4B0FF lavender     ( 8.2:1 on tag background), profile tags only
   ========================================================================== */

:root {
  --bg: #14100d;
  --surface: #1f1915;
  --surface-2: #2a221c;
  --border: #3a3029;
  --text: #f7efe6;
  --muted: #c9bcae;

  --primary: #ffb547;
  --secondary: #5ed3c6;
  --tertiary: #ff8f80;
  --quaternary: #c4b0ff; /* tags only */
  --on-accent: #1a1209;

  --radius: 20px;
  --radius-sm: 12px;
  --gap: clamp(12px, 1.6vw, 18px);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(60rem 40rem at 0% 0%, rgb(255 181 71 / 0.10), transparent 60%),
    radial-gradient(50rem 40rem at 100% 100%, rgb(255 143 128 / 0.08), transparent 60%),
    radial-gradient(40rem 30rem at 100% 0%, rgb(94 211 198 / 0.06), transparent 60%);
  background-attachment: fixed;
}

[hidden] { display: none !important; }
img, svg { display: block; max-width: 100%; }
svg { fill: currentColor; }
h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: inherit; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 16px; top: -100px;
  z-index: 10;
  padding: 12px 18px;
  background: var(--primary);
  color: var(--on-accent);
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.hl-primary { color: var(--primary); font-weight: 700; }

/* ---------- Layout ---------- */

.layout {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--gap) 16px;
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .layout {
    padding: 24px;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "profile profile"
      "now     meetup"
      "books   books";
  }
  .profile { grid-area: profile; }
  .now     { grid-area: now; }
  .meetup  { grid-area: meetup; }
  .books   { grid-area: books; }
}

/* Desktop: everything in one viewport, bento style */
@media (min-width: 1080px) and (min-height: 700px) {
  .layout {
    align-content: center;
    grid-template-columns: minmax(300px, 0.9fr) 1fr 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
      "profile now   meetup"
      "profile books books";
  }
}

/* ---------- Cards ---------- */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(18px, 2vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.03) inset, 0 12px 32px -18px rgb(0 0 0 / 0.6);
}

.card h2 {
  font-size: 1.25rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.eyebrow {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.eyebrow-primary   { color: var(--primary); }
.eyebrow-secondary { color: var(--secondary); }
.eyebrow-tertiary  { color: var(--tertiary); }

/* Accent strip on top of each card */
.card::before {
  content: "";
  position: absolute;
  inset: 0 24px auto;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--accent, var(--primary));
}
.profile { --accent: linear-gradient(90deg, var(--primary), var(--tertiary)); }
.now     { --accent: var(--primary); }
.meetup  { --accent: var(--secondary); }
.books   { --accent: var(--tertiary); }

/* ---------- Profile ---------- */

.profile {
  align-items: center;
  text-align: center;
  justify-content: center;
}

.avatar {
  width: clamp(104px, 22vw, 168px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 3px var(--primary), 0 10px 30px -10px rgb(255 181 71 / 0.45);
}

.profile h1 {
  font-size: clamp(1.75rem, 3.2vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-top: 4px;
}

.role {
  margin-top: 6px;
  font-size: 1.0625rem;
  color: var(--muted);
}

.tags {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tag {
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: var(--surface-2);
}
.tag-primary   { color: var(--primary); }
.tag-secondary { color: var(--secondary); }
.tag-tertiary  { color: var(--tertiary); }
.tag-quaternary { color: var(--quaternary); }

.bio {
  max-width: 38ch;
  line-height: 1.65;
  color: var(--muted);
}

.socials ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.socials a {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  transition: background-color .2s, color .2s, transform .2s, border-color .2s;
}
.socials svg { width: 20px; height: 20px; }
.socials a:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-accent);
  transform: translateY(-2px);
}

/* Wider than phone: profile goes side by side until the desktop column layout */
@media (min-width: 720px) and (max-width: 1079px), (min-width: 1080px) and (max-height: 699px) {
  .profile {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "avatar text"
      "avatar bio"
      "avatar socials";
    column-gap: 24px;
    text-align: left;
    justify-items: start;
  }
  .avatar        { grid-area: avatar; }
  .profile-text  { grid-area: text; }
  .bio           { grid-area: bio; max-width: 60ch; }
  .socials       { grid-area: socials; }
  .tags, .socials ul { justify-content: flex-start; }
}

/* ---------- Now / previous roles (carousel) ---------- */

.eyebrow-muted { color: var(--muted); }

.roles { display: grid; }

.role-slide {
  grid-area: 1 / 1;           /* slides stack, so the card is as tall as the tallest role */
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.role-slide .eyebrow { padding-right: 160px; } /* room for the controls */

.js-carousel .role-slide {
  transition: opacity .45s ease, transform .45s ease, visibility 0s linear .45s;
}
.js-carousel .role-slide:not(.is-active) {
  opacity: 0;
  visibility: hidden;
  transform: translateX(16px);
}
.js-carousel .role-slide.is-active {
  transition-delay: 0s;
}

.role-title {
  font-size: 1.25rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.now-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-tile {
  flex: none;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
/* Logos fit inside a 52px box, whatever their shape */
.logo-tile img {
  width: auto;
  height: auto;
  max-width: 52px;
  max-height: 52px;
}

.roles-controls {
  position: absolute;
  z-index: 1;
  top: calc(clamp(18px, 2vw, 24px) - 6px);
  right: clamp(12px, 1.6vw, 18px);
  display: flex;
  align-items: center;
  gap: 6px;
}
.roles-dots { display: flex; }

.dot {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 999px;
}
.dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 2px solid var(--muted);
  transition: width .3s ease, background-color .3s ease, border-color .3s ease;
}
.dot:hover::before { border-color: var(--text); }
.dot[aria-current="true"]::before {
  width: 18px;
  background: var(--primary);
  border-color: var(--primary);
}

.roles-toggle {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.roles-toggle:hover { border-color: var(--muted); }
.roles-toggle svg { width: 14px; height: 14px; }
.roles-toggle .icon-play,
.is-paused .roles-toggle .icon-pause { display: none; }
.is-paused .roles-toggle .icon-play { display: block; }

.now-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--primary);
  text-underline-offset: 3px;
  min-height: 44px;
}
.text-link svg, .button svg, .buy svg { width: 16px; height: 16px; flex: none; }

/* ---------- NSManchester ---------- */

.meetup-body {
  display: flex;
  gap: 14px;
  align-items: center;
}
.meetup-img {
  flex: none;
  /* Same footprint and corners as the JLR logo tile (52px + 2 × 10px padding) */
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.facts { display: grid; gap: 8px; }
.facts li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.facts svg {
  flex: none;
  width: 20px; height: 20px;
  margin-top: 2px;
  color: var(--secondary);
}
#next-meetup strong { color: var(--secondary); }

.button {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  transition: filter .2s, transform .2s;
}
.button-secondary {
  background: var(--secondary);
  color: var(--on-accent);
}
.button:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* ---------- Books ---------- */

/* Phones: a compact list, Linktree style */
.book-list {
  display: grid;
  gap: 12px;
}

.book {
  display: flex;
  align-items: stretch;
  gap: 14px;
}
.book img {
  flex: none;
  align-self: flex-start;
  width: 72px;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 8px 20px -8px rgb(0 0 0 / 0.7);
}
.book h3 {
  font-size: 0.9375rem;
  line-height: 1.3;
}
.book .muted { font-size: 0.8125rem; }

/* Meta column fills the cover's height so the buy link sits level with its bottom edge */
.book-meta {
  display: flex;
  flex-direction: column;
}

.buy {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 44px;
  line-height: 1.2;
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--tertiary);
  text-underline-offset: 3px;
}

/* Tablet and up: three across */
@media (min-width: 720px) {
  .book-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
  .book img { width: 42%; max-width: 104px; }
}
@media (min-width: 720px) and (max-width: 1079px) {
  .book { flex-direction: column; }
  .book img { width: 100%; max-width: 120px; }
}

/* ---------- Footer ---------- */

.footer {
  text-align: center;
  padding: 8px 16px 20px;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .socials a:hover, .button:hover { transform: none; }
  .js-carousel .role-slide { transition: none; }
}

/* Windows High Contrast / forced colours */
@media (forced-colors: active) {
  .card::before { display: none; }
  .socials a, .button { border: 1px solid CanvasText; }
}
