@font-face {
  font-family: 'Apfel Grotesk';
  src: url('./ApfelGrotezk-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Apfel Grotesk';
  src: url('./ApfelGrotezk-Mittel.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Apfel Grotesk';
  src: url('./ApfelGrotezk-Satt.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Apfel Grotesk';
  src: url('./ApfelGrotezk-Fett.woff2') format('woff2');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Apfel Grotesk Brukt';
  src: url('./ApfelGrotezk-Brukt.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #6b7280; /* gray-500 */
  --accent: #111111; /* neutral accent */
  --border: #e5e5e5; /* gray-200 */
  --font-sans: "Apfel Grotesk", "Syne Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-mono: "Apfel Grotesk", "Syne Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --text: #f5f5f5;
    --muted: #9ca3af; /* gray-400 */
    --accent: #f5f5f5; /* neutral accent */
    --border: #222222;
  }
}

[data-theme="light"] {
  --bg: #ffffff;
  --text: #111111;
  --muted: #6b7280;
  --accent: #111111;
  --border: #e5e5e5;
}

[data-theme="dark"] {
  --bg: #111111;
  --text: #f5f5f5;
  --muted: #9ca3af;
  --accent: #f5f5f5;
  --border: #222222;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Apfel Grotesk", var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

@media (max-width: 640px) {
  html, body {
    height: 100vh;
    overflow: hidden;
  }

  body {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }

  body > .site-header { flex-shrink: 0; }
  body > .hero { flex-shrink: 0; }
  body > .work-sections {
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
  }
  body > .social-links {
    flex-shrink: 0;
    margin-top: auto;
    position: relative;
    bottom: auto;
    right: auto;
  }
}

@media (min-width: 641px) {
  html, body {
    height: 100vh;
    overflow: hidden;
  }

  body {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }

  body > .site-header { flex-shrink: 0; }
  body > .hero { flex-shrink: 0; }
  body > .work-sections {
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
  }
  body > .social-links {
    flex-shrink: 0;
    margin-top: auto;
    position: relative;
    bottom: auto;
    right: auto;
  }
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.5s ease-out;
  pointer-events: auto;
  visibility: visible;
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Ensure skip button is always clickable */
.skip-loading {
  pointer-events: auto !important;
}

/* Skip Loading Button */
.skip-loading {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: none;
  border: none;
  color: rgba(0, 0, 0, 0.4);
  font-family: "Apfel Grotesk", var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.5px;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.2s ease;
  z-index: 1002;
  pointer-events: auto;
  user-select: none;
}

.skip-loading:hover {
  color: rgba(0, 0, 0, 0.6);
}

/* Dark mode visibility */
[data-theme="dark"] .skip-loading {
  color: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .skip-loading:hover {
  color: rgba(255, 255, 255, 0.6);
}

.loading-header {
  position: sticky;
  top: 0;
  backdrop-filter: saturate(160%) blur(8px);
  background-color: color-mix(in oklab, var(--bg) 85%, transparent);
  z-index: 10;
  padding-block: 5px;
  font-size: clamp(12px, 1.2vw, 16px);
  font-family: "Apfel Grotesk", var(--font-mono);
  font-weight: 100;
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

.loading-header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-inline: 30px;
}

.loading-header-left {
  display: flex;
  align-items: center;
  font-family: "Apfel Grotesk", var(--font-mono);
  gap: 0.75rem;
  justify-self: start;
}

.loading-header-center {
  display: flex;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  font-family: "Apfel Grotesk", var(--font-mono);
  justify-self: center;
}

.loading-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-self: end;
  font-family: "Apfel Grotesk", var(--font-mono);
}

.loading-name {
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text);
  font-family: "Apfel Grotesk", var(--font-mono);
  font-weight: 400;
}

.loading-title {
  font-family: "Apfel Grotesk", var(--font-mono);
  font-weight: 400;
  letter-spacing: 0.5px;
  color: var(--text);
}

.loading-percentage {
  font-family: "Apfel Grotesk", var(--font-mono);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Animation for name moving to header - handled by JavaScript */
.loading-name.move-to-header {
  /* Styles will be applied dynamically by JavaScript */
  position: fixed;
  z-index: 1001;
}

/* Keep loading name visible in header position */
body.loaded .loading-name.move-to-header {
  opacity: 1;
  pointer-events: auto;
  transition: none; /* Remove transition when in final position */
}

.loading-title,
.loading-percentage {
  transition: opacity 0.2s ease-out;
}

/* Hide main content during loading */
body.loading .site-header,
body.loading .hero,
body.loading .about-page {
  opacity: 0;
  transform: translate(0, 0);
  transition: opacity 0.5s ease-out;
}

/* Header and hero appear at the same time */
body.loaded .site-header,
body.loaded .hero,
body.loaded .about-page {
  opacity: 1;
  transform: translate(0, 0);
  transition: opacity 0.5s ease-out;
}

/* Mobile responsiveness for loading screen */
@media (max-width: 640px) {
  .loading-header-inner {
    padding-inline: 10px;
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
  }
  
  .loading-header-center {
    display: none;
  }
  
  .loading-header-left {
    justify-self: start;
  }
  
  .loading-header-right {
    justify-self: end;
    flex-wrap: nowrap;
    white-space: nowrap;
  }
  
  .loading-name.move-to-header {
    left: 20px;
    font-size: clamp(12px, 1.2vw, 16px);
  }
  
  .skip-loading {
    bottom: 15px;
    right: 15px;
    font-size: 11px;
  }
}

.container {
  /* max-width: 1100px; */
  width: 100%;
  /* margin-inline: auto; */
  padding-inline: 30px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  backdrop-filter: saturate(160%) blur(8px);
  background-color: transparent;
  /* border-bottom: 1px solid var(--border); */
  z-index: 10;
  padding-block: 5px; /* hug contents with small breathing room */
  font-size: clamp(12px, 1.2vw, 16px); /* variable header text size, max 16px */
  font-family: "Apfel Grotesk", var(--font-mono);
  font-weight: 100; /* regular weight only in header */
  width: 100vw; /* full-bleed header */
  margin-left: calc(50% - 50vw); /* prevent horizontal scroll from 100vw */
}
.header-inner { display: grid; 
  grid-template-columns: 1fr auto 1fr; 
  align-items: center; 
  /* no fixed height; let content dictate */
}
.header-inner-left { 
  display: flex; 
  align-items: center; 
  font-family: "Apfel Grotesk", var(--font-mono); 
  gap: 0.75rem; 
  justify-self: start; 
}
.header-inner-center { 
  display: flex; 
  justify-content: center; 
  font-variant-numeric: tabular-nums; 
  font-family: "Apfel Grotesk", var(--font-mono); 
  justify-self: center; 
}
.header-inner-right{ 
  display: flex; 
  align-items: center;
  gap: 0.75rem; /* even spacing between music, garden, toggle */
  justify-self: end;
  font-family: "Apfel Grotesk", var(--font-mono);  }
.brand {
  font-weight: 700; 
  letter-spacing: 0.2px;
  color: var(--text);
  text-decoration: none;
  font-family: "Apfel Grotesk", var(--font-sans); 
}
.site-header .brand { font-family: "Apfel Grotesk", var(--font-mono); font-weight: 400; }
.theme-toggle { 
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  /* padding: 0rem 0.75rem; */
  /* border: 1px solid var(--border); */
  /* border-radius: 999px; */
  background: none;
  color: var(--text);
  cursor: pointer;
}
.theme-toggle:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* Hero */
.hero { min-height: auto; display: block; }
.hero:focus { outline: none; }

/* About page */
.about-page { min-height: auto; display: block; padding-block: 1vh; }
.about-inner {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  font-family: "Apfel Grotesk", var(--font-sans);
  color: var(--text);
}

.about-inner .hero-subtitle {
  opacity: 1;
  transform: none;
  animation: none;
}

.about-inner .hero-learn-more {
  opacity: 1;
  transform: none;
  animation: none;
}

.hero-inner {
  padding-block: 1vh;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  font-family: "Apfel Grotesk", var(--font-sans);
  color: var(--text);
}
.hero-subtitle { 
  grid-column: 1 / span 4; /* 4/12 on web */
  color: var(--text); 
  font-weight: 200; 
  font-size: clamp(12px, 1.3vw, 18px); 
  /* margin: 0 0 1.5rem 0;  */
  line-height: 1.6;
  cursor: default;
  word-wrap: break-word;
  hyphens: none;
  text-align: left;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s ease-out forwards;
}

.hero-subtitle {
  animation-delay: 0.2s;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-subtitle + .hero-subtitle {
  margin-top: -0.5rem; /* Reduce spacing between paragraphs */
}

.hero-line {
  display: block;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
              transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: opacity, transform;
}

.hero-line.animate {
  opacity: 1;
  transform: translateY(0);
}

.hero-word {
  display: inline;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
              transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: opacity, transform;
}

.clickable-open,
.clickable-open:visited,
.clickable-open:hover,
.clickable-open:active {
  text-decoration: underline;
  color: inherit;
  text-decoration-color: currentColor;
}

.hero-read-more {
  font-size: clamp(10px, 1.1vw, 14px);
  color: var(--muted);
  font-weight: 300;
  cursor: pointer;
  transition: color 0.2s ease;
  margin-top: 0;
  animation-delay: 0.7s;
  position: relative;
}

.plus-sign {
  color: var(--muted);
  transition: color 0.2s ease;
}

.read-more-text {
  text-decoration: underline;
  transition: color 0.2s ease;
}

.hero-read-more:hover .plus-sign,
.hero-read-more:hover .read-more-text {
  color: var(--text);
}

.hero-learn-more {
  display: inline-block;
  grid-column: 1 / span 4;
  margin-top: calc(-1rem + 0.1rem); /* Pull up past grid gap, leave 0.1rem */
  font-size: clamp(10px, 1vw, 12px);
  font-family: "Apfel Grotesk", var(--font-mono);
  color: #2563eb;
  text-decoration: underline;
  text-decoration-color: #2563eb;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s ease-out 0.6s forwards;
}

.hero-learn-more:hover {
  color: #1d4ed8;
  text-decoration-color: #1d4ed8;
}

.hero-learn-more:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Social Links: fixed bottom right */
.social-links {
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 30px 1.25rem 0;
  opacity: 0;
  animation: fadeInUp 0.8s ease-out forwards;
  animation-delay: 1.0s;
  justify-content: flex-end;
  align-items: center;
}

@media (max-width: 640px) {
  .social-links {
    padding-right: 10px;
    padding-bottom: 1rem;
  }
}

.social-link {
  color: var(--muted);
  text-decoration: none;
  font-size: clamp(10px, 1vw, 12px);
  font-weight: 300;
  transition: color 0.2s ease;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: "Apfel Grotesk", var(--font-mono);
}

.social-link:hover {
  color: var(--text);
}
.btn { display: inline-block; text-decoration: none; padding: 0.75rem 1rem; border-radius: 0.75rem; border: 1px solid var(--border); }
.btn.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn.secondary { color: var(--text); }
.btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* Work sections: titles on top, panels reveal on click */
.work-sections {
  position: relative;
  z-index: 1;
  padding-block: clamp(3rem, 8vh, 6rem);
  padding-inline: 30px;
}

@media (min-width: 641px) {
  .work-sections {
    padding-block: clamp(2rem, 5vh, 4rem);
  }
}

.work-section-headers {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  margin-bottom: 0;
}

.work-section-trigger {
  font-family: "Apfel Grotesk", var(--font-mono);
  font-weight: 400;
  font-size: clamp(11px, 1.2vw, 14px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.work-section-trigger:hover {
  color: var(--text);
}

.work-section-trigger.is-active {
  color: var(--text);
}

.work-section-trigger:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}

.work-panels {
  position: relative;
  width: 100%;
  margin-top: 0.5rem;
}

.work-panel {
  display: none;
  width: 100%;
  padding-inline: 0;
}

.work-panel.is-visible {
  display: block;
  animation: workPanelIn 0.25s ease-out;
}

@keyframes workPanelIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.work-section-rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 1.5rem 0;
}

/* Horizontal project slider */
.work-slider {
  display: flex;
  align-items: stretch;
  position: relative;
}

.work-slider-track {
  display: flex;
  gap: 2.5rem;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-width: 0;
  padding-block: 1rem;
  padding-inline: 0.25rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.work-slider-track::-webkit-scrollbar {
  display: none;
}

.work-slider-btn {
  position: absolute;
  top: calc(1rem + (min(320px, 85vw) * 3 / 8));
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: color-mix(in oklab, var(--bg) 92%, var(--text) 8%);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
  z-index: 2;
  flex-shrink: 0;
}

.work-slider-prev {
  left: 0;
}

.work-slider-next {
  right: 0;
}

.work-slider-btn:hover {
  background: color-mix(in oklab, var(--bg) 85%, var(--border) 15%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.work-slider-btn.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.work-slider-btn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.work-item {
  flex: 0 0 auto;
  width: min(320px, 85vw);
  max-width: 320px;
  scroll-snap-align: start;
  margin-bottom: 0;
  overflow: visible;
}

.work-slider-track .work-item:hover {
  z-index: 1;
}

.work-item-image {
  aspect-ratio: 4 / 3;
  width: 100%;
  background: var(--border);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  transition: transform 0.3s ease;
  transform-origin: center center;
}

.work-item:hover .work-item-image {
  transform: scale(1.05);
}

.work-item-title,
.work-item-desc {
  transition: transform 0.3s ease;
  transform-origin: left center;
}

.work-item:hover .work-item-title,
.work-item:hover .work-item-desc {
  transform: scale(1.03);
}

/* Visual experiments: auto-looping image slider, no buttons, no scrollbar */
.visual-experiments-slider .work-slider-track {
  align-items: flex-start;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.visual-experiments-slider .work-slider-track::-webkit-scrollbar {
  display: none;
}

.visual-slide {
  flex: 0 0 auto;
  width: min(260px, 70vw);
  max-width: 260px;
  scroll-snap-align: start;
  background: var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.visual-slide--1x1 {
  aspect-ratio: 1 / 1;
}

.visual-slide--3x4 {
  aspect-ratio: 3 / 4;
}

.visual-slide--4x3 {
  aspect-ratio: 4 / 3;
}

.visual-slide--9x16 {
  aspect-ratio: 9 / 16;
}

.work-item:last-child {
  margin-bottom: 0;
}

.work-item-title {
  font-family: "Apfel Grotesk", var(--font-sans);
  font-weight: 400;
  font-size: clamp(14px, 1.5vw, 18px);
  color: var(--text);
  margin: 0 0 0;
  line-height: 1.35;
}

.work-item-desc {
  font-family: "Apfel Grotesk", var(--font-sans);
  font-weight: 300;
  font-size: clamp(12px, 1.2vw, 14px);
  color: var(--text);
  line-height: 1.6;
  margin: 0 0 0.5rem 0;
}

.work-item-link,
.work-item-link:visited {
  font-family: "Apfel Grotesk", var(--font-mono);
  font-size: clamp(10px, 1vw, 12px);
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--muted);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.work-item-link:hover,
.work-item-link:focus-visible {
  color: var(--text);
  text-decoration-color: var(--text);
}

.work-item-coming-soon {
  display: inline-block;
  font-family: "Apfel Grotesk", var(--font-mono);
  font-size: clamp(10px, 1vw, 11px);
  color: var(--text);
  padding: 0.2rem 0.5rem;
  background: color-mix(in oklab, var(--bg) 80%, var(--border) 20%);
  border-radius: 4px;
}

/* Writing panel: horizontal list with arrow and tags at right */
.writing-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.writing-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.6rem 0.5rem;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.writing-item:hover {
  background-color: color-mix(in oklab, var(--bg) 70%, var(--border) 30%);
}

[data-theme="dark"] .writing-item:hover {
  background-color: color-mix(in oklab, var(--bg) 60%, var(--text) 40%);
}

.writing-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.writing-link {
  font-family: "Apfel Grotesk", var(--font-sans);
  font-weight: 400;
  font-size: clamp(14px, 1.4vw, 17px);
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease;
  flex: 1;
  min-width: 0;
}

.writing-item:hover .writing-link {
  color: var(--text);
}

.writing-link:hover {
  color: var(--text);
}

.writing-link:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.writing-item-end {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.writing-item:hover .writing-arrow {
  color: var(--text);
}

.writing-arrow {
  font-family: "Apfel Grotesk", var(--font-mono);
  color: var(--muted);
  font-size: clamp(12px, 1.2vw, 14px);
  transition: color 0.2s ease;
}

.writing-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.writing-tag {
  font-family: "Apfel Grotesk", var(--font-mono);
  font-size: clamp(10px, 1vw, 11px);
  color: var(--text);
  padding: 0.2rem 0.5rem;
  background: color-mix(in oklab, var(--bg) 80%, var(--border) 20%);
  border-radius: 4px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.writing-item:hover .writing-tag {
  color: var(--text);
  background: color-mix(in oklab, var(--border) 90%, var(--text) 10%);
}

[data-theme="dark"] .writing-item:hover .writing-tag {
  background: color-mix(in oklab, var(--border) 70%, var(--bg) 30%);
}

@media (max-width: 640px) {
  .work-sections {
    padding-inline: 10px;
  }

  /* Mobile: accordion layout - reorder triggers + panels into pairs */
  .work-sections {
    display: flex;
    flex-direction: column;
  }

  .work-section-headers {
    display: contents;
  }

  .work-panels {
    display: contents;
  }

  /* Order: t1(1), p1(2), t2(3), p2(4), t3(5), p3(6), t4(7), p4(8) */
  .work-section-headers .work-section-trigger:nth-child(1) { order: 1; }
  .work-section-headers .work-section-trigger:nth-child(2) { order: 3; }
  .work-section-headers .work-section-trigger:nth-child(3) { order: 5; }
  .work-section-headers .work-section-trigger:nth-child(4) { order: 7; }
  .work-panels .work-panel:nth-child(1) { order: 2; }
  .work-panels .work-panel:nth-child(2) { order: 4; }
  .work-panels .work-panel:nth-child(3) { order: 6; }
  .work-panels .work-panel:nth-child(4) { order: 8; }

  .work-section-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1rem 0;
    text-align: left;
    border-bottom: 1px solid var(--border);
  }

  .work-section-headers .work-section-trigger:nth-child(1) {
    border-top: 1px solid var(--border);
  }

  .work-section-trigger::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    transition: transform 0.2s ease;
  }

  .work-section-trigger.is-active::after {
    transform: rotate(180deg);
  }

  .work-panel {
    display: block;
    max-height: 0;
    overflow: hidden;
    margin-top: 0;
    transition: max-height 0.3s ease;
  }

  .work-panel.is-visible {
    max-height: 5000px;
  }

  /* Stack projects vertically on mobile (except visual experiments) */
  .work-slider:not(.visual-experiments-slider) {
    flex-direction: column;
  }

  .work-slider:not(.visual-experiments-slider) .work-slider-track {
    flex-direction: column;
    overflow-x: visible;
    overflow-y: visible;
    scroll-snap-type: none;
    gap: 2.5rem;
  }

  .work-slider:not(.visual-experiments-slider) .work-item {
    width: 100%;
    max-width: none;
  }

  .work-slider:not(.visual-experiments-slider) .work-slider-btn {
    display: none;
  }
}

code, pre, kbd, samp { font-family: "Apfel Grotesk", var(--font-mono); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

@media (max-width: 1024px) {
  /* Tablet: 5/8 grid for subtitle */
  .hero-subtitle { grid-column: 1 / span 5; }
  .hero-learn-more { grid-column: 1 / span 5; }
}

@media (max-width: 640px) {
  .container {
    padding-inline: 10px;
  }
  .header-inner { grid-template-columns: auto 1fr; gap: 0.5rem; }
  .header-inner-center { display: none; }
  .header-inner-left { justify-self: start; }
  .header-inner-right { justify-self: end; flex-wrap: nowrap; white-space: nowrap; }
  /* Mobile: 2/2 grid for subtitle */
  .hero-subtitle { grid-column: 1 / span 12; font-size: clamp(14px, 4vw, 18px); }
  .hero-learn-more { grid-column: 1 / span 12; }
}

/* Music popup */
.music-popup[hidden] { display: none; }
.music-popup { position: fixed; inset: 0; z-index: 20; }
.music-overlay { position: absolute; inset: 0; background: color-mix(in oklab, var(--bg) 88%, var(--text) 12%); opacity: 0.7; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.music-panel { position: relative; margin-top: 0; }
.music-card { position: absolute; right: 31px; top: 64px; width: 392px; background: var(--bg); color: var(--text); border-radius: 16px; padding: 0.5rem; display: flex; flex-direction: column; transform: translateY(-6px); opacity: 0; transition: transform 180ms ease, opacity 180ms ease; }
.music-open .music-card { transform: translateY(0); opacity: 1; }
.music-header { display: flex; justify-content: space-between; align-items: center; padding: 0.25rem 0.25rem 0.5rem 0.25rem; }
.music-title { font-family: "Apfel Grotesk", var(--font-mono); font-weight: 400; letter-spacing: 0.5px; }
.music-close { background: none; border: none; color: var(--text); cursor: pointer; font-family: "Apfel Grotesk", var(--font-mono); }
.music-list { list-style: none; margin: 0; padding: 0.25rem; display: grid; gap: 0.35rem; }
.music-item { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 0.5rem; padding: 0.25rem; border-radius: 8px; background: color-mix(in oklab, var(--bg) 90%, var(--border) 10%); min-height: 0; position: relative; transition: box-shadow 120ms ease, background-color 120ms ease; cursor: pointer; opacity: 0; transform: translateY(12px); }
.music-item.in { opacity: 1; transform: translateY(0); transition: opacity 600ms ease, transform 600ms cubic-bezier(.22,1,.36,1); }
.music-art { width: 48px; height: 48px; aspect-ratio: 1 / 1; border-radius: 6px; object-fit: cover; }
.music-title-text { color: var(--text); font-weight: 400; font-size: clamp(11px, 1.6vw, 16px); transition: font-weight 80ms linear, color 120ms ease; }
.music-artist { color: var(--muted); font-weight: 300; font-size: clamp(10px, 1.5vw, 14px); transition: font-weight 80ms linear, color 120ms ease; }
.music-meta { display: grid; }
.music-link { color: var(--text); text-decoration: none; display: contents; }
.music-item:hover { box-shadow: 0 0 0 2px var(--text); background: color-mix(in oklab, var(--bg) 88%, var(--border) 12%); }
.music-item:focus-within { box-shadow: 0 0 0 2px var(--text); }
.music-item:hover .music-title-text { font-weight: 800; }
.music-item:hover .music-artist { font-weight: 600; color: var(--text); }

@media (max-width: 1024px) {
  .music-card { right: 24px; top: 64px; width: 392px; }
}

@media (max-width: 640px) {
  .music-card { position: fixed; left: 10px; right: 10px; width: auto; top: 64px; }
}

/* Subtle page depth when music is open */
/* remove hero blur per new request */

/* Garden popup */
.garden-popup[hidden] { display: none; }
.garden-popup { position: fixed; inset: 0; z-index: 20; }
.garden-overlay { position: absolute; inset: 0; background: color-mix(in oklab, var(--bg) 88%, var(--text) 12%); opacity: 0.7; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.garden-panel { position: relative; }
.garden-card { position: absolute; left: 50%; transform: translate(-50%, -6px); top: 64px; width: min(920px, 92%); max-height: calc(100vh - 100px); background: var(--bg); color: var(--text); border-radius: 16px; padding: 0.5rem; opacity: 0; transition: transform 2000ms ease, opacity 2000ms ease; --tile: clamp(16px, 2.2vw, 24px); --rows: 8; contain: layout paint; display: flex; flex-direction: column; }
.garden-open .garden-card { transform: translate(-50%, 0); opacity: 1; }
.garden-header { display: flex; justify-content: space-between; align-items: center; padding: 0.25rem 0.25rem 0.5rem 0.25rem; }
.garden-title { font-family: "Apfel Grotesk", var(--font-mono); font-weight: 400; letter-spacing: 0.5px; }
.garden-close { background: none; border: none; color: var(--text); cursor: pointer; font-family: "Apfel Grotesk", var(--font-mono); }
.garden-count { display: flex; color: var(--muted); align-items: baseline; padding: 0 0.25rem 0.5rem 0.25rem; font-family: "Apfel Grotesk", var(--font-mono); }
.garden-count .count-label { color: var(--muted); font-size: clamp(10px, 1.4vw, 12px); margin-right: 6px; }
.garden-count .count-num { color: var(--text); font-size: clamp(10px, 1.4vw, 14px); font-variant-numeric: tabular-nums; }
.garden-marquee { overflow: hidden; white-space: nowrap; padding: 0.5rem 0.25rem; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 0.5rem 0; }
.garden-marquee-content { display: inline-flex; animation: marquee 20s linear infinite; font-family: "Apfel Grotesk Brukt", "Apfel Grotesk", var(--font-mono); font-size: clamp(10px, 1.2vw, 14px); color: var(--muted); text-transform: uppercase; }
.garden-marquee-content span { padding-right: 3rem; }
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-33.333%); }
}
.garden-body { position: relative; flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; }
.garden-list { position: relative; z-index: 1; list-style: none; margin: 0; padding: 10px; display: grid; grid-template-columns: repeat(auto-fit, var(--tile)); grid-auto-rows: var(--tile); grid-auto-flow: row; gap: 2px; justify-content: start; justify-items: start; overflow: visible; }
.tile { width: var(--tile); height: var(--tile); display: block; background: transparent; border: 1px solid color-mix(in oklab, var(--text) 35%, transparent); }
.tile { opacity: 0; transform: translateY(10px); transition: opacity 120ms ease, transform 120ms cubic-bezier(.22,1,.36,1); }
.flower { width: var(--tile); height: var(--tile); background: color-mix(in oklab, var(--bg) 85%, var(--border) 15%); display: block; opacity: 0; transform: translateY(12px); will-change: transform, opacity; transition: opacity 100ms ease, transform 150ms cubic-bezier(.22,1,.36,1); }
.flower.in { opacity: 1; transform: translateY(0); transition: opacity 300ms ease, transform 300ms cubic-bezier(.22,1,.36,1); }
.flower img { width: 100%; height: 100%; object-fit: cover; display: block; border: 1px solid rgba(255, 255, 255, 0.3); }
.flower { overflow: visible; }
.flower[title] { position: relative; overflow: visible; }
.flower[title]::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #666;
  margin-bottom: -1px;
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.1s ease;
  pointer-events: none;
}

.flower[title]::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #666;
  color: white;
  padding: 8px 12px;
  border-radius: 3px;
  font-family: 'Syne', monospace;
  font-size: 11px;
  font-weight: 400;
  white-space: pre-line;
  text-align: center;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  margin-bottom: 6px;
  min-width: 120px;
  letter-spacing: 0.2px;
  opacity: 0;
  transition: opacity 0.1s ease;
  pointer-events: none;
}

.flower[title]:hover::before,
.flower[title]:hover::after {
  opacity: 1;
}

/* Hide default cursor */
body {
  cursor: none;
}

/* Trail path SVG */
.trail-path {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}

.trail-path svg {
  width: 100%;
  height: 100%;
}

.trail-path path {
  stroke: url(#trailGradient);
  stroke-width: 4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(255, 0, 0, 0.6));
  opacity: 0.9;
}

/* Gradient definition for trail */
.trail-gradient {
  stop-color: #ff0000;
  stop-opacity: 1;
}

.trail-gradient-stop {
  stop-color: #ff6600;
  stop-opacity: 0.8;
}

/* Bottom Right Illustration */
.bottom-illustration {
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  animation: fadeInUp 0.8s ease-out forwards;
  animation-delay: 1.2s;
  padding-right: 30px;
  padding-bottom: 1rem;
}

.bottom-illustration img {
  position: absolute;
  bottom: 1rem;
  right: 30px;
  display: block;
  width: auto;
  height: auto;
  max-width: calc((100vw - 60px) / 12 * 4);
  object-fit: contain;
}

/* Light mode image (Self-portrait-black) - visible by default and in light theme */
.illustration-light {
  display: block;
}

/* Dark mode image (Self-portrait-white) - hidden by default */
.illustration-dark {
  display: none;
}

/* Hide light mode image and show dark mode image in dark theme */
[data-theme="dark"] .illustration-light {
  display: none !important;
}

[data-theme="dark"] .illustration-dark {
  display: block !important;
}

/* Ensure light mode image is visible in light theme */
[data-theme="light"] .illustration-light {
  display: block !important;
}

[data-theme="light"] .illustration-dark {
  display: none !important;
}

/* Handle system preference for dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .illustration-light {
    display: none !important;
  }
  
  :root:not([data-theme="light"]) .illustration-dark {
    display: block !important;
  }
}

/* Handle system preference for light mode */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .illustration-light {
    display: block !important;
  }
  
  :root:not([data-theme="dark"]) .illustration-dark {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .bottom-illustration img {
    max-width: calc((100vw - 60px) / 12 * 3);
  }
}

@media (max-width: 640px) {
  .bottom-illustration {
    padding-right: 10px;
    padding-bottom: 0.5rem;
  }
  
  .bottom-illustration img {
    max-width: calc((100vw - 20px) / 12 * 4);
  }
}
