/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --color-bg:        #0b0b0b;
  --color-surface:   #101010;
  --color-surface-2: #151515;
  --color-border:    #333;
  --color-text:      #ffffff;
  --color-text-muted: rgba(255, 255, 255, 0.6);

  --font-family: 'Inter', sans-serif;

  --text-xs:   0.75rem;   /* 12px */
  --text-sm:   1rem;      /* 16px */
  --text-base: 1.125rem;  /* 18px */
  --text-lg:   1.75rem;   /* 28px */
  --text-xl:   2rem;      /* 32px */
  --text-2xl:  2.75rem;   /* 44px */
  --text-3xl:  3rem;      /* 48px */
  --text-hero: clamp(3rem, 8vw, 6.25rem); /* 100px → fluid */

  --radius:    1rem;       /* 16px */
  --gap:       1rem;       /* 16px */
  --pad-page:  clamp(1.5rem, 5vw, 5rem);  /* 80px → fluid */
  --pad-section: 3rem;
  --pad-card:  2.625rem;   /* 42px */
  --max-width: 90rem;      /* 1440px */
  --max-content: 38rem;    /* 608px */
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  line-height: 1.6;
  min-height: 100dvh;
}

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

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 3px;
  border-radius: 4px;
}

ul, ol { list-style: none; }

/* ============================================================
   SKIP LINK (RGAA)
   ============================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--color-text);
  color: var(--color-bg);
  padding: 0.5rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 700;
  z-index: 1000;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */
.page-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-inline: var(--pad-page);
}

.container {
  width: 100%;
  max-width: var(--max-width);
}

.container--narrow {
  width: 100%;
  max-width: var(--max-content);
}

/* ============================================================
   HEADER / NAV
   ============================================================ */
.site-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--color-bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2.625rem;
}

.site-header__logo {
  display: flex;
  gap: 0;
  font-size: var(--text-base);
  white-space: nowrap;
}
.site-header__logo span:first-child { font-weight: 400; }
.site-header__logo span:last-child  { font-weight: 700; }

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-back {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-base);
}

.nav-back img {
  width: 1.5rem;
  height: 1.5rem;
  transition: transform 0.3s ease;
}

.nav-back:hover img {
  transform: translateX(-4px);
}

@media (prefers-reduced-motion: reduce) {
  .nav-back img { transition: none; }
  .nav-back:hover img { transform: none; }
}

.nav-link {
  font-size: var(--text-base);
  font-weight: 400;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: opacity 0.2s;
}
.nav-link:hover { opacity: 0.7; }
.nav-link[aria-current="page"] { font-weight: 700; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.site-footer__inner {
  width: 100%;
  max-width: var(--max-width);
  background: var(--color-surface);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer__email { font-size: var(--text-base); }

.site-footer__tagline { font-size: var(--text-sm); font-weight: 300; opacity: 0.7; }

.site-footer__social {
  display: flex;
  gap: 0.625rem;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  background: var(--color-surface-2);
  border-radius: 9999px;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.social-btn:hover { opacity: 0.7; }
.social-btn img {
  width: 2.75rem;
  height: 2.75rem;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-block: var(--pad-section);
}

.section__header {
  width: 100%;
  max-width: var(--max-width);
  font-size: var(--text-2xl);
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding-top: clamp(3rem, 8vw, 10.25rem);
  padding-bottom: clamp(2rem, 5vw, 6rem);
}

.hero__line1 {
  font-size: var(--text-hero);
  font-weight: 400;
  line-height: 1.1;
  display: flex;
  align-items: center;
  gap: 0.25em;
}

/* Twemoji inline — crisp at any size */
.emoji {
  display: inline-block;
  height: 0.85em;
  width: 0.85em;
  vertical-align: -0.05em;
}

.hero__line2 {
  font-size: var(--text-hero);
  font-weight: 600;
  line-height: 1.1;
}

/* ============================================================
   LOGO GRID ("I've worked for")
   ============================================================ */
.logo-grid {
  width: 100%;
  max-width: var(--max-width);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

.logo-cell {
  background: var(--color-surface);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.75rem 3.375rem;
  min-height: 13rem;
}

.logo-cell img {
  max-height: 4rem;
  width: auto;
  object-fit: contain;
}

/* ============================================================
   CARD GRID
   ============================================================ */
.card-grid {
  width: 100%;
  max-width: var(--max-width);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--gap);
}

/* Span variants */
.card--span-4 { grid-column: span 4; }
.card--span-3 { grid-column: span 3; }
.card--span-2 { grid-column: span 2; }

.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 28rem;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.4); }

/*
 * Card images: positioned absolutely, centered horizontally,
 * natural aspect ratio. The card clips overflow.
 * Overlay sits on top via z-index.
 */

/* Screenshots (QStudio, RPM, ECG) — fill the visual zone, stop before overlay */
.card__bg-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 5rem);
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  padding: 0.5rem;
}

/* Centered logo/artwork (Heloa, Design Journeys, Velo Parkr) */
.card__logo-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% - 2rem));
  width: 60%;
  height: auto;
  max-height: 55%;
  object-fit: contain;
  pointer-events: none;
}

.card__overlay {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 1;
  padding: 2rem;
  background: rgba(11, 11, 11, 0.5);
}

.card__meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  color: var(--color-text);
}

.card__meta-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.card__title {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
}

.card__category {
  font-size: var(--text-xs);
  font-weight: 400;
  opacity: 0.9;
}

.card__meta-right {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-self: stretch;
  text-align: right;
  flex-shrink: 0;
}

.card__company {
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.card__year {
  font-size: var(--text-xs);
  font-weight: 400;
}

/* ============================================================
   INFO TABLE (case study metadata + career + education)
   ============================================================ */
.info-table {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  row-gap: 1px;
  column-gap: 0;
  background: var(--color-border);
}

.info-table--2col { grid-template-columns: 1fr 1fr; max-width: var(--max-content); }
.info-table--4col { grid-template-columns: repeat(4, 1fr); }

.info-table__cell {
  background: var(--color-surface);
  padding: 1.5rem;
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  min-height: 4.1875rem;
}

.info-table__cell--bold { font-weight: 700; }
.info-table__cell--right { text-align: right; justify-content: flex-end; }

.info-table--2col [role="row"] .info-table__cell:first-child { font-weight: 700; }

/* ============================================================
   CASE STUDY PAGE
   ============================================================ */
.case-study-hero {
  width: 100%;
  max-width: 50rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 4rem;
}

.case-study-hero__title {
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1.15;
}

.case-study__meta {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0;
  padding-bottom: 2rem;
}

.case-study__image-block {
  width: 100%;
  max-width: var(--max-width);
  padding-top: 0;
  padding-bottom: 1.5rem;
}

.case-study__image-block img {
  width: 100%;
  border-radius: var(--radius);
  height: auto;
}

.case-study__content {
  width: 100%;
  max-width: var(--max-content);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-block: 3rem;
}

.case-study__content h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.2;
}

.case-study__content h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.25;
  margin-top: 0.5rem;
}

.case-study__content p {
  font-size: var(--text-sm);
  line-height: 1.7;
}

.case-study__content p + p { margin-top: 1rem; }

.case-study__content ul,
.case-study__content ol {
  list-style: disc;
  padding-left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.case-study__content ol { list-style: decimal; }

/* Breakout images: escape from narrow content to full max-width */
.case-study__content img {
  width: 100vw;
  max-width: var(--max-width);
  margin-inline: calc(50% - 50vw);
  border-radius: var(--radius);
  margin-block: 1.5rem;
}
@media (min-width: 90rem) {
  .case-study__content img {
    margin-inline: calc((var(--max-content) - var(--max-width)) / 2);
  }
}

.case-study__content hr {
  border: none;
  height: 1px;
  background: var(--color-border);
  margin-block: 1.5rem;
}

.case-study__content a {
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.85;
}
.case-study__content a:hover { opacity: 1; }

/* ============================================================
   ABOUT PAGE
   ============================================================ */
.about-hero {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  padding-top: 4rem;
  padding-bottom: 1.5rem;
}

.about-hero__photo {
  width: 12.5rem;
  height: auto;
  border-radius: var(--radius);
}

.about-hero__title {
  font-size: var(--text-hero);
  font-weight: 500;
  text-align: center;
  line-height: 1.1;
}

.about-bio {
  width: 100%;
  max-width: var(--max-content);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-block: 3rem;
  font-size: var(--text-sm);
  line-height: 1.7;
}

/* ============================================================
   TALKS GRID (About page)
   ============================================================ */
.talks-grid {
  width: 100%;
  max-width: var(--max-width);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--gap);
  min-height: 60rem;
}

.talk-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.talk-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.4); }

/* Talk card: full background photo (LPC-type) — covers entire card */
.talk-card__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  pointer-events: none;
}

/* Talk card: centered artwork (podcasts, flupa) — contained above overlay */
.talk-card__art {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 5.5rem);
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  padding: 1rem;
}

.talk-card__overlay {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 1;
  padding: 2rem;
  background: rgba(11, 11, 11, 0.5);
}


.talk-card__meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  color: var(--color-text);
}

.talk-card__left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.talk-card__title {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
}

.talk-card__role {
  font-size: var(--text-xs);
  font-weight: 400;
}

.talk-card__right {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-self: stretch;
  text-align: right;
  flex-shrink: 0;
}

.talk-card__event {
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.talk-card__year {
  font-size: var(--text-xs);
  font-weight: 400;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet (≤ 1024px) */
@media (max-width: 64rem) {
  .case-study-hero {
    padding-block: 1.5rem;
  }

  .case-study__meta {
    padding-block: 1rem;
  }

  .about-hero {
    padding-top: 1.5rem;
    padding-bottom: 0;
  }

  .about-bio {
    padding-top: 0;
    padding-bottom: 1rem;
  }

  .card-grid,
  .talks-grid {
    grid-template-columns: 1fr;
  }

  .card--span-4,
  .card--span-3,
  .card--span-2 { grid-column: span 1; }

  .talk-card { grid-column: span 1 !important; }

  /* Cards: switch to flow layout (image top, overlay bottom) */
  .card {
    min-height: auto;
    display: flex;
    flex-direction: column;
  }

  .card__bg-img {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    height: auto;
    padding: 0;
    object-fit: cover;
    aspect-ratio: 16 / 9;
    flex-shrink: 0;
  }

  .card__logo-center {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-height: none;
    padding: 3rem 4rem;
    flex-shrink: 0;
    object-fit: contain;
  }

  .card__overlay {
    position: relative;
    z-index: 1;
  }

  /* Talk cards: same flow layout */
  .talk-card {
    min-height: auto;
    display: flex;
    flex-direction: column;
  }

  .talk-card__art {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    height: auto;
    padding: 2rem 4rem;
    object-fit: contain;
  }

  /* LPC-type bg cards: keep image as bg, but size the card properly */
  .talk-card:has(.talk-card__bg) {
    min-height: 20rem;
  }

  .talk-card__overlay {
    position: relative;
    margin-top: auto;
  }

  /* Talk cards with bg image: overlay stays absolute at bottom */
  .talk-card:has(.talk-card__bg) .talk-card__overlay {
    position: absolute;
    bottom: 0;
    inset-inline: 0;
  }

  /* Tables → stacked cards */
  .info-table--4col,
  .info-table--2col {
    display: flex !important;
    flex-direction: column;
    gap: 1rem;
    background: transparent;
    max-width: 100%;
  }

  .info-table [role="row"] {
    display: flex !important;
    flex-direction: column;
    background: var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    padding: 0;
    gap: 1px;
  }

  .info-table .info-table__cell {
    min-height: auto;
    padding: 0.75rem 1rem;
    font-size: var(--text-sm);
    background: var(--color-surface);
  }

  .info-table__cell--right {
    text-align: left;
    justify-content: flex-start;
  }

  .info-table__cell--bold {
    font-size: 1.125rem;
  }
}

/* Mobile (≤ 640px) */
@media (max-width: 40rem) {
  :root {
    --pad-section: 2rem;
  }

  .site-header__inner {
    padding: 1rem 1.25rem;
  }

  .logo-grid {
    grid-template-columns: 1fr;
  }

  .logo-cell {
    min-height: 8rem;
    padding: 2rem 1.5rem;
  }

  /* Cards & tables already handled by tablet breakpoint above */

  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .section__header {
    font-size: var(--text-xl); /* 32px */
  }

  .case-study-hero__title {
    font-size: var(--text-xl);
  }

  .hero__line1,
  .hero__line2 {
    font-size: clamp(2rem, 10vw, 6.25rem);
  }
}

/* ============================================================
   REVEAL ANIMATION (scroll-triggered, once only)
   ============================================================ */
.reveal {
  opacity: 0;
  filter: blur(8px);
  transform: translateY(1.25rem);
  transition:
    opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1),
    filter 1.2s cubic-bezier(0.16, 1, 0.3, 1),
    transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--delay, 0s);
}

.reveal.is-visible {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Print */
@media print {
  .site-header, .site-footer { display: none; }
  body { background: white; color: black; }
  .card, .talk-card { break-inside: avoid; }
}
