/* =========================================================================
   Components. Every color here comes from a token in tokens.css.
   ========================================================================= */

/* =========================================================================
   Topbar
   ========================================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease-out),
              background var(--dur) var(--ease-out);
}

.topbar[data-stuck="true"] {
  border-bottom-color: var(--rule);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: var(--space-m);
  min-height: var(--topbar-h);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5ch;
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
  transform: translateY(-0.1em);
}

.topbar__nav { margin-inline-start: auto; }

.navlist {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  gap: var(--space-xs);
  list-style: none;
  padding: 0;
}

.navlist a {
  display: block;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  color: var(--ink-muted);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}

.navlist a:hover { color: var(--ink); background: var(--paper-sunken); }

.navlist a[aria-current="true"] {
  color: var(--ink);
  background: var(--accent-soft);
}

.topbar__tools {
  display: flex;
  align-items: center;
  gap: var(--space-3xs);
}

.iconbtn {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  color: var(--ink-muted);
  transition: color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}

.iconbtn:hover { color: var(--ink); background: var(--paper-sunken); }
.iconbtn svg { width: 1.125rem; height: 1.125rem; }

.topbar__menu { display: none; }

/* Reading progress, hairline under the bar. */
.topbar__progress {
  height: 2px;
  background: var(--accent);
  transform: scaleX(var(--progress, 0));
  transform-origin: 0 50%;
  transition: transform 80ms linear;
}

/* The hamburger takes over at 60rem rather than 52rem: between roughly 833px
   and 855px the horizontal .navlist no longer fits, and body's overflow-x:
   hidden swallowed the overflowing links without a scrollbar to reveal it. */
@media (max-width: 60rem) {
  /* 68px of a 667px phone viewport is too much bar, and scroll-padding-top
     compounds it on every anchor jump. */
  :root { --topbar-h: 3.5rem; }

  .topbar__menu { display: grid; }

  /* The auto margin moves to the tools here: .topbar__nav leaves flex flow
     below this width, so its own margin stops pushing anything to the edge
     and the buttons were left stranded mid-bar. */
  .topbar__tools {
    margin-inline-start: auto;
    gap: var(--space-2xs);
  }

  /* 44px minimum touch target on the chrome buttons. */
  .topbar .iconbtn,
  .viewer__bar .iconbtn {
    width: 2.75rem;
    height: 2.75rem;
  }

  .viewer__gallerynav .iconbtn--sm { width: 2.5rem; height: 2.5rem; }

  /* A sheet, not a dropdown. It cannot be position: fixed — .topbar carries a
     backdrop-filter, which makes it the containing block for fixed
     descendants — so it is positioned against the sticky bar and sized to
     whatever viewport is left below it. */
  .topbar__nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    height: calc(100dvh - var(--topbar-h) - 2px);
    margin-inline-start: 0;
    padding: var(--space-s) var(--gutter) var(--space-2xl);
    background: var(--paper);
    border-top: 1px solid var(--rule);
    overflow-y: auto;
    overscroll-behavior: contain;
    display: none;
  }

  .topbar__nav[data-open="true"] { display: block; }

  .navlist {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0;
  }

  .navlist a {
    display: flex;
    align-items: center;
    min-height: 3.25rem;
    padding-inline: var(--space-3xs);
    border-radius: 0;
    font-size: var(--step-1);
    color: var(--ink);
  }

  .navlist a::after {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    margin-inline-start: auto;
    border-top: 1.5px solid var(--ink-faint);
    border-right: 1.5px solid var(--ink-faint);
    rotate: 45deg;
  }

  .navlist li + li a { border-top: 1px solid var(--rule); }

  .navlist a:hover,
  .navlist a[aria-current="true"] {
    background: none;
    color: var(--accent);
  }

  .navlist a[aria-current="true"]::after {
    border-color: var(--accent);
  }
}

@media (max-width: 60rem) and (prefers-reduced-motion: no-preference) {
  .topbar__nav[data-open="true"] { animation: sheet-in var(--dur) var(--ease-out); }
}

@keyframes sheet-in {
  from { opacity: 0; translate: 0 -0.75rem; }
}

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  padding: 0.7rem 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}

.btn:active { transform: translateY(1px); }
.btn svg { width: 1em; height: 1em; flex: none; }

.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

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

.btn--ghost {
  border-color: var(--rule-strong);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--ink-muted);
  background: var(--paper-raised);
}

/* =========================================================================
   Hero — the thesis. Statement, quiet role line, bio, portrait plate.
   ========================================================================= */
.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 20rem);
  align-items: end;
  gap: var(--space-2xl);
  padding-block: clamp(var(--space-2xl), 10vw, calc(var(--space-3xl) + var(--space-l)))
                 clamp(var(--space-2xl), 8vw, var(--space-3xl));
}

.hero__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
  min-width: 0;
}

/* The name sits above the statement, so it carries more weight than a section
   eyebrow does. */
.hero__text > .eyebrow {
  font-size: var(--step-0);
  color: var(--ink-muted);
}

.hero__statement {
  font-size: var(--step-5);
  line-height: var(--leading-tight);
  letter-spacing: -0.028em;
  max-width: 14ch;
  text-wrap: balance;
}

/* The one italic moment on the page: the last word of the statement. */
.hero__statement em {
  font-style: italic;
  color: var(--accent);
}

.hero__role {
  display: flex;
  align-items: center;
  gap: 0.15ch;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  min-height: 1.6em;
}

.hero__role .caret {
  display: inline-block;
  width: 0.55ch;
  height: 1.05em;
  background: var(--accent);
  translate: 0 0.12em;
  animation: caret-blink 1.15s steps(1) infinite;
}

@keyframes caret-blink {
  0%, 45%  { opacity: 1; }
  50%, 95% { opacity: 0; }
}

.hero__bio {
  font-size: var(--step-1);
  color: var(--ink-muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-l);
  padding-top: var(--space-2xs);
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: var(--step--2);
}

.hero__meta div {
  display: flex;
  align-items: baseline;
  gap: 0.6ch;
}

.hero__meta dt {
  color: var(--ink-faint);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.hero__meta dd {
  font-family: var(--font-mono);
  color: var(--ink);
}

.hero__meta .dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--good);
  display: inline-block;
  translate: 0 -0.1em;
}

/* Portrait as a print plate: a fine rule frame with an offset accent rule
   behind it, and the image held just short of full saturation. */
.hero__plate {
  position: relative;
  align-self: end;
}

.hero__plate::before {
  content: "";
  position: absolute;
  inset: var(--space-s) calc(-1 * var(--space-s)) calc(-1 * var(--space-s)) var(--space-s);
  border: 1px solid var(--accent);
  opacity: 0.5;
  border-radius: var(--radius-md);
  pointer-events: none;
}

.hero__plate img {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 22%;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  background: var(--paper-sunken);
  filter: saturate(0.72) contrast(1.03);
  transition: filter var(--dur-slow) var(--ease-out);
}

.hero__plate:hover img { filter: saturate(1) contrast(1); }

@media (max-width: 60rem) {
  .hero__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-xl);
  }
  .hero__statement { max-width: 18ch; }
  .hero__plate { max-width: 15rem; order: -1; }
  .hero__plate::before { display: none; }
}

/* =========================================================================
   Toolbar — project search + sort
   ========================================================================= */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
}

.search {
  position: relative;
  flex: 1 1 18rem;
  min-width: 0;
}

.search__icon {
  position: absolute;
  inset-inline-start: 0.85rem;
  top: 50%;
  translate: 0 -50%;
  width: 1rem;
  height: 1rem;
  color: var(--ink-faint);
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 0.72rem 5.5rem 0.72rem 2.6rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  font-size: var(--step--1);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}

.search input::placeholder { color: var(--ink-faint); }

.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* The `/` hint hides itself once the field is in use. */
.search__hint {
  position: absolute;
  inset-inline-end: 0.6rem;
  top: 50%;
  translate: 0 -50%;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-faint);
  pointer-events: none;
}

.search__hint kbd {
  font-family: inherit;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--rule-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.search:focus-within .search__hint,
.search[data-filled="true"] .search__hint { display: none; }

.search__clear {
  position: absolute;
  inset-inline-end: 0.5rem;
  top: 50%;
  translate: 0 -50%;
  display: none;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  color: var(--ink-muted);
}

.search__clear:hover { background: var(--paper-sunken); color: var(--ink); }
.search__clear svg { width: 0.85rem; height: 0.85rem; }
.search[data-filled="true"] .search__clear { display: grid; }

.sort {
  display: flex;
  align-items: center;
  gap: 0.5ch;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-faint);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.sort select {
  padding: 0.6rem 0.7rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
  cursor: pointer;
}

/* =========================================================================
   Filter chips — two dimensions, multi-select, with live counts
   ========================================================================= */
.filters {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.chipset {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs);
}

.chipset__label {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-faint);
  flex: 0 0 4.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  background: var(--paper-raised);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  color: var(--ink-muted);
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}

.chip:hover {
  color: var(--ink);
  border-color: var(--ink-faint);
}

.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
}

.chip__count {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
}

.chip[aria-pressed="true"] .chip__count { color: var(--accent); }

.chip[data-empty="true"] {
  opacity: 0.4;
  cursor: not-allowed;
}

.chip--more {
  border-style: dashed;
  color: var(--ink-faint);
}

.chip--clear {
  border-color: transparent;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.chip--clear:hover { background: var(--accent-soft); }

.resultcount {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}

.resultcount b {
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
   Work grid + cards
   ========================================================================= */
.workgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr));
  gap: var(--space-m);
  list-style: none;
  padding: 0;
}

.workcard {
  position: relative; /* anchors the title button's full-card click layer */
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-align: start;
  transition: border-color var(--dur) var(--ease-out),
              box-shadow var(--dur) var(--ease-out),
              transform var(--dur) var(--ease-out);
}

.workcard:hover,
.workcard:focus-within {
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.workcard__cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--paper-sunken);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}

.workcard__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale var(--dur-slow) var(--ease-out);
}

.workcard:hover .workcard__cover img { scale: 1.03; }

.workcard__cover--icon {
  display: grid;
  place-items: center;
  color: var(--ink-faint);
}

.workcard__cover--icon svg { width: 2.25rem; height: 2.25rem; }

.workcard__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  padding: var(--space-s);
  flex: 1;
}

.workcard__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5ch;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-faint);
}

.workcard__cats span:not(:last-child)::after { content: " ·"; }

.workcard__title {
  font-size: var(--step-1);
  line-height: 1.22;
}

/* The whole card is clickable, but only the title is a real button, so the
   accessible name and focus ring land on something meaningful. */
.workcard__open {
  text-align: start;
  font: inherit;
  color: inherit;
}

.workcard__open::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.workcard__desc {
  font-size: var(--step--1);
  color: var(--ink-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* The card's bottom row: tags flow, direct links pin to the end. */
.workcard__foot {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2xs);
  margin-top: auto;
  padding-top: var(--space-2xs);
}

.workcard__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  list-style: none;
  min-width: 0;
}

.tag {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  padding: 0.12rem 0.42rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  background: var(--paper);
  white-space: nowrap;
}

.tag--overflow { border-style: dashed; color: var(--ink-faint); }

/* Direct links sit above the card's click layer. */
.workcard__links {
  position: relative;
  z-index: 1;
  display: flex;
  gap: var(--space-3xs);
  flex: none;
}

.workcard__links a {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  color: var(--ink-muted);
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}

.workcard__links a:hover { color: var(--accent); border-color: var(--accent); }
.workcard__links svg { width: 0.95rem; height: 0.95rem; }

mark {
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 0 0.12em;
}

.emptystate {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
  padding: var(--space-2xl) var(--space-l);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-lg);
  color: var(--ink-muted);
}

.emptystate h3 { font-size: var(--step-1); color: var(--ink); }

/* =========================================================================
   Ledger — experience & education
   ========================================================================= */
.ledger { border-top: 1px solid var(--rule); }

.ledger__item { border-bottom: 1px solid var(--rule); }

.ledger__row {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr) 1.5rem;
  align-items: baseline;
  gap: var(--space-m);
  padding-block: var(--space-m);
  cursor: pointer;
  list-style: none;
  transition: background var(--dur-fast) var(--ease-out);
}

.ledger__row::-webkit-details-marker { display: none; }
.ledger__row:hover { background: var(--paper-raised); }

.ledger__date {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ledger__title {
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.2;
}

.ledger__org {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  color: var(--ink-muted);
  padding-top: 0.25rem;
}

.ledger__org .sep { color: var(--ink-faint); padding-inline: 0.5ch; }

.ledger__chev {
  justify-self: end;
  align-self: center;
  width: 1.1rem;
  height: 1.1rem;
  color: var(--ink-faint);
  transition: rotate var(--dur) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.ledger__item[open] .ledger__chev { rotate: 180deg; color: var(--accent); }
.ledger__row:hover .ledger__chev { color: var(--ink); }

.ledger__panel {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: var(--space-m);
  padding-block: 0 var(--space-l);
}

.ledger__detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
  grid-column: 2;
  max-width: var(--measure);
}

.ledger__detail p { color: var(--ink-muted); }

/* A label and the list it introduces, which would otherwise sit flush
   against each other — every margin is zeroed in base.css. */
.ledger__block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.ledger__detail h4 {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* Serif bullets at 1.62 line-height need more than a half-step between them,
   or a two-line bullet reads as one paragraph with the next. */
.bullets {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding-inline-start: 1.1rem;
}

.bullets li { color: var(--ink-muted); }
.bullets li::marker { color: var(--accent); }

.taglist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  list-style: none;
  padding: 0;
}

@media (max-width: 44rem) {
  .ledger__row {
    grid-template-columns: minmax(0, 1fr) 1.5rem;
    row-gap: var(--space-3xs);
  }
  .ledger__date { grid-column: 1; }
  .ledger__chev { grid-row: 1; grid-column: 2; }
  .ledger__main { grid-column: 1 / -1; }
  .ledger__panel { grid-template-columns: minmax(0, 1fr); }
  .ledger__detail { grid-column: 1; }
}

/* =========================================================================
   Skills — a grouped index, not a card wall
   ========================================================================= */
.skillindex {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  gap: var(--space-l) var(--space-xl);
  list-style: none;
  padding: 0;
}

.skillgroup {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  padding-top: var(--space-s);
  border-top: 1px solid var(--rule);
}

.skillgroup__title { font-size: var(--step-1); }

.skillgroup__desc {
  font-size: var(--step--1);
  color: var(--ink-muted);
}

.skillgroup__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: var(--space-3xs) 0 0;
  list-style: none;
}

/* =========================================================================
   Certifications
   ========================================================================= */
.certgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr));
  gap: var(--space-s);
  list-style: none;
  padding: 0;
}

.certcard {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: var(--space-2xs);
  padding: var(--space-s);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur) var(--ease-out),
              box-shadow var(--dur) var(--ease-out);
}

.certcard:hover,
.certcard:focus-within {
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-sm);
}

.certcard__mark {
  display: grid;
  place-items: start center;
  padding-top: 0.15em;
  color: var(--accent);
}

.certcard__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  min-width: 0;
}

.certcard__name {
  font-size: var(--step-0);
  line-height: 1.3;
}

.certcard__name a { color: inherit; }
.certcard__name a:hover { color: var(--accent); }

.certcard__meta {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-muted);
}

.certcard__id {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}

.certcard__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: var(--space-3xs) 0 0;
  list-style: none;
}

/* =========================================================================
   Contact
   ========================================================================= */
.section--contact .section__body { gap: var(--space-xl); }

.contact__statement {
  font-size: var(--step-4);
  line-height: var(--leading-tight);
  letter-spacing: -0.022em;
  max-width: 16ch;
}

.contact__statement em { font-style: italic; color: var(--accent); }

/* Pulled outward by exactly the row's inline padding, so the text still lines
   up with the rest of the page while the hover fill has room around it. */
.channels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
  gap: 0 var(--space-l);
  list-style: none;
  padding: 0;
  margin-inline: calc(var(--space-s) * -1);
  border-top: 1px solid var(--rule);
}

/* The <li> is markup-correctness only; the anchor stays the grid item. */
.channels > li { display: contents; }

.channel {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: var(--space-s);
  padding-block: var(--space-s);
  padding-inline: var(--space-s);
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out);
}

.channel:hover { background: var(--paper-raised); }

.channel__type {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* `break-word`, not `anywhere`: an address only splits when it genuinely
   cannot fit, instead of eagerly breaking mid-word at every narrow column. */
.channel__value {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  overflow-wrap: break-word;
}

.channel__arrow {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--ink-faint);
  transition: color var(--dur-fast) var(--ease-out),
              translate var(--dur-fast) var(--ease-out);
}

.channel:hover .channel__arrow { color: var(--accent); translate: 2px -2px; }

/* =========================================================================
   Footer
   ========================================================================= */
.footer {
  border-top: 1px solid var(--rule);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-s);
  padding-block: var(--space-l);
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-faint);
}

.footer a { color: var(--ink-muted); }

/* =========================================================================
   Project viewer — a native <dialog> as a side panel
   ========================================================================= */
.viewer {
  margin: 0 0 0 auto;
  width: min(720px, 100%);
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  border: none;
  border-inline-start: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}

.viewer::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(2px);
}

/* Slide-in works where allow-discrete is supported and degrades to an
   instant open where it isn't. */
@media (prefers-reduced-motion: no-preference) {
  .viewer {
    translate: 100% 0;
    transition: translate var(--dur) var(--ease-out),
                overlay var(--dur) allow-discrete,
                display var(--dur) allow-discrete;
  }
  .viewer[open] { translate: 0 0; }
  @starting-style {
    .viewer[open] { translate: 100% 0; }
  }
  .viewer::backdrop {
    opacity: 0;
    transition: opacity var(--dur) var(--ease-out),
                overlay var(--dur) allow-discrete,
                display var(--dur) allow-discrete;
  }
  .viewer[open]::backdrop { opacity: 1; }
  @starting-style {
    .viewer[open]::backdrop { opacity: 0; }
  }
}

.viewer__inner {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
}

.viewer__bar {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-2xs) var(--space-s);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.viewer__nav {
  display: flex;
  align-items: center;
  gap: var(--space-3xs);
}

.viewer__counter {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  padding-inline: var(--space-3xs);
}

.viewer__bar .viewer__spacer { margin-inline-start: auto; }

.iconbtn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.iconbtn[disabled]:hover { background: none; color: var(--ink-muted); }

.viewer__scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.viewer__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
  padding: var(--space-l) var(--space-l) var(--space-3xl);
}

.viewer__media {
  aspect-ratio: 16 / 9;
  background: var(--paper-sunken);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Letterboxed, not cropped: a gallery exists so the screenshot can be read,
   and `cover` would slice the top and bottom off anything portrait-ish. */
.viewer__media img,
.viewer__media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.viewer__media iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
}

.viewer__media--icon {
  display: grid;
  place-items: center;
  color: var(--ink-faint);
}

/* ---- Gallery: stage, strip, counts ---- */
.viewer__gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.viewer__caption {
  font-size: var(--step--1);
  color: var(--ink-muted);
}

.viewer__thumbs {
  display: flex;
  gap: var(--space-2xs);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  padding-block-end: var(--space-3xs);
}

.viewer__thumb {
  position: relative;
  flex: none;
  width: 5.5rem;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--paper-sunken);
  scroll-snap-align: start;
  opacity: 0.62;
  transition: opacity var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}

.viewer__thumb:hover { opacity: 1; }

.viewer__thumb[aria-current="true"] {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.viewer__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.viewer__thumbicon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--ink-faint);
}

/* Marks a clip in the strip, so the video/image split reads at a glance. */
.viewer__thumbbadge {
  position: absolute;
  inset-block-end: 0.2rem;
  inset-inline-end: 0.2rem;
  display: grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
}

.viewer__gallerybar {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-faint);
}

.viewer__count {
  margin-inline-end: auto;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

.viewer__gallerynav {
  display: flex;
  align-items: center;
  gap: var(--space-3xs);
}

.viewer__position { font-variant-numeric: tabular-nums; }

.iconbtn--sm { width: 2rem; height: 2rem; }
.iconbtn--sm svg { width: 0.95rem; height: 0.95rem; }

.viewer__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.viewer__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5ch;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--accent);
}

.viewer__cats span:not(:last-child)::after { content: " ·"; color: var(--ink-faint); }

.viewer__title {
  font-size: var(--step-3);
  line-height: 1.15;
}

.viewer__section {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding-top: var(--space-m);
  border-top: 1px solid var(--rule);
}

.viewer__section h4 {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-faint);
}

.viewer__section p { color: var(--ink-muted); }

.featurelist {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  list-style: none;
  padding: 0;
}

.featurelist li {
  display: grid;
  grid-template-columns: 1.15rem minmax(0, 1fr);
  gap: var(--space-2xs);
  color: var(--ink-muted);
}

.featurelist svg {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--accent);
  translate: 0 0.42em;
}

/* auto-*fill*, so a one-person team occupies one column instead of stretching
   a lone card across the whole panel. */
.team {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));
  gap: var(--space-s);
  list-style: none;
  padding: 0;
}

.teammate {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: var(--space-xs);
  align-items: start;
  padding: var(--space-xs);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--paper-raised);
}

/* Name, role and contact stack — inline they ran straight into each other. */
.teammate__info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.teammate__avatar {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--step--2);
  overflow: hidden;
}

.teammate__avatar img { width: 100%; height: 100%; object-fit: cover; }

.teammate__name {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 500;
}

.teammate__role {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-faint);
}

.teammate__contact {
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: var(--step--2);
  overflow-wrap: anywhere;
  padding-top: 0.15rem;
}

.viewer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}

@media (max-width: 48rem) {
  .viewer {
    width: 100%;
    border-inline-start: none;
  }
  .viewer__body { padding: var(--space-m) var(--space-s) var(--space-2xl); }
}

/* =========================================================================
   Phones — the first breakpoint that reclaims space rather than reflowing it
   ========================================================================= */
@media (max-width: 30rem) {
  /* `/` is a keyboard shortcut, so on a phone the hint and the 5.5rem of
     padding reserved for it only shrink the field. */
  .search__hint { display: none; }
  .search input { padding-inline-end: 2.75rem; }

  .viewer__bar { padding-inline: var(--space-2xs); }
  .viewer__thumb { width: 4.75rem; }
}

/* =========================================================================
   Toast — surfaces a failed data fetch instead of failing silently
   ========================================================================= */
.toast {
  position: fixed;
  z-index: 300;
  inset-block-end: var(--space-m);
  inset-inline: var(--space-m);
  margin-inline: auto;
  width: fit-content;
  max-width: min(34rem, calc(100vw - 2 * var(--space-m)));
  display: flex;
  align-items: flex-start;
  gap: var(--space-2xs);
  padding: var(--space-2xs) var(--space-s);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-inline-start: 3px solid var(--warn);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  color: var(--ink-muted);
}

.toast svg { width: 1rem; height: 1rem; color: var(--warn); flex: none; translate: 0 0.28em; }
.toast button { color: var(--ink-faint); padding-inline-start: var(--space-2xs); }
.toast button:hover { color: var(--ink); }

/* =========================================================================
   Skeletons — hold layout while the JSON is in flight
   ========================================================================= */
.skeleton {
  background: var(--skeleton);
  background-size: 400% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.4s ease-in-out infinite;
  color: transparent !important;
}

@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.skeleton-block {
  height: var(--h, 1rem);
  width: var(--w, 100%);
}

.skeleton-card {
  height: 20rem;
  border-radius: var(--radius-lg);
}
