/* =========================================
   ARTNEST TREASURES — MY ART (art.html)
   Spiral view: the works wind round a 3D helix that turns as you
   scroll (js/art.js). List view: every work as a framed card.
   Header, menu and footer are shared with the other pages.
   ========================================= */

.page-art {
  background-color: #141310;
}

.art-page {
  position: relative;
  display: block;
  color: var(--color-brand-warm-ivory);
  background: radial-gradient(ellipse 70% 60% at 50% 45%, #1F1D19, #121110 80%);
}

/* faint mandala layout template, fixed behind the gallery, turning slowly */
.art-bg {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 0;
  width: max(120vw, 120vh);
  height: auto;
  aspect-ratio: 1 / 1;
  translate: -50% -50%;
  pointer-events: none;
  opacity: 0.1;
  animation: art-bg-turn 300s linear infinite;
}

.art-bg :is(circle, line) {
  fill: none;
  stroke: var(--color-neutral-warm-sand);
  stroke-width: 1;
}

.art-bg .dash { stroke-dasharray: 3 7; }
.art-bg .node { fill: var(--color-neutral-warm-sand); stroke: none; }

@keyframes art-bg-turn { to { rotate: 360deg; } }

@media (prefers-reduced-motion: reduce) { .art-bg { animation: none; } }

.spiral, .art-list { position: relative; z-index: 1; }

/* ---------- spiral • list switch ---------- */

.art-switch {
  position: fixed;
  top: calc(var(--header-h, 80px) + var(--space-4));
  left: 50%;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(20, 19, 16, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transform: translateX(-50%);
}

.art-switch__btn {
  padding: 2px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--font-size-body);
  color: rgba(248, 245, 236, 0.5);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.art-switch__btn.is-active,
.art-switch__btn:hover {
  color: var(--color-brand-warm-ivory);
}

.art-switch__btn:focus-visible {
  outline: 2px solid var(--color-brand-warm-ivory);
  outline-offset: 4px;
  border-radius: 4px;
}

.art-switch__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-brand-burnt-orange);
}

/* ---------- Spiral ---------- */

/* tall runway; the stage sticks while scrolling turns the helix */
.spiral {
  position: relative;
}

.spiral__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  perspective: 1500px;
  perspective-origin: 50% 46%;
}

.spiral__intro {
  position: absolute;
  left: var(--container-padding-desktop);
  bottom: clamp(var(--space-6), 8vh, var(--space-8));
  z-index: 120;
  max-width: 25rem;
  transition: opacity 600ms ease;
}

/* soft dark pool behind the text so it reads over the cards */
.spiral__intro::before {
  content: "";
  position: absolute;
  inset: -40% -40% -30% -30%;
  z-index: -1;
  background: radial-gradient(ellipse at 35% 60%, rgba(18, 18, 16, 0.85), rgba(18, 18, 16, 0.5) 45%, transparent 72%);
  pointer-events: none;
}

.spiral.is-moving .spiral__intro {
  opacity: 0.55;
}

.spiral__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-brand-burnt-orange);
}

.spiral__eyebrow::before {
  content: "";
  width: 40px;
  height: 2px;
  background: var(--color-brand-burnt-orange);
}

.spiral__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 8vw, 7.5rem);
  font-weight: var(--font-weight-display);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--color-brand-warm-ivory);
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.55);
}

.spiral__title em {
  font-style: italic;
  color: var(--color-brand-burnt-orange);
}

.spiral__desc {
  margin: var(--space-4) 0 0;
  font-size: var(--font-size-body);
  line-height: 1.7;
  color: rgba(248, 245, 236, 0.86);
}

.spiral__hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0 0;
  font-size: var(--font-size-small);
  color: rgba(248, 245, 236, 0.75);
}

.spiral__works {
  padding: 5px 12px;
  border: 1px solid rgba(196, 90, 46, 0.7);
  border-radius: 999px;
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-brand-burnt-orange);
}

.spiral__scroll::before {
  content: "↓ ";
  color: #E8865A;
}

.spiral__ring {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  transform-style: preserve-3d;
}

/* each card is placed by js/art.js through --x/--y/--z/--ry/--o/--b */
.sp-card {
  position: absolute;
  top: 50%;
  left: 50%;
  /* every card the same size and shape */
  width: min(clamp(190px, 18vw, 280px), 33vh);
  aspect-ratio: 4 / 5;
  transform:
    translate(-50%, -50%)
    translate3d(var(--x, 0px), var(--y, 0px), var(--z, 0px))
    rotateY(var(--ry, 0deg));
  opacity: var(--o, 1);
  filter: blur(var(--b, 0px)) brightness(var(--l, 1));
  cursor: pointer;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.sp-card picture,
.sp-card img {
  display: block;
  width: 100%;
  height: 100%;
}

.sp-card img {
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 24px 50px -24px rgba(0, 0, 0, 0.85);
  /* fine ivory outline around every card, stronger on the front one */
  outline: 1px solid rgba(248, 245, 236, 0.22);
  outline-offset: 6px;
  transition: outline-color 400ms ease;
}

.sp-card.is-front img {
  outline-color: rgba(248, 245, 236, 0.6);
}

/* label pill for the front work */
.spiral__label {
  position: absolute;
  left: 50%;
  bottom: clamp(var(--space-5), 5vh, var(--space-7));
  z-index: 4;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 6px 18px 6px 6px;
  border: 0;
  border-radius: 14px;
  background: var(--color-brand-warm-ivory);
  color: var(--color-neutral-charcoal);
  font: inherit;
  text-align: left;
  transform: translateX(-50%);
  cursor: pointer;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.6);
}

.spiral__label:focus-visible {
  outline: 3px solid var(--color-brand-burnt-orange);
  outline-offset: 3px;
}

.spiral__thumb {
  flex: none;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 10px;
}

.spiral__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.spiral__text {
  display: grid;
  gap: 1px;
  min-width: 9rem;
}

.spiral__name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.1;
}

.spiral__cat {
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  color: var(--color-brand-burnt-orange);
}

.spiral__count {
  margin-left: var(--space-3);
  padding-left: var(--space-3);
  border-left: 1px solid rgba(var(--ink-rgb, 46, 46, 43), 0.15);
  font-size: var(--font-size-caption);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
  color: rgba(var(--ink-rgb, 46, 46, 43), 0.6);
  white-space: nowrap;
}

/* ---------- List ---------- */

.art-list {
  padding: calc(var(--header-h, 80px) + var(--space-10)) var(--container-padding-desktop) var(--space-10);
}

.art-list__grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)); /* five works per row */
  gap: var(--space-7) var(--space-5);
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.ls-card {
  display: grid;
  gap: var(--space-3);
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ls-frame {
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 14px;
  background: #22201C;
}

.ls-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ls-card:hover .ls-frame img {
  transform: scale(1.04);
}

.ls-card:focus-visible .ls-frame {
  outline: 3px solid var(--color-brand-warm-ivory);
  outline-offset: 4px;
}

.ls-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--space-3);
  align-items: baseline;
}

.ls-num {
  grid-row: span 2;
  font-size: var(--font-size-caption);
  font-variant-numeric: tabular-nums;
  color: rgba(248, 245, 236, 0.5);
}

.ls-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  line-height: 1.25;
}

.ls-cat {
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  color: #E8865A;
}

/* ---------- Viewer ---------- */

.art-viewer {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-brand-warm-ivory);
}

.art-viewer::backdrop {
  background: rgba(14, 13, 11, 0.95);
}

.art-viewer[open] {
  display: grid;
  place-items: center;
  overflow-y: auto; /* long stories scroll on small screens */
}

.art-viewer__figure {
  display: grid;
  justify-items: center;
  gap: var(--space-4);
  margin: 0;
  padding: var(--space-7) var(--space-9);
}

.art-viewer__img {
  display: block;
  max-width: min(66vw, 900px);
  max-height: 58dvh;
  width: auto;
  height: auto;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/* ---------- Traditional frame (viewer) ----------
   gold:   gilded carved moulding with a dark beaded inlay
   walnut: dark carved walnut with a gold bead band (pen & ink) */
.art-frame {
  --m1: #F3DD98; --m2: #C79A3E; --m3: #8A6420; --m4: #E6C470;
  --inlay: #3A2410; --bead: #E9C977; --bead-hi: #FFF3C8;
  position: relative;
  padding: clamp(14px, 1.6vw, 22px);
  border-radius: 3px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 248, 220, 0.16) 0 2px, transparent 2px 7px),
    linear-gradient(135deg, var(--m1) 0%, var(--m2) 28%, var(--m3) 52%, var(--m4) 76%, var(--m3) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 245, 210, 0.45),
    inset 2px 2px 0 rgba(255, 245, 210, 0.5),
    inset -2px -2px 0 rgba(60, 40, 10, 0.55),
    0 40px 80px -30px rgba(0, 0, 0, 0.85),
    0 12px 24px -12px rgba(0, 0, 0, 0.6);
}

.art-viewer[data-frame="walnut"] .art-frame {
  --m1: #6A4A33; --m2: #3A2519; --m3: #1E130C; --m4: #563A27;
  --inlay: #120B07; --bead: #D9B45F; --bead-hi: #FBE7A8;
}

/* bead band */
.art-frame__beads {
  padding: clamp(7px, 0.8vw, 10px);
  background:
    radial-gradient(circle at 40% 40%, var(--bead-hi) 0 18%, var(--bead) 34%, rgba(0, 0, 0, 0.45) 56%, transparent 60%) 0 0 / 10px 10px,
    var(--inlay);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

/* fine gold liner */
.art-frame__liner {
  padding: 3px;
  background: linear-gradient(135deg, #FBEBB4, #B88A34 50%, #F1D68C);
}

/* ivory mat with a bevelled window */
.art-frame__mat {
  padding: clamp(18px, 3vw, 44px);
  background: var(--color-brand-warm-ivory);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.art-viewer[open] .art-frame {
  animation: frame-in 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes frame-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .art-viewer[open] .art-frame { animation: none; }
}

.art-viewer figcaption {
  text-align: center;
}

/* the artwork's story, from Veda's catalogue */
.art-viewer__desc {
  max-width: 34rem;
  margin: var(--space-3) auto 0;
  font-size: var(--font-size-small);
  line-height: 1.7;
  color: rgba(248, 245, 236, 0.82);
}

/* wide screens: framed work on the left, its name and story on the right */
@media (min-width: 1024px) {
  .art-viewer__figure {
    grid-template-columns: auto minmax(16rem, 24rem);
    align-items: center;
    column-gap: clamp(var(--space-7), 4vw, var(--space-9));
  }
  .art-viewer figcaption { text-align: left; }
  .art-viewer__title { font-size: 2.25rem; line-height: 1.1; margin-top: var(--space-2); }
  .art-viewer__desc { margin: var(--space-4) 0 0; font-size: var(--font-size-body); }
  .art-viewer__img { max-width: min(48vw, 820px); max-height: 70dvh; }
}

.art-viewer__cat {
  margin: 0;
  font-size: var(--font-size-caption);
  font-weight: var(--font-weight-semibold);
  color: #E8865A;
}

.art-viewer__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
}

.art-viewer__close,
.art-viewer__nav {
  position: absolute;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(248, 245, 236, 0.4);
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.2rem;
  cursor: pointer;
}

.art-viewer__close:hover,
.art-viewer__nav:hover {
  background: var(--color-brand-warm-ivory);
  color: var(--color-neutral-charcoal);
}

.art-viewer__close { top: var(--space-5); right: var(--space-5); }
.art-viewer__nav { top: 50%; margin-top: -23px; }
.art-viewer__nav--prev { left: var(--space-5); }
.art-viewer__nav--next { right: var(--space-5); }

/* ---------- Sound toggle ---------- */

/* ---------- Opening entrance ----------
   The intro text, the spiral • list switch and the name label rise
   softly out of a light blur, one after another. Uses the individual
   translate property so it never fights the elements' own transforms. */
@keyframes art-rise {
  from { opacity: 0; translate: 0 16px; filter: blur(8px); }
  to   { opacity: 1; translate: 0 0; filter: none; }
}

.spiral__intro > *,
.art-switch,
.spiral__label {
  animation: art-rise 1200ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.art-switch { animation-delay: 100ms; }
.spiral__intro > :nth-child(1) { animation-delay: 200ms; }
.spiral__intro > :nth-child(2) { animation-delay: 320ms; }
.spiral__intro > :nth-child(3) { animation-delay: 460ms; }
.spiral__intro > :nth-child(4) { animation-delay: 580ms; }
.spiral__label { animation-delay: 700ms; }

@media (prefers-reduced-motion: reduce) {
  .spiral__intro > *,
  .art-switch,
  .spiral__label { animation: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .spiral__intro { left: var(--container-padding-tablet); }
  .art-list { padding-inline: var(--container-padding-tablet); }
  .art-list__grid { gap: var(--space-6) var(--space-4); }
}

@media (max-width: 768px) {
  .sp-card { width: min(40vw, 26vh); }

  .spiral__intro {
    left: var(--container-padding-mobile);
    right: var(--container-padding-mobile);
    top: calc(var(--header-h, 80px) + 64px);
    bottom: auto;
  }

  .spiral__title { font-size: clamp(3rem, 14vw, 4rem); }
  .spiral__desc { display: none; }
  .spiral__hint { margin-top: var(--space-3); }

  .spiral__label { bottom: var(--space-8); }
  .spiral__count { display: none; }

  .art-list { padding-inline: var(--container-padding-mobile); }
  .art-list__grid { grid-template-columns: 1fr 1fr; gap: var(--space-6) var(--space-4); }
  .ls-title { font-size: 1.1rem; }

  .art-viewer__figure { padding: calc(var(--space-8) + 16px) var(--space-4) 112px; }
  .art-viewer__img { max-width: 70vw; max-height: 46dvh; }
  .art-frame { padding: 10px; }
  .art-frame__mat { padding: 12px; }
  .art-viewer__nav { position: fixed; top: auto; bottom: var(--space-5); margin-top: 0; z-index: 2; background: rgba(14, 13, 11, 0.9); }
  .art-viewer__close { position: fixed; z-index: 2; background: rgba(14, 13, 11, 0.9); }
  .art-viewer__nav--prev { left: calc(50% - 56px); }
  .art-viewer__nav--next { right: calc(50% - 56px); }
}

