/* ERNIX — detail.css
   Project detail — callout, zoom, sheet. */

/* ══════════════════════════════════════════════════════════
   PROJECT DETAIL
   First click opens a callout in the drawing. A second click
   zooms through to the sheet. Back reverses the whole move
   and leaves the callout open where you left it.
   ══════════════════════════════════════════════════════════ */

.stage { transition: opacity 0.28s var(--ease); }
.is-sheet .stage { display: none; }

/* ══════════════════════════════════════════════════════════
   STEP 1 · CALLOUT
   ══════════════════════════════════════════════════════════ */
.callout {
  flex: none;
  inline-size: 0;
  overflow: hidden;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transition: inline-size 0.45s var(--ease);
}
.callout.is-open { inline-size: clamp(300px, 32vw, 430px); }

.callout-inner {
  inline-size: clamp(300px, 32vw, 430px);
  padding-inline-start: 26px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  block-size: 100%;
}

.callout-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-block-end: 12px;
}
.callout-ref {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 9px; font-weight: 700; letter-spacing: var(--track-lg);
  text-transform: uppercase; color: var(--g400);
}
.callout-bubble {
  inline-size: 26px; block-size: 26px;
  display: grid; place-items: center;
  border: 1.5px solid var(--black); border-radius: 50%;
  font-size: 10px; font-weight: 700; letter-spacing: 0; color: var(--black);
}
.callout-dismiss {
  font-size: 16px; line-height: 1; color: var(--g400);
  padding: 2px 6px; border-radius: var(--r);
}
.callout-dismiss:hover { color: var(--black); }

.detail-canvas {
  position: relative;
  display: grid; place-items: center;
  background: #12161f;
  overflow: hidden;
}
.detail-canvas::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}
.detail-canvas .glyph-stack { z-index: 1; color: rgba(255,255,255,0.92); }
.detail-canvas .glyph-layer :is(path, rect, line, polyline, polygon, circle, ellipse) { stroke-dashoffset: 0; }

.callout-canvas { aspect-ratio: 4/3; margin-block-end: 16px; }
.callout-canvas .glyph-stack { inline-size: 100px; block-size: 100px; }

.callout-title {
  font-size: 16px; font-weight: 700; letter-spacing: var(--track-tight);
  line-height: 1.25; margin-block-end: 4px;
}
.callout-scale {
  font-size: 12px; font-weight: 700; letter-spacing: var(--track-tight);
  color: var(--black); margin-block: -8px 14px;
}
.callout-place { font-size: 12px; color: var(--g400); margin-block-end: 14px; }
.callout-desc { font-size: 12.5px; line-height: 1.7; color: var(--g600); margin-block-end: 18px; }

/* The way through to the sheet — stated, not hidden behind a
   second click nobody would guess at */
.callout-more {
  align-self: flex-start;
  font-size: 10px; font-weight: 700; letter-spacing: var(--track-md);
  text-transform: uppercase; color: var(--black);
  padding: 8px 14px; border: 1px solid var(--black); border-radius: var(--r);
  transition: background 0.2s, color 0.2s;
}
.callout-more:hover { background: var(--black); color: var(--white); }
.callout-more::after { content: ' →'; }

.sec-col.is-selected .sec-glyphwrap { color: var(--black); }
.sec-col.is-selected .sec-rule { border-block-start-width: 3px; }

/* ══════════════════════════════════════════════════════════
   STEP 2 · ZOOM THROUGH
   The drawing enlarges on the chosen bay, annotation resolves
   at the new scale, and the sheet arrives out of that move.
   ══════════════════════════════════════════════════════════ */
.sec-canvas {
  transform-origin: 0 100%;
  transition: transform 0.55s var(--ease);
}

.is-zooming .sec-col { opacity: 0.1; transition: opacity 0.4s var(--ease); }
.is-zooming .sec-col.is-zoom-target { opacity: 1; }
.is-zooming .grid-bubble,
.is-zooming .seg-label { opacity: 0.12; transition: opacity 0.4s var(--ease); }
.is-zooming .hstrip { overflow: hidden; }
.is-zooming .callout { inline-size: 0; }

/* Annotation that only exists once the view is enlarged —
   scale-dependent visibility, the way a real view behaves */
.zoom-annot {
  position: absolute;
  inset-inline: -6px;
  inset-block-end: 100%;
  opacity: 0;
  transition: opacity 0.3s var(--ease) 0.2s;
  pointer-events: none;
}
.is-zoom-target .zoom-annot { opacity: 1; }

.annot-dim { position: relative; margin-block-end: 7px; border-block-end: 0.5px solid var(--g400); }
.annot-dim::before, .annot-dim::after {
  content: ''; position: absolute; inset-block-end: -3px;
  inline-size: 0.5px; block-size: 7px; background: var(--g400);
}
.annot-dim::before { inset-inline-start: 0; }
.annot-dim::after  { inset-inline-end: 0; }
.annot-dim span {
  position: absolute; inset-block-end: 2px; inset-inline: 0; text-align: center;
  font-size: 4.5px; color: var(--g400); font-variant-numeric: tabular-nums;
}
.annot-level {
  position: absolute; inset-block-end: -6px; inset-inline-start: 0;
  font-size: 4.5px; font-weight: 700; color: var(--g400); white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════
   STEP 3 · SHEET
   ══════════════════════════════════════════════════════════ */
.sheet-view[hidden] { display: none; }

.is-sheet .sheet-view {
  animation: sheetIn 0.45s var(--ease) both;
}
@keyframes sheetIn {
  from { opacity: 0; transform: scale(1.035); }
  to   { opacity: 1; transform: scale(1); }
}
.sheet-view.is-leaving { animation: sheetOut 0.3s var(--ease) both; }
@keyframes sheetOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.03); }
}

.sheet-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding-inline: var(--pad-x); padding-block: 0 20px;
}
.sheet-back {
  font-size: 11px; font-weight: 500; letter-spacing: var(--track-sm);
  text-transform: uppercase; color: var(--g400);
}
.sheet-back::before { content: '← '; }
.sheet-back:hover { color: var(--black); }

.sheet-step { display: flex; align-items: center; gap: 10px; }
.sheet-pos {
  font-size: 10px; font-weight: 700; letter-spacing: var(--track-md);
  color: var(--g400); font-variant-numeric: tabular-nums;
}
.sheet-step button {
  inline-size: 30px; block-size: 30px; display: grid; place-items: center;
  border: 1px solid var(--g200); border-radius: var(--r);
  color: var(--g400); font-size: 13px; line-height: 1;
}
.sheet-step button:hover { border-color: var(--black); color: var(--black); }

.sheet-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1px;
  background: var(--g200);
  border-block: 1px solid var(--g200);
}
.sheet-main, .sheet-block { background: var(--white); }

.sheet-main .detail-canvas { aspect-ratio: 16/9; }
.sheet-main .detail-canvas .glyph-stack { inline-size: 190px; block-size: 190px; }

.sheet-text { padding: 32px 36px 40px; }
.sheet-title {
  font-size: clamp(24px, 3vw, 32px); font-weight: 800;
  letter-spacing: var(--track-title); line-height: 1.05; margin-block-end: 8px;
}
.sheet-place { font-size: 13px; color: var(--g400); margin-block-end: 22px; }
.sheet-desc { font-size: 14px; line-height: 1.75; color: var(--g600); max-inline-size: 62ch; }

/* Right column reads as a title block */
.sheet-block { padding: 32px 28px; }
.sheet-block-head {
  font-size: 9px; font-weight: 700; letter-spacing: var(--track-xl);
  text-transform: uppercase; color: var(--g400);
  padding-block-end: 12px; margin-block-end: 18px;
  border-block-end: 1px solid var(--black);
}
.detail-specs { display: grid; grid-template-columns: minmax(84px, auto) 1fr; gap: 9px 22px; }
.detail-key {
  font-size: 9px; font-weight: 500; letter-spacing: var(--track-xl);
  text-transform: uppercase; color: var(--g400); padding-block-start: 2px;
}
.detail-val { font-size: 12.5px; line-height: 1.45; color: var(--black); }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   Below 860px the callout would leave no drawing visible, so
   the first click goes straight to the sheet instead.
   ══════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  .sheet-body { grid-template-columns: 1fr; }
  .sheet-text { padding: 26px 24px 32px; }
  .callout.is-open { inline-size: min(86vw, 380px); }
  .callout-inner { inline-size: min(86vw, 380px); }
}

@media (prefers-reduced-motion: reduce) {
  .callout, .sec-canvas, .stage { transition: none; }
  .is-sheet .sheet-view, .sheet-view.is-leaving { animation: none; }
  .zoom-annot { transition: none; }
}

@media print {
  .callout, .sheet-view { display: none !important; }
}

/* ── Additional work: the list inside its callout and sheet ── */
.detail-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  border-block-start: 1px solid var(--g200);
}
.detail-list li {
  padding-block: 10px;
  border-block-end: 1px solid var(--g200);
}
.detail-list strong {
  display: block;
  font-weight: 700;
  color: var(--black);
}
.detail-list span { display: block; margin-block-start: 2px; }

/* ══════════════════════════════════════════════════════════
   PROJECT IMAGES — hero, grouped gallery, lightbox
   Photographs and renders fill their frame; drawings are shown
   whole on a sheet-white ground, never cropped.
   ══════════════════════════════════════════════════════════ */
.sheet-hero {
  display: block; position: relative; inline-size: 100%;
  aspect-ratio: 16 / 9; overflow: hidden; background: var(--g100);
  cursor: zoom-in;
}
.sheet-hero img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
.sheet-hero--drawing { background: var(--white); border-block-end: 1px solid var(--g200); }
.sheet-hero--drawing img { object-fit: contain; padding: 12px; }
.sheet-hero-tag {
  position: absolute; inset-block-end: 12px; inset-inline-start: 12px;
  font-size: 9px; font-weight: 700; letter-spacing: var(--track-md); text-transform: uppercase;
  background: var(--white); color: var(--black); padding: 5px 8px; border-radius: var(--r);
  box-shadow: 0 1px 2px rgba(10, 10, 10, 0.12);
}
.sheet-hero:focus-visible, .gal-thumb:focus-visible { outline: 2px solid var(--black); outline-offset: -2px; }

.callout-photo { aspect-ratio: 4 / 3; overflow: hidden; background: var(--g100); margin-block: 12px 14px; }
.callout-photo img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }

.gallery { padding: 0 36px 40px; display: grid; gap: 28px; }
.gal-head {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 9px; font-weight: 700; letter-spacing: var(--track-xl); text-transform: uppercase;
  color: var(--black); padding-block-end: 10px; margin-block-end: 12px;
  border-block-end: 1px solid var(--black);
}
.gal-head span { color: var(--g400); font-weight: 500; }
.gal-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.gal-thumb {
  display: block; aspect-ratio: 4 / 3; overflow: hidden;
  background: var(--g100); cursor: zoom-in;
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
.gal-thumb img { inline-size: 100%; block-size: 100%; object-fit: cover; display: block; }
.gal-thumb--drawing { background: var(--white); border: 1px solid var(--g200); }
.gal-thumb--drawing img { object-fit: contain; padding: 6px; }
@media (hover: hover) {
  .gal-thumb:hover { box-shadow: var(--shadow-lift, 0 6px 16px rgba(10,10,10,.12)); transform: translateY(-2px); }
}

.lightbox {
  inline-size: 100vw; block-size: 100dvh; max-inline-size: none; max-block-size: none;
  margin: 0; padding: 0; border: 0; background: #0a0a0a; color: #fff;
}
.lightbox::backdrop { background: rgba(10, 10, 10, 0.6); }
.lightbox[open] { display: grid; grid-template-rows: auto 1fr; }
.lb-bar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px var(--pad-x, 20px);
  font-size: 11px; letter-spacing: var(--track-sm); text-transform: uppercase;
}
.lb-cap { flex: 1; font-weight: 700; }
.lb-pos { color: #bdbdbd; font-variant-numeric: tabular-nums; }
.lb-close { font-size: 26px; line-height: 1; color: #fff; inline-size: 40px; block-size: 40px; }
.lb-stage { display: grid; place-items: center; min-block-size: 0; padding: 0 64px 24px; }
.lb-img { max-inline-size: 100%; max-block-size: calc(100dvh - 100px); inline-size: auto; block-size: auto; object-fit: contain; }
.lb-img--drawing { background: #fff; }
.lb-nav {
  position: absolute; inset-block-start: 50%; transform: translateY(-50%);
  inline-size: 44px; block-size: 64px; font-size: 30px; color: #fff;
  background: rgba(255, 255, 255, 0.08); border-radius: var(--r);
}
.lb-nav:hover { background: rgba(255, 255, 255, 0.18); }
.lb-prev { inset-inline-start: 10px; }
.lb-next { inset-inline-end: 10px; }
[dir="rtl"] .lb-nav { transform: translateY(-50%) scaleX(-1); }
html.lb-open { overflow: hidden; }

@media (max-width: 860px) {
  .gallery { padding: 0 24px 32px; }
  .gal-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .lb-stage { padding: 0 8px 70px; }
  .lb-nav { inset-block-start: auto; inset-block-end: 12px; transform: none; block-size: 44px; }
  [dir="rtl"] .lb-nav { transform: scaleX(-1); }
}
@media (max-width: 420px) { .gal-grid { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) { .gal-thumb { transition: none; } }

.sheet-title:focus:not(:focus-visible) { outline: none; }
