/* Cinematic experience, v57.
   Owns the opening's image planes, viewer, detail loupe and history overview.
   Existing page content and gallery order remain in their original HTML. */

:root {
  --glass-line: rgba(215, 234, 223, 0.18);
  --glass-fill: rgba(20, 34, 39, 0.65);
}

/* A fixed crop, with translation on separate planes. No animated image scale. */
.hero { isolation: isolate; }
.hero-image,
.hero-foreground {
  position: absolute;
  inset: -60px;
  background: none;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}
.hero-image { z-index: 0; }
.hero-foreground { z-index: 3; }
.hero-image > img,
.hero-foreground > img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 57% center;
  transform: none;
}
.hero-foreground {
  -webkit-mask: url("cinematic/starport-near.svg") 57% center / cover no-repeat;
  mask: url("cinematic/starport-near.svg") 57% center / cover no-repeat;
}
.hero-image::after,
.hero-foreground::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 14, 19, 0.91), rgba(5, 14, 19, 0.48) 39%, rgba(5, 14, 19, 0.03) 75%),
    linear-gradient(0deg, #090f12, transparent 32%),
    linear-gradient(180deg, rgba(4, 11, 17, 0.2), transparent 25%);
}
.hero-content { z-index: 2; }
.hero-bottom { z-index: 5; }
.hero-atmosphere { z-index: 4; pointer-events: none; }
.hero-monogram {
  display: block;
  width: 38px;
  height: 40px;
  margin-bottom: 28px;
  stroke: #c6ded2;
  stroke-width: 8;
  stroke-linejoin: miter;
  opacity: 0.8;
}
.hero-monogram path {
  stroke-dasharray: 1000;
  animation: monogram-trace 1700ms var(--scene-ease) both;
}
.hero-copy h1 {
  animation: name-arrival 1300ms var(--scene-ease) 100ms both;
}
@keyframes monogram-trace {
  from { stroke-dashoffset: 1000; opacity: 0; }
  to { stroke-dashoffset: 0; opacity: 1; }
}
@keyframes name-arrival {
  from { opacity: 0; clip-path: inset(0 0 100% 0); transform: translateY(18px); }
  to { opacity: 1; clip-path: inset(0); transform: translateY(0); }
}

/* Small diagonal terminals echo the monogram, only at chapter boundaries. */
.section-heading::after,
.projects-chapter-heading::after {
  height: 3px;
  background: linear-gradient(90deg, rgba(188, 228, 213, 0.45), rgba(188, 228, 213, 0.06) 80%);
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 100%, 3px 100%);
}
.project-art { position: relative; overflow: hidden; }
.project-info { gap: 18px; }
.project-artstation {
  display: grid;
  flex: none;
  place-items: center;
  align-self: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--glass-line);
  background: rgba(19, 32, 38, 0.6);
  border-radius: 8px;
  transition: background-color 180ms ease, border-color 180ms ease;
}
.project-artstation img { display: block; width: 20px; height: 20px; }
.project-artstation:is(:hover, :focus-visible) {
  border-color: #13aff0;
  background: rgba(19, 175, 240, 0.12);
}
.project-view { opacity: 0; transition: opacity 180ms ease; }
.project-art:is(:hover, :focus-visible) .project-view { opacity: 1; }

/* The viewer keeps full originals, gallery context, and optional reading space. */
.image-lightbox {
  width: min(98vw, 1920px);
  max-width: 98vw;
  height: 94vh;
  height: 94svh;
  max-height: 94svh;
  margin: auto;
  padding: 14px;
  border: 1px solid var(--glass-line);
  border-radius: 12px;
  color: #edf3ec;
  background: rgba(8, 16, 21, 0.97);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}
.image-lightbox[open] {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.image-lightbox::backdrop {
  background: rgba(3, 8, 11, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
body.lightbox-open { overflow: hidden; }
.lightbox-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-width: 0;
}
.lightbox-heading { margin-right: auto; min-width: 0; }
.lightbox-title {
  max-width: 62ch;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  line-height: 1.5;
  font-weight: 600;
}
.lightbox-status {
  margin: 2px 0 0;
  color: #a4b8b7;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
}
.lightbox-toolbar button,
.lightbox-detail-link {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--glass-line);
  border-radius: 7px;
  color: #ecf3ee;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  font: 500 0.8rem system-ui, sans-serif;
}
.lightbox-toolbar button:hover,
.lightbox-toolbar button[aria-pressed="true"],
.lightbox-toolbar button[aria-expanded="true"] { background: rgba(188, 228, 213, 0.13); }
.lightbox-toolbar button:disabled { opacity: 0.3; cursor: default; }
.lightbox-toolbar .lightbox-close { position: static; width: 42px; padding: 0; font-size: 24px; }
.lightbox-content { display: flex; gap: 14px; flex: 1; min-width: 0; min-height: 0; }
.lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #04090c;
  border-radius: 4px;
}
.lightbox-stage > img {
  display: block;
  flex: none;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  transform: translate3d(var(--pan-x, 0px), var(--pan-y, 0px), 0) scale(var(--viewer-zoom, 1));
}
.lightbox-stage.is-zoomed { cursor: grab; touch-action: none; }
.lightbox-stage.is-dragging { cursor: grabbing; }
.lightbox-stage.is-loading::after {
  content: 'Loading original';
  position: absolute;
  bottom: 16px;
  padding: 8px 12px;
  background: rgba(8, 17, 21, 0.88);
  border: 1px solid var(--glass-line);
  border-radius: 5px;
  color: #b7c9c3;
  font-size: 0.7rem;
}
.lightbox-error { max-width: 30ch; padding: 24px; color: #c8d0ca; font-size: 0.9rem; text-align: center; }
.lightbox-details {
  flex: 0 0 clamp(250px, 23vw, 340px);
  padding: 26px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--glass-line);
  border-radius: 5px;
  background: var(--glass-fill);
  scrollbar-width: thin;
}
.lightbox-details[hidden],
.image-lightbox [hidden] { display: none; }
.lightbox-details h3 { margin: 0 0 24px; font-size: 1.25rem; line-height: 1.3; letter-spacing: -0.02em; }
.lightbox-details p { margin: 0 0 18px; color: #bbc9c3; font-size: 0.86rem; line-height: 1.8; }
.lightbox-details .personal-work-software { justify-content: start; margin: 24px 0; max-width: none; }
.lightbox-details .software-tooltip { left: 0; right: auto; }
.lightbox-detail-link { display: inline-flex; gap: 10px; text-decoration: none; margin-top: 6px; }
.lightbox-detail-link img { width: 18px; height: 18px; }
.lightbox-thumbnails {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  flex: none;
  height: 60px;
  padding: 3px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.lightbox-thumb {
  display: block;
  flex: 0 0 auto;
  width: 84px;
  height: 50px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  overflow: hidden;
  opacity: 0.5;
  background: #101b21;
  cursor: pointer;
}
.lightbox-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lightbox-thumb[aria-current="true"] { border-color: #c0dfce; opacity: 1; }
.lightbox-thumb:hover { opacity: 1; }
.image-lightbox :focus-visible { outline: 2px solid #badfca; outline-offset: 2px; }

/* Actual image pixels inside a movable, restrained glass magnifier. */
.photo-grid figure { position: relative; }
.detail-toggle {
  position: absolute;
  z-index: 4;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid rgba(230, 241, 229, 0.22);
  border-radius: 7px;
  color: #e0e9e2;
  background: rgba(6, 17, 21, 0.75);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  font: 500 0.68rem system-ui, sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.detail-toggle svg { width: 14px; height: 14px; }
.detail-toggle[aria-pressed="true"] { border-color: #c0dfce; background: rgba(27, 50, 52, 0.92); }
.detail-loupe {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  width: var(--loupe-size, 176px);
  height: var(--loupe-size, 176px);
  border: 1px solid rgba(227, 244, 235, 0.7);
  border-radius: 50%;
  background-repeat: no-repeat;
  background-color: #081318;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), 0 0 0 5px rgba(230, 241, 229, 0.05);
  pointer-events: none;
  opacity: 0;
}
.detail-loupe.is-visible { opacity: 1; }
.photo-grid figure.is-inspecting > .image-expand > img { transform: none; }
.detail-hint {
  position: absolute;
  z-index: 4;
  top: 58px;
  left: 14px;
  max-width: 38ch;
  padding: 7px 10px;
  border-radius: 5px;
  background: rgba(6, 17, 21, 0.9);
  color: #d5e3da;
  font-size: 0.65rem;
  pointer-events: none;
}
.detail-hint[hidden] { display: none; }

/* A model, its silhouette, and glass occupy different depths on this page. */
.projects-page .projects-opening {
  position: relative;
  overflow: hidden;
  min-height: 760px;
  padding-bottom: 38px;
  background:
    radial-gradient(ellipse at 74% 47%, rgba(136, 114, 76, 0.1), transparent 52%),
    #0d171b;
}
.projects-opening > .shell { position: relative; }
.projects-opening h1 { position: relative; z-index: 3; max-width: 8ch; pointer-events: none; }
.projects-feature { position: absolute; inset: -80px -5% 5px 34%; }
.projects-feature-model {
  position: absolute;
  inset: -35px 0 auto auto;
  width: min(100%, 770px);
  height: 650px;
  object-fit: contain;
  object-position: center bottom;
  opacity: 0.9;
  transform: translate3d(var(--model-x, 0px), var(--model-y, 0px), 0);
  -webkit-mask-image: linear-gradient(#000 85%, transparent);
  mask-image: linear-gradient(#000 85%, transparent);
}
.projects-feature .projects-feature-glass {
  position: absolute;
  z-index: 4;
  right: 2%;
  bottom: 66px;
  width: min(300px, 65%);
  padding: 25px;
  border: 1px solid rgba(228, 208, 177, 0.3);
  border-radius: 3px 3px 3px 20px;
  background: rgba(19, 31, 35, 0.64);
  -webkit-backdrop-filter: blur(22px) saturate(115%);
  backdrop-filter: blur(22px) saturate(115%);
  box-shadow: inset 0 1px 0 rgba(244, 227, 203, 0.07), 0 20px 70px rgba(0, 0, 0, 0.16);
}
.projects-feature-glass .eyebrow { font-size: 0.59rem; margin: 0 0 12px; }
.projects-feature-glass h2 { margin: 0 0 10px; font-size: 1.9rem; letter-spacing: -0.04em; }
.projects-feature-glass > p:not(.eyebrow) { margin: 0 0 18px; color: #b9c5be; font-size: 0.79rem; line-height: 1.8; }
.projects-feature-glass a { font-size: 0.74rem; }
.projects-opening-bottom { position: relative; z-index: 5; margin-top: 170px; }

/* A generated overview reads the editable year rows as its source of truth. */
.history-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(260px, 0.8fr);
  margin: 48px 0 32px;
  border: 1px solid var(--glass-line);
  border-radius: 3px 3px 3px 20px;
  overflow: hidden;
  background: rgba(20, 34, 39, 0.58);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.history-overview-image {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #080f13;
}
.history-overview-image > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.history-overview-year {
  position: absolute;
  bottom: 18px;
  left: 22px;
  margin: 0;
  padding: 4px 12px;
  color: #e0eade;
  background: rgba(5, 14, 19, 0.75);
  border-left: 2px solid #aecdbf;
  font-size: clamp(1.8rem, 3.4vw, 3.3rem);
  letter-spacing: -0.05em;
  line-height: 1.2;
}
.history-overview-details { padding: clamp(22px, 3vw, 40px); min-width: 0; }
.history-overview [hidden] { display: none; }
.history-overview-details > .eyebrow { margin: 0 0 24px; font-size: 0.62rem; }
.history-overview-specs { margin: 0; }
.history-overview-specs > div { position: relative; margin: 0 0 20px; padding-left: 12px; border-left: 1px solid rgba(220, 238, 226, 0.12); }
.history-overview-specs dt { margin: 0 0 5px; color: #849e9d; font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; }
.history-overview-specs dd { margin: 0; color: #c8d4cc; font-size: 0.8rem; line-height: 1.5; }
.history-overview-specs dd span { display: block; }
.history-overview-specs dd span + span { margin-top: 3px; color: #92aaa3; font-size: 0.7rem; }
.history-overview-specs .has-changed { border-left-color: #c7e3bc; }
.history-overview-specs .has-changed dt { color: #c7e3bc; }
.history-change-note { margin: 0 0 18px; color: #8eaaa3; font-size: 0.65rem; line-height: 1.6; }
.history-overview-details .text-link { font-size: 0.75rem; }
.history-scrubber {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 22px;
  border-top: 1px solid var(--glass-line);
}
.history-scrubber label { font-size: 0.7rem; color: #acc4b8; }
.history-scrubber input { width: 100%; margin: 0; accent-color: #bdd8c4; cursor: pointer; }
.history-scrubber select {
  min-width: 88px;
  padding: 9px 10px;
  border: 1px solid var(--glass-line);
  border-radius: 5px;
  color: #dce8de;
  background: #122127;
  font: inherit;
  font-size: 0.8rem;
}
.typing-waveform { display: block; width: 100%; height: 44px; margin-top: 16px; opacity: 0.75; }

@media (hover: none) {
  .project-view { opacity: 1; }
}
@media (max-width: 1000px) {
  .projects-opening h1 { font-size: clamp(4rem, 9.5vw, 7rem); }
  .projects-feature { inset: -30px -9% 5px 30%; }
  .projects-feature-model { height: 600px; }
  .projects-feature .projects-feature-glass { right: 9%; bottom: 40px; }
  .history-overview { grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.8fr); }
}
@media (max-width: 760px) {
  .hero-image > img, .hero-foreground > img { object-position: 60% center; }
  .hero-foreground { -webkit-mask-position: 60% center; mask-position: 60% center; }
  .hero-image::after, .hero-foreground::after {
    background: linear-gradient(90deg, rgba(5, 14, 19, 0.85), rgba(5, 14, 19, 0.28)), linear-gradient(0deg, #090f12, transparent 40%);
  }
  .hero-monogram { width: 30px; height: 32px; margin-bottom: 20px; }
  .hero-copy h1 { font-size: clamp(4rem, 12vw, 5.8rem); }
  .image-lightbox { width: 100vw; max-width: 100vw; height: 100svh; max-height: 100svh; padding: 10px; border-radius: 0; }
  .image-lightbox[open] { gap: 8px; }
  .lightbox-toolbar { flex-wrap: wrap; gap: 6px; }
  .lightbox-heading { flex: 1 1 calc(100% - 50px); }
  .lightbox-toolbar button { height: 38px; min-width: 38px; padding: 0 11px; }
  .lightbox-toolbar .lightbox-close { order: -1; margin-left: auto; width: 38px; }
  .lightbox-heading { order: -2; }
  .lightbox-content { position: relative; }
  .lightbox-details { position: absolute; inset: 0 0 0 auto; z-index: 2; width: min(100%, 340px); background: rgba(12, 25, 31, 0.97); }
  .lightbox-title { font-size: 0.8rem; }
  .lightbox-thumbnails { height: 54px; }
  .lightbox-thumb { width: 72px; height: 44px; }
  .projects-page .projects-opening { min-height: 0; padding-bottom: 32px; }
  .projects-opening h1 { max-width: none; margin-bottom: 0; }
  .projects-feature { position: relative; inset: auto; height: 510px; margin: -22px -5% 0; }
  .projects-feature-model { width: 100%; height: 490px; inset: 0; }
  .projects-feature .projects-feature-glass { bottom: 10px; right: 6%; width: min(280px, 68%); padding: 20px; }
  .projects-opening-bottom { margin-top: 22px; align-items: center; }
  .projects-opening-bottom p { max-width: 28ch; font-size: 0.86rem; }
  .history-overview { grid-template-columns: minmax(0, 1fr); }
  .history-overview-image { aspect-ratio: 4 / 3; }
  .history-overview-details { padding: 24px; }
  .history-overview-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
  .history-scrubber { padding: 18px; gap: 10px; }
}
@media (max-width: 420px) {
  .history-overview-specs { grid-template-columns: 1fr; }
  .history-scrubber label { display: none; }
  .history-scrubber { grid-template-columns: minmax(0, 1fr) auto; }
  .detail-toggle { top: 10px; left: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-image, .hero-foreground { transform: none !important; will-change: auto; }
  .hero-copy h1, .hero-monogram path { animation: none; }
  .hero-monogram path { stroke-dashoffset: 0; }
  .project-artstation, .project-view { transition: none; }
}
