/* Web fonts — subsetted + woff2, served from /fonts */
@font-face {
  font-family: "Grotesk";
  src: url("/fonts/Grotesk-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Grotesk";
  src: url("/fonts/Grotesk-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mono";
  src: url("/fonts/Mono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Easing curves (Emil Kowalski) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --font-sans: "Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-mono: "Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --paper: #fefff5;
  --ink: #2e2c29;
  --muted: #b5ab9a;
  --rule: rgba(181, 171, 154, 0.5);
  --panel-border: #2e2c29;
  --theme-chip: rgba(255, 255, 255, 0.72);
  --theme-chip-border: rgba(46, 44, 41, 0.12);
  --theme-chip-muted: #8e8678;
  --theme-thumb: #2e2c29;
  --mesh-color-1: #6065ed;
  --mesh-color-2: #cdb8f8;
  --mesh-color-3: #FEFFF1;
  --mesh-color-4: #ffac97;
  --brand-heading: #0d0d0d;
  --brand-subhead: #ffffff;
  --hover-ink: #0d0d0d;
  --hover-muted: #7a7266;
  --hover-rule: rgba(46, 44, 41, 0.18);
  --shadow-preview: rgba(0, 0, 0, 0.2);
  --monogram: #0d0d0d;
}

:root[data-theme="dark"] {
  --paper: #12110f;
  --ink: #f5f1e8;
  --muted: #b8b0a2;
  --rule: rgba(245, 241, 232, 0.2);
  --panel-border: rgba(245, 241, 232, 0.52);
  --theme-chip: rgba(18, 17, 15, 0.68);
  --theme-chip-border: rgba(245, 241, 232, 0.16);
  --theme-chip-muted: #9e9688;
  --theme-thumb: #f5f1e8;
  --mesh-color-1: #0d0d0d;
  --mesh-color-2: #2e2c29;
  --mesh-color-3: #8e60ed;
  --mesh-color-4: #6065ED;
  --brand-heading: #f5f1e8;
  --brand-subhead: #b8b0a2;
  --hover-ink: #f5f1e8;
  --hover-muted: #d4cec4;
  --hover-rule: rgba(245, 241, 232, 0.25);
  --shadow-preview: rgba(0, 0, 0, 0.45);
  --monogram: #f5f1e8;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body,
a,
p,
h1,
h2,
button {
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 400;
}

a,
button {
  color: inherit;
}

/* Skip link */

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  border-radius: 0 0 0.25rem 0.25rem;
  font-size: 0.85rem;
}

.skip-link:focus {
  top: 0;
}

/* Layout */

.portfolio-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.brand-panel,
.content-panel {
  min-height: 100vh;
}

.brand-panel {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand-panel > * {
  position: relative;
  z-index: 1;
}

.gradient-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  --gradient-color-1: var(--mesh-color-1);
  --gradient-color-2: var(--mesh-color-2);
  --gradient-color-3: var(--mesh-color-3);
  --gradient-color-4: var(--mesh-color-4);
}

/* Work view: swap gradient palette to the cool blue/violet scheme */
:root[data-view="work"] {
  --mesh-color-1: #5A6EF0;
  --mesh-color-2: #8EA1FF;
  --mesh-color-3: #C5D3F6;
  --mesh-color-4: #CDB8F8;
}

:root[data-view="work"][data-theme="dark"] {
  --mesh-color-1: #2b3a8f;
  --mesh-color-2: #5A6EF0;
  --mesh-color-3: #8EA1FF;
  --mesh-color-4: #CDB8F8;
}

:root[data-gradient="off"] .gradient-canvas {
  opacity: 0;
}

/* Gradient off: recolor the secondary text below the name */
:root[data-gradient="off"] .brand-lockup__home p {
  color: #B5AB9A;
}

/* Brand lockup */

.brand-lockup {
  position: relative;
  text-transform: uppercase;
  min-height: 9.5rem;
  overflow: hidden;
}

.brand-lockup__home,
.brand-lockup__work {
  position: absolute;
  inset: 0;
  width: 100%;
}

/* Reverse (work → home): "Diego" fades in after slide+collapse finishes */
.brand-lockup__home {
  transition:
    opacity 350ms var(--ease-out) 450ms,
    transform 350ms var(--ease-out) 450ms;
}

/* Reverse (work → home): "Work" fades out immediately */
.brand-lockup__work {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 180ms var(--ease-out),
    transform 200ms var(--ease-out);
}

.brand-lockup h1,
.brand-lockup p,
.brand-lockup__title {
  margin: 0;
  font-size: clamp(2rem, 2.35vw, 2.75rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
  font-weight: 400;
  color: var(--brand-heading);
}

.brand-lockup p {
  color: var(--brand-subhead);
}

.brand-lockup__title {
  display: block;
  font-size: clamp(3rem, 4.5vw, 5rem);
}

/* Forward (home → work): "Diego" exits up */
:root[data-view="work"] .brand-lockup__home {
  opacity: 0;
  transform: translateY(-16px);
  pointer-events: none;
  transition:
    opacity 200ms var(--ease-out),
    transform 250ms var(--ease-out);
}

/* Forward (home → work): "Work" enters from below after Diego exits */
:root[data-view="work"] .brand-lockup__work {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 350ms var(--ease-out) 180ms,
    transform 350ms var(--ease-out) 180ms;
}

/* Project previews */

.project-preview {
  position: absolute;
  inset: clamp(9.6rem, 19vh, 12rem) 1.5rem 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  transition:
    opacity 200ms var(--ease-out),
    transform 250ms var(--ease-out);
  pointer-events: none;
}

.project-preview img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 52rem);
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 28px 45px var(--shadow-preview));
}

.project-preview--zillow img {
  max-width: min(100%, 58rem);
}

@media (max-height: 760px) {
  .project-preview {
    inset: 8.4rem 1.25rem 3rem;
  }

  .project-preview img {
    max-width: min(100%, 46rem);
  }

  .project-preview--zillow img {
    max-width: min(100%, 50rem);
  }
}

@media (max-height: 620px) {
  .project-preview {
    inset: 7.5rem 1rem 2rem;
  }

  .project-preview img {
    max-width: min(100%, 40rem);
  }

  .project-preview--zillow img {
    max-width: min(100%, 44rem);
  }
}

/* Preview on hover — CSS :has() with JS fallback class */

.portfolio-shell:has(.project-row--mozper:hover) .project-preview--mozper,
.portfolio-shell:has(.project-row--mozper:focus-visible) .project-preview--mozper,
.portfolio-shell:has(.bio-link[data-case="mozper"]:hover) .project-preview--mozper,
.portfolio-shell:has(.bio-link[data-case="mozper"]:focus-visible) .project-preview--mozper,
.portfolio-shell.preview-mozper .project-preview--mozper {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.portfolio-shell:has(.project-row--zillow:hover) .project-preview--zillow,
.portfolio-shell:has(.project-row--zillow:focus-visible) .project-preview--zillow,
.portfolio-shell:has(.bio-link[data-case="zillow"]:hover) .project-preview--zillow,
.portfolio-shell:has(.bio-link[data-case="zillow"]:focus-visible) .project-preview--zillow,
.portfolio-shell.preview-zillow .project-preview--zillow {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.portfolio-shell:has(.project-row--conekta:hover) .project-preview--conekta,
.portfolio-shell:has(.project-row--conekta:focus-visible) .project-preview--conekta,
.portfolio-shell.preview-conekta .project-preview--conekta {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.portfolio-shell:has(.project-row--cypress:hover) .project-preview--cypress,
.portfolio-shell:has(.project-row--cypress:focus-visible) .project-preview--cypress,
.portfolio-shell.preview-cypress .project-preview--cypress {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.portfolio-shell:has(.project-row--reborn:hover) .project-preview--reborn,
.portfolio-shell:has(.project-row--reborn:focus-visible) .project-preview--reborn,
.portfolio-shell.preview-reborn .project-preview--reborn {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Case study view — brand panel */

.brand-lockup__case {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 180ms var(--ease-out),
    transform 200ms var(--ease-out);
}

:root[data-view="case"] .brand-lockup__home {
  opacity: 0;
  transform: translateY(-16px);
  pointer-events: none;
  transition:
    opacity 200ms var(--ease-out),
    transform 250ms var(--ease-out);
}

:root[data-view="case"] .brand-lockup__work {
  opacity: 0;
  transform: translateY(-16px);
  pointer-events: none;
  transition:
    opacity 200ms var(--ease-out),
    transform 250ms var(--ease-out);
}

:root[data-view="case"] .brand-lockup__case {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 350ms var(--ease-out) 180ms,
    transform 350ms var(--ease-out) 180ms;
}

:root[data-view="case"] .gradient-canvas {
  opacity: 0;
  transition: opacity 400ms var(--ease-out);
}

.gradient-canvas {
  transition: opacity 400ms var(--ease-out);
}

/* Case study — cool color overrides (light) */

:root[data-view="case"] {
  --paper: #ffffff;
  --ink: #1a1a1a;
  --muted: #8b8d94;
  --rule: rgba(0, 0, 0, 0.1);
  --panel-border: #1a1a1a;
  --monogram: #1a1a1a;
  --hover-ink: #000000;
  --hover-muted: #6b6d74;
  --hover-rule: rgba(0, 0, 0, 0.18);
  --brand-heading: #1a1a1a;
}

:root[data-view="case"][data-theme="dark"] {
  --paper: #111113;
  --ink: #e8e8ec;
  --muted: #8b8d94;
  --rule: rgba(255, 255, 255, 0.12);
  --panel-border: rgba(232, 232, 236, 0.52);
  --monogram: #e8e8ec;
  --hover-ink: #ffffff;
  --hover-muted: #a8aab0;
  --hover-rule: rgba(255, 255, 255, 0.2);
  --brand-heading: #e8e8ec;
  --theme-chip-muted: #8b8d94;
  --theme-thumb: #e8e8ec;
  --theme-chip-border: rgba(232, 232, 236, 0.16);
}

:root[data-view="case"] body {
  background: var(--paper);
}

:root[data-view="case"] .brand-panel {
  background: var(--paper);
}

:root[data-view="case"] .content-panel {
  background: var(--paper);
}

:root[data-view="case"] .brand-lockup__case .brand-lockup__title {
  font-size: 2rem;
}

:root[data-view="case"] .brand-panel > .monogram {
  display: none;
}

:root[data-view="case"] .portfolio-shell {
  min-height: 50vh;
  height: 50vh;
}

:root[data-view="case"] .brand-panel,
:root[data-view="case"] .content-panel {
  min-height: 50vh;
  height: 50vh;
}

/* Case study view — content panel */

.case-description {
  display: none;
  max-width: 41.375rem;
  padding-bottom: 1rem;
}

:root[data-view="case"] .case-description[data-case-active] {
  display: block;
}

:root[data-view="case"] .bio-section {
  display: none;
}

:root[data-view="case"] .projects-stage {
  display: none;
}

:root[data-view="case"] .content-body {
  transform: none !important;
  padding-top: 0 !important;
  justify-content: flex-end;
  min-height: 0;
  flex: 1;
}

:root[data-view="case"] .content-clip {
  display: flex;
  flex-direction: column;
}

/* Case study gallery */

.case-gallery {
  display: none;
}

:root[data-view="case"] .case-gallery {
  display: block;
}

.case-gallery__set {
  display: none;
}

.case-gallery__set[data-case-active] {
  display: flex;
  flex-direction: column;
  background: #F1F2F6;
  padding: 5.2rem;
  gap: 5.2rem;
}

@media (min-width: 981px) {
  .case-gallery__set[data-case-active] {
    padding: 6.76rem 13.182rem;
    gap: 6.76rem;
  }
}

:root[data-theme="dark"] .case-gallery__set[data-case-active] {
  background: #1e1e22;
}

.case-gallery__set img {
  display: block;
  width: 100%;
  max-width: 1500px;
  height: auto;
  margin-inline: auto;
}

/* Monogram */

.monogram {
  width: 2rem;
  height: 2rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--monogram);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}

.monogram:hover {
  transform: scale(1.08);
}

.monogram:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 2px;
}

.monogram svg {
  display: block;
  width: 100%;
  height: 100%;
}


/* Content panel */

.content-panel {
  border-left: 1px solid var(--panel-border);
  padding: 1.5rem 3rem 0 2rem;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.content-clip {
  flex: 1;
  overflow: clip;
  min-height: 0;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

/* Header monogram — hidden on desktop, shown on mobile */

.header-monogram {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}

.header-monogram svg {
  display: block;
}

/* Mobile menu toggle — hidden on desktop */

.menu-toggle {
  display: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0.25rem;
  cursor: pointer;
  line-height: 0;
}

.menu-toggle__icon--close {
  display: none;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__icon--open {
  display: none;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__icon--close {
  display: block;
}

.site-header nav {
  display: flex;
  gap: 2.95rem;
}

.site-header a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.5rem 0;
  transition: color 200ms var(--ease-out);
}

.site-header a.is-active,
.nav-link.is-active {
  color: var(--ink);
}

/* Nav links */

.nav-link {
  border: 0;
  background: transparent;
  padding: 0.5rem 0;
  text-decoration: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  transition: color 200ms var(--ease-out), transform 120ms var(--ease-out);
}

.nav-link:hover:not(:disabled),
.nav-link:focus-visible:not(:disabled) {
  color: var(--ink);
}

.site-header a:hover,
.site-header a:focus-visible {
  color: var(--ink);
}

.nav-link:active:not(:disabled) {
  transform: scale(0.97);
}

.nav-link--tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.nav-link--disabled {
  cursor: default;
}

.nav-link--disabled:hover {
  color: var(--rule);
  transition: color 200ms var(--ease-out);
}

.nav-tooltip {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 0px) scale(0.96);
  transform-origin: center top;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.74rem;
  line-height: 1;
  transition:
    transform 100ms var(--ease-out),
    opacity 100ms var(--ease-out),
    visibility 0ms linear 100ms;
}

@media (hover: hover) and (pointer: fine) {
  .nav-link--tooltip:hover .nav-tooltip,
  .nav-link--tooltip:focus .nav-tooltip,
  .nav-link--tooltip:focus-within .nav-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translate(-50%, 6px) scale(1);
    transition:
      transform 150ms var(--ease-out),
      opacity 150ms var(--ease-out),
      visibility 0ms linear 0ms;
  }
}

/* Touch: tap-activated tooltips */
.nav-tooltip.is-visible {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 6px) scale(1);
  transition:
    transform 150ms var(--ease-out),
    opacity 150ms var(--ease-out),
    visibility 0ms linear 0ms;
}

/* Theme toggle */

.theme-toggle {
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  padding: 0.5rem 0;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font: inherit;
  gap: 0;
}

.theme-toggle__label {
  display: none;
}

.theme-toggle__track {
  width: 2rem;
  height: 1.1rem;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--muted);
  padding: 0.15rem;
  display: inline-flex;
  align-items: center;
  transition: border-color 200ms var(--ease-out);
}

.theme-toggle:hover .theme-toggle__track {
  border-color: var(--ink);
}

.theme-toggle__thumb {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: var(--ink);
  transform: translateX(0);
  transition:
    transform 280ms var(--ease-out),
    background-color 180ms ease;
}

.theme-toggle[aria-pressed="true"] .theme-toggle__thumb {
  transform: translateX(0.75rem);
}

/* Content body — the "sheet" that slides */

.content-body {
  display: flex;
  flex-direction: column;
  gap: clamp(2.25rem, 6vh, 3.75rem);
  padding-top: var(--sheet-pad, 0);
  transition: transform 500ms var(--ease-in-out);
}

.bio-section {
  max-width: 41.375rem;
  transition: opacity 350ms var(--ease-out);
}

:root[data-view="work"] .bio-section {
  opacity: 0;
  pointer-events: none;
}

.bio-section p {
  margin: 0;
}

.bio-section p + p {
  margin-top: 1rem;
}

.bio-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  transition: text-decoration-color 160ms var(--ease-out);
}

.bio-link:hover,
.bio-link:focus-visible {
  text-decoration-color: currentColor;
}

/* Projects */

.projects-stage {
  width: 100%;
  padding-right: 0.5rem;
}

.projects-block--all {
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms var(--ease-out);
}

:root[data-view="work"] .projects-block--all {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 350ms var(--ease-out) 200ms;
}

/* Work state: sheet slides up */
:root[data-view="work"] .content-body {
  transform: translateY(var(--sheet-offset, 0));
}

.section-label {
  margin: 0 0 0.95rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.section-label--work {
  display: none;
}

:root[data-view="work"] .section-label--home {
  display: none;
}

:root[data-view="work"] .section-label--work {
  display: block;
}

.projects-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.projects-heading .section-label {
  margin-bottom: 0.95rem;
}


.projects-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.5rem;
  margin: 0 0 0.95rem;
  cursor: pointer;
  line-height: 0;
  transition: opacity 150ms var(--ease-out);
}

.projects-close svg {
  display: block;
  width: 1rem;
  height: 1rem;
}

:root[data-view="work"] .projects-close {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 250ms var(--ease-out) 200ms;
}

/* Project table & rows */

.projects-table {
  border-top: 1px solid var(--rule);
  list-style: none;
  margin: 0;
  padding: 0;
}

.project-row {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr) 2.5rem 1rem;
  gap: 1rem;
  align-items: start;
  padding: 1.05rem 0 0.95rem;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  overflow: visible;
  transition:
    transform 160ms var(--ease-out),
    border-color 160ms var(--ease-out);
}

.projects-table li:last-child .project-row {
  border-bottom: 0;
}

.project-row:hover,
.project-row:focus-visible {
  border-color: var(--hover-rule);
  transform: translateX(0.35rem);
  outline: none;
}

.project-row:hover .project-name,
.project-row:focus-visible .project-name,
.project-row:hover .project-year,
.project-row:focus-visible .project-year {
  color: var(--hover-ink);
}

.project-row:hover .project-meta,
.project-row:focus-visible .project-meta {
  color: var(--hover-muted);
}

.project-row:hover .project-chevron,
.project-row:focus-visible .project-chevron {
  opacity: 1;
  transform: translateX(0);
}

.project-name,
.project-meta,
.project-year {
  margin: 0;
  font-size: 1rem;
}

.project-chevron {
  align-self: center;
  justify-self: end;
  opacity: 0;
  color: var(--ink);
  transform: translateX(-6px);
  transition:
    opacity 160ms var(--ease-out),
    transform 160ms var(--ease-out);
}

.project-chevron svg {
  display: block;
  width: 1rem;
  height: 1rem;
}

.project-meta {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-year {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

/* Empty project rows */

.project-row--empty {
  cursor: default;
  position: relative;
}

.project-row--empty:hover,
.project-row--empty:focus-visible {
  transform: none;
  border-color: var(--rule);
}

.project-row--empty:hover .project-name,
.project-row--empty:hover .project-year,
.project-row--empty:hover .project-meta {
  color: var(--muted);
}

.project-row--empty .project-chevron {
  display: none;
}

.project-tooltip {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%) scale(0.96);
  transform-origin: right center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.74rem;
  line-height: 1;
  transition:
    transform 100ms var(--ease-out),
    opacity 100ms var(--ease-out),
    visibility 0ms linear 100ms;
}

@media (hover: hover) and (pointer: fine) {
  .project-row--empty:hover .project-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateY(-50%) scale(1);
    transition:
      transform 150ms var(--ease-out),
      opacity 150ms var(--ease-out),
      visibility 0ms linear 0ms;
  }
}

/* Touch: tap-activated project tooltips */
.project-tooltip.is-visible {
  visibility: visible;
  opacity: 1;
  transform: translateY(-50%) scale(1);
  transition:
    transform 150ms var(--ease-out),
    opacity 150ms var(--ease-out),
    visibility 0ms linear 0ms;
}

/* About dialog */

.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #2e2c29;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 350ms var(--ease-out),
    visibility 0ms linear 350ms;
}

:root[data-theme="dark"] .about-overlay {
  background: #0a0908;
}

.about-overlay.is-open {
  visibility: visible;
  opacity: 1;
  transition:
    opacity 250ms var(--ease-out),
    visibility 0ms linear 0ms;
}

.about-sheet {
  position: relative;
  width: 100%;
  max-width: 42rem;
  min-height: min(44rem, calc(100vh - 4rem));
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--paper);
  overflow: hidden;
  border-radius: 1rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  transform: translateY(40px) scale(0.96);
  opacity: 0;
  transition:
    transform 350ms var(--ease-out),
    opacity 350ms var(--ease-out);
}

.about-overlay.is-open .about-sheet {
  transform: translateY(0) scale(1);
  opacity: 1;
  transition:
    transform 280ms var(--ease-out),
    opacity 200ms var(--ease-out);
}

.about-header {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10;
}

.about-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.75rem;
  cursor: pointer;
  line-height: 0;
  transition: color 200ms var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.about-close:hover {
  color: var(--ink);
}

.about-close svg {
  display: block;
}

.about-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 3rem 3rem 0;
  gap: 2rem;
  position: relative;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.5;
}

.about-content h1,
.about-content h2,
.about-content h3,
.about-content p,
.about-content a,
.about-content button,
.about-content span {
  font-family: inherit;
}

.about-monogram {
  width: 1.92rem;
  height: 1.92rem;
  color: #2E2C29;
  align-self: center;
}

.about-monogram svg path {
  fill: #2E2C29;
}

:root[data-theme="dark"] .about-monogram {
  color: #FEFFF1;
}

:root[data-theme="dark"] .about-monogram svg path {
  fill: #FEFFF1;
}

.about-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.about-name {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink);
}

.about-updated {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.about-bio {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.about-bio p {
  margin: 0;
  color: var(--ink);
}

.about-bio a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* Dark mode overrides for the About modal */
:root[data-theme="dark"] .about-name,
:root[data-theme="dark"] .about-bio p,
:root[data-theme="dark"] .about-bio a {
  color: #B5AB9A;
}

:root[data-theme="dark"] .about-updated {
  color: #68635C;
}

.about-scene {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 35%);
  width: 140%;
  max-width: none;
  height: auto;
  pointer-events: none;
  z-index: 0;
}

.about-scene--day {
  display: block;
}

.about-scene--night {
  display: none;
}

:root[data-theme="dark"] .about-scene--day {
  display: none;
}

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

/* Flying birds */

.about-birds {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
  container-type: inline-size;
}

.about-birds--day { display: block; }
:root[data-theme="dark"] .about-birds--day { display: none; }

.bird-fly {
  position: absolute;
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  animation: birdFly var(--fly-dur, 18s) linear var(--fly-delay, 0s) infinite backwards;
  top: var(--fly-y, 45%);
}

/* Wing flap keyframes (matching the SVG's built-in timing) */
.bird-fly .wing-up   { animation: birdFlapUp   0.45s steps(1) infinite; }
.bird-fly .wing-mid  { animation: birdFlapMid  0.45s steps(1) infinite; }
.bird-fly .wing-down { animation: birdFlapDown 0.45s steps(1) infinite; }
.bird-fly .bird-bob  { animation: birdBob 0.45s steps(1) infinite; }

@keyframes birdFlapUp {
  0%, 100% { opacity: 1; }
  33% { opacity: 0; }
  66% { opacity: 0; }
}
@keyframes birdFlapMid {
  0%, 100% { opacity: 0; }
  33% { opacity: 1; }
  66% { opacity: 0; }
}
@keyframes birdFlapDown {
  0%, 100% { opacity: 0; }
  33% { opacity: 0; }
  66% { opacity: 1; }
}
@keyframes birdBob {
  0%, 100% { transform: translateY(0); }
  33% { transform: translateY(-1px); }
  66% { transform: translateY(1px); }
}

/* Flight path: right to left (cqw = container query width, scoped to .about-birds) */
@keyframes birdFly {
  0% {
    transform: translateX(calc(100cqw + 40px)) translateY(0);
  }
  25% {
    transform: translateX(75cqw) translateY(-15px);
  }
  50% {
    transform: translateX(50cqw) translateY(5px);
  }
  75% {
    transform: translateX(25cqw) translateY(-10px);
  }
  100% {
    transform: translateX(-60px) translateY(0);
  }
}

/* Alternate path: left to right (flipped bird) */
@keyframes birdFlyReverse {
  0% {
    transform: translateX(-60px) scaleX(-1) translateY(0);
  }
  25% {
    transform: translateX(25cqw) scaleX(-1) translateY(10px);
  }
  50% {
    transform: translateX(50cqw) scaleX(-1) translateY(-8px);
  }
  75% {
    transform: translateX(75cqw) scaleX(-1) translateY(12px);
  }
  100% {
    transform: translateX(calc(100cqw + 40px)) scaleX(-1) translateY(0);
  }
}

/* Shooting stars (night) */

.about-stars {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
  display: none;
}

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

.shooting-star {
  position: absolute;
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  animation: starStreak 1.2s cubic-bezier(0.1, 0, 0.3, 1) forwards;
  opacity: 0;
}

@keyframes starStreak {
  0%   { transform: translate(0, 0); opacity: 0; }
  5%   { opacity: 0.7; }
  15%  { opacity: 1; }
  40%  { opacity: 0.5; }
  100% { transform: translate(-120px, 120px); opacity: 0; }
}

/* Responsive — tablet & mobile (stacked layout) */

@media (max-width: 980px) {
  /* Re-order: header on top, brand panel below, then content */
  .portfolio-shell {
    display: flex;
    flex-direction: column;
  }

  /* Break out content-panel children into the flex flow */
  .content-panel {
    display: contents;
  }

  .site-header {
    order: 1;
    padding: 1rem 1.5rem;
    background: var(--paper);
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    border-bottom: 0;
  }

  .brand-panel {
    order: 2;
    min-height: auto;
    padding: 2rem 1.5rem 6.5rem;
    justify-content: flex-start;
    gap: 0;
  }

  .content-clip {
    order: 3;
    padding: 0 1.5rem 2rem;
    background: var(--paper);
    overflow: visible;
  }

  /* Show header monogram, hide brand panel one */
  .header-monogram {
    display: flex !important;
  }

  .brand-panel .monogram {
    display: none;
  }

  .site-header nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: nowrap;
  }

  /* Hide hamburger on tablet/mobile */
  .menu-toggle {
    display: none !important;
  }

  /* Brand lockup: static positioning for stacked layout */
  .brand-lockup {
    min-height: auto;
    overflow: visible;
  }

  .brand-lockup__home,
  .brand-lockup__work {
    position: static;
  }

  .brand-lockup__work {
    display: none;
  }

  :root[data-view="work"] .brand-lockup__home {
    display: none;
  }

  :root[data-view="work"] .brand-lockup__work {
    display: block;
    opacity: 1;
    transform: none;
  }

  .project-preview {
    display: none;
  }

  /* Content body — scrollable, no sheet */
  .content-body {
    gap: 2.5rem;
    transform: none !important;
    padding-top: 1.5rem !important;
  }

  /* Bio — hide completely in work view */
  .bio-section {
    margin-top: 0;
  }

  :root[data-view="work"] .bio-section {
    display: none;
  }

  /* Hide the all-projects block on mobile in home view (no sheet slide) */
  .projects-block--all {
    display: none;
  }

  /* All-block always visible in work view */
  :root[data-view="work"] .projects-block--all {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  /* Hide close button */
  .projects-close {
    display: none;
  }

  /* Swap heading text: "Recently at" → "All work" in work view */

  .projects-stage {
    gap: 0;
  }

  /* Case study — mobile overrides */
  :root[data-view="case"] .portfolio-shell {
    height: auto;
    min-height: auto;
  }

  :root[data-view="case"] .site-header {
    background: var(--paper);
  }

  :root[data-view="case"] .brand-panel {
    min-height: auto;
    height: auto;
    padding: 2rem 1.5rem;
    background: var(--paper);
  }

  :root[data-view="case"] .content-panel {
    height: auto;
    min-height: auto;
  }

  :root[data-view="case"] .content-clip {
    padding-bottom: 0;
    background: var(--paper);
  }

  :root[data-view="case"] .content-body {
    justify-content: flex-start;
  }

  :root[data-view="case"] .case-description[data-case-active] {
    display: block;
  }

  .case-gallery__set[data-case-active] {
    padding: 1.5rem;
    gap: 1.5rem;
  }
}

/* Responsive — small mobile */

@media (max-width: 640px) {
  body,
  a,
  p,
  h1,
  h2 {
    font-size: 0.94rem;
  }

  .site-header {
    gap: 1.25rem;
  }

  .site-header nav {
    gap: 1rem;
  }

  /* Theme toggle stays visible on mobile (labels are already hidden in base styles) */

  .brand-lockup h1,
  .brand-lockup p {
    font-size: 1.5rem;
  }

  .brand-lockup__title {
    font-size: 2rem;
  }

  /* Project rows — stacked layout */
  .project-row {
    grid-template-columns: 1fr auto;
    gap: 0.25rem;
  }

  .project-name {
    grid-column: 1;
  }

  .project-year {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  .project-meta {
    grid-column: 1 / -1;
    max-width: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .project-chevron {
    display: none;
  }

  /* About dialog — tighter padding on mobile */
  .about-overlay {
    padding: 1rem;
  }

  .about-sheet {
    min-height: min(36rem, calc(100vh - 2rem));
    max-height: calc(100vh - 2rem);
  }

  .about-content {
    padding: 2rem 1.75rem 0;
    gap: 1.5rem;
  }

  .about-header {
    top: 0.75rem;
    right: 0.75rem;
  }
}

/* Accessibility: reduced motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.15s !important;
    transition-delay: 0ms !important;
  }

  .project-preview {
    transition: opacity 0.15s ease !important;
    transform: none !important;
  }

  .project-preview img {
    filter: none;
  }

  .brand-lockup__home,
  .brand-lockup__work {
    transform: none !important;
  }

  .content-body {
    transition-duration: 0.01ms !important;
  }
}
