/* Songket loom page. One accent (the metal thread), one ground (the silk colour). */
:root {
  --bg: #211315;
  --silk: #7d1f2c;
  --metal: #d9b25a;
  --ink: #efe7d8;
  --ink-2: rgba(239, 231, 216, 0.8);
  --ink-3: rgba(239, 231, 216, 0.66);
  --line: rgba(239, 231, 216, 0.14);
  --on-metal: #1d1612;
  --gutter: clamp(16px, 4vw, 64px);
  --display: 'Bodoni Moda', 'Didot', Georgia, serif;
  --text: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--text);
  transition: background-color 0.8s var(--ease);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
h1, h2, p, dl, dd, ol { margin: 0; }
:focus-visible { outline: 2px solid var(--metal); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 50;
  padding: 8px 16px; background: var(--ink); color: var(--on-metal); border-radius: 4px; text-decoration: none;
}
.skip:focus { top: 16px; }

/* ---------- buttons and links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px; border: 0; border-radius: 999px;
  font: 500 16px/1 var(--text); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform 140ms var(--ease), background-color 400ms var(--ease), opacity 200ms;
}
.btn:active { transform: scale(0.97); }
.btn--metal { background: var(--metal); color: var(--on-metal); }
.btn--metal:hover { background: color-mix(in srgb, var(--metal) 88%, #fff); }
.btn--light { background: var(--ink); color: var(--on-metal); }
.btn[aria-disabled='true'] { opacity: 0.6; cursor: progress; }
.link {
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--ink); font: 500 16px/1.4 var(--text);
  text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--metal) 70%, transparent);
  text-underline-offset: 5px; text-decoration-thickness: 1px;
  transition: text-decoration-color 160ms;
}
.link:hover { text-decoration-color: var(--metal); }

/* ---------- nav ---------- */
.nav {
  position: absolute; inset: 0 0 auto; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 24px var(--gutter);
  pointer-events: none;
}
.nav > * { pointer-events: auto; }
.nav__name { font: 400 24px/1.1 var(--display); letter-spacing: 0.01em; }
.nav__end { display: flex; align-items: center; gap: 24px; }
.nav__contact { color: var(--ink); text-decoration: none; font-weight: 500; }
.nav__contact:hover { color: var(--metal); }
.lang { display: flex; border-radius: 999px; background: rgba(239, 231, 216, 0.1); padding: 4px; }
.lang button {
  min-width: 40px; height: 32px; border: 0; border-radius: 999px; background: none; cursor: pointer;
  font: 500 13px/1 var(--text); color: var(--ink-3); transition: background-color 200ms, color 200ms;
}
.lang button[aria-pressed='true'] { background: var(--ink); color: var(--on-metal); }

/* ---------- the stage ---------- */
.stage { position: relative; height: 100svh; min-height: 640px; overflow: hidden; }
.stage__view { position: absolute; inset: 0; }
.stage__gl { display: block; width: 100%; height: 100%; touch-action: pan-y; outline: none; }
.stage__fallback { position: absolute; inset: 15% 10% 20% 38%; width: auto; height: auto; max-height: 65%; margin: auto; object-fit: contain; }

.curtain {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-content: center; gap: 16px; justify-items: center;
  background: var(--bg); color: var(--ink-2); font-size: 13px;
  transition: opacity 900ms var(--ease), visibility 900ms;
}
.curtain.is-done { opacity: 0; visibility: hidden; }
.curtain__bar { width: 160px; height: 1px; background: var(--line); overflow: hidden; }
.curtain__bar span { display: block; height: 100%; width: 100%; background: var(--metal); transform: scaleX(0); transform-origin: left; transition: transform 400ms var(--ease); }

.caption {
  position: absolute; z-index: 3;
  left: var(--gutter); top: 50%; transform: translateY(-50%);
  width: min(28vw, 340px);
  transition: opacity 500ms var(--ease);
}
.caption.is-out { opacity: 0; }
.caption__title { font: italic 400 32px/1.15 var(--display); margin-bottom: 16px; text-wrap: balance; }
.caption__meta { color: var(--ink-2); font-size: 16px; line-height: 1.5; }
.caption__links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 24px; }

.dock {
  position: absolute; z-index: 3;
  right: var(--gutter); bottom: 32px;
  display: flex; align-items: flex-end; gap: 32px;
  padding: 16px 16px 16px 24px; border-radius: 32px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  transition: background-color 0.8s var(--ease);
}
.dock__group { display: grid; grid-auto-flow: column; align-items: center; gap: 8px; }
.dock__label { grid-column: 1 / -1; grid-row: 1; font-size: 13px; color: var(--ink-3); }
.dock__next { min-width: 240px; }
.dock__group > button, .swatches { grid-row: 2; }
.metal {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 12px;
  border: 0; border-radius: 999px; background: rgba(239, 231, 216, 0.08); cursor: pointer;
  font-size: 13px; color: var(--ink-2); transition: background-color 200ms, color 200ms;
}
.metal i { width: 16px; height: 16px; border-radius: 50%; }
.metal[data-metal='gold'] i { background: radial-gradient(circle at 35% 30%, #fbe6a6, #c79a3c 60%, #8a6420); }
.metal[data-metal='silver'] i { background: radial-gradient(circle at 35% 30%, #ffffff, #b9bec4 60%, #7d8389); }
.metal:hover { background: rgba(239, 231, 216, 0.14); }
.metal[aria-pressed='true'] { background: var(--ink); color: var(--on-metal); }
.swatches { display: flex; gap: 8px; }
.swatch {
  width: 24px; height: 40px; border: 0; border-radius: 12px; cursor: pointer; padding: 0;
  background: repeating-linear-gradient(90deg, var(--c) 0 3px, color-mix(in srgb, var(--c) 72%, #000) 3px 4px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: transform 160ms var(--ease);
}
.swatch:hover { transform: translateY(-2px); }
.swatch[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }

.tag {
  position: absolute; z-index: 4; left: 0; top: 0; pointer-events: none;
  padding: 8px 12px; border-radius: 999px; white-space: nowrap;
  background: rgba(18, 12, 12, 0.84); color: var(--ink); font-size: 13px; line-height: 1;
  transform: translate(-50%, calc(-100% - 16px));
}
.hints { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.hint {
  position: absolute; display: flex; flex-direction: column; align-items: center; gap: 8px;
  transform: translate(-50%, -100%); opacity: 0;
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
}
.hint.is-on { opacity: 1; transform: translate(-50%, calc(-100% - 8px)); }
.hint span { padding: 8px 12px; border-radius: 999px; background: var(--ink); color: var(--on-metal); font-size: 13px; line-height: 1; white-space: nowrap; }
.hint::after { content: ''; width: 1px; height: 24px; background: var(--ink); }

/* ---------- all works: one long cloth ---------- */
.works { padding: 96px 0; }
.works__head, .about, .contact { padding-inline: var(--gutter); }
.works__head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: end; margin-bottom: 48px; }
.works__head p, .contact p { max-width: 46ch; color: var(--ink-2); }
h2 { font: 400 clamp(32px, 4.4vw, 48px)/1.08 var(--display); letter-spacing: -0.01em; text-wrap: balance; }

.cloth { background: var(--silk) var(--tile) repeat; background-size: 128px 112px; transition: background-color 0.8s var(--ease); }
.cloth__band { height: 80px; background: var(--band-down) repeat-x; background-size: 104px 80px; }
.cloth__band--bottom { background-image: var(--band-up); }
.cloth__row {
  display: flex; gap: 48px; padding: 40px var(--gutter) 32px; list-style: none;
  overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-x: contain;
  scrollbar-width: thin; scrollbar-color: var(--metal) transparent; cursor: grab;
}
.cloth__row.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.cloth__row li { flex: none; scroll-snap-align: center; }
.piece {
  display: grid; gap: 16px; padding: 16px 16px 20px; border: 0; cursor: pointer; text-align: left;
  background: var(--panel, var(--silk)); transition: background-color 0.8s var(--ease);
}
.piece img {
  height: clamp(220px, 34vh, 320px); width: auto; max-width: none;
  outline: 1px solid var(--metal); outline-offset: 6px;
  transition: transform 300ms var(--ease);
  user-select: none; -webkit-user-drag: none;
}
.piece:hover img { transform: translateY(-4px); }
.piece__title { font: italic 400 16px/1.3 var(--display); max-width: 32ch; }
.piece__year { font-size: 13px; color: var(--ink-2); margin-top: -8px; }
.piece[aria-current='true'] .piece__title::after { content: '  \2726'; color: var(--metal); font-style: normal; }

/* ---------- about and contact ---------- */
.about { padding-block: 96px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 32px 64px; border-top: 1px solid var(--line); }
.about__body { display: grid; gap: 48px; align-content: start; }
.about__portrait { margin: 48px 0 0; display: grid; gap: 12px; max-width: 320px; }
.about__portrait img { width: 100%; height: auto; outline: 1px solid var(--metal); outline-offset: 6px; }
.about__portrait figcaption { font-size: 13px; color: var(--ink-3); line-height: 1.5; margin-top: 8px; }
.about__text { display: grid; gap: 16px; max-width: 60ch; color: var(--ink-2); }
.about__text p:first-child { color: var(--ink); font-size: 24px; line-height: 1.4; }
.about__facts { display: grid; grid-template-columns: max-content 1fr; gap: 12px 32px; font-size: 16px; }
.about__facts dt { color: var(--ink-3); }

.contact { padding-block: 96px 128px; display: grid; gap: 24px; justify-items: start; border-top: 1px solid var(--line); }
.contact__actions { display: flex; align-items: center; gap: 32px; margin-top: 8px; }

.foot { padding: 32px var(--gutter) 48px; font-size: 13px; color: var(--ink-3); border-top: 1px solid var(--line); }

/* ---------- full-size viewer ---------- */
.viewer {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: color-mix(in srgb, var(--bg) 96%, #000); color: var(--ink);
}
.viewer[open] { display: grid; grid-template-rows: 1fr auto; }
.viewer::backdrop { background: rgba(0, 0, 0, 0.6); }
.viewer__frame { position: relative; overflow: hidden; display: grid; place-items: center; padding: 32px var(--gutter) 0; cursor: zoom-in; }
.viewer__frame.is-zoomed { cursor: zoom-out; }
.viewer__frame img { max-width: 100%; max-height: calc(100svh - 160px); object-fit: contain; transition: transform 400ms var(--ease); }
.viewer__bar { display: flex; align-items: center; gap: 32px; padding: 24px var(--gutter); }
.viewer__bar > div { flex: 1; min-width: 0; }
.viewer__title { font: italic 400 24px/1.2 var(--display); }

/* ---------- phones and narrow windows ---------- */
@media (max-width: 899px) {
  .nav { padding: 16px; }
  .nav__name { font-size: 20px; }
  .nav__end { gap: 16px; }
  .stage { height: auto; min-height: 0; overflow: visible; }
  .stage__view { position: relative; height: 56svh; min-height: 360px; overflow: hidden; }
  .stage__fallback { inset: 72px 16px 16px; max-height: none; }
  .caption { position: static; transform: none; width: auto; padding: 24px 16px 0; }
  .caption__title { font-size: 24px; margin-bottom: 8px; }
  .caption__links { margin-top: 16px; }
  .dock { position: static; flex-wrap: wrap; gap: 24px; padding: 24px 16px 0; align-items: flex-end; background: none; border-radius: 0; }
  .dock__next { flex: 1 1 100%; }
  .works { padding: 80px 0; }
  .works__head { grid-template-columns: 1fr; gap: 16px; margin-bottom: 32px; }
  .cloth__row { gap: 32px; padding-inline: 16px; }
  .piece img { height: 180px; }
  .about { grid-template-columns: 1fr; padding-block: 80px; }
  .about__text p:first-child { font-size: 20px; }
  .contact { padding-block: 80px 96px; }
  .contact__actions { flex-wrap: wrap; gap: 24px; }
  .viewer__frame { padding: 16px 16px 0; }
  .viewer__frame img { max-height: calc(100svh - 260px); }
  .viewer__bar { flex-wrap: wrap; gap: 16px 24px; padding: 16px; }
  .viewer__bar > div { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
