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

html {
  scroll-behavior: smooth;
  color-scheme: light;
}

html.dark {
  color-scheme: dark;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: 200;
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  color: var(--color-brand);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
}

h1,
h2,
h3,
h4,
.card__title,
.hero__title {
  text-wrap: balance;
}

p,
.case__subtitle,
.case__prose,
figcaption,
.card__desc {
  text-wrap: pretty;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: var(--leading-body);
  transition: background-color var(--duration) var(--ease), color var(--duration) var(--ease);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

.container {
  width: min(100% - var(--gutter), var(--container));
  margin-inline: auto;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.icon--sm {
  width: 1rem;
  height: 1rem;
}

.icon--lg {
  width: 2rem;
  height: 2rem;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--nav-height);
  background: var(--color-nav);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--color-on-dark) 10%, transparent);
  box-shadow: var(--shadow-edge);
}

.site-nav__inner {
  min-height: var(--nav-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-4) var(--space-6);
  padding-block: var(--space-3);
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-self: start;
  line-height: 1.05;
  font-family: var(--font-mono);
  font-size: var(--text-logo);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  text-decoration: none;
  color: var(--color-on-dark);
}

.logo__line {
  display: block;
  white-space: nowrap;
}

.logo__cursor {
  display: inline-block;
  width: 0.42em;
  height: 0.92em;
  margin-left: 0.06em;
  vertical-align: -0.08em;
  background: var(--color-accent);
  animation: blink 1.1s step-end infinite;
}

@keyframes blink {
  0%,
  100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Homepage: the nav logo stays hidden while the hero title (same logo style) is in view,
   then fades in. Only applies when JS can reveal it again. */
@media (scripting: enabled) {
  .site-nav[data-hero-logo] .logo {
    opacity: 0;
    transform: translateY(-0.5rem);
    visibility: hidden;
    transition:
      opacity 0.35s var(--ease),
      transform 0.35s var(--ease),
      visibility 0s linear 0.35s;
  }

  .site-nav[data-hero-logo].is-logo-visible .logo {
    opacity: 1;
    transform: none;
    visibility: visible;
    transition-delay: 0s;
  }
}

/* Homepage on small screens: the nav is transparent over the hero, then turns solid
   (together with the logo) once the hero title has scrolled away. Also solid while the menu is open. */
@media (scripting: enabled) and (max-width: 767.98px) {
  .hero--home {
    --hero-nav-offset: var(--nav-height);
  }

  .site-nav[data-hero-logo] {
    margin-bottom: calc(-1 * var(--nav-height));
    background: transparent;
    border-bottom-color: transparent;
    box-shadow: none;
    backdrop-filter: blur(0);
    transition:
      background-color 0.35s var(--ease),
      border-color 0.35s var(--ease),
      box-shadow 0.35s var(--ease),
      backdrop-filter 0.35s var(--ease);
  }

  .site-nav[data-hero-logo] .nav-toggle {
    color: var(--color-brand);
    transition: color 0.35s var(--ease);
  }

  .site-nav[data-hero-logo].is-logo-visible,
  .site-nav[data-hero-logo].is-open {
    background: var(--color-nav);
    border-bottom-color: color-mix(in srgb, var(--color-on-dark) 10%, transparent);
    box-shadow: var(--shadow-edge);
    backdrop-filter: blur(12px);
  }

  .site-nav[data-hero-logo].is-logo-visible .nav-toggle,
  .site-nav[data-hero-logo].is-open .nav-toggle {
    color: var(--color-white);
  }

  .site-nav[data-hero-logo] .nav-toggle:hover,
  .site-nav[data-hero-logo] .nav-toggle[aria-expanded="true"] {
    color: var(--color-accent);
  }
}

.site-nav__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.site-nav__links a {
  color: var(--color-on-dark-muted);
  text-decoration: none;
  padding-bottom: 0.1rem;
  border-bottom: 1px solid transparent;
}

.site-nav__links a:hover,
.site-nav__links a[aria-current="page"],
.site-nav__links a[aria-current="true"] {
  color: var(--color-on-dark);
  border-bottom-color: var(--color-accent);
}

.site-nav__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  gap: var(--space-4);
}

.site-nav__panel {
  display: contents;
}

.nav-toggle {
  position: relative;
  display: none;
  padding: var(--space-1);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-white);
  cursor: pointer;
}

/* Invisible hit area: grows the touch target to 44px without changing the layout */
.nav-toggle::after,
.theme-toggle::after {
  content: "";
  position: absolute;
  inset: -0.5rem;
}

.nav-toggle .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.nav-toggle:hover,
.nav-toggle[aria-expanded="true"] {
  color: var(--color-accent);
}

.site-nav.is-open .nav-toggle__open,
.site-nav:not(.is-open) .nav-toggle__close {
  display: none;
}

@media (max-width: 767.98px) {
  .site-nav__inner {
    grid-template-columns: 1fr auto;
  }

  .nav-toggle {
    display: inline-flex;
    justify-self: end;
  }

  .site-nav__panel {
    display: none;
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-5);
    padding: var(--space-4) 0 var(--space-2);
    border-top: 1px solid color-mix(in srgb, var(--color-on-dark) 10%, transparent);
  }

  .site-nav.is-open .site-nav__panel {
    display: flex;
  }

  .site-nav__links {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

  .site-nav__links a {
    position: relative;
    display: inline-block;
    padding: var(--space-1) 0;
  }

  .site-nav__links a::after {
    content: "";
    position: absolute;
    inset: -0.35rem 0;
  }

  .site-nav__actions {
    justify-content: flex-start;
    padding-top: var(--space-3);
    border-top: 1px solid color-mix(in srgb, var(--color-on-dark) 10%, transparent);
  }
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  padding: var(--space-1);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-on-dark-muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--color-accent);
}

html:not(.dark) .theme-toggle__sun,
html.dark .theme-toggle__moon {
  display: none;
}

.hero {
  position: relative;
  background: var(--color-hero);
  overflow: hidden;
  box-shadow: var(--shadow-edge-inset);
}

.hero--plain {
  background: none;
  box-shadow: none;
}

.hero--plain::after {
  content: none;
}

.hero--plain .hero__title,
.hero--plain .hero__tagline {
  color: var(--color-heading);
}

.hero--plain .btn--ghost {
  color: var(--color-heading);
  border-color: var(--color-heading);
}

.hero--plain .btn--ghost:hover {
  background: color-mix(in srgb, var(--color-heading) 8%, transparent);
}

/* Dark mode: brand-coloured buttons would vanish on the dark page, so they take the accent */
html.dark .btn--primary,
html.dark .carousel__btn {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-brand);
}

html.dark .btn--primary:hover,
html.dark .carousel__btn:hover {
  background: var(--color-accent-strong);
  border-color: var(--color-accent-strong);
}

/* Dark mode: the outline button takes the heading colour (as on resume.html) */
html.dark .btn--ghost {
  color: var(--color-heading);
  border-color: var(--color-heading);
}

html.dark .btn--ghost:hover {
  background: color-mix(in srgb, var(--color-heading) 8%, transparent);
}

/* The coloured (yellow) hero keeps the dark brand buttons in both modes.
   Below 768px the homepage buttons sit under the yellow area, so they follow the page theme there. */
@media (min-width: 768px) {
  html.dark .hero:not(.hero--plain) .btn--ghost {
    color: var(--color-brand);
    border-color: var(--color-brand);
  }

  html.dark .hero:not(.hero--plain) .btn--ghost:hover {
    background: color-mix(in srgb, var(--color-brand) 5%, transparent);
  }

  html.dark .hero:not(.hero--plain) .btn--primary {
    background: var(--color-brand);
    border-color: var(--color-brand);
    color: var(--color-white);
  }

  html.dark .hero:not(.hero--plain) .btn--primary:hover {
    background: var(--color-brand-hover);
    border-color: var(--color-brand-hover);
  }
}

.has-noise {
  position: relative;
}

.has-noise::after,
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.04;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.hero__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.hero__avatar {
  display: flex;
  justify-content: center;
  padding-top: var(--space-8);
}

.hero__avatar img {
  width: 8rem;
  height: 8rem;
  object-fit: cover;
  object-position: center;
  border-radius: var(--radius-full);
  border: 2px solid color-mix(in srgb, var(--color-brand) 10%, transparent);
  box-shadow: var(--shadow-md);
}

.hero__content {
  text-align: center;
  padding-bottom: var(--space-8);
  margin-bottom: var(--space-8);
}

.hero__title {
  margin: 0;
  color: var(--color-brand);
  font-size: var(--text-4xl);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: var(--leading-tight);
}

/* Homepage hero title styled like the logo (double class beats the responsive .hero__title size) */
.hero__title.hero__title--logo {
  font-family: var(--font-mono);
  font-size: clamp(2.75rem, 7vw, var(--text-6xl));
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: var(--color-brand);
}

.hero__title--logo .logo__cursor {
  background: var(--color-white);
}

/* Homepage tagline carries tag-title brackets, white on the yellow hero */
.hero--home .hero__tagline::before,
.hero--home .hero__tagline::after {
  color: var(--color-white);
}

.hero__tagline {
  margin: var(--space-2) 0 0;
  color: var(--color-brand);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: var(--leading-snug);
  text-wrap: pretty;
}

.hero__intro {
  display: none;
  margin: var(--space-5) auto 0;
  max-width: 32rem;
  color: color-mix(in srgb, var(--color-brand) 80%, transparent);
  font-size: var(--text-sm);
}

.hero__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.hero__portrait {
  display: none;
}

.hero__portrait picture {
  display: contents;
}

.hero__portrait img {
  height: var(--portrait-height);
  width: auto;
  max-width: none;
  object-fit: contain;
  object-position: bottom;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--btn-padding);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--duration) var(--ease), color var(--duration) var(--ease);
}

.btn--primary {
  background: var(--color-brand);
  color: var(--color-white);
  border: 1px solid var(--color-brand);
}

.btn--primary:hover {
  background: var(--color-brand-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--color-brand);
  border: 1px solid var(--color-brand);
}

.btn--ghost:hover {
  background: color-mix(in srgb, var(--color-brand) 5%, transparent);
}

.resume-layout {
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
  padding-block: var(--space-8);
}

.resume-sidebar {
  order: 2;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.resume-content {
  order: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
}

/* Shared list: "/*" marker, mono title, short explanation (case pages and homepage principles) */
.feature-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.feature-list li {
  position: relative;
  padding-left: 1.6rem;
  font-size: var(--text-sm);
  line-height: var(--leading-body);
  color: var(--color-text);
}

.feature-list li::before {
  content: "/*";
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: inherit;
  color: var(--color-accent);
}

.feature-list strong {
  display: block;
  margin-bottom: var(--space-hair);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--color-heading);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card__header {
  background: var(--color-brand);
  padding: var(--space-3) var(--space-5);
}

.card__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-on-dark);
}

/* Shared "<title/>" brackets, used on every title that carries them */
.tag-title::before {
  content: "<";
  font-weight: 700;
  color: var(--color-accent);
  margin-right: 0.15em;
}

.tag-title::after {
  content: "/>";
  font-weight: 700;
  color: var(--color-accent);
  margin-left: 0.15em;
}

/* Hanging indent: when a title wraps, the next lines align with the text after the "<".
   Indent = width of "<" (1ch) + its margin + the title's letter-spacing (--tag-ls). */
.tag-title {
  --tag-ls: 0em;
  --tag-indent: calc(1ch + 0.15em + var(--tag-ls));
  padding-left: var(--tag-indent);
  text-indent: calc(-1 * var(--tag-indent));
}

.home-title,
.pillar__title,
.case h2,
.case h3 {
  --tag-ls: 0.06em;
}

.work__title,
.case__hero h1 {
  --tag-ls: -0.03em;
}

/* Centred titles keep their symmetrical layout */
.home-cta .tag-title {
  padding-left: 0;
  text-indent: 0;
}

.card__body {
  padding: var(--space-5);
}

.resume-content .card__body {
  padding: var(--space-6);
}

.score {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score__chart {
  position: relative;
  width: var(--donut-size);
  height: var(--donut-size);
}

.score__chart svg {
  width: 100%;
  height: 100%;
}

.donut-track {
  stroke: var(--color-border);
}

html.dark .donut-track {
  stroke: var(--color-brand);
}

.donut-arc {
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  animation: donut-draw 1.6s var(--ease) 0.3s forwards;
}

@keyframes donut-draw {
  from { stroke-dashoffset: 283; }
  to { stroke-dashoffset: 28.3; }
}

.score__label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.score__value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-heading);
  line-height: 1;
}

.score__rank {
  margin-top: var(--space-1);
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.score__caption {
  margin: var(--space-3) 0 0;
  font-size: var(--text-xs);
  text-align: center;
  color: var(--color-text-muted);
}

.skill-group + .skill-group {
  margin-top: var(--space-4);
}

.skill-group__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.skill-group__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-xs);
}

.skill-tag {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--color-border-soft);
  color: var(--color-text);
  font-size: var(--text-xs);
  line-height: 1rem;
  transition: color 150ms var(--ease), background-color 150ms var(--ease);
}

.skill-tag:hover {
  background: color-mix(in srgb, var(--color-accent) 16%, transparent);
  color: var(--color-heading);
}

.meta-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.meta-list__title {
  margin: 0;
  font-weight: 500;
  color: var(--color-heading);
}

.meta-list__detail {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.meta-list__note {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.lang-list,
.contact-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.lang-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
}

.lang-list__level {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: right;
}

.contact-list a,
.contact-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  color: var(--color-text-muted);
  text-decoration: none;
}

.contact-list a:hover {
  color: var(--color-accent);
}

.contact-list .icon {
  color: var(--color-accent);
  margin-top: var(--space-hair);
}

.resume-prose {
  margin: 0;
  color: var(--color-text-muted);
}

.resume-jobs {
  display: flex;
  flex-direction: column;
}

.resume-job {
  border-top: 1px solid var(--color-border-soft);
}

.resume-job:first-child {
  border-top: 0;
}

.resume-job__trigger {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-4) 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.resume-job__trigger .badge {
  margin-left: calc(0.45rem + var(--space-3));
}

.resume-job__heading {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 0;
  flex: 1;
}

.resume-job__chevron {
  width: 0.45rem;
  height: 0.45rem;
  margin-top: 0.45rem;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(-45deg);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
  flex-shrink: 0;
}

.resume-job.is-open .resume-job__chevron {
  transform: rotate(45deg);
}

.resume-job__trigger:hover .resume-job__chevron {
  border-color: var(--color-accent);
}

.resume-job__title {
  display: block;
  font-weight: 600;
  color: var(--color-heading);
}

.resume-job__meta {
  display: block;
  margin-top: var(--space-hair);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--badge-padding);
  border-radius: var(--radius-chip);
  border: 1px solid;
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}

.badge--amber {
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
  color: color-mix(in srgb, var(--color-accent) 45%, var(--color-heading));
  border-color: color-mix(in srgb, var(--color-accent) 40%, transparent);
}

.badge--green,
.badge--violet {
  background: color-mix(in srgb, var(--color-heading) 8%, transparent);
  color: var(--color-text);
  border-color: var(--color-border);
}

.resume-job__panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  transition: max-height 0.35s var(--ease), opacity 0.25s var(--ease), visibility 0s linear 0.35s;
}

.resume-job.is-open .resume-job__panel {
  max-height: 2000px;
  opacity: 1;
  visibility: visible;
  transition: max-height 0.4s var(--ease), opacity 0.3s var(--ease) 0.05s, visibility 0s;
}

.resume-job__body {
  padding: 0 0 var(--space-6) var(--space-8);
  overflow: hidden;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.resume-job__body p {
  margin: 0;
}

.star {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.star dt {
  font-weight: 600;
  color: var(--color-text);
}

.star dd {
  margin: 0;
}

.star__inline dt,
.star__inline dd {
  display: inline;
}

.star ul {
  margin: var(--space-1) 0 0 1.1rem;
  padding: 0;
}

.star li + li,
.resume-job__body p + p {
  margin-top: var(--space-2);
}

.tech-line {
  margin: var(--space-3) 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.tech-line strong {
  color: var(--color-text);
}

.resume-job__body a {
  color: var(--color-accent);
  font-weight: 500;
}

.carousel {
  position: relative;
  width: min(100% - var(--gutter), 80rem);
  margin-inline: auto;
}

.carousel__btn {
  position: absolute;
  top: 50%;
  z-index: 20;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--color-brand);
  color: var(--color-white);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transform: translateY(-50%);
}

/* Invisible hit area: 40px button grows to a 44px touch target */
.carousel__btn::after {
  content: "";
  position: absolute;
  inset: -0.125rem;
}

.carousel__btn--prev { left: 0; }
.carousel__btn--next { right: 0; }

.carousel__btn:hover {
  background: var(--color-brand-hover);
}

.carousel__frame {
  margin-inline: var(--space-4);
}

@property --fade-start {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@property --fade-end {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

/*
 * The track bleeds past the frame with padding and an equal negative margin.
 * That padding is the room the card shadows need, because overflow-x: auto
 * clips on both axes. The edge fade is a mask on the track itself, so it fades
 * cards and shadows alike and works on any background.
 */
.carousel__track {
  --carousel-pad-x: var(--space-8);
  --carousel-pad-y: var(--space-10);
  --fade-size: clamp(3rem, 12vw, 8rem);
  display: flex;
  align-items: stretch;
  gap: var(--carousel-gap);
  margin: calc(-1 * var(--carousel-pad-y)) calc(-1 * var(--carousel-pad-x));
  padding: var(--carousel-pad-y) var(--carousel-pad-x);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--carousel-pad-x);
  scroll-behavior: smooth;
  scrollbar-width: none;
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 var(--fade-start),
    #000 calc(100% - var(--fade-end)),
    transparent 100%
  );
  transition: --fade-start 0.3s var(--ease), --fade-end 0.3s var(--ease);
}

.carousel__track.is-scrollable-left {
  --fade-start: var(--fade-size);
}

.carousel__track.is-scrollable-right {
  --fade-end: var(--fade-size);
}

.carousel__track::-webkit-scrollbar {
  display: none;
}

.quote {
  flex: 0 0 82%;
  scroll-snap-align: start;
  display: flex;
}

.quote__card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: var(--quote-min-height);
  margin: 0;
  padding: var(--space-6);
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

/* Dark mode: project and quote cards share the surface colour, a solid neutral border and theme text */
html.dark .project-card,
html.dark .quote__card,
html.dark .project-card__content {
  background: var(--color-surface);
}

html.dark .project-card,
html.dark .quote__card {
  border: 1px solid color-mix(in srgb, var(--color-text) 20%, var(--color-surface));
}

html.dark .quote__text {
  color: var(--color-text);
}

html.dark .quote__name {
  color: var(--color-heading);
}

html.dark .quote__role {
  color: var(--color-text-muted);
}

html.dark .quote__author {
  border-top-color: var(--color-border);
}

.quote__mark {
  color: var(--color-accent);
  margin-bottom: var(--space-4);
}

.quote__text {
  margin: 0;
  flex: 1;
  font-size: var(--text-sm);
  color: var(--color-brand);
}

.quote__author {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid color-mix(in srgb, var(--color-brand) 12%, transparent);
}

.quote__name {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-brand);
}

.quote__role {
  margin: var(--space-hair) 0 0;
  font-size: var(--text-xs);
  color: color-mix(in srgb, var(--color-brand) 70%, var(--color-white));
}

.carousel__dots {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-8);
}

.carousel__dot {
  position: relative;
  width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--color-text) 30%, transparent);
  cursor: pointer;
  transition: background-color 0.3s var(--ease), transform 0.3s var(--ease);
}

/* Invisible hit area: 44px tall, as wide as the dot spacing allows */
.carousel__dot::after {
  content: "";
  position: absolute;
  inset: -1.125rem -0.25rem;
}

.carousel__dot.is-active {
  background: var(--color-heading);
  transform: scale(1.25);
}

/* Kicker and section title (homepage sections and contact band) */
.home-kicker {
  margin: 0 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.home-title {
  margin: 0 0 var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: var(--leading-heading);
  text-transform: uppercase;
  color: var(--color-brand);
}

/* Dark mode: brand text would vanish on the dark page */
html.dark .home-title {
  color: var(--color-on-dark);
}

/* Contact band (full-width, shared by index.html and resume.html) */
.home-contact {
  padding-block: var(--space-12);
  background-color: var(--color-brand);
  color: var(--color-on-dark);
}

.home-contact__title {
  margin-bottom: var(--space-4);
  color: var(--color-on-dark); /* on the brand background */
}

/* Muted kicker needs a lighter tone on the brand background */
.home-contact .home-kicker {
  color: var(--color-on-dark-muted);
}

.home-contact__text {
  margin: 0;
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: inherit;
  text-wrap: pretty;
}

.home-contact__text a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.home-contact__text a:hover {
  color: var(--color-white);
}

.site-footer {
  padding-block: var(--space-6);
  font-size: var(--text-xs);
  background-color: var(--color-nav);
  color: var(--color-on-dark);
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
}

.site-footer__inner p {
  margin: 0;
}

.site-footer__social {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__social a {
  position: relative;
  display: inline-flex;
  color: inherit;
}

/* Invisible hit area: 16px icon grows to a 28x44px touch target */
.site-footer__social a::after {
  content: "";
  position: absolute;
  inset: -0.875rem -0.375rem;
}

.site-footer__social a:hover {
  color: var(--color-accent);
}

@media (max-width: 767.98px) {
  .hero {
    padding-top: var(--space-8);
  }

  /* Homepage hero on small screens: yellow band with title, tagline and portrait,
     the buttons sit below it on the page background. .hero__content dissolves into the grid. */
  .hero--home {
    padding-top: 0;
    background: var(--color-bg);
    box-shadow: none;
  }

  .hero--home .hero__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--hero-nav-offset, 0px) auto auto 1fr auto;
    gap: 0;
  }

  .hero--home .hero__inner::before {
    content: "";
    grid-column: 1;
    grid-row: 1 / 5;
    margin-inline: calc(var(--gutter) / -2);
    background: var(--color-hero);
    box-shadow: var(--shadow-edge-inset);
  }

  .hero--home .hero__avatar,
  .hero--home .hero__intro {
    display: none;
  }

  .hero--home .hero__content {
    display: contents;
  }

  .hero--home .hero__title.hero__title--logo {
    grid-column: 1;
    grid-row: 2;
    padding-top: var(--space-12);
    text-align: left;
  }

  .hero--home .hero__tagline {
    grid-column: 1;
    grid-row: 3;
    width: min(70%, 17rem);
    margin-top: var(--space-3);
    font-size: 0.9rem;
    text-align: left;
    text-wrap: balance;
  }

  .hero--home .hero__portrait {
    display: flex;
    grid-column: 1;
    grid-row: 3 / 5;
    justify-self: end;
    align-self: end;
  }

  .hero--home .hero__portrait img {
    height: clamp(18rem, 60vw, 22rem);
  }

  .hero--home .hero__actions {
    grid-column: 1;
    grid-row: 5;
    margin-top: var(--space-6);
    padding-bottom: var(--space-8);
  }
}

@media (min-width: 640px) {
  .hero__avatar img {
    width: 9rem;
    height: 9rem;
  }

  .hero__intro {
    display: block;
  }

  .quote {
    flex-basis: calc((100% - (2 * var(--carousel-gap))) / 2.3);
  }
}

@media (min-width: 768px) {
  .hero__inner {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-6);
  }

  .hero__avatar {
    display: none;
  }

  .hero__content {
    flex: 1;
    max-width: 40rem;
    text-align: left;
    padding: var(--space-12) 0 0;
    margin-bottom: var(--space-8);
  }

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

  .hero__tagline {
    font-size: var(--text-xl);
  }

  .hero__intro {
    margin-left: 0;
    font-size: var(--text-base);
  }

  .hero__actions {
    flex-direction: row;
    flex-wrap: wrap;
    width: auto;
    justify-content: flex-start;
  }

  .btn {
    width: auto;
  }

  .hero__portrait {
    display: flex;
    align-items: flex-end;
    align-self: flex-end;
    flex-shrink: 0;
  }

  .resume-job__trigger {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
  }

  .resume-job__trigger .badge {
    margin-left: 0;
  }

  .carousel__frame {
    margin-inline: var(--space-16);
  }
}

@media (min-width: 1024px) {
  .resume-layout {
    flex-direction: row;
    align-items: flex-start;
    padding-block: var(--space-12);
  }

  .resume-sidebar {
    order: 1;
    width: var(--sidebar-width);
    flex-shrink: 0;
  }

  .resume-content {
    order: 2;
    flex: 1;
  }

  .hero__portrait img {
    height: 23.75rem;
  }

  .quote {
    flex-basis: calc((100% - (3 * var(--carousel-gap))) / 3.2);
  }
}

@media (min-width: 1280px) {
  .hero__portrait img {
    height: 26.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .donut-arc {
    animation: none;
    stroke-dashoffset: 28.3;
  }

  .logo__cursor {
    animation: none;
  }
}
