/* ---------- Theme tokens ---------- */
:root {
  --bg: #f7f6f6;
  --bg-alt: #eeecec;
  --text: #181414;
  --text-dim: #656061;
  --accent: #8c2331;
  --accent-hover: #a3283a;
  --accent-soft: rgba(140,35,49,0.1);
  --online: #2f7a4f;
  --border: rgba(30,26,26,0.09);
  --grid-line: rgba(30,26,26,0.07);
  --shadow: rgba(24,20,20,0.08);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* ---- Layout tokens ----
     Every top-level band (hero, sections, credibility strip, case TOC) shares
     --gutter so their content starts on one vertical line. Previously the hero
     was left-anchored at 6vw while .section was a centered 1100px column, which
     put them ~240px apart on a wide screen. The gutter is clamped so it doesn't
     run away on ultrawide displays.
     --page-max caps the whole band; below it everything stays left-anchored,
     above it the band centers so an ultrawide screen doesn't leave a huge void
     on the right. --content-max keeps grids from stretching uncomfortably wide
     while still letting them run further right than a text column. */
  --gutter: clamp(1.25rem, 6vw, 6.5rem);
  --page-max: 1700px;
  --content-max: 1240px;
  --header-h: 5.5rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08090b;
    --bg-alt: #0d0e12;
    --text: #f3ece7;
    --text-dim: #9d9698;
    --accent: #a3283a;
    --accent-hover: #b8324a;
    --accent-soft: rgba(163,40,58,0.16);
    --online: #3fa06a;
    --border: rgba(200,196,196,0.09);
    --grid-line: rgba(190,170,172,0.06);
    --shadow: rgba(0,0,0,0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #08090b;
  --bg-alt: #0d0e12;
  --text: #f3ece7;
  --text-dim: #9d9698;
  --accent: #a3283a;
  --accent-hover: #b8324a;
  --accent-soft: rgba(163,40,58,0.16);
  --online: #3fa06a;
  --border: rgba(200,196,196,0.09);
  --grid-line: rgba(190,170,172,0.06);
  --shadow: rgba(0,0,0,0.5);
  color-scheme: dark;
}

/* ---------- Reset ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Mobile browsers default this tap-flash to blue; match the site accent instead. */
  -webkit-tap-highlight-color: rgba(140,35,49,0.25);
}

/* Reserve the scrollbar's width permanently so opening/closing the mobile
   menu (which locks body scroll) never changes the page's effective width.
   Without this, the scrollbar disappearing/reappearing shifts fixed-position
   elements (header, hamburger, theme toggle) by the scrollbar's width. */
html {
  scrollbar-gutter: stable;
}

/* scroll-behavior: smooth was removed — it could silently fail to complete
   in some environments, leaving in-page links (nav, hero CTAs, the case-study
   table of contents) stuck at the top instead of jumping to the target
   section. A plain instant jump is less flashy but always actually works. */

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  transition: background 0.3s ease, color 0.3s ease;
}

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

ul { list-style: none; }

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

/* ---------- Faint grid texture ---------- */
.grid-texture {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
}

/* ---------- Focus states ---------- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  z-index: 200;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: var(--text);
}

/* ---------- Avatar menu ---------- */
.avatar-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.avatar-link {
  position: relative;
  display: block;
  line-height: 0;
  border-radius: 50%;
}

.avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: block;
  border: 1px solid var(--border);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.avatar-link:hover .avatar-img {
  border-color: var(--accent);
  transform: scale(1.05);
}

.avatar-caret {
  width: 1.4rem;
  height: 1.4rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.avatar-caret:hover,
.avatar-caret:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.avatar-caret[aria-expanded="true"] {
  transform: rotate(180deg);
}

.online-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid var(--bg);
  animation: onlinePulse 3s ease-in-out infinite;
}

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

.avatar-dropdown {
  position: absolute;
  top: calc(100% + 0.75rem);
  left: 0;
  min-width: 190px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.4rem;
  box-shadow: 0 12px 28px var(--shadow);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 220;
}

.profile-card-name {
  padding: 0.45rem 0.7rem 0.6rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.avatar-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.avatar-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  transition: background 0.15s ease, color 0.15s ease;
}

.avatar-dropdown a:hover {
  background: var(--bg);
  color: var(--accent);
}

/* ---------- Desktop nav ----------
   Hidden by default (mobile-first); the hamburger handles small screens. At
   the desktop breakpoint below these links appear and the hamburger hides. */
.desktop-nav {
  display: none;
  align-items: center;
  gap: 2rem;
  margin-left: auto;
  /* Leaves room for the fixed theme toggle pinned to the right edge. */
  margin-right: 4rem;
}

.desktop-nav a {
  position: relative;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 0.25rem 0;
  transition: color 0.2s ease;
}

.desktop-nav a:hover,
.desktop-nav a:focus-visible {
  color: var(--text);
}

/* Subtle underline marks the section currently in view (or the current page). */
.desktop-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.desktop-nav a:hover::after,
.desktop-nav a.active::after,
.desktop-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.desktop-nav a.active,
.desktop-nav a[aria-current="page"] {
  color: var(--text);
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed;
  top: 1.7rem;
  right: 5.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 210;
}

.theme-toggle .icon { width: 20px; height: 20px; position: absolute; transition: opacity 0.25s ease, transform 0.25s ease; }
.theme-toggle .icon-moon { opacity: 1; transform: scale(1); }
.theme-toggle .icon-sun { opacity: 0; transform: scale(0.5); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { opacity: 0; transform: scale(0.5); }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { opacity: 1; transform: scale(1); }
}
:root[data-theme="dark"] .theme-toggle .icon-moon { opacity: 0; transform: scale(0.5); }
:root[data-theme="dark"] .theme-toggle .icon-sun { opacity: 1; transform: scale(1); }

/* ---------- Hamburger ---------- */
.hamburger {
  position: fixed;
  top: 1.6rem;
  right: 2rem;
  width: 2.25rem;
  height: 2.25rem;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 210;
}

.hamburger span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.35s cubic-bezier(0.65,0,0.35,1), opacity 0.2s ease, background 0.3s ease;
}

.hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ---------- Nav overlay ---------- */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  z-index: 150;
  clip-path: circle(0px at calc(100% - 3.1rem) 2.6rem);
  transition: clip-path 0.6s cubic-bezier(0.65,0,0.35,1);
  pointer-events: none;
  overflow-y: auto;
  padding: 3rem 0;
}

.nav-overlay.open {
  clip-path: circle(150% at calc(100% - 3.1rem) 2.6rem);
  pointer-events: auto;
}

.nav-links {
  text-align: center;
}

.nav-links li {
  margin: 0.7rem 0;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  transition-delay: calc(var(--i) * 0.05s);
}

.nav-overlay.open .nav-links li {
  opacity: 1;
  transform: translateY(0);
}

.nav-links a {
  font-size: clamp(1.35rem, 4.5vw, 2.25rem);
  font-weight: 600;
  color: var(--text);
  transition: color 0.2s ease;
}

.nav-links a:hover { color: var(--accent); }

.nav-footer {
  opacity: 0.6;
  font-size: 0.9rem;
}

/* ---------- Main sections ---------- */
main { overflow: hidden; }

/* Shared page band. Applied to every top-level block so the hero and the
   sections below it start on the same vertical line. Left-anchored until the
   viewport exceeds --page-max, then centered as one unit. */
.hero,
.section,
.credibility-strip,
.case-toc {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding-top: 6rem;
  padding-bottom: 3rem;
}

/* Hero text keeps its old comfortable measure — the band is wider now, but the
   copy shouldn't stretch with it. */
.hero > .eyebrow,
.hero > h1,
.hero > .hero-sub,
.hero > .hero-support,
.hero > .status-line,
.hero > .hero-actions {
  max-width: 900px;
  width: 100%;
}

/* Scroll cue: overlays the bottom-center of the hero, points down to the gallery */
.hero-scroll-cue {
  /* Now a <button> (it opens the gallery slideshow rather than navigating to
     an anchor), so reset the button defaults the rest of this rule doesn't
     already cover. */
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  position: absolute;
  left: 50%;
  bottom: 1.75rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dim);
  animation: scrollCueBounce 2.2s ease-in-out infinite;
  transition: color 0.2s ease;
}

.hero-scroll-cue-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-scroll-cue-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

.hero-scroll-cue:hover,
.hero-scroll-cue:focus-visible {
  color: var(--accent);
}

.hero-scroll-cue:hover .hero-scroll-cue-icon,
.hero-scroll-cue:focus-visible .hero-scroll-cue-icon {
  border-color: var(--accent);
}

@keyframes scrollCueBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

@keyframes scrollCueBounceMobile {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* Two-column hero variant (Wraps page) */
.hero.hero-split {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  gap: 3rem;
}

/* The split hero's two columns shouldn't stretch to the full band width on a
   very wide screen — cap the pair while keeping them left-anchored. */
.hero.hero-split > * {
  max-width: none;
}

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

.hero-split .hero-content,
.hero-split .hero-media {
  max-width: 620px;
}

.hero-split .hero-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero-media { width: 100%; }

.hero-photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--border);
}

@media (max-width: 900px) {
  .hero.hero-split {
    grid-template-columns: 1fr;
    /* Desktop uses a full-viewport-height hero for a dramatic split-screen
       effect. On mobile the layout stacks instead, so forcing the same
       min-height just pads empty space below the content — drop it so the
       hero is only as tall as it needs to be. */
    min-height: auto;
    padding-bottom: 2rem;
  }
  .hero-split .hero-media {
    order: 2;
    margin-top: 1.5rem;
  }
  /* The scroll cue is absolutely positioned against the whole hero section on
     desktop, which works because the hero-media sits beside the text. On
     mobile the layout stacks (text, then photo), making the hero taller than
     one viewport — so an absolute "bottom" offset lands mid-photo instead of
     below it. Drop it back into normal flow, after the photo, instead. */
  .hero-scroll-cue {
    position: static;
    order: 3;
    margin: 1rem auto 0;
    transform: none;
    /* Desktop's bounce keyframe bakes in translateX(-50%) to stay centered
       under absolute positioning; that would fight this static, margin-auto
       centering, so mobile gets its own vertical-only bounce instead. */
    animation: scrollCueBounceMobile 2.2s ease-in-out infinite;
  }
}

/* Project lockup — app icon beside the project title on a case-study hero.
   The mark sits on the baseline block rather than above it so the pair reads
   as one unit at every width. */
.project-lockup {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  max-width: 900px;
  width: 100%;
}

.project-mark {
  width: clamp(3rem, 7vw, 4.75rem);
  height: auto;
  flex-shrink: 0;
  /* The icon carries its own dark shapes; a faint glow keeps it from sitting
     flat against the dark page without altering the artwork itself. */
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.45));
}

.project-lockup h1 { margin: 0; }

@media (max-width: 640px) {
  .project-lockup { gap: 0.8rem; }
}

/* Case-study figures — image plus its caption as one block. */
.case-shots figure { margin: 0; }

/* Compact table of contents (case-study pages) */
.case-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-bottom: 3rem;
}

.case-toc a {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.case-toc a:hover,
.case-toc a:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.eyebrow {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: clamp(2.75rem, 9vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.hero-sub {
  margin-top: 1.25rem;
  max-width: 42ch;
  color: var(--text);
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  font-weight: 600;
}

.hero-support {
  margin-top: 0.65rem;
  max-width: 46ch;
  color: var(--text-dim);
  font-size: clamp(1rem, 2vw, 1.1rem);
}

.status-line {
  margin-top: 1.75rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  opacity: 0.75;
}

/* Wrap Factory disclosure directly under the hero CTAs — keeps it clear that
   quotes/scheduling go through the shop, not a separate business of mine. */
.hero-disclosure {
  margin-top: 1rem;
  max-width: 46ch;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.45;
}

.hero-disclosure strong { color: var(--text); }

.hero-actions {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-top: 2.25rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.75rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  background: transparent;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.btn:hover,
.btn:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-solid {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-solid:hover,
.btn-solid:focus-visible {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.section {
  padding-block: 7rem;
  border-top: 1px solid var(--border);
  /* Clears the fixed header when jumped to via an in-page anchor, so the
     heading isn't tucked underneath it. */
  scroll-margin-top: var(--header-h);
}

/* Grids and galleries may run further right than a text column, but still stop
   short of the full band so the page keeps some breathing room on the right. */
.grid,
.featured-grid,
.builds-compact-grid,
.credibility-grid,
.case-shots,
.case-meta-grid,
.contact-actions {
  max-width: var(--content-max);
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  margin-bottom: 2rem;
}

.section-title .num {
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
}

.section-text {
  max-width: 65ch;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.section-intro {
  margin-bottom: 2.5rem;
}

.section-text-tight {
  margin-top: 0.75rem;
}

.section-title.small-title {
  font-size: 1.1rem;
  margin: 2.5rem 0 1rem;
}

.grid {
  display: grid;
  /* The band is wider than the old fixed 1100px column, so a 260px minimum
     would now open up four tracks and strand the remaining cards in a short
     row. A larger minimum keeps the cards substantial and lets them fill the
     row they're on. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: 1.5rem;
}

.card {
  position: relative;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px var(--shadow);
}

.card h3 { font-size: 1.15rem; margin-bottom: 0.9rem; }

.card p {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.card-link {
  display: inline-block;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* draft / TODO content slots */
.card-draft {
  background: transparent;
  border-style: dashed;
}

.card-badge {
  display: inline-block;
  margin-bottom: 1rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

.card-badge.badge-status {
  color: var(--accent);
  border-color: var(--accent);
}

.card-field {
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
  color: var(--text-dim);
}

.card-field .field-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  opacity: 0.7;
  margin-bottom: 0.2rem;
}

/* Featured project card */
.card-featured {
  grid-column: 1 / -1;
  padding: 0;
  overflow: hidden;
}

.card-shot-link { display: block; }

.card-shot {
  display: block;
  width: 100%;
  height: auto;
  border-bottom: 1px solid var(--border);
}

.card-featured .card-body {
  padding: 1.75rem 2rem 2rem;
}

.card-desc { max-width: 65ch; }

.card-actions {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.card-actions .btn {
  padding: 0.65rem 1.4rem;
  font-size: 0.9rem;
}

.todo {
  font-style: italic;
  color: var(--text-dim);
  border-bottom: 1px dashed var(--border);
}

/* Lab section */
.lab-list { max-width: 72ch; }

.lab-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}

.lab-title { font-weight: 600; }
.lab-note { color: var(--text-dim); font-size: 0.95rem; }

/* Notes section */
.draft-list { max-width: 65ch; }

.draft-item {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}

.draft-tag {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.draft-title { font-weight: 500; }

/* Contact */
.contact-actions {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-top: 1.75rem;
  flex-wrap: wrap;
}

/* Trust line (Wrap Factory attribution) — a small, integrated inline
   mention rather than a large referral card. The logo keeps its own light
   "chip" background since it has light/gradient artwork that doesn't read
   cleanly on a dark theme otherwise. */
.trust-line {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 480px;
  margin-top: 1.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.45;
  transition: color 0.2s ease;
}

.trust-line:hover,
.trust-line:focus-visible {
  color: var(--accent);
}

.trust-line-logo {
  width: 36px;
  height: auto;
  flex-shrink: 0;
  border-radius: 5px;
  background: #f4f3f1;
  padding: 2px;
  border: 1px solid rgba(0,0,0,0.08);
}

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

/* ---------- Nostalgic profile details ---------- */
.site-footer .heart {
  color: var(--accent);
}

/* Credibility strip — compact trust bar directly under the hero. Intentionally
   unnumbered and tighter than a full .section so it reads as a quick trust
   signal, not a new content block. */
.credibility-strip {
  padding-block: 3rem;
  border-top: 1px solid var(--border);
}

.credibility-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.75rem;
}

.credibility-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.credibility-item p {
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.5;
}

.credibility-item strong { color: var(--text); }

.credibility-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--accent);
}

.credibility-logo-chip {
  flex-shrink: 0;
  display: block;
  width: 2.75rem;
  border-radius: 6px;
  background: #f4f3f1;
  border: 1px solid rgba(0,0,0,0.08);
  padding: 3px;
  transition: transform 0.2s ease;
}

.credibility-logo-chip:hover,
.credibility-logo-chip:focus-visible {
  transform: translateY(-2px);
}

.credibility-logo-chip img { width: 100%; height: auto; display: block; }

.credibility-materials {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
}

.credibility-materials img {
  display: block;
  height: 24px;
  width: auto;
  padding: 0.4rem 0.6rem;
  background: #f4f3f1;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 7px;
  transition: transform 0.2s ease;
}

.credibility-materials a:hover img,
.credibility-materials a:focus-visible img {
  transform: translateY(-2px);
}

/* Attribution note — clarifies which parts of the work shown are mine vs the
   shop's production team. Deliberately quiet so it reads as a disclosure, not
   a headline. */
.attribution-note {
  max-width: 68ch;
  margin: -1.25rem 0 2.25rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.55;
}

/* Featured Work — compact, visually strong cards for the three showcase builds */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.75rem;
}

.featured-card {
  display: flex;
  flex-direction: column;
}

.featured-photo {
  display: block;
  width: 100%;
  /* height: auto is required here — without it, some browsers size the
     element from the HTML width/height attributes (the image's native
     pixel dimensions) instead of the CSS aspect-ratio below, blowing the
     card out to the photo's full natural height. */
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--bg-alt);
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 0.9rem;
}

.featured-tag {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.6rem;
}

.featured-title { font-size: 1.3rem; margin-bottom: 0.5rem; }

.featured-desc {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 0.6rem;
}

.featured-meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  opacity: 0.85;
}

.featured-thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.featured-thumbs img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  background: var(--bg-alt);
  border-radius: 7px;
  border: 1px solid var(--border);
}

/* More Builds — a lean compact gallery for the rest of the portfolio, so not
   every project gets the same large full-width treatment as Featured Work. */
.builds-compact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.builds-compact-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--bg-alt);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 0.6rem;
}

.builds-compact-item h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.builds-compact-item p {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  opacity: 0.85;
}

@media (max-width: 640px) {
  .builds-compact-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* Wraps: services & process */
.services-list { max-width: 72ch; }

.service-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}

.service-title { font-weight: 600; }
.service-note { color: var(--text-dim); font-size: 0.95rem; }

.process-list {
  counter-reset: process;
  list-style: none;
  max-width: 72ch;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.process-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-left: 2.5rem;
  position: relative;
}

.process-item::before {
  counter-increment: process;
  content: counter(process);
  position: absolute;
  left: 0;
  top: 0.1rem;
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}

.process-step-title { font-weight: 600; }
.process-step-note { color: var(--text-dim); font-size: 0.95rem; }

.post-list { max-width: 65ch; }

/* Case-study pages (software projects) */
.case-photo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
}

.case-shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.case-shots .case-photo { margin-bottom: 0.5rem; }

.case-caption {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  opacity: 0.8;
}

.case-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem;
  margin: 1.75rem 0;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-wrap: anywhere;
}

.case-meta-grid .field-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  opacity: 0.7;
  margin-bottom: 0.25rem;
}

.diagram-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.75rem 0 2.5rem;
  overflow-x: auto;
}

.diagram-box svg { display: block; min-width: 640px; }

.code-block {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0 2.5rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text);
}

.code-block .cm { color: var(--text-dim); opacity: 0.75; }

.limitations-list { max-width: 72ch; }

.limitations-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}

.limitations-title { font-weight: 600; }

.limitations-note { color: var(--text-dim); font-size: 0.95rem; }

.case-actions {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 0.5rem;
}

.section-text code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
}

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

.post a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 0;
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.post a:hover {
  color: var(--accent);
  padding-left: 0.4rem;
}

.post-title { font-weight: 600; }
.post-date { color: var(--text-dim); font-size: 0.9rem; }

.site-footer {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.meta-line {
  font-family: var(--mono);
  font-size: 0.75rem;
}

/* ---------- Metadata chips ----------
   Short factual pills under a hero. Same mono pill treatment as .case-toc, but
   .case-toc is a full-width layout band with its own gutter, so reusing it here
   would double-indent inside an already-padded hero. */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
  list-style: none;
}

.chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
}

/* ---------- System panel (Midnight-PC hero) ----------
   A depiction of the machine's layers, not a live readout — every value is
   static markup. It sits in the hero's .hero-media slot so it inherits the
   split hero's existing stacking behaviour on narrow screens for free. */
.sys-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-alt);
  padding: 1.1rem 1.25rem 1.25rem;
  font-family: var(--mono);
}

.sys-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.85rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

/* One quiet heartbeat rather than five competing ones. Reuses the avatar's
   existing keyframe, so it is already covered by the reduced-motion block. */
.sys-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--online);
  animation: onlinePulse 3s ease-in-out infinite;
}

.sys-rows { display: flex; flex-direction: column; gap: 0.55rem; }

.sys-row {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  font-size: 0.78rem;
}

.sys-row dt {
  flex: 0 0 4.6rem;
  color: var(--text-dim);
  opacity: 0.75;
}

.sys-row dd { margin: 0; color: var(--text); }

/* ---------- Inline flow diagram ----------
   Built from HTML rather than SVG so it reflows instead of scaling: on a phone
   the columns stack and the arrows rotate, which keeps the labels at full size.
   An SVG here would have shrunk the text to about 6px. */
.flow {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: var(--content-max);
  margin: 1.75rem 0 0;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.flow-col {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1 1 12rem;
}

.flow-node {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.7rem 0.9rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
}

.flow-node small {
  font-size: 0.68rem;
  color: var(--text-dim);
  opacity: 0.7;
}

.flow-node-accent { border-color: var(--accent); }

.flow-arrow {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  opacity: 0.5;
}

@media (max-width: 720px) {
  .flow { flex-direction: column; align-items: stretch; }
  .flow-arrow { transform: rotate(90deg); }
  /* Once stacked, the flex-basis that balances the columns side by side would
     instead stretch a one-node column to match a two-node one, leaving a large
     gap around it. Size to content in this direction. */
  .flow-col { flex: 0 0 auto; }
}

/* ---------- Lightbox ---------- */
.lightbox-trigger {
  cursor: zoom-in;
  transition: opacity 0.2s ease;
}

.lightbox-trigger:hover, .lightbox-trigger:focus-visible {
  opacity: 0.88;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1.5rem;
  background: rgba(6, 5, 5, 0.92);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.lightbox-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

/* Wrapper around the image + caption/counter. It has no background of its
   own — the dark backdrop shows straight through — and is only as big as
   its content, so it doesn't intercept clicks meant for the true backdrop
   beyond a small margin around the image (handled in script.js). */
.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  max-width: 100%;
  max-height: 100%;
}

.lightbox-overlay img {
  display: block;
  max-width: 100%;
  /* Generous cap that still leaves room for the caption/counter bar below
     without needing to know its exact height in advance. Standalone mode
     (no caption bar) gets a taller cap right below. */
  max-height: min(70vh, calc(100vh - 12rem));
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-overlay:not(.gallery-mode) img {
  max-height: calc(100vh - 7rem);
}

.lightbox-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  text-align: center;
  max-width: 60ch;
  padding: 0 1rem;
}

.lightbox-counter {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: rgba(243, 236, 231, 0.6);
}

.lightbox-caption {
  font-size: 0.92rem;
  line-height: 1.45;
  color: #f3ece7;
}

/* My role on the project, on its own quieter line under the caption. */
.lightbox-role {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: rgba(243, 236, 231, 0.55);
}

.lightbox-role[hidden] { display: none; }

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #f3ece7;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-nav:hover, .lightbox-nav:focus-visible {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox-prev { left: 1.25rem; }
.lightbox-next { right: 1.25rem; }

.lightbox-prev:hover, .lightbox-prev:focus-visible { transform: translateY(-50%) translateX(-2px); }
.lightbox-next:hover, .lightbox-next:focus-visible { transform: translateY(-50%) translateX(2px); }

/* [hidden] would otherwise lose to these same-specificity display rules
   under normal cascade order, since author styles beat the UA stylesheet
   regardless — so hiding has to be spelled out explicitly. */
.lightbox-nav[hidden],
.lightbox-meta[hidden] {
  display: none;
}

.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #f3ece7;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover, .lightbox-close:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}

@media (max-width: 640px) {
  .lightbox-overlay { padding: 4.5rem 1rem 1.5rem; }
  .lightbox-overlay img { max-height: min(58vh, calc(100vh - 11rem)); }
  .lightbox-overlay:not(.gallery-mode) img { max-height: calc(100vh - 6rem); }
  .lightbox-close { top: 1rem; right: 1rem; width: 2.25rem; height: 2.25rem; }
  .lightbox-nav { width: 2.25rem; height: 2.25rem; }
  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
  .lightbox-caption { font-size: 0.85rem; }
}

/* ---------- Desktop nav breakpoint ----------
   At >=900px the inline links replace the hamburger. The nav overlay markup
   stays in the DOM (and keeps its Home entry) so nothing breaks if the window
   is resized back down. */
@media (min-width: 900px) {
  .desktop-nav { display: flex; }
  .hamburger { display: none; }
  /* The toggle can take the hamburger's old spot now that it's hidden. */
  .theme-toggle { right: 2rem; }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .site-header { padding: 1.25rem 1.25rem; }
  .theme-toggle { right: 4.5rem; top: 1.4rem; }
  .hamburger { right: 1.25rem; top: 1.3rem; }
  .section { padding-block: 5rem; }
  .hero-actions, .contact-actions { gap: 1.1rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
