/* Project stories only. Shared chrome and the locked homepage hero live in styles.css.
   A project owns its named glow tokens; text and surfaces use the shared grounds. */
.project-page {
  --project-glow: 32, 111, 91;
  --project-glow-soft: 73, 100, 89;
  --project-field-from: #247F63;
  --project-field-to: #4A9C87;
  background: var(--chrome-dark);
}
.project-tone-terrace { --project-glow: 24, 91, 118; --project-glow-soft: 56, 108, 96; --project-field-from: #176F8E; --project-field-to: #43B59C; }
.project-tone-arc { --project-glow: 67, 101, 111; --project-glow-soft: 105, 102, 88; --project-field-from: #437D8B; --project-field-to: #709792; }
.project-tone-gozlan { --project-glow: 104, 86, 78; --project-glow-soft: 76, 88, 102; --project-field-from: #946858; --project-field-to: #516F93; }
.project-tone-signal { --project-glow: 46, 104, 82; --project-glow-soft: 63, 92, 102; --project-field-from: #3F926C; --project-field-to: #497B9C; }
.project-tone-sankari { --project-glow: 112, 53, 67; --project-glow-soft: 97, 81, 76; --project-field-from: #A94A66; --project-field-to: #826B63; }
.project-opening { background: var(--bg); color: var(--fg); }
.project-opening figure { position: relative; margin: 0; }
.project-image-link { display: block; position: relative; }
.project-image-link:focus-visible { outline-offset: -6px; }
.project-opening-image img {
  width: 100%; height: min(82svh, 1080px); min-height: 360px;
  object-fit: cover; object-position: 50% 54%;
}
.project-opening figcaption {
  position: absolute; bottom: 16px; left: max(var(--gut), calc((100% - 1840px) / 2));
  max-width: calc(100% - 2 * var(--gut)); margin: 0; padding: 5px 9px;
  background: var(--dialog-scrim); color: var(--fg); font-size: 12px; line-height: 1.5;
  pointer-events: none;
}

/* Colored introduction. Static diffuse ground is the no-script/GPU fallback;
   the bounded reference-noise surface runs only while the introduction is visible. */
.project-intro { position: relative; isolation: isolate; overflow: hidden; background: var(--bg); color: var(--fg); }
.project-intro::before {
  content: ''; position: absolute; z-index: -1; inset: -15% -10%; pointer-events: none;
  background: radial-gradient(ellipse at 27% 34%, rgba(var(--project-glow), .55), transparent 58%),
    radial-gradient(ellipse at 63% 75%, rgba(var(--project-glow-soft), .18), transparent 53%);
}
.project-intro.has-project-field::before { opacity: 0; }
.project-field-canvas { position: absolute; z-index: -1; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 2s ease-out; }
.has-project-field > .project-field-canvas { opacity: 1; }
.project-intro-inner { padding-block: clamp(40px, 6vw, 104px); }
.project-facts { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 24px; margin: 0 0 clamp(40px, 5vw, 80px); font-size: 14px; line-height: 1.5; }
.project-facts dt { margin: 0 0 6px; color: var(--fg-2); font-size: 12px; }
.project-facts dd { margin: 0; }
.project-intro h1 { max-width: 24ch; font-size: clamp(44px, 6.5vw, 104px); line-height: 1.02; letter-spacing: -.04em; font-weight: 400; }
.project-intro .project-summary { max-width: 43ch; margin: 28px 0 0; letter-spacing: -.025em; }
.project-contents { display: flex; flex-wrap: wrap; gap: 8px 32px; margin-top: 40px; }
.project-contents a { display: inline-flex; align-items: center; gap: 20px; min-height: 44px; border-bottom: 1px solid var(--rule-strong); font-size: 14px; }
.project-contents a:hover { border-color: var(--fg); }
.project-page .link-arrow { flex-shrink: 0; }
.project-intro-actions { display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.project-intro-actions .page-share { margin-top: 40px; }
.project-intro-actions .page-share-panel { top: auto; bottom: calc(100% + 8px); }

/* Editorial project story. */
.project-story { padding-block: clamp(56px, 7vw, 112px); }
.project-story-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px; }
.project-section-label { grid-column: 1 / span 3; margin: 0; font-size: 18px; line-height: 1.4; }
.project-story-copy { grid-column: 5 / span 8; min-width: 0; }
.project-story h2, .project-film-heading h2 { font-size: clamp(32px, 4vw, 64px); font-weight: 400; line-height: 1.07; letter-spacing: -.03em; }
.project-story-copy > p { max-width: 58ch; margin: 24px 0 0; color: var(--fg-2); font-size: clamp(18px, 1.65vw, 24px); line-height: 1.5; }

/* Owner-supplied gallery. Empty sections stay hidden; image links and native
   horizontal scrolling remain available when enhancements are unavailable. */
.project-gallery { padding-block: 0 clamp(48px, 6vw, 88px); }
.project-gallery-heading { margin-bottom: 24px; }
.project-gallery-heading .project-section-label { margin: 0; font-size: 18px; line-height: 1.4; font-weight: 400; }
.project-gallery-shell { position: relative; --project-slide-width: min(86vw, 1600px); }
.project-gallery-rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: var(--project-slide-width); gap: 5px;
  overflow-x: auto; overflow-y: hidden; padding-inline: calc((100% - var(--project-slide-width)) / 2);
  scroll-snap-type: x mandatory; scroll-padding-inline: 0; overscroll-behavior-x: contain;
  scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent;
}
.project-gallery-slide { min-width: 0; margin: 0; scroll-snap-align: center; }
.project-gallery-slide img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.project-gallery-slide figcaption { min-height: 44px; padding-block: 12px; color: var(--fg-2); font-size: 13px; line-height: 1.5; }
.project-gallery-rail.is-dragging, .project-gallery-rail.is-settling { scroll-snap-type: none; }
.project-gallery-rail.is-dragging, .project-gallery-rail.is-dragging * { cursor: grabbing; user-select: none; }
.project-gallery-arrows { position: absolute; inset: 0; pointer-events: none; }
.project-gallery-arrows button {
  position: absolute; top: calc(var(--project-slide-width) * .28125); transform: translateY(-50%);
  display: grid; place-items: center; width: clamp(52px, 6vw, 88px); height: clamp(52px, 6vw, 88px);
  padding: 14px; border: 1px solid var(--rule-strong); border-radius: 50%;
  border-color: color-mix(in srgb, var(--chrome-on-dark) 55%, transparent);
  color: var(--chrome-on-dark); background: var(--dialog-scrim);
  background: color-mix(in srgb, var(--chrome-dark) 18%, transparent); backdrop-filter: blur(8px);
  pointer-events: auto; cursor: pointer;
}
#project-gallery-prev { left: 16px; }
#project-gallery-next { right: 16px; }
.project-gallery-arrows svg { width: 28px; height: 28px; fill: none; stroke: none; }
.project-gallery-arrows button:disabled { opacity: .3; cursor: default; }
.project-gallery-pagination, .project-gallery-page-buttons { display: flex; align-items: center; justify-content: center; gap: 8px; }
.project-gallery-pagination { margin-top: 16px; }
.project-gallery-page-buttons button {
  min-width: 44px; min-height: 44px; padding: 8px 12px; border: 0; border-bottom: 1px solid transparent;
  color: var(--fg-2); background: transparent; font: inherit; font-size: 14px; cursor: pointer;
}
.project-gallery-page-buttons button[aria-pressed="true"] { color: var(--fg); border-bottom-color: currentColor; }

/* One locally hosted camera study. Controls and poster work independently of the glow. */
.project-film { padding-block: clamp(40px, 6vw, 88px); }
.project-film-heading { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 32px; margin-bottom: 32px; }
.project-film-heading > div { grid-column: 5 / span 8; }
.project-film-heading p { max-width: 53ch; margin: 20px 0 0; color: var(--fg-2); font-size: 18px; line-height: 1.5; }
.project-film-frame { position: relative; background: var(--bg); }
.project-film video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.project-film-toggle { position: absolute; right: 16px; bottom: 16px; display: grid; place-items: center; width: 48px; height: 48px; padding: 12px; border: 1px solid var(--fg); border-radius: 50%; background: var(--dialog-scrim); color: var(--fg); cursor: pointer; }
.project-film-toggle svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.project-film-toggle .project-play, .project-film-toggle[data-paused="true"] .project-pause { display: none; }
.project-film-toggle[data-paused="true"] .project-play { display: block; }
.project-film-note { margin: 12px 0 0; color: var(--fg-2); font-size: 13px; line-height: 1.5; }
.project-return { padding-block: 40px 64px; }
.project-return .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.project-return a { display: inline-flex; align-items: center; gap: 32px; min-height: 48px; border-bottom: 1px solid var(--rule-strong); }

/* Native modal enhancement; normal image links remain the fallback. */
html.project-viewer-open { overflow: hidden; }
.project-viewer {
  width: 100%; height: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0;
  padding: max(16px, env(safe-area-inset-top)) var(--gut) max(16px, env(safe-area-inset-bottom));
  border: 0; background: var(--bg); color: var(--fg);
}
.project-viewer[open] { display: flex; flex-direction: column; gap: 16px; }
.project-viewer:not([open]) { display: none; }
.project-viewer::backdrop { background: var(--dialog-scrim); }
.project-viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.project-viewer-bar h2 { font-size: 18px; font-weight: 400; line-height: 1.3; }
.project-viewer-close { display: grid; place-items: center; flex-shrink: 0; width: 48px; height: 48px; padding: 10px; border: 1px solid var(--rule-strong); background: var(--bg); color: var(--fg); cursor: pointer; }
.project-viewer-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.project-viewer-bar h2 { min-width: 0; }
.project-viewer-controls { display: flex; flex-shrink: 0; align-items: center; gap: 8px; }
.project-viewer-controls > button {
  display: grid; place-items: center; flex-shrink: 0; width: 48px; height: 48px; padding: 10px;
  border: 1px solid var(--rule-strong); background: var(--bg); color: var(--fg); cursor: pointer;
}
.project-viewer-controls > button:disabled { opacity: .35; cursor: default; }
.project-viewer-controls svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.project-viewer-controls svg.site-arrow { stroke: none; }
.project-viewer img { width: 100%; min-height: 0; flex: 1; object-fit: contain; touch-action: pan-y pinch-zoom; user-select: none; }
.project-viewer-caption { align-self: start; margin: 0; font-size: 14px; color: var(--fg-2); }
.project-viewer-open-image { align-self: start; text-decoration: underline; text-underline-offset: .25em; }

@media (max-width: 767px) {
  .project-opening-image img { height: 62svh; min-height: 320px; max-height: 640px; object-position: 53% 50%; }
  .project-facts { grid-template-columns: 1fr 1fr; gap: 22px 20px; font-size: 13px; }
  .project-facts > div:last-child { grid-column: 1 / -1; }
  .project-intro h1 { max-width: 15ch; }
  .project-contents { gap: 12px 24px; margin-top: 28px; }
  .project-story-grid, .project-film-heading { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .project-section-label, .project-story-copy, .project-film-heading > div { grid-column: 1; }
  .project-section-label { font-size: 16px; }
  .project-film-heading p { font-size: 17px; }
  .project-gallery-heading .project-section-label { font-size: 16px; }
  #project-gallery-prev { left: 8px; }
  #project-gallery-next { right: 8px; }
}
@media (max-width: 767px), (max-width: 1024px) and (max-height: 500px) and (orientation: landscape) {
  .project-viewer[open] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(64px, 1fr) auto;
    gap: 12px;
  }
  .project-viewer-bar, .project-viewer-controls { display: contents; }
  .project-viewer-bar h2 { grid-area: 1 / 1; place-self: center start; overflow-wrap: anywhere; }
  .project-viewer-close { grid-area: 1 / 2; }
  .project-viewer-controls > button { width: 44px; height: 44px; }
  .project-viewer img { grid-area: 2 / 1 / 3 / -1; width: 100%; height: 100%; }
  #project-viewer-prev, #project-viewer-next {
    grid-area: 2 / 1 / 3 / -1;
    align-self: center;
    z-index: 1;
    margin-inline: calc((100% - var(--viewer-photo-width, 100%)) / 2);
  }
  #project-viewer-prev { justify-self: start; }
  #project-viewer-next { justify-self: end; }
  .project-viewer-caption { grid-area: 3 / 1 / 4 / -1; justify-self: start; overflow-wrap: anywhere; }
  .project-viewer-open-image { display: none; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .project-opening-image img { height: 100svh; min-height: 240px; }
}
@media (prefers-reduced-motion: reduce) {
  .project-intro.has-project-field::before { opacity: 1; }
  .project-field-canvas { display: none; transition: none; }
}
@media (forced-colors: active) {
  .project-intro::before, .project-field-canvas { display: none; }
  .project-page { background: Canvas; }
  .project-film-toggle, .project-viewer-close { border-color: ButtonText; }
  .project-gallery-arrows button, .project-viewer-controls > button { border-color: ButtonText; background: ButtonFace; color: ButtonText; }
}
@media print {
  .project-intro::before, .project-field-canvas, .project-contents, .project-film, .project-viewer, .project-return { display: none !important; }
  .project-opening-image img { height: auto; min-height: 0; }
  .project-opening figcaption { position: static; background: none; color: inherit; }
  .project-intro-inner, .project-story { padding-block: 24px; }
  .project-gallery-arrows, .project-gallery-pagination { display: none !important; }
  .project-gallery-rail { display: block; overflow: visible; padding: 0; }
  .project-gallery-slide { margin-bottom: 16px; break-inside: avoid; }
}
