/* Project-page presentation only. The existing gallery and Info remain single
   DOM instances; layouts never create duplicate asset cards or text IDs. */
.project-layout-tools[hidden], .project-layout-host[hidden],
.project-layout-host [hidden], .project-layout-tools [hidden] { display: none !important; }
.project-layout-tools { margin: .25rem 0 1rem; }
.project-view-controls { display:flex; flex-wrap:wrap; gap:.35rem; margin:.4rem 0; }
.project-layout-tools button, .project-layout-text-toggle, .project-layout-studio select {
  background:var(--panel-2); color:var(--bone); border:1px solid var(--line);
  padding:.42rem .7rem; font:inherit; cursor:pointer;
}
.project-layout-tools button[aria-pressed="true"] {
  border-color:var(--colorbird-accent,var(--peach)); color:var(--colorbird-accent,var(--peach));
}
.project-layout-tools button:disabled { opacity:.55; cursor:wait; }
.project-layout-studio { border:1px solid var(--line); padding:.6rem .8rem; background:var(--panel); }
.project-layout-studio summary { cursor:pointer; color:var(--colorbird-accent,var(--peach)); }
.project-layout-studio p { margin:.55rem 0; }
.project-layout-studio-fields { display:flex; flex-wrap:wrap; gap:.55rem; align-items:center; }
.project-layout-studio-fields label { display:flex; align-items:center; gap:.4rem; flex-wrap:wrap; }
.project-layout-host { display:grid; min-width:0; align-items:start; gap:clamp(.7rem,2vw,1.5rem);
  grid-template-columns:minmax(0,1fr); grid-template-areas:"text" "media"; }
.project-layout-host[data-template="balanced"] {
  grid-template-columns:minmax(0,1fr) minmax(0,1fr); grid-template-areas:"text media";
}
.project-layout-host[data-template="media-led"] {
  grid-template-columns:minmax(0,1.65fr) minmax(0,1fr); grid-template-areas:"media text";
}
.project-layout-host[data-template="reading-led"] {
  grid-template-columns:minmax(0,1.65fr) minmax(0,1fr); grid-template-areas:"text media";
}
.project-layout-host[data-template="gallery-first"] {
  grid-template-areas:"toggle" "text" "media";
}
.project-layout-reading { grid-area:text; min-width:0; overflow-wrap:anywhere; }
.project-layout-media { grid-area:media; min-width:0; }
.project-layout-text-toggle { grid-area:toggle; justify-self:start; }
.project-layout-media > .project-media-section { margin-top:0; }
.project-layout-reading .project-overview-caption { max-width:65ch; }
.project-layout-reading .project-info-panel .project-info-columns { column-count:1; }
.project-layout-reading .project-info-article-title { display:none; }
.project-layout-reading .project-info-article { padding:0; }
.project-layout-host[data-template="text-first"] .project-layout-reading { width:100%; max-width:75ch; margin-inline:auto; }
.project-layout-host .gallery-toolbar-heading { flex-wrap:wrap; }
@media(max-width:900px) {
  .project-layout-host[data-template="balanced"],
  .project-layout-host[data-template="reading-led"] {
    grid-template-columns:minmax(0,1fr); grid-template-areas:"text" "media";
  }
  .project-layout-host[data-template="media-led"] {
    grid-template-columns:minmax(0,1fr); grid-template-areas:"media" "text";
  }
}

/* Storybook layouts preserve the canonical gallery below the narrative. */
.project-story[hidden], .project-story-cover[hidden], .project-story-date[hidden] { display:none !important; }
.project-story-cover { width:100%; margin:0 0 1.5rem; }
.project-story-cover .project-story-illustration { display:block; }
.project-story-cover img { width:100%; max-height:65vh; object-fit:contain; display:block; }
.project-story-date { margin:.35rem 0 1rem; color:inherit; opacity:.8; }
.project-story { min-width:0; margin:1rem 0 2rem; }
.project-story #overview { max-width:none; width:100%; margin:0; }
.project-story-spread { margin:0 0 clamp(1.5rem,4vw,3rem); min-width:0; display:flow-root; }
.project-story-text { min-width:0; overflow-wrap:anywhere; }
.project-story-text > :first-child { margin-top:0; }
.project-story-illustration { display:block; min-width:0; }
.project-story-illustration img { display:block; width:100%; height:auto; object-fit:contain; }
.project-story[data-template="storybook-wrap"] .project-story-spread .project-story-illustration {
  float:left; width:min(42%,26rem); margin:0 1.25rem .7rem 0;
}
.project-story[data-template="storybook-wrap"] .project-story-reverse .project-story-illustration {
  float:right; margin:0 0 .7rem 1.25rem;
}
.project-story[data-template="storybook-alternating"] .project-story-has-image {
  display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:clamp(1rem,4vw,3rem); align-items:start;
}
.project-story[data-template="storybook-alternating"] .project-story-reverse .project-story-illustration { grid-column:2; grid-row:1; }
.project-story[data-template="storybook-alternating"] .project-story-reverse .project-story-text { grid-column:1; grid-row:1; }
.project-story[data-template="storybook-plates"] .project-story-illustration { margin:0 0 1.5rem; }
.project-story[data-template="storybook-plates"] .project-story-illustration img { max-height:80vh; }
.project-story[data-template="storybook-plates"] .project-story-text,
.project-story-spread:not(.project-story-has-image) .project-story-text { max-width:75ch; margin-inline:auto; }
@media(max-width:700px) {
  .project-story[data-template="storybook-wrap"] .project-story-spread .project-story-illustration { float:none; width:100%; margin:0 0 1rem; }
  .project-story[data-template="storybook-alternating"] .project-story-has-image { display:block; }
  .project-story[data-template="storybook-alternating"] .project-story-illustration { margin:0 0 1rem; }
}

/* Storybook uses the persisted Gallery Style radius and grid/mosaic preference.
   Canonical gallery cards remain mounted for pagination and Lightbox. */
.project-story-gallery-toggle[hidden], .project-media .media-figure[data-story-used="1"] { display:none!important; }
.project-story-gallery-toggle { font:inherit; color:inherit; background:var(--panel-2); border:1px solid var(--line); padding:.4rem .7rem; cursor:pointer; }
.project-story-visual { min-width:0; width:100%; display:flex; align-items:center; justify-content:center; }
.project-story-illustration { position:relative; overflow:hidden; border-radius:var(--gallery-radius,0px); background:transparent; }
.project-story-illustration img { position:absolute; inset:0; width:100%; height:100%; object-fit:scale-down; border-radius:inherit; }
.project-story-cover .project-story-illustration { width:100%; max-height:65vh; margin-inline:auto; }
.project-story-cover img { max-height:none; }
.project-story-visual .project-story-illustration { width:min(100%,var(--story-image-width,100%)); max-height:var(--story-image-height,30vh); margin:0; }
.project-story[data-template="storybook-wrap"] .project-story-spread .project-story-visual { float:left; width:min(42%,26rem); margin:0 1.25rem .7rem 0; }
.project-story[data-template="storybook-wrap"] .project-story-reverse .project-story-visual { float:right; margin:0 0 .7rem 1.25rem; }
.project-story[data-template="storybook-wrap"] .project-story-spread .project-story-illustration { float:none; width:min(100%,var(--story-image-width)); margin:0; }
.project-story[data-template="storybook-alternating"] .project-story-has-image,
.project-story[data-template="storybook-clusters"] .project-story-has-image { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:clamp(1rem,4vw,3rem); align-items:center; }
.project-story[data-template="storybook-alternating"] .project-story-reverse .project-story-visual,
.project-story[data-template="storybook-clusters"] .project-story-reverse .project-story-visual { grid-column:2; grid-row:1; }
.project-story[data-template="storybook-clusters"] .project-story-reverse .project-story-text { grid-column:1; grid-row:1; }
.project-story .project-story-cluster { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); grid-template-rows:repeat(2,minmax(0,1fr)); gap:8px; height:var(--story-height,25vh); }
.project-story .project-story-cluster .project-story-illustration { width:100%; height:100%; max-height:100%; justify-self:center; }
.project-story[data-gallery-layout="masonry"] .project-story-cluster .project-story-illustration { width:min(100%,var(--story-image-width)); height:auto; }
.project-story[data-template="storybook-plates"] .project-story-visual { margin-bottom:1.5rem; }
.project-story[data-template="storybook-plates"] .project-story-illustration { width:100%; max-height:70vh; }
@media(max-width:700px) {
  .project-story[data-template="storybook-wrap"] .project-story-spread .project-story-visual { float:none; width:100%; margin:0 0 1rem; }
  .project-story[data-template="storybook-alternating"] .project-story-has-image,
  .project-story[data-template="storybook-clusters"] .project-story-has-image { display:block; }
  .project-story-visual { margin:0 0 1rem; }
}

/* A four-up Grid uses truly square tiles even in a wide media column. */
.project-story[data-gallery-layout="grid"] .project-story-cluster .project-story-illustration {
  width:min(100%,var(--story-image-height)); height:auto; aspect-ratio:1;
}
.project-story[data-gallery-density="dense"] .project-story-cluster { gap:5px; }
.project-story[data-gallery-density="large"] .project-story-cluster { gap:10px; }
.project-story-overflow-note[hidden] { display:none!important; }
.project-story-overflow-note { margin:.5rem 0; font-size:.9em; opacity:.85; }

.project-story-editor[hidden],.project-story-editor [hidden]{display:none!important}
.project-story-editor{margin:.8rem 0;border:1px solid var(--line);padding:.7rem;min-width:0}
.project-story-editor input[type="number"]{width:5.5rem;background:var(--panel-2);color:inherit;border:1px solid var(--line);padding:.35rem}
.project-story-editor select{max-width:min(100%,30rem)}
.project-story-editor details{margin-top:.8rem}
.project-story-editor ul{margin:.4rem 0;padding-left:1.2rem}
.project-story-resolution{display:none;position:absolute;z-index:2;inset:auto 0 0;background:#151515df;color:#eee;padding:.3rem;font:11px/1.35 system-ui,sans-serif;overflow-wrap:anywhere;pointer-events:none}
.project-story-diagnostics .project-story-resolution{display:block}

.project-story[data-template="storybook-plates"] .project-story-visual .project-story-illustration { max-height:min(70vh,var(--story-image-height,70vh)); }

/* The manager iframe is a layout preview, not another editing surface. */
.project-layout-preview .content-utility-cluster,.project-layout-preview .project-layout-tools,.project-layout-preview .project-story-gallery-toggle {display:none!important}
.project-layout-preview .project-info-trigger {pointer-events:none}

/* Editorial captions live outside the image frame. They do not alter its
   aspect ratio, crop rectangle, derivative selection or four-up grid. */
.project-story-single { margin:0; min-width:0; width:100%; }
.project-story-visual .project-story-single { width:min(100%,var(--story-image-width,100%)); }
.project-story-cover .project-story-single { width:100%; }
.project-story-visual .project-story-single > .project-story-illustration { width:100%; }
.project-story-caption {
  display:block; margin:.35rem 0 0; padding:0;
  font-family:inherit; font-size:.78rem; font-weight:400; line-height:1.4;
  color:var(--caption-text,var(--bone,inherit)); overflow-wrap:anywhere;
  text-align:left;
}
.project-story-caption strong { display:inline; font:inherit; font-weight:700; color:inherit; }

/* Project identity, ratings and the quality emoji are deliberately left in
   their original hero/utility/card locations in every layout. */
.project-identity-location { margin:.35rem 0; color:var(--colorbird-body-text,var(--bone)); white-space:normal; }
.project-info-columns > [data-story-section][hidden], #overview[hidden] { display:none!important; }
.project-story #overview { font-style:normal; }
.project-story-section-heading { color:var(--colorbird-accent,var(--peach)); font-family:inherit; font-size:clamp(1.15rem,2vw,1.5rem); font-weight:600; line-height:1.25; margin:1rem 0 .5rem; break-after:avoid; }
.project-story-text > .project-story-section-heading:first-child { margin-top:0; }
.project-content-footer { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,16rem),1fr)); gap:clamp(.8rem,2vw,1.5rem); margin:2rem 0 0; padding:1.25rem 0; border-top:1px solid var(--line); }
.project-footer-entry { min-width:0; padding:1rem; border:1px solid var(--line); background:var(--panel); overflow-wrap:anywhere; }
.project-footer-entry h2 { font:inherit; font-size:1.1rem; font-weight:700; color:var(--colorbird-accent,var(--peach)); margin:0 0 .7rem; }
.project-footer-entry ul { padding-left:1.2rem; margin:0; }
.project-footer-entry .project-info-markdown > :first-child { margin-top:0; }
.project-footer-entry .project-info-markdown > :last-child { margin-bottom:0; }

/* Use the original gallery badge geometry; compact four-up frames may
   be smaller than a normal thumbnail, so cap its footprint there. */
.project-story-cluster .project-gallery-quality-badge { top:.35rem; right:.35rem; width:1.8rem; height:1.8rem; font-size:1.1rem; }
