:root {
  --bg: #0a0a0d;
  --bg-panel: #131318;
  --bg-panel-hover: #17171f;
  --fg: #eeecf4;
  --fg-dim: #9c98ab;
  --accent: #9a64ff;
  --accent-dim: #5c3aa8;
  --border: #232231;
  --border-soft: #1a1a24;
  --max-w: 1720px;
  --edge: clamp(1.25rem, 4vw, 4rem);

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
  --space-7: 5.5rem;
  --space-8: 8rem;

  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 220px 220px;
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: #b384ff; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--edge);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: rgba(10, 10, 13, 0.85);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.site-header .brand {
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--fg);
  font-size: 1.15rem;
}
.site-header .brand:hover { color: var(--fg); }

.site-header nav { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); justify-content: flex-end; }
.site-header nav a {
  color: var(--fg-dim);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.2rem 0;
  border-bottom: 1px solid transparent;
}
.site-header nav a:hover { color: var(--fg); }
.site-header nav a.active { color: var(--accent); border-bottom-color: var(--accent); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--fg);
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .site-header nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: var(--space-1);
    background: var(--bg);
    border-bottom: 1px solid var(--border-soft);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    padding: 0 var(--space-4);
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
  }
  .site-header nav.open {
    max-height: 400px;
    opacity: 1;
    padding: var(--space-2) var(--space-4) var(--space-4);
  }
  .site-header nav a { padding: var(--space-1) 0; }
}

/* Layout */
main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--edge);
  counter-reset: section;
}

/* Homepage hero: asymmetric, not centered, sized to use real window space */
.hero { padding: var(--space-8) 0 var(--space-6); }
.hero h1 {
  font-size: clamp(3.5rem, 11vw, 9rem);
  line-height: 0.92;
  margin: 0 0 var(--space-6);
  letter-spacing: -0.03em;
  font-weight: 800;
}
.hero-body {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-6);
  align-items: end;
}
.hero-body .tagline {
  grid-column: 1;
  font-size: clamp(1.05rem, 1.4vw, 1.3rem);
  color: var(--fg-dim);
  margin: 0;
  max-width: 58ch;
}
.hero-body .aliases {
  grid-column: 2;
  justify-self: end;
  text-align: right;
  font-size: 0.85rem;
  color: var(--fg-dim);
  opacity: 0.75;
  line-height: 1.6;
}
@media (max-width: 800px) {
  .hero-body { grid-template-columns: 1fr; }
  .hero-body .aliases { justify-self: start; text-align: left; }
}

/* Photo gallery (bento grid) */
.gallery { padding: var(--space-4) 0 var(--space-6); }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 130px);
  grid-template-areas:
    "hero hero grass cat"
    "hero hero grass beach"
    "doodle logo fishing beach";
  gap: var(--space-2);
}
.area-hero   { grid-area: hero; }
.area-grass  { grid-area: grass; }
.area-cat    { grid-area: cat; }
.area-beach  { grid-area: beach; }
.area-doodle { grid-area: doodle; }
.area-logo   { grid-area: logo; }
.area-fishing{ grid-area: fishing; }

.gallery-item {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-panel);
  cursor: zoom-in;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease, filter 0.35s ease;
}
.gallery-item.gallery-dark img { object-fit: contain; padding: var(--space-3); }
.gallery-item:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item.gallery-dark:hover img { transform: scale(1.1); }

.gallery-caption {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.45rem 0.65rem;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--fg);
  text-align: left;
  background: linear-gradient(to bottom, rgba(8, 8, 11, 0.72), rgba(8, 8, 11, 0));
  backdrop-filter: blur(3px);
  pointer-events: none;
}

@media (max-width: 720px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 140px);
    grid-template-areas:
      "hero hero"
      "grass cat"
      "beach doodle"
      "beach logo"
      "fishing fishing";
    grid-template-rows: repeat(5, 140px);
  }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 9, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 100;
  cursor: zoom-out;
  animation: fade-in 0.15s ease;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: min(90vw, 1000px);
  max-height: 88vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: none;
  border: none;
  color: var(--fg);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Scroll-reveal */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* Subpage headers */
.page-hero { padding: var(--space-7) 0 var(--space-3); }
.page-hero h1 { font-size: clamp(2.75rem, 7vw, 5.5rem); margin: 0 0 var(--space-3); font-weight: 800; letter-spacing: -0.02em; line-height: 0.95; }
.page-hero p { color: var(--fg-dim); max-width: 60ch; font-size: 1.05rem; }

/* Homepage quick-link cards */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
  margin: var(--space-6) 0 var(--space-7);
}
.nav-card {
  display: block;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 4px 22px 4px 22px;
  padding: var(--space-4);
  color: var(--fg);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, border-radius 0.18s ease;
}
.nav-card:hover {
  border-color: var(--accent-dim);
  background: var(--bg-panel-hover);
  transform: translateY(-3px) rotate(-0.6deg);
  border-radius: 22px 4px 22px 4px;
}
.nav-card h3 { margin: 0 0 var(--space-1); font-size: 1.1rem; color: var(--accent); font-weight: 700; }
.nav-card p { margin: 0; font-size: 0.85rem; color: var(--fg-dim); }

/* Qualifications */
.quals-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.quals-list li { padding-left: var(--space-4); position: relative; color: var(--fg-dim); }
.quals-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* Content sections */
.panel { padding: var(--space-8) 0; border-top: 1px solid var(--border-soft); counter-increment: section; }
.panel h2 {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
  margin: 0 0 var(--space-4);
  color: var(--fg);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.panel h2::before {
  content: counter(section, decimal-leading-zero) " / ";
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.55em;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0;
}
.panel h2.accent { color: var(--accent); }
.panel > p { color: var(--fg-dim); font-size: 1.05rem; max-width: 70ch; }

/* Embeds */
.embed-wrap iframe { border: 0; border-radius: var(--radius-sm); }
.embed-placeholder {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
  color: var(--fg-dim);
  font-size: 0.95rem;
}

/* YouTube video grids (popular / random / recent) */
.yt-subhead {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: var(--space-4) 0 var(--space-2);
}
.yt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}
.yt-card iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius-sm);
  display: block;
}
.yt-title {
  margin: var(--space-1) 0 0;
  font-size: 0.85rem;
  color: var(--fg-dim);
  line-height: 1.35;
}

/* Albums (Bandcamp embeds) */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-4);
  justify-items: center;
}
.album-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
}
.album-card iframe { display: block; max-width: 100%; border-radius: var(--radius-sm); }

/* Games grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: var(--space-4);
}
.game-card {
  display: block;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 4px 22px 4px 22px;
  padding: var(--space-3);
  color: var(--fg);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, border-radius 0.18s ease;
}
.game-card:hover {
  border-color: var(--accent-dim);
  background: var(--bg-panel-hover);
  transform: translateY(-3px) rotate(0.6deg);
  border-radius: 22px 4px 22px 4px;
}
.game-card img { width: 100%; border-radius: var(--radius-sm); margin-bottom: var(--space-2); aspect-ratio: 16/10; object-fit: cover; }
.game-card h3 { margin: 0 0 0.25rem; font-size: 1.05rem; font-weight: 700; }
.game-card p { margin: 0; font-size: 0.85rem; color: var(--fg-dim); }

/* Connect links (footer) */
.connect-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}
.connect-list a { font-size: 1rem; color: var(--fg); font-weight: 500; }
.connect-list a:hover { color: var(--accent); }

/* Footer */
.site-footer {
  flex-shrink: 0;
  text-align: center;
  padding: var(--space-5) var(--edge) var(--space-6);
  border-top: 1px solid var(--border-soft);
  color: var(--fg-dim);
  font-size: 0.85rem;
  margin-top: var(--space-6);
}
.site-footer .connect-list { justify-content: center; margin-bottom: var(--space-3); }

/* Blog */
.blog-post + .blog-post { margin-top: var(--space-6); padding-top: var(--space-6); border-top: 1px solid var(--border-soft); }
.blog-post h2 { margin: 0 0 0.25rem; font-size: 1.35rem; font-weight: 700; }
.blog-post h2 a { color: var(--fg); }
.blog-post h2 a:hover { color: var(--accent); }
.blog-date { color: var(--fg-dim); font-size: 0.85rem; margin: 0 0 var(--space-3); }
.blog-body p { margin: 0 0 var(--space-3); color: var(--fg-dim); }
.blog-body hr { border: none; border-top: 1px solid var(--border); margin: var(--space-4) 0; }

/* Design portfolio */
.design-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
}
.design-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 4px 22px 4px 22px;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.design-card:hover { border-color: var(--accent-dim); transform: translateY(-3px); }
.design-thumb {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  padding: var(--space-3);
}
.design-thumb.on-light { background: #eae7f0; }
.design-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.design-card h3 { margin: var(--space-2) var(--space-3) 0.2rem; font-size: 1.05rem; font-weight: 700; }
.design-card p { margin: 0 var(--space-3) var(--space-3); font-size: 0.9rem; color: var(--fg-dim); }

/* Mastering credits (Branches) */
.mastering-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}
.mastering-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
}
.mastering-card iframe { display: block; border-radius: var(--radius-sm); }

/* Placeholder pages */
.coming-soon {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--fg-dim);
  margin: var(--space-3) 0 var(--space-6);
}
