/* ===========================================================
   David Nwinangi, developer portfolio (light and dark)

   Type
   Same three fonts as Turnly:
   - Display: Manrope (headings, names, big numbers)
   - Text:    Barlow (paragraphs, buttons, navigation)
   - Mono:    IBM Plex Mono (labels, dates, tags)

   Colour: warm paper and ink, one green accent.
   Every colour is a token below. The dark values are used when
   the visitor's device is dark, or when they press the toggle.
   =========================================================== */
:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --card-2: #efeee9;
  --ink: #131311;
  --on-ink: #ffffff;
  --mute: #5d5d56;
  --faint: #a2a19a;
  --line: #e2e1da;
  --accent: #0b7a50;
  --accent-soft: #e0f2e9;
  --top-bg: rgba(246, 245, 241, 0.86);
  --shadow: rgba(19, 19, 17, 0.32);
  --art-bg: radial-gradient(70% 60% at 50% 0%, #e2f6c9 0%, rgba(226, 246, 201, 0) 70%), #fbfdf6;
  --art-glow: rgba(22, 163, 74, 0.42);
  --line-art: none;
  --dot: #22c55e;

  --font-display: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 20px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f100e;
    --card: #171815;
    --card-2: #1f201c;
    --ink: #efeee8;
    --on-ink: #0f100e;
    --mute: #a3a29a;
    --faint: #6f6e67;
    --line: #272823;
    --accent: #52d99f;
    --accent-soft: rgba(82, 217, 159, 0.12);
    --top-bg: rgba(15, 16, 14, 0.82);
    --shadow: rgba(0, 0, 0, 0.7);
    --art-bg: radial-gradient(70% 60% at 50% 0%, rgba(130, 200, 60, 0.2) 0%, rgba(130, 200, 60, 0) 70%), #141612;
    --art-glow: rgba(82, 217, 159, 0.35);
    --line-art: invert(1);
    --dot: #4ade80;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f100e;
  --card: #171815;
  --card-2: #1f201c;
  --ink: #efeee8;
  --on-ink: #0f100e;
  --mute: #a3a29a;
  --faint: #6f6e67;
  --line: #272823;
  --accent: #52d99f;
  --accent-soft: rgba(82, 217, 159, 0.12);
  --top-bg: rgba(15, 16, 14, 0.82);
  --shadow: rgba(0, 0, 0, 0.7);
  --art-bg: radial-gradient(70% 60% at 50% 0%, rgba(130, 200, 60, 0.2) 0%, rgba(130, 200, 60, 0) 70%), #141612;
  --art-glow: rgba(82, 217, 159, 0.35);
  --line-art: invert(1);
  --dot: #4ade80;
  color-scheme: dark;
}

/* ---------- base ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.no-scroll {
  overflow: hidden;
}

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

ul,
ol {
  list-style: none;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 3000;
  background: var(--ink);
  color: var(--on-ink);
  padding: 10px 20px;
  border-radius: 0 0 8px 0;
  text-decoration: none;
}

.skip:focus {
  left: 0;
}

.nav,
main,
.foot {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 26px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  font: 600 0.9375rem/1 var(--font);
  letter-spacing: 0.005em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s, background 0.25s, color 0.25s, box-shadow 0.25s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(1px);
}

.btn-solid {
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: 0 10px 24px -10px var(--shadow);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
}

.btn-outline:hover {
  background: var(--ink);
  color: var(--on-ink);
}

/* ---------- top bar ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--top-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-right: auto;
}

.brand-logo {
  height: 50px;
  width: auto;
  filter: var(--line-art);
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-right: 8px;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--mute);
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover {
  color: var(--ink);
  background: var(--card-2);
}

.theme-toggle {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.25s, border-color 0.25s;
}

.theme-toggle:hover {
  transform: rotate(14deg);
  border-color: var(--ink);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .moon {
    display: none;
  }
}

:root[data-theme="dark"] .theme-toggle .sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .moon {
  display: none;
}

/* ---------- hero ---------- */
.hero {
  padding: clamp(56px, 10vw, 120px) 0 clamp(64px, 9vw, 110px);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
}

.dot {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot);
}

.dot::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: var(--dot);
  opacity: 0.25;
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.hero h1 {
  margin-top: 28px;
  font-size: clamp(2.6rem, 7.6vw, 5.75rem);
  line-height: 1;
  letter-spacing: -0.032em;
  font-weight: 700;
}

.role {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.8vw, 2.75rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.022em;
}

.muted {
  color: var(--faint);
  margin-right: 0.28em;
}

.type {
  white-space: nowrap;
}

.caret {
  display: inline-block;
  width: 3px;
  height: 0.88em;
  margin-left: 4px;
  vertical-align: -0.08em;
  background: var(--accent);
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.lede {
  margin-top: 26px;
  max-width: 44ch;
  font-size: 1.1875rem;
  line-height: 1.6;
  color: var(--mute);
}

.cta {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.tools {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tools li {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 500 0.8125rem/1 var(--mono);
}

.social {
  margin-top: 36px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
}

.social a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--mute);
  transition: color 0.2s;
}

.social a:hover {
  color: var(--ink);
}

.social i {
  font-size: 1.25rem;
}

/* ---------- sections ---------- */
.section {
  padding: clamp(56px, 8vw, 96px) 0;
  border-top: 1px solid var(--line);
}

.section-head {
  margin-bottom: clamp(32px, 5vw, 56px);
}

.eyebrow {
  font: 500 0.75rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

.section h2 {
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.section-note {
  margin-top: 14px;
  color: var(--mute);
  font-size: 1.0625rem;
  max-width: 50ch;
}

/* ---------- featured projects ---------- */
.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 56px);
  align-items: center;
  margin-bottom: clamp(56px, 8vw, 96px);
}

.feature.flip .feature-shot {
  order: 2;
}

.feature-shot {
  display: block;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 30px 60px -38px var(--shadow);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s;
}

a.feature-shot:hover {
  transform: translateY(-6px);
  box-shadow: 0 40px 70px -36px var(--shadow);
}

.feature-shot img {
  width: 100%;
  height: auto;
}

.feature-shot.art {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px 32px;
  background: var(--art-bg);
}

.feature-shot .art-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  box-shadow: 0 18px 36px -12px var(--art-glow);
}

.art-name {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
}

.art-line {
  margin-top: 6px;
  color: var(--mute);
  font-size: 0.9375rem;
}

.feature-shot .art-reader {
  width: min(250px, 66%);
  height: auto;
  margin-top: 22px;
  filter: var(--line-art);
}

.kind {
  font: 500 0.75rem/1.3 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.feature-body h3 {
  margin-top: 12px;
  font-size: clamp(2rem, 4.4vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.032em;
  font-weight: 700;
}

.what {
  margin-top: 16px;
  font-size: 1.125rem;
  line-height: 1.6;
}

.built {
  margin: 20px 0 22px;
  display: grid;
  gap: 12px;
}

.built li {
  position: relative;
  padding-left: 24px;
  color: var(--mute);
  font-size: 0.96875rem;
  line-height: 1.6;
}

.built li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 10px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags li {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font: 500 0.78125rem/1 var(--mono);
  color: var(--ink);
}

.tags.small li {
  padding: 5px 11px;
  font-size: 0.75rem;
  color: var(--mute);
}

.note-line {
  margin-top: 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--mute);
  font-size: 0.875rem;
}

.pill-status {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 500 0.75rem/1 var(--mono);
}

.links {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.visit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 20px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.visit i {
  font-size: 0.75rem;
}

.visit:hover {
  background: var(--ink);
  color: var(--on-ink);
}

.visit.ghost {
  background: var(--card);
  border-color: var(--line);
}

.visit.ghost:hover {
  background: var(--ink);
  border-color: var(--ink);
}

/* ---------- more work ---------- */
.more-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: clamp(24px, 4vw, 48px);
  padding-top: clamp(40px, 6vw, 64px);
  border-top: 1px solid var(--line);
  margin-bottom: 22px;
}

.more-head h3 {
  font-size: clamp(1.75rem, 3.6vw, 2.25rem);
  letter-spacing: -0.03em;
  font-weight: 700;
}

.more-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--mute);
  text-decoration: none;
}

.more-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

.more-link i {
  font-size: 0.6875rem;
}

.more {
  border-top: 1px solid var(--line);
}

.more-item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 26px;
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.more-item img {
  width: 150px;
  height: 100px;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
}

.more-item h4 {
  margin-top: 8px;
  font-size: 1.5rem;
  line-height: 1.15;
  letter-spacing: -0.022em;
  font-weight: 700;
}

.more-item p:not(.kind) {
  margin-top: 6px;
  color: var(--mute);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.more-item .tags {
  margin-top: 12px;
}

/* ---------- stack ---------- */
.stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.stack-group {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}

.stack-group h3 {
  margin-bottom: 18px;
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.stack-group .tags li {
  background: var(--bg);
}

/* ---------- experience ---------- */
.jobs {
  border-top: 1px solid var(--line);
}

.job {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
}

.when {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font: 500 0.8125rem/1.6 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.now-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.job h3 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
  font-weight: 700;
}

.job .org {
  margin-top: 4px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--mute);
}

.job .org a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

.job .org a:hover {
  text-decoration-color: var(--ink);
}

.job-text {
  margin-top: 12px;
  max-width: 62ch;
  color: var(--mute);
  font-size: 0.96875rem;
  line-height: 1.65;
}

/* ---------- contact ---------- */
.contact h2 {
  font-size: clamp(2.5rem, 7.4vw, 5.25rem);
  letter-spacing: -0.035em;
  line-height: 1;
}

/* ---------- footer ---------- */
.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 32px;
  padding-top: 28px;
  padding-bottom: 40px;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--mute);
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
}

.foot-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  font-weight: 500;
  color: var(--ink);
}

.foot-links a:hover {
  text-decoration: underline;
}

/* ---------- download icon animation ---------- */
.dl {
  flex: none;
  overflow: visible;
}

.btn:hover .dl-arrow,
.btn:focus-visible .dl-arrow,
.btn.is-downloading .dl-arrow {
  animation: dl-drop 0.9s ease-in-out infinite;
}

.btn:hover .dl-tray,
.btn:focus-visible .dl-tray,
.btn.is-downloading .dl-tray {
  animation: dl-tray 0.9s ease-in-out infinite;
}

@keyframes dl-drop {
  0% {
    transform: translateY(-7px);
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
  65% {
    transform: translateY(2px);
    opacity: 1;
  }
  100% {
    transform: translateY(6px);
    opacity: 0;
  }
}

@keyframes dl-tray {
  0%,
  55% {
    transform: translateY(0);
  }
  80% {
    transform: translateY(1.5px);
  }
  100% {
    transform: translateY(0);
  }
}

.btn.is-downloading {
  pointer-events: none;
}

/* ---------- contact popup (dark in both themes) ---------- */
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s, visibility 0.3s;
}

.popup-overlay.active {
  visibility: visible;
  opacity: 1;
}

.popup-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  transform: scale(0.85);
  opacity: 0;
}

.popup-content.active {
  transform: scale(1);
  opacity: 1;
}

.popup-overlay :focus-visible {
  outline-color: #fff;
}

.close-btn {
  position: absolute;
  top: -8px;
  right: -4px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform 0.3s;
}

.close-btn:hover {
  transform: rotate(90deg);
}

.popup-title {
  margin-bottom: 26px;
  padding: 0 40px;
  color: #fff;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.022em;
  text-align: center;
}

.contact-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.contact-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px 12px;
  min-height: 130px;
  border-radius: 16px;
  background: #1b1c19;
  color: #fff;
  text-decoration: none;
  transition: transform 0.3s, background 0.3s;
}

.contact-item:hover {
  transform: translateY(-4px);
  background: #272824;
}

.contact-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.14);
}

.phone .contact-icon {
  background: rgba(37, 211, 102, 0.2);
  color: #25d366;
}

.linkedin .contact-icon,
.twitter .contact-icon {
  background: rgba(29, 161, 242, 0.2);
  color: #4db5f5;
}

.contact-text {
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  overflow-wrap: anywhere;
}

/* ---------- type tuning for Manrope, Barlow and IBM Plex Mono ---------- */
body {
  font-size: 1.125rem;
  line-height: 1.6;
}

h1,
h2,
h3,
h4 {
  letter-spacing: -0.02em;
}

.hero h1,
.section h2,
.feature-body h3,
.contact h2,
.art-name,
.more-head h3 {
  font-weight: 800;
  letter-spacing: -0.025em;
}

.hero h1 {
  font-size: clamp(2.4rem, 6.6vw, 5rem);
  line-height: 1.04;
}

.role {
  font-size: clamp(1.4rem, 3.4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section h2 {
  font-size: clamp(2rem, 4.6vw, 3.25rem);
  line-height: 1.08;
}

.feature-body h3 {
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  line-height: 1.08;
}

.contact h2 {
  font-size: clamp(2.3rem, 6.4vw, 4.75rem);
  line-height: 1.04;
}

.job h3,
.more-item h4,
.stack-group h3 {
  font-weight: 700;
  letter-spacing: -0.015em;
}

.lede {
  font-size: 1.3125rem;
  line-height: 1.55;
}

.what {
  font-size: 1.1875rem;
}

.section-note {
  font-size: 1.125rem;
}

.built li {
  font-size: 1.0625rem;
  line-height: 1.55;
}

.more-item p:not(.kind) {
  font-size: 1.0625rem;
  line-height: 1.5;
}

.job-text {
  font-size: 1.0625rem;
}

.btn {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0;
}

.visit {
  font-size: 1rem;
}

.nav-links a,
.social a,
.status,
.more-link,
.foot,
.note-line {
  font-size: 1rem;
}

.job .org {
  font-size: 1rem;
}

.tools li {
  font-size: 0.78125rem;
}

.tags li {
  font-size: 0.75rem;
}

.tags.small li {
  font-size: 0.71875rem;
}

.eyebrow,
.kind,
.when {
  letter-spacing: 0.1em;
}

.when {
  font-size: 0.8125rem;
}

.pill-status {
  font-size: 0.71875rem;
}

.art-line {
  font-size: 1.0625rem;
}

.contact-text {
  font-size: 1rem;
}

/* ---------- featured projects: cards that stack as you scroll ---------- */
.deck {
  display: block;
}

.feature {
  position: relative;
}

/* the dimming layer a card gets when the next one covers it (set from app.js) */
.feature::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #000;
  opacity: calc(var(--cover, 0) * 0.32);
  pointer-events: none;
}

@media (min-width: 900px) and (min-height: 820px) {
  .deck .feature {
    position: sticky;
    top: calc(96px + var(--i) * 14px);
    height: min(calc(100vh - 130px), 740px);
    margin-bottom: 72px;
    padding: clamp(28px, 3.2vw, 44px);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
    gap: clamp(28px, 4vw, 52px);
    align-items: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: 0 -18px 50px -30px var(--shadow), 0 30px 60px -40px var(--shadow);
    overflow: hidden;
    transform-origin: 50% 0;
    will-change: transform;
  }

  .deck .feature:last-child {
    margin-bottom: 24px;
  }

  .deck .feature .feature-body {
    order: 1;
    min-width: 0;
  }

  .deck .feature .feature-shot,
  .deck .feature.flip .feature-shot {
    order: 2;
    align-self: center;
    max-height: 100%;
    box-shadow: 0 24px 48px -32px var(--shadow);
  }

  .deck .feature .feature-shot img {
    max-height: calc(min(calc(100vh - 130px), 740px) - 90px);
    object-fit: cover;
    object-position: top;
  }

  .deck .feature-body h3 {
    font-size: clamp(1.8rem, 3.2vw, 2.5rem);
  }

  .deck .built {
    margin: 14px 0 16px;
    gap: 8px;
  }

  .deck .built li {
    font-size: 1rem;
    line-height: 1.5;
  }

  .deck .what {
    font-size: 1.125rem;
    margin-top: 12px;
  }

  .deck .links {
    margin-top: 20px;
  }
}

/* theme change: the new theme grows out of the toggle as a circle */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

.theme-toggle svg {
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle.spin svg {
  transform: rotate(180deg) scale(0.9);
}

/* ---------- floating header: logo + location, pill nav, local time ---------- */
.top {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 18px max(28px, env(safe-area-inset-right, 0px)) 0 max(28px, env(safe-area-inset-left, 0px));
  background: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  pointer-events: none;
}

.top > * {
  pointer-events: auto;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.top-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
}

.top .brand {
  margin-right: 0;
}

.top .brand-logo {
  height: 40px;
}

.top-meta {
  font: 400 0.8125rem/1 var(--mono);
  letter-spacing: 0.02em;
  color: var(--mute);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pill {
  position: relative;
  display: flex;
  gap: 2px;
  margin-top: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 68%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 12px 32px -20px var(--shadow);
}

.pill a {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  font: 500 0.9375rem/1 var(--font);
  color: var(--mute);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.3s;
}

.pill a:hover {
  color: var(--ink);
}

.pill a.is-active {
  color: var(--on-ink);
}

.pill-indicator {
  position: absolute;
  z-index: 0;
  top: 4px;
  left: 0;
  width: 0;
  height: calc(100% - 8px);
  border-radius: 999px;
  background: var(--ink);
  transition: transform 0.5s cubic-bezier(0.3, 1.25, 0.4, 1), width 0.5s cubic-bezier(0.3, 1.25, 0.4, 1);
}

/* room for the floating header */
html {
  scroll-padding-top: 100px;
}

.hero {
  padding-top: clamp(150px, 17vw, 210px);
}

@media (min-width: 900px) and (min-height: 820px) {
  .deck .feature {
    top: calc(100px + var(--i) * 14px);
    height: min(calc(100vh - 160px), 730px);
    padding: clamp(24px, 2.8vw, 38px);
  }

  .deck .feature .feature-shot img {
    max-height: calc(min(calc(100vh - 160px), 730px) - 80px);
  }
}

@media (max-width: 1060px) {
  .top .top-meta {
    display: none;
  }
}

@media (max-width: 640px) {
  .pill .wide-only {
    display: none;
  }
}

@media (max-width: 640px) {
  .top {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    padding-top: 12px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }

  .pill {
    justify-self: center;
    margin-top: 0;
  }

  .pill a {
    min-height: 38px;
    padding: 0 12px;
    font-size: 0.875rem;
  }

  .top .brand-logo {
    height: 32px;
  }

  .hero {
    padding-top: 110px;
  }
}

@media (max-width: 360px) {
  .pill a {
    padding: 0 9px;
  }
}

/* ---------- pill nav: icons on desktop, the name slides out on hover ---------- */
.pill .ni {
  display: none;
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* desktop with a mouse: icons only */
@media (min-width: 641px) and (hover: hover) {
  .pill a {
    justify-content: center;
    min-width: 44px;
    padding: 0 13px;
  }

  .pill .ni {
    display: block;
  }

  .pill .nl {
    display: inline-block;
    max-width: 0;
    margin-left: 0;
    overflow: hidden;
    opacity: 0;
    white-space: nowrap;
    transition: max-width 0.4s cubic-bezier(0.3, 1, 0.4, 1), margin-left 0.4s cubic-bezier(0.3, 1, 0.4, 1), opacity 0.25s ease;
  }

  .pill a:hover .nl,
  .pill a:focus-visible .nl {
    max-width: 120px;
    margin-left: 8px;
    opacity: 1;
  }
}

/* ---------- header icon buttons: Download CV sits beside the theme button ---------- */
.top-right {
  gap: 10px;
}

.icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.25s, transform 0.25s;
}

.icon-btn:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}

.icon-btn .dl {
  width: 19px;
  height: 19px;
}

.icon-btn:hover .dl-arrow,
.icon-btn:focus-visible .dl-arrow,
.icon-btn.is-downloading .dl-arrow {
  animation: dl-drop 0.9s ease-in-out infinite;
}

.icon-btn:hover .dl-tray,
.icon-btn:focus-visible .dl-tray,
.icon-btn.is-downloading .dl-tray {
  animation: dl-tray 0.9s ease-in-out infinite;
}

.icon-btn.is-downloading {
  pointer-events: none;
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 640px) {
  .top-right {
    gap: 6px;
  }

  .top-left,
  .top .brand {
    flex: none;
  }

  .top .brand-logo {
    height: 28px;
    width: auto;
    max-width: none;
  }

  .pill a {
    padding: 0 10px;
  }

  .icon-btn,
  .top .theme-toggle {
    width: 40px;
    height: 40px;
  }
}

/* very small phones: the hero's Download CV button is right below, so the header keeps only the theme button */
@media (max-width: 370px) {
  .top .icon-btn {
    display: none;
  }

  .top {
    gap: 6px;
  }

  .pill a {
    padding: 0 9px;
  }
}

@media (max-width: 335px) {
  .top .brand-logo {
    height: 24px;
  }

  .pill a {
    padding: 0 7px;
    font-size: 0.8125rem;
  }
}

/* ---------- logo that flips against whatever is behind it ----------
   The logo is drawn white and blended with "difference": over white or light
   areas it shows black, over dark areas it shows white. It lives in its own
   fixed layer because blending inside the header would only see the header. */
:root {
  --logo-h: 40px;
  --logo-row: 50px;   /* height of the header row (the pill) */
  --logo-top: 18px;
  --logo-left: max(28px, env(safe-area-inset-left, 0px));
}

.brand-fixed {
  position: fixed;
  z-index: 60;
  top: var(--logo-top);
  left: var(--logo-left);
  height: var(--logo-row);
  display: flex;
  align-items: center;
  margin: 0;
  mix-blend-mode: difference;
}

.brand-fixed .brand-logo {
  height: var(--logo-h);
  width: auto;
  max-width: none;
  filter: invert(1);   /* black artwork becomes white before blending */
}

.brand-space {
  display: block;
  width: calc(var(--logo-h) * 1.867);
  height: var(--logo-h);
}

@media (max-width: 640px) {
  :root {
    --logo-h: 28px;
    --logo-row: 48px;
    --logo-top: 12px;
    --logo-left: max(16px, env(safe-area-inset-left, 0px));
  }
}

@media (max-width: 335px) {
  :root {
    --logo-h: 24px;
  }
}

/* nothing is highlighted while you're at the top of the page */
.pill-indicator {
  opacity: 1;
}

.pill-indicator.is-hidden {
  opacity: 0;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .feature,
  .feature.flip {
    grid-template-columns: minmax(0, 1fr);
  }

  .feature.flip .feature-shot {
    order: 0;
  }

  .stack {
    grid-template-columns: minmax(0, 1fr);
  }

  .job {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
}

@media (max-width: 640px) {
  .nav {
    height: 68px;
    gap: 8px;
  }

  .brand-logo {
    height: 40px;
  }

  .nav-links {
    margin-right: 0;
    gap: 0;
  }

  .nav-links li:nth-child(2),
  .nav-links li:nth-child(3) {
    display: none;
  }

  .nav-links a {
    padding: 0 10px;
    font-size: 0.875rem;
  }

  .nav .btn {
    padding: 0 16px;
    min-width: 48px;
  }

  .nav .btn span {
    display: none;
  }

  .cta .btn {
    flex: 1 1 100%;
  }

  .more-item {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 16px 18px;
    align-items: start;
  }

  .more-item img {
    width: 96px;
    height: 72px;
    border-radius: 10px;
  }

  .more-item .visit {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .links .visit {
    flex: 1 1 100%;
    justify-content: center;
  }

  .contact-info {
    grid-template-columns: 1fr;
  }

  .contact-item {
    min-height: 0;
    flex-direction: row;
    justify-content: flex-start;
    padding: 14px 18px;
    gap: 16px;
  }

  .contact-text {
    text-align: left;
    font-size: 0.9375rem;
  }

  .foot,
  .foot-links {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 380px) {
  .nav-links a {
    padding: 0 7px;
    font-size: 0.8125rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}


/* ---------- app screenshots: use each app's own dark version in dark mode ---------- */
.img-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .img-dark {
    display: block;
  }
  :root:not([data-theme="light"]) .img-light {
    display: none;
  }
}

:root[data-theme="dark"] .img-dark {
  display: block;
}

:root[data-theme="dark"] .img-light {
  display: none;
}
