/* === Reset === */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

/* === Dark theme + hide native cursor === */
body {
  background: #000;
  color: #f5f5f5;
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
    "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

html.has-custom-cursor body,
html.has-custom-cursor a,
html.has-custom-cursor button,
html.has-custom-cursor input,
html.has-custom-cursor textarea {
  cursor: none;
}

html:not(.has-custom-cursor) .cursor-dot,
html:not(.has-custom-cursor) .cursor-blur {
  display: none !important;
}

/* === Left‑locked text column === */

.page {
  max-width: 460px;
  margin-top: 40px;
  margin-left: 60px;
  padding-bottom: 80px;
  position: relative;
  z-index: 1; /* keep text above background/sim but below cursor */
}

@media (max-width: 600px) {
  .page {
    margin-top: 24px;
    margin-left: 24px;
    max-width: calc(100% - 48px);
  }
}

.intro-line {
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 1.1rem;
}

.quote-line {
  margin: 0 0 1.4rem;
  font-style: italic;
  color: #cccccc;
}

.line {
  margin: 0 0 0.4rem;
}

.line-gallery {
  margin: 0.95rem 0 0.95rem;
}

/* Simple link style */
a {
  color: #f5f5f5;
  text-decoration: none;
  border-bottom: 1px solid rgba(245, 245, 245, 0.4);
}

a:hover {
  border-bottom-color: rgba(245, 245, 245, 0.9);
}

/* === Cursor blur lens (blurs everything under it) === */

/* .cursor-blur {
  position: fixed;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 19;

  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  /* important: no background color */
  /*background: transparent;
} */

/* === Custom cursor dot === */

.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid #f5f5f5;
  background: transparent;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  transition:
    opacity 0.2s ease-out,
    background 0.2s ease-out,
    border-color 0.2s ease-out,
    transform 0.2s ease-out;
  z-index: 20;  /* ALWAYS above the simulation */
}

.cursor-dot.is-visible {
  opacity: 1;
}

.cursor-dot--link {
  background: #f5f5f5;
  border-color: #f5f5f5;
  transform: translate(-50%, -50%) scale(1.6);
}

/* === Centered sandpile simulation === */

.sim-wrapper {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(60vmin, 480px);
  height: min(60vmin, 480px);
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0; /* behind everything except background */
}

#sandpile {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;  /* keep it crisp blocky */
  border-radius: 8px;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.7);
  border: none;               /* remove faint border */
  outline: none;
  display: block;
}

/* === Project page (video-focused) === */

.project-nav {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 2;
}

.project-nav a {
  color: #f5f5f5;
  text-decoration: none;
  border-bottom: 1px solid rgba(245, 245, 245, 0.4);
}

.project-nav a:hover {
  border-bottom-color: rgba(245, 245, 245, 0.9);
}

.project-hero {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  box-sizing: border-box;
}

.video-hero {
  width: min(90vw, 1200px);
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.85);
}

.video-hero iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-embed-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 48%),
    linear-gradient(180deg, rgba(20, 20, 20, 0.98), rgba(0, 0, 0, 0.98));
}

.video-embed-fallback__eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(245, 245, 245, 0.55);
}

.video-embed-fallback__title {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 500;
  color: #f5f5f5;
}

.video-embed-fallback__text {
  margin: 0;
  max-width: 40ch;
  color: rgba(245, 245, 245, 0.75);
}

.video-embed-fallback__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.video-embed-fallback__hint {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(245, 245, 245, 0.5);
}

.project-meta {
  margin-top: 20px;
  max-width: 720px;
  text-align: center;
}

.project-meta h1 {
  font-size: 1.2rem;
  font-weight: 500;
  margin: 0 0 6px;
}

.project-meta p {
  margin: 0;
  color: #cccccc;
  font-size: 0.95rem;
}

/* === Project text block === */

.project-text {
  margin-top: 20px;
  max-width: 860px;   /* keeps paragraphs square & readable */
}

.project-text p {
  margin: 0 0 14px;
  max-width: 860px;

  font-size: 0.95rem;
  line-height: 1.55;
  color: #e0e0e0;

  text-align: justify;
  text-justify: inter-word;

  /* These are the key bits */
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;

  word-break: normal;
  overflow-wrap: break-word;
}

.project-text p:last-child {
  margin-bottom: 0;
}

/* === Blur + fade reveal animation (Microcosm page) === */

/* === Blur + fade reveal (general) === */
.reveal {
  opacity: 0;
  filter: blur(14px);
  transform: translateY(10px);
  transition:
    opacity 700ms ease,
    filter 900ms ease,
    transform 700ms ease;
  will-change: opacity, filter, transform;
}

.reveal.is-visible {
  opacity: 1;
  filter: blur(0px);
  transform: translateY(0);
}

/* === Slide in from RIGHT to LEFT (matches ← arrow direction) === */
.reveal-right {
  opacity: 0;
  filter: blur(14px);
  transform: translateX(18px);
  transition:
    opacity 700ms ease,
    filter 900ms ease,
    transform 700ms ease;
  will-change: opacity, filter, transform;
}

.reveal-right.is-visible {
  opacity: 1;
  filter: blur(0px);
  transform: translateX(0);
}
.reveal-left.is-visible {
  opacity: 1;
  filter: blur(0px);
  transform: translateX(0);
}

/* On narrow screens, don't vertically center project pages */
@media (max-width: 900px) {
  .project-hero {
    justify-content: flex-start;
    padding-top: 96px;   /* space for the fixed back button */
    padding-bottom: 48px;
  }
}

/* === Project subheading (references / context) === */

.project-subhead {
  margin: 4px 0 16px;
  font-size: 0.8rem;
  font-style: italic;
  color: rgba(245, 245, 245, 0.65);
  line-height: 1.4;
}


/* Blocky highlight that hugs the text width */
.hl {
  display: inline;
  background: rgba(0, 0, 0, 0.85);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  padding: 0.08em 0.18em;
  border-radius: 3px;
}

/* Optional: make links inside highlights look clean */
.hl a {
  border-bottom-color: rgba(245, 245, 245, 0.55);
}
.hl a:hover {
  border-bottom-color: rgba(245, 245, 245, 0.95);
}

/*/* Local project video fits the same frame as YouTube embeds */
.project-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border: 0;
}

/* === Video forward / back arrows === */

.video-nav {
  margin: 14px 0 6px;
  display: flex;
  justify-content: center;
  gap: 32px;
}

.video-arrow {
  background: transparent;
  border: none;
  color: #f5f5f5;
  font: inherit;
  font-size: 1rem;
  padding: 2px 6px;

  font-weight: 400;
  transition:
    font-weight 200ms ease,
    transform 200ms ease,
    opacity 200ms ease;
}

.video-arrow:hover {
  font-weight: 700;
  transform: translateY(-1px);
}

/* Sound UI */
/* === Sound toggle (minimal) === */

.sound-toggle {
  background: transparent;
  border: none;
  color: rgba(245,245,245,0.85);
  font: inherit;
  font-size: 0.85rem;
  font-style: italic;
  padding: 2px 6px;

  transition:
    font-weight 200ms ease,
    opacity 200ms ease,
    transform 200ms ease;
}

.sound-toggle:hover {
  font-weight: 700;
  transform: translateY(-1px);
}

.sound-toggle--icon {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  color: rgba(245, 245, 245, 0.82);
  font-size: 0;
  font-style: normal;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sound-toggle--icon .sound-icon {
  position: absolute;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 180ms ease;
}

.sound-toggle--icon.is-muted .sound-icon-muted,
.sound-toggle--icon.is-unmuted .sound-icon-unmuted {
  opacity: 1;
}

.video-arrow:disabled,
.sound-toggle:disabled {
  opacity: 0.45;
  transform: none;
}

.microcosm-title-jump {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  line-height: inherit;
  border-bottom: 1px solid transparent;
  transition:
    border-color 180ms ease,
    opacity 180ms ease;
}

.microcosm-title-jump:hover {
  border-bottom-color: rgba(245, 245, 245, 0.8);
}

.microcosm-title-jump.is-active {
  border-bottom-color: rgba(245, 245, 245, 0.45);
}

.video-hero--microcosm {
  position: relative;
}

.microcosm-audio-btn {
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.18);
  color: rgba(245, 245, 245, 0.85);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.microcosm-audio-btn.is-visible {
  opacity: 0.92;
  pointer-events: auto;
}

.microcosm-audio-btn:hover {
  background: rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.microcosm-audio-icon {
  position: absolute;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 160ms ease;
}

.microcosm-audio-hotspot {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 25%;
  height: 25%;
}

.microcosm-audio-btn.is-muted .microcosm-audio-icon-muted,
.microcosm-audio-btn.is-unmuted .microcosm-audio-icon-unmuted {
  opacity: 1;
}

.microcosm-audio-btn:disabled {
  transform: none;
}

.microcosm-meta {
  margin-top: 10px;
}

.microcosm-controls {
  margin: 4px 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.microcosm-scenes {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.microcosm-scene-btn {
  background: transparent;
  border: 0;
  padding: 1px 4px;
  color: rgba(245, 245, 245, 0.62);
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  transition:
    color 180ms ease,
    opacity 180ms ease,
    transform 180ms ease;
}

.microcosm-scene-btn:hover {
  color: rgba(245, 245, 245, 0.92);
  transform: translateY(-1px);
}

.microcosm-scene-btn.is-active {
  color: #f5f5f5;
  font-weight: 700;
}

.microcosm-video {
  opacity: 1;
  transition: opacity 1000ms ease;
}

.microcosm-video.is-screen-faded {
  opacity: 0;
}

/* === Intrinsik page === */

.intrinsik-page {
  justify-content: flex-start;
  padding-top: 110px;
  padding-bottom: 56px;
}

.intrinsik-meta {
  margin-top: 18px;
}

.intrinsik-title-link {
  border-bottom-color: rgba(245, 245, 245, 0.85);
}

.intrinsik-title-link:hover {
  border-bottom-color: rgba(245, 245, 245, 1);
}

.intrinsik-portraits {
  width: min(1100px, 100%);
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.intrinsik-portrait-card {
  margin: 0;
  overflow: hidden;
  border-radius: 14px;
  background: #050505;
  box-shadow: 0 0 36px rgba(0, 0, 0, 0.72);
  outline: 0;
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    opacity 220ms ease;
}

.intrinsik-portrait-card:hover,
.intrinsik-portrait-card:focus-visible,
.intrinsik-portrait-card.is-playing {
  transform: translateY(-3px);
  box-shadow: 0 0 42px rgba(0, 0, 0, 0.88);
}

.intrinsik-portrait-media {
  --ratio: 9 / 16;
  background: #050505;
}

.intrinsik-portrait-card .g-thumb,
.intrinsik-portrait-card .g-vid {
  object-fit: cover;
  background: #050505;
}

.intrinsik-copy {
  width: min(860px, 100%);
  margin-top: 24px;
}

.intrinsik-landscape {
  width: min(1100px, 100%);
  margin-top: 38px;
}

.intrinsik-landscape-shell {
  position: relative;
  width: 100%;
}

.intrinsik-landscape-controls {
  margin-top: 10px;
}

.intrinsik-landscape-video {
  opacity: 1;
  transition:
    opacity 450ms ease,
    filter 450ms ease;
}

.intrinsik-landscape-video.is-screen-faded {
  opacity: 0;
  filter: blur(6px);
}

.intrinsik-copy--landscape {
  margin-top: 20px;
}

.intrinsik-landscape-subhead {
  width: min(860px, 100%);
  margin: 18px 0 0;
  font-size: 0.95rem;
  font-style: italic;
  color: #cccccc;
  line-height: 1.4;
  text-align: center;
}

/* === Gallery page === */

.gallery-wrap {
  min-height: 100vh;
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 88px 24px 40px;
}

.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.gallery-head h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
}

.gallery-size {
  width: min(220px, 45vw);
}

.gallery-slider {
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.gallery-slider::-webkit-slider-runnable-track {
  height: 1px;
  background: rgba(245, 245, 245, 0.72);
}

.gallery-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-radius: 999px;
  border: 1px solid #f5f5f5;
  background: rgba(0, 0, 0, 0.98);
}

.gallery-slider::-moz-range-track {
  height: 1px;
  background: rgba(245, 245, 245, 0.72);
}

.gallery-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid #f5f5f5;
  background: rgba(0, 0, 0, 0.98);
}

.gallery-grid {
  --gallery-unit: 250px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--gallery-unit), 1fr));
  grid-auto-flow: row;
  grid-auto-rows: auto;
  gap: 20px;
  align-items: stretch;
}

.g-tile {
  appearance: none;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  overflow: hidden;
  text-align: left;
  grid-column: span 1;
}

.g-tile:hover {
  opacity: 0.96;
}

.g-tile.is-landscape {
  grid-column: span 2;
}

.g-media {
  position: relative;
  width: 100%;
  aspect-ratio: var(--ratio, 1 / 1);
  background: transparent;
}

.g-audio-icon {
  position: absolute;
  left: 10px;
  bottom: 10px;
  width: 26px;
  height: 26px;
  color: rgba(245, 245, 245, 0.82);
  background: rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  padding: 4px;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 180ms ease;
}

.g-audio-hotspot {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 84px;
  height: 84px;
  z-index: 3;
}

.g-audio-icon.is-visible {
  opacity: 0.84;
}

.g-audio-icon svg {
  position: absolute;
  inset: 3px;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 180ms ease;
}

.g-audio-icon.is-muted .g-audio-icon-muted,
.g-audio-icon.is-unmuted .g-audio-icon-unmuted {
  opacity: 1;
}

.g-thumb,
.g-vid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.g-thumb {
  opacity: 1;
  transition: opacity 220ms ease;
}

.g-vid {
  opacity: 0;
  transition: opacity 220ms ease;
}

.g-tile.is-playing .g-thumb {
  opacity: 0;
}

.g-tile.is-playing .g-vid {
  opacity: 1;
}

.g-tile.no-thumb .g-thumb {
  display: none;
}

@media (max-width: 760px) {
  .intrinsik-portraits {
    grid-template-columns: 1fr;
    max-width: 420px;
    gap: 14px;
  }

  .intrinsik-page {
    padding-top: 96px;
  }

  .gallery-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .gallery-size {
    width: min(260px, 100%);
  }
}

@media (max-width: 560px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .g-tile.is-landscape,
  .g-tile.is-portrait {
    grid-column: span 1;
  }
}
