@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500&family=Playfair+Display:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; border-color: hsl(var(--border)); }

:root {
  --background: 40 5% 95%;
  --foreground: 0 0% 10%;
  --primary: 220 100% 50%;
  --primary-foreground: 0 0% 100%;
  --muted: 40 4% 88%;
  --muted-foreground: 0 0% 45%;
  --border: 40 4% 82%;
  --ring: 220 100% 50%;
  --radius: 0.5rem;
  --font-display: 'Playfair Display', serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html, body {
  margin: 0;
  height: 100%;
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-mono);
}

.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }

.fixed { position: fixed; }
.absolute { position: absolute; }
.relative { position: relative; }
.inset-0 { inset: 0; }
.top-0 { top: 0; }
.top-6 { top: 1.5rem; }
.top-12 { top: 3rem; }
.top-16 { top: 4rem; }
.bottom-3 { bottom: 0.75rem; }
.bottom-6 { bottom: 1.5rem; }
.bottom-12 { bottom: 3rem; }
.bottom-20 { bottom: 5rem; }
.left-0 { left: 0; }
.left-3 { left: 0.75rem; }
.left-6 { left: 1.5rem; }
.left-12 { left: 3rem; }
.right-6 { right: 1.5rem; }
.right-12 { right: 3rem; }
.top-1\/2 { top: 50%; }
.left-1\/2 { left: 50%; }
.-translate-x-1\/2 { transform: translateX(-50%); }
.-translate-y-1\/2 { transform: translateY(-50%); }
.-top-3 { top: -0.75rem; }
.-left-3 { left: -0.75rem; }

.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-50 { z-index: 50; }

.flex { display: flex; }
.grid { display: grid; }
.hidden { display: none; }
.block { display: block; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-6 { gap: 1.5rem; }

.w-full { width: 100%; }
.w-px { width: 1px; }
.w-1 { width: 0.25rem; }
.w-7 { width: 1.75rem; }
.w-8 { width: 2rem; }
.h-full { height: 100%; }
.h-px { height: 1px; }
.h-1 { height: 0.25rem; }
.h-6 { height: 1.5rem; }
.h-7 { height: 1.75rem; }
.h-16 { height: 4rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-none { max-width: none; }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.pt-6 { padding-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.pb-4 { padding-bottom: 1rem; }

.text-center { text-align: center; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-\[8px\] { font-size: 8px; }
.text-\[9px\] { font-size: 9px; }
.text-\[10px\] { font-size: 10px; }
.text-\[12px\] { font-size: 12px; }
.text-\[14vw\] { font-size: 14vw; }
.text-\[18vw\] { font-size: 18vw; }
.leading-none { line-height: 1; }
.leading-relaxed { line-height: 1.625; }
.link-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  line-clamp: 6;
  overflow: hidden;
  min-height: calc(1.625em * 6);
  max-height: calc(1.625em * 6);
}
.tracking-tight { letter-spacing: -0.025em; }
.tracking-\[-0\.05em\] { letter-spacing: -0.05em; }
.tracking-\[0\.15em\] { letter-spacing: 0.15em; }
.tracking-\[0\.2em\] { letter-spacing: 0.2em; }
.tracking-\[0\.3em\] { letter-spacing: 0.3em; }
.tracking-\[0\.4em\] { letter-spacing: 0.4em; }
.uppercase { text-transform: uppercase; }
.whitespace-nowrap { white-space: nowrap; }
.select-none { user-select: none; }

.bg-background { background-color: hsl(var(--background)); }
.bg-muted { background-color: hsl(var(--muted)); }
.bg-primary { background-color: hsl(var(--primary)); }
.bg-foreground\/\[0\.04\] { background-color: hsl(var(--foreground) / 0.04); }
.bg-foreground\/\[0\.06\] { background-color: hsl(var(--foreground) / 0.06); }
.bg-foreground\/20 { background-color: hsl(var(--foreground) / 0.2); }
.bg-background\/60 { background-color: hsl(var(--background) / 0.6); }
.bg-background\/80 { background-color: hsl(var(--background) / 0.8); }
.bg-gradient-to-t { background-image: linear-gradient(to top, var(--tw-gradient-stops)); }
.from-background\/80 { --tw-gradient-from: hsl(var(--background) / 0.8); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, transparent); }
.to-transparent { --tw-gradient-to: transparent; }

.text-foreground { color: hsl(var(--foreground)); }
.text-primary { color: hsl(var(--primary)); }
.text-muted-foreground { color: hsl(var(--muted-foreground)); }
.text-foreground\/70 { color: hsl(var(--foreground) / 0.7); }
.text-foreground\/80 { color: hsl(var(--foreground) / 0.8); }
.text-muted-foreground\/30 { color: hsl(var(--muted-foreground) / 0.3); }
.text-muted-foreground\/40 { color: hsl(var(--muted-foreground) / 0.4); }
.text-muted-foreground\/50 { color: hsl(var(--muted-foreground) / 0.5); }
.hover\:text-foreground:hover { color: hsl(var(--foreground)); }

.opacity-15 { opacity: 0.15; }
.opacity-\[0\.03\] { opacity: 0.03; }
.opacity-\[0\.06\] { opacity: 0.06; }
.opacity-60 { opacity: 0.6; }
.group:hover .group-hover\:opacity-80 { opacity: 0.8; }

.border { border-width: 1px; }
.border-t { border-top-width: 1px; }
.border-l { border-left-width: 1px; }
.border-border\/20 { border-color: hsl(var(--border) / 0.2); }
.border-border\/30 { border-color: hsl(var(--border) / 0.3); }
.border-border\/40 { border-color: hsl(var(--border) / 0.4); }
.border-border\/70 { border-color: hsl(var(--border) / 0.7); }
.hover\:border-border:hover { border-color: hsl(var(--border)); }
.group:hover .group-hover\:text-foreground { color: hsl(var(--foreground)); }

.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.object-cover { object-fit: cover; }
.aspect-\[4\/3\] { aspect-ratio: 4 / 3; }
.rounded-full { border-radius: 9999px; }
.origin-left { transform-origin: left; }
.origin-top { transform-origin: top; }
.scale-105 { transform: scale(1.05); }
.group:hover .group-hover\:scale-100 { transform: scale(1); }
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }
.backdrop-blur-sm { backdrop-filter: blur(4px); }
.backdrop-blur-xl { backdrop-filter: blur(24px); }
.shrink-0 { flex-shrink: 0; }
.transition-colors { transition-property: color, background-color, border-color; transition-duration: 150ms; }
.transition-opacity { transition-property: opacity; transition-duration: 150ms; }
.transition-transform { transition-property: transform; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }
.duration-500 { transition-duration: 500ms; }
.duration-700 { transition-duration: 700ms; }
.transition-all { transition-property: all; }

.page-root {
  position: fixed;
  inset: 0;
  background-color: hsl(var(--background));
  overflow: hidden;
  user-select: none;
}

.milo-refresh-zone {
  display: none;
}

.page-root--scroll {
  overflow-y: auto;
  overflow-x: hidden;
}

.page-watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  text-align: center;
}

.coordinate-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.border-label {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 4.5rem;
  height: auto;
  min-height: 2rem;
  padding: 0.4rem 0.65rem;
  box-sizing: border-box;
  border: 1px solid hsl(var(--border) / 0.5);
  background-color: hsl(var(--background));
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1;
  white-space: nowrap;
  color: hsl(var(--muted-foreground));
}

.title-border,
.contact-border {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.title-border {
  margin-top: 3rem;
  margin-bottom: 1rem;
}

.contact-border {
  margin-top: 4rem;
  margin-bottom: 3rem;
}

.title-border::before,
.contact-border::before {
  content: '';
  position: absolute;
  left: 3rem;
  right: 3rem;
  top: 50%;
  height: 1px;
  background-color: hsl(var(--foreground) / 0.04);
}

.border-label--contact {
  pointer-events: auto;
  text-decoration: none;
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
}

.border-label--contact:hover {
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

.page-scroll-border {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  margin: 3rem;
  border: 1px solid hsl(var(--border));
  background-color: transparent;
}

.page-scroll-contact {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 2;
  transform: translate(-50%, 50%);
  font-size: 10px;
  letter-spacing: 0.3em;
  pointer-events: auto;
  user-select: auto;
}

.page-scroll-contact.is-address {
  text-transform: none;
  letter-spacing: 0.04em;
}

.btn-text {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border) / 0.4);
  background-color: hsl(var(--background) / 0.6);
  backdrop-filter: blur(4px);
  padding: 0.375rem 0.75rem;
  transition: color 150ms, border-color 150ms;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-text:hover {
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

.details-panel {
  position: fixed;
  right: 0;
  top: 4rem;
  bottom: 0;
  width: 100%;
  z-index: 30;
  backdrop-filter: blur(24px);
  background-color: hsl(var(--background) / 0.8);
  border-left: 1px solid hsl(var(--border) / 0.3);
  border-top: 1px solid hsl(var(--border) / 0.3);
  transform: translateX(100%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
.details-panel.is-open {
  transform: translateX(0);
  opacity: 1;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: hsl(var(--background));
  z-index: 10;
}

.loading-bar {
  width: 1px;
  height: 4rem;
  background-color: hsl(var(--foreground) / 0.2);
  position: relative;
  overflow: hidden;
}

.loading-fill {
  width: 100%;
  background-color: hsl(var(--primary));
  position: absolute;
  top: 0;
  left: 0;
  transition: height 0.3s;
}

.corner-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.corner-btn span.label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  transition: color 0.3s;
  color: hsl(var(--muted-foreground));
}
.corner-btn:hover span.label { color: hsl(var(--foreground)); }
.corner-btn span.underline {
  display: block;
  height: 1px;
  margin-top: 0.25rem;
  transition: all 0.5s;
  width: 0;
  background-color: hsl(var(--foreground) / 0.3);
}
.corner-btn:hover span.underline { width: 100%; }
.corner-btn.is-active span.label { color: hsl(var(--primary)); }
.corner-btn.is-active span.underline { width: 100%; background-color: hsl(var(--primary)); }

.prose-content {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  line-height: 1.625;
  max-width: none;
}
.prose-content img { max-width: 100%; height: auto; }

model-viewer {
  cursor: grab !important;
  width: 100%;
  height: 100%;
  background-color: #F2F2F0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

model-viewer.is-grabbing {
  cursor: grabbing !important;
}

img, model-viewer, video {
  -webkit-touch-callout: none;
  pointer-events: auto;
}
img {
  user-select: none;
  -webkit-user-drag: none;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: hsl(var(--muted-foreground) / 0.3);
  border-radius: 2px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleXIn {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes scaleYIn {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.animate-fade-in-delayed { animation: fadeIn 1s ease 2s both; }
.animate-scale-x { animation: scaleXIn 1.5s ease-out 1.5s both; }
.animate-scale-x-delayed { animation: scaleXIn 1.5s ease-out 1.7s both; }
.animate-scale-y { animation: scaleYIn 1.5s ease-out 1.6s both; }
.animate-scale-y-delayed { animation: scaleYIn 1.5s ease-out 1.8s both; }
.animate-fade-up { animation: fadeUp 0.5s ease both; }

@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:w-96 { width: 24rem; }
  .sm\:text-\[10vw\] { font-size: 10vw; }
  .sm\:text-\[11vw\] { font-size: 11vw; }
  .sm\:text-\[15vw\] { font-size: 15vw; }
  .sm\:hidden { display: none; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 639px) {
  .details-panel { width: 100%; }

  /* Milo: readable text + tap targets on mobile (fonts ~3/4 prior size) */
  body.viewer-master-template .btn-text {
    font-size: 10.5px;
    letter-spacing: 0.18em;
    padding: 0.65rem 0.9rem;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
  }

  body.viewer-master-template .corner-btn {
    padding: 0.5rem 0;
    min-height: 2.75rem;
  }

  body.viewer-master-template .corner-btn span.label {
    font-size: 10.5px;
    letter-spacing: 0.18em;
  }

  body.viewer-master-template .viewer-page-title p,
  body.viewer-master-template .viewer-page-title .text-\[12px\] {
    font-size: 11.25px;
    letter-spacing: 0.15em;
    font-weight: 700;
  }

  /* Milo: pull Audio Description closer to Back */
  body.viewer-master-template #audio-btn {
    margin-top: -0.4rem;
  }

  /* Milo: raise top controls; leave ~one button of space above the model */
  body.viewer-master-template .fixed.top-6.left-6,
  body.viewer-master-template .fixed.top-6.right-6 {
    top: max(0.35rem, env(safe-area-inset-top, 0px));
  }

  body.viewer-master-template .page-root > .absolute.inset-0 {
    top: calc(max(0.35rem, env(safe-area-inset-top, 0px)) + 2.75rem + 2.75rem);
  }

  body.viewer-master-template .prose-content {
    font-size: 0.796875rem;
    line-height: 1.7;
  }

  body.viewer-master-template #loading-progress {
    font-size: 0.65625rem;
  }

  /* Milo: title centered above More Details on mobile */
  body.viewer-master-template .viewer-page-title {
    top: auto;
    bottom: 3.75rem;
  }

  /* Milo: top 10% ignores model touch so pull-to-refresh can work */
  body.viewer-master-template .milo-refresh-zone {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 10%;
    z-index: 5;
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
  }

  body.viewer-master-template {
    overscroll-behavior-y: auto;
  }

  body.viewer-master-template .page-root {
    overscroll-behavior-y: auto;
  }

  /* Milo: centered solid details scroll (~50%) with space around */
  body.viewer-master-template .details-panel {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: 78%;
    height: 50%;
    max-width: 22rem;
    max-height: 50%;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--border) / 0.45);
    border-radius: 0.25rem;
    box-shadow: 0 12px 40px hsl(0 0% 0% / 0.12);
    transform: translate(-50%, -46%) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  }

  body.viewer-master-template .details-panel.is-open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
  }

  body.viewer-master-template .details-panel > div {
    padding: 1rem;
    min-height: 0;
  }

  body.viewer-master-template .details-panel .mb-10 {
    margin-bottom: 0.75rem;
  }

  body.viewer-master-template .details-panel h2 {
    font-size: 1.125rem;
  }

  body.viewer-master-template .details-panel .flex-1.overflow-y-auto {
    border: 1px solid hsl(var(--border) / 0.55);
    padding: 0.75rem;
    margin: 0;
    min-height: 0;
  }

  body.viewer-master-template .details-close--back {
    position: static;
    align-self: flex-start;
    margin-bottom: 0.75rem;
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: hsl(var(--muted-foreground));
    border: 1px solid hsl(var(--border) / 0.4);
    background-color: hsl(var(--background));
    padding: 0.65rem 0.9rem;
    min-height: 2.75rem;
  }

  body.viewer-master-template .details-close--back:hover {
    color: hsl(var(--foreground));
    border-color: hsl(var(--border));
  }
}

@media (min-width: 640px) {
  .details-panel { width: 24rem; }
}

.group { position: relative; }

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

button { font: inherit; }

#details-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}
