:root {
  --bg: #071c14;
  --bg-deep: #04140d;
  --surface: #0d2a20;
  --surface-2: #12382a;
  --mint: #b8f2c7;
  --mint-strong: #8ee9a7;
  --cream: #f4f1e8;
  --muted: #aab9b0;
  --line: rgba(184,242,199,.22);
  --bronze: #b98b59;
  --max: 1280px;
}

* { box-sizing: border-box; }

/* `hidden` must win over the display rules below (e.g. .error-state). */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--cream);
  background: var(--bg);
  font-family: "DM Sans", Arial, sans-serif;
  line-height: 1.5;
}

body, button, a { -webkit-font-smoothing: antialiased; }

button, input { font: inherit; }

button { cursor: pointer; }

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

h1, h2, h3 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 500;
}

h1 {
  font-size: clamp(64px, 8vw, 112px);
  line-height: .88;
  letter-spacing: -.045em;
}

h2 {
  font-size: clamp(42px, 5vw, 68px);
  line-height: .95;
  letter-spacing: -.035em;
}

p { margin: 0; }

.eyebrow {
  margin: 0 0 16px;
  color: var(--mint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.site-header {
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  right: 0;
  height: 76px;
  padding: 0 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(184,242,199,.10);
  background: rgba(7,28,20,.82);
  backdrop-filter: blur(18px);
}

.brand {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 22px;
  white-space: nowrap;
}

.desktop-nav {
  display: flex;
  gap: 34px;
  color: var(--muted);
  font-size: 12px;
}

.desktop-nav a:hover { color: var(--mint); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-btn,
.circle-btn {
  border: 1px solid var(--line);
  color: var(--cream);
  background: rgba(13,42,32,.7);
}

.lang-btn {
  min-width: 52px;
  height: 34px;
  padding: 0 14px;
  border-radius: 20px;
  font-size: 11px;
}

.home-hero {
  position: relative;
  min-height: 820px;
  display: flex;
  align-items: flex-end;
  padding: 0 7vw 90px;
  overflow: hidden;
}

.hero-image {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(3,18,12,.94) 0%, rgba(3,18,12,.63) 45%, rgba(3,18,12,.20) 100%),
    linear-gradient(0deg, rgba(7,28,20,.92) 0%, transparent 55%),
    url("assets/images/hero.jpg") center / cover,
    #173b2d;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 650px;
}

.hero-title {
  margin-top: 26px;
  color: var(--mint);
  font-size: 19px;
}

.hero-description {
  max-width: 450px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  margin-top: 24px;
  padding: 0 22px;
  border-radius: 28px;
  font-size: 12px;
  font-weight: 700;
  transition: transform .2s, background .2s;
}

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

.button-primary {
  background: var(--mint);
  color: #061a10;
}

.section {
  width: min(var(--max), calc(100% - 10vw));
  margin: 0 auto;
  padding: 115px 0;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 38px;
}

.section-heading.compact { margin-bottom: 25px; }

.text-link {
  color: var(--muted);
  font-size: 12px;
}

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

.artist-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.artist-card {
  min-width: 0;
  min-height: 385px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  transition: transform .22s, border-color .22s;
}

.artist-card:hover {
  transform: translateY(-5px);
  border-color: var(--mint);
}

.artist-card-link {
  display: block;
  height: 100%;
}

.artist-card-image {
  position: absolute;
  inset: 0;
  background-position: center top;
  background-size: cover;
  background-color: #173b2d;
}

.artist-card-content {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 165px;
  padding: 20px 17px;
  background: linear-gradient(0deg, rgba(4,20,13,.98), rgba(4,20,13,.08));
}

.artist-card h3 {
  font-size: 19px;
  line-height: 1.05;
}

.artist-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.artist-handprint {
  position: absolute;
  left: 17px;
  bottom: 16px;
  width: 54px;
  height: 54px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: #4a3524;
}

.artist-handprint img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.arrow-circle {
  position: absolute;
  right: 16px;
  bottom: 18px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--mint);
  border-radius: 50%;
  color: var(--mint);
}

.walk-section {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  grid-template-rows: auto auto;
  gap: 0;
  padding-top: 65px;
  padding-bottom: 65px;
}

/* Google Maps embed */
.walk-photo {
  width: 100%;
  height: 100%;
  min-height: 410px;
  grid-row: 1 / span 2;
  border: 0;
  border-radius: 26px 0 0 26px;
  background: #173b2d;
}

.walk-copy {
  padding: 55px 50px 35px;
  border-radius: 0 26px 0 0;
  background: var(--surface);
}

.walk-copy p:not(.eyebrow) {
  max-width: 390px;
  margin-top: 20px;
  color: var(--muted);
  line-height: 1.75;
}

.walk-map {
  min-height: 170px;
  border-radius: 0 0 26px 0;
  background:
    linear-gradient(90deg, rgba(7,28,20,.25), transparent),
    url("assets/images/ainars-virga-handprint-2.jpg") center 70% / cover,
    #173b2d;
}

.about-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 90px;
  border-top: 1px solid var(--line);
}

.about-copy {
  padding-top: 18px;
}

.about-copy p {
  max-width: 560px;
  margin-bottom: 22px;
  color: var(--muted);
  line-height: 1.8;
}

/* ARTIST PAGE */

#artistPage {
  padding-top: 76px;
}

.loading-state,
.error-state {
  min-height: 70vh;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.error-state h1 {
  font-size: 50px;
}

.back-link {
  display: inline-block;
  margin-bottom: 40px;
  color: var(--muted);
  font-size: 12px;
}

.back-link:hover { color: var(--mint); }

.artist-hero {
  width: min(var(--max), calc(100% - 10vw));
  margin: 0 auto;
  padding: 65px 0 0;
}

.artist-hero-grid {
  min-height: 470px;
  display: grid;
  grid-template-columns: 1fr .8fr;
  gap: 60px;
  align-items: center;
}

.artist-intro {
  padding-bottom: 20px;
}

.artist-intro h1 {
  max-width: 650px;
}

.artist-role {
  margin-top: 18px;
  color: var(--mint);
  font-size: 13px;
}

.artist-bio-short {
  max-width: 590px;
  margin-top: 28px;
  color: var(--muted);
  line-height: 1.8;
  font-size: 14px;
}

.artist-portrait {
  min-height: 500px;
  align-self: stretch;
  border-radius: 25px;
  background-position: center top;
  background-size: cover;
  background-color: #173b2d;
  mask-image: linear-gradient(90deg, transparent 0%, black 15%, black 100%);
}

.artist-tabs {
  display: flex;
  gap: 28px;
  margin-top: 38px;
  border-bottom: 1px solid var(--line);
}

.artist-tab {
  position: relative;
  padding: 0 0 14px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}

.artist-tab.active {
  color: var(--cream);
}

.artist-tab.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--mint);
}

.artist-content {
  padding-top: 65px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 26px;
  align-items: start;
}

.model-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
}

.model-card-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.view-pill {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: 18px;
  color: #061a10;
  background: var(--mint);
  font-size: 10px;
  font-weight: 700;
}

.model-label {
  margin-left: 12px;
  color: var(--muted);
  font-size: 10px;
}

.circle-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.model-wrap {
  position: relative;
}

.model-help {
  position: absolute;
  right: 0;
  bottom: 17px;
  left: 0;
  display: flex;
  justify-content: center;
  gap: 9px;
  color: rgba(244,241,232,.65);
  font-size: 10px;
  pointer-events: none;
}

.artist-side {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.music-card,
.about-artist {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
}

.music-card {
  padding: 16px;
}

.music-cover {
  width: 100%;
  height: 175px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--mint);
  font-size: 45px;
  background:
    linear-gradient(135deg, rgba(7,28,20,.15), rgba(7,28,20,.75)),
    #173b2d;
}

.music-main {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 15px;
}

.music-meta {
  min-width: 0;
  flex: 1;
}

.music-meta strong,
.music-meta span {
  display: block;
}

.music-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.music-meta span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.play-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  color: #061a10;
  background: var(--mint);
}

.play-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.progress-row {
  display: grid;
  grid-template-columns: 35px 1fr 35px;
  gap: 9px;
  align-items: center;
  margin-top: 16px;
  color: var(--muted);
  font-size: 9px;
}

#progressRange {
  width: 100%;
  accent-color: var(--mint);
}

.about-artist {
  padding: 28px;
}

.about-artist p:last-child {
  color: var(--muted);
  line-height: 1.8;
  font-size: 13px;
}

.gallery-section {
  padding-right: 0;
  padding-left: 0;
}

.artist-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.gallery-item {
  min-height: 210px;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.image-missing {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}

/* FOOTER */

.site-footer {
  width: min(var(--max), calc(100% - 10vw));
  margin: 0 auto;
  padding: 45px 0 90px;
  display: block;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 10px;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

/* RESPONSIVE */

@media (max-width: 1050px) {
  .artist-grid { grid-template-columns: repeat(3, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .artist-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .artist-gallery { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 800px) {
  .desktop-nav { display: none; }

  .home-hero {
    min-height: 720px;
    padding-right: 24px;
    padding-left: 24px;
  }

  .section,
  .artist-hero,
  .site-footer {
    width: calc(100% - 48px);
  }

  .section { padding: 80px 0; }

  .artist-grid { grid-template-columns: repeat(2, 1fr); }

  .walk-section,
  .about-section,
  .artist-hero-grid {
    grid-template-columns: 1fr;
  }

  .walk-photo {
    min-height: 350px;
    grid-row: auto;
    border-radius: 26px 26px 0 0;
  }

  .walk-copy {
    border-radius: 0;
    padding: 40px;
  }

  .walk-map {
    border-radius: 0 0 26px 26px;
  }

  .artist-portrait {
    min-height: 420px;
    mask-image: none;
  }

  .artist-side { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .brand { font-size: 18px; }

  h1 { font-size: 62px; }

  .section-heading {
    display: block;
  }

  .section-heading .text-link {
    display: inline-block;
    margin-top: 15px;
  }

  .artist-grid { grid-template-columns: 1fr; }

  .artist-card { min-height: 410px; }

  .artist-tabs {
    gap: 16px;
    overflow-x: auto;
  }

  .artist-tab { white-space: nowrap; }

  .artist-gallery {
    grid-template-columns: 1fr;
  }

  .gallery-item { min-height: 260px; }

  .footer-row {
    flex-direction: column;
  }
}


/* =====================================================
   OBJ / THREE.JS VIEWER
===================================================== */

.obj-viewer {
  width: 100%;
  height: 515px;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #315b45 0%, #0b2419 60%, #061a10 100%);
}

.obj-viewer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.model-error {
  display: grid;
  place-items: center;
}

.model-error-message {
  padding: 30px;
  color: #ffb6a8;
  text-align: center;
  font-size: 12px;
}

/* ===== 3D viewer: loading overlay, fullscreen fallback ===== */
.model-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background-color: #0b2419;
  background-size: cover;
  background-position: center;
  color: var(--mint);
  font-size: 13px;
  letter-spacing: .04em;
  text-align: center;
  padding: 24px;
  transition: opacity .35s ease;
}

.model-loading.is-done {
  opacity: 0;
  pointer-events: none;
}

.model-loading-bar {
  width: min(220px, 60%);
  height: 3px;
  border-radius: 3px;
  background: rgba(184, 242, 199, .2);
  overflow: hidden;
}

.model-loading-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--mint-strong);
  transition: width .2s ease;
}

.model-loading.is-indeterminate .model-loading-bar span {
  width: 40%;
  animation: model-loading-slide 1.1s ease-in-out infinite;
}

@keyframes model-loading-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(260%); }
}

.viewer-close {
  display: none;
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  z-index: 5;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(4, 20, 13, .8);
  color: var(--cream);
  font-size: 18px;
  cursor: pointer;
}

/* Used when the browser has no native element fullscreen (iPhone Safari) */
.obj-viewer.is-pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

.obj-viewer.is-pseudo-fullscreen .viewer-close { display: block; }

body.no-scroll { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .model-loading-bar span { animation: none !important; }
}

/* ===== Artist bio sections ===== */
.bio-sections p {
  color: var(--muted);
  line-height: 1.8;
  font-size: 13px;
  margin: 0 0 12px;
}

.bio-sections .bio-dates {
  color: var(--mint);
  font-size: 12px;
  letter-spacing: .04em;
  margin-bottom: 16px;
}

.bio-sections h4 {
  margin: 18px 0 6px;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cream);
}

/* ===== Sources & credits (footer) ===== */
.footer-sources {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.6;
}

.footer-sources h2 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cream);
}

.footer-sources h3 {
  margin: 22px 0 10px;
  font-size: 13px;
  color: var(--mint);
}

.footer-sources h4 {
  margin: 0 0 6px;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cream);
}

.src-intro,
.src-disclaimer {
  margin: 0 0 6px;
  max-width: 760px;
}

.src-disclaimer { margin-top: 22px; opacity: .85; }

.src-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px 28px;
}

.src-list {
  margin: 0;
  padding-left: 16px;
}

.src-list li { margin-bottom: 5px; }

.src-list a {
  color: var(--mint);
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.src-date { opacity: .7; white-space: nowrap; }

.src-todo { font-style: italic; opacity: .75; }

.src-all {
  margin-top: 18px;
}

.src-all summary {
  cursor: pointer;
  color: var(--mint);
  font-size: 12px;
}
