/* Version 1 is opt-in per gallery. No legacy or Admin theme override. */
.client-gallery-view.appearance-v1 {
  container: gallery-appearance / inline-size;
  --g-font-heading: var(--gallery-heading-font);
  --g-font-body: var(--font-ui);
  --g-font-ui: var(--font-ui);
  --type-hero: clamp(3rem, 5cqw, 5rem);
  --type-gallery-heading: clamp(1.875rem, 3cqw, 3rem);
  color: var(--g-ink);
  background: var(--g-bg);
  font-family: var(--g-font-body);
}
.client-gallery-view.appearance-v1 :is(.client-photo-section,.masonry-grid,.client-gallery-footer,.footer-copyright) { background: var(--g-bg); color: var(--g-ink); }
.client-gallery-view.appearance-v1 .client-hero-copy h1 { font-family:var(--g-font-heading); line-height:1.02; }
.client-gallery-view.appearance-v1 .client-section-heading h2 { font-family:var(--g-font-heading); }
.client-gallery-view.appearance-v1 .client-section-actions > button {
  color:var(--g-ink);border-color:var(--g-border);border-radius:var(--g-control-radius);font-family:var(--g-font-ui);
}
.client-gallery-view.appearance-v1 .client-section-actions > button:hover { background:var(--g-surface); }
.client-gallery-view.appearance-v1 :is(.view-gallery-button,.client-section-actions > button) { border-radius:var(--g-control-radius); }
.client-gallery-view.appearance-v1 :is(.view-gallery-button,.client-section-actions > button):focus-visible { outline:2px solid var(--g-focus);outline-offset:3px; }
.client-gallery-view.appearance-v1 .client-section-more-menu { background:var(--g-surface);color:var(--g-ink);border-color:var(--g-border); }
.client-gallery-view.appearance-v1 :is(.footer-location,.footer-copyright) { color:var(--g-muted); }
.client-gallery-view.appearance-palette-charcoal .footer-brand img { background:#f7f6f3;border-radius:3px; }

/* Draft-only Design controls. Existing navigation and client workflows stay intact. */
.p0-apply-bar { display:flex;align-items:center;gap:10px;flex-wrap:wrap; }
.p0-apply-bar button { min-height:40px; }
.p0-preset-grid { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px; }
.p0-preset { display:grid;text-align:left;gap:7px;padding:16px;min-height:86px; }
.p0-preset small { color:var(--muted);font-size:12px;line-height:1.45; }
.p0-palette-grid { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px; }
.p0-palette-grid button { display:flex;align-items:center;gap:8px; }
.p0-palette-grid i { display:block;width:18px;height:18px;border-radius:50%; }
.p0-design [aria-pressed="true"].design-option { border-color:var(--ink);box-shadow:inset 0 0 0 1px var(--ink); }
.p0-design .design-preview-shell { display:block;place-items:start;min-height:0;overflow:hidden; }
.p0-preview-canvas {
  transform-origin:top left;overflow:auto;isolation:isolate;box-shadow:0 10px 32px rgba(0,0,0,.15);
  color:#11110f;background:#f7f6f3;color-scheme:light;font-family:var(--font-ui);
}
.p0-preview-canvas > .client-gallery-view {
  container: gallery-appearance / inline-size;min-height:100%;
  --type-hero:clamp(3rem,5cqw,5rem);--type-h1:clamp(2.5rem,4cqw,3.75rem);
  --type-gallery-heading:clamp(1.875rem,3cqw,3rem);
}
.p0-preview-canvas .client-gallery-hero { min-height:var(--p0-preview-height);height:var(--p0-preview-height); }
.p0-preview-canvas .cover-template-vintage .client-gallery-hero { min-height:0;height:auto;grid-template-rows:min(calc(var(--p0-preview-height) * .52),560px) auto; }
.p0-preview-canvas .cover-template-vintage .client-hero-logo { top:calc(min(calc(var(--p0-preview-height) * .52),560px) - 98px); }
.p0-preview-canvas .cover-template-journal .client-gallery-hero { grid-template-columns:62% 38%; }
.p0-preview-canvas .client-photo-section { padding:50px 42px 80px; }
.p0-preview-canvas .client-gallery-footer { min-height:0; }
.p0-preview-canvas.is-desktop .masonry-grid { --grid-columns:4; }
.p0-preview-canvas.is-mobile .masonry-grid { --grid-columns:2; }
.p0-preview-canvas.is-desktop .client-hero-copy { padding:70px 34px 108px; }
.p0-preview-canvas.is-desktop .cover-template-west .client-hero-copy { align-items:flex-start;text-align:left;padding-left:84px; }
.p0-preview-canvas.is-desktop .cover-template-vintage .client-hero-copy { padding:38px 24px 44px; }

/* Queries use gallery width, including the simulated 390px preview, not Admin's window. */
@container gallery-appearance (max-width:767px) {
  .appearance-v1 .client-hero-copy h1, .p0-preview-canvas .client-hero-copy h1 { font-size:clamp(2.4rem,10cqw,3.8rem);max-width:92%; }
  .p0-preview-canvas .client-hero-copy { padding:66px 20px 110px; }
  .p0-preview-canvas .client-photo-section { padding:40px 20px 65px; }
  .p0-preview-canvas .client-section-heading { align-items:flex-start;flex-direction:column; }
  .p0-preview-canvas .client-gallery-footer .footer-inner { grid-template-columns:1fr;grid-template-areas:"brand" "location" "contact" "copyright";text-align:center; }
  .p0-preview-canvas .footer-brand { justify-content:center; }
  .p0-preview-canvas .footer-contact { flex-direction:column;align-items:center; }
  .p0-preview-canvas .cover-template-west .client-hero-copy { width:100%;padding:72px 24px 110px; }
  .p0-preview-canvas .cover-template-border .client-hero-copy { inset:76px 18px 100px;padding:54px 18px 74px; }
  .p0-preview-canvas .cover-template-vintage .client-gallery-hero { grid-template-rows:calc(var(--p0-preview-height) * .5) auto; }
  .p0-preview-canvas .cover-template-vintage .client-hero-copy { padding:30px 20px 40px; }
  .p0-preview-canvas .cover-template-vintage .client-hero-logo { top:calc(var(--p0-preview-height) * .5 - 84px); }
  .p0-preview-canvas .cover-template-journal .client-gallery-hero { grid-template-columns:1fr;grid-template-rows:calc(var(--p0-preview-height) * .58) auto; }
  .p0-preview-canvas .cover-template-journal .client-hero-media { grid-column:1;grid-row:1; }
  .p0-preview-canvas .cover-template-journal .client-hero-copy { grid-column:1;grid-row:2;min-height:calc(var(--p0-preview-height) * .42);padding:38px 22px 62px;align-items:center;text-align:center; }
  .p0-preview-canvas .cover-template-journal .client-hero-logo { left:50%;top:calc(var(--p0-preview-height) * .58 - 84px);bottom:auto; }
}
@media(max-width:640px){.p0-apply-bar{width:100%;}.p0-apply-bar .design-save-state{width:100%;}.p0-preset-grid{grid-template-columns:1fr;}}

/* Explicit draft actions stay in view while browsing Appearance controls. */
.p0-design .p0-apply-bar { position:sticky;top:68px;z-index:17;justify-content:space-between;padding:14px 16px;margin:0 0 24px;background:var(--warm-white,#f8f7f3);border:1px solid var(--line);border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.06); }
.p0-apply-bar > div:first-child { display:grid;gap:5px; }
.p0-apply-bar strong { font-size:14px;font-weight:500; }
.p0-action-buttons { display:flex;gap:8px;flex-wrap:wrap; }
.p0-apply-bar .design-save-state { font-size:12px;letter-spacing:normal;text-transform:none; }
.p0-apply-bar button { font-size:13px;min-height:42px;padding:0 16px; }
body.admin-page[data-admin-theme="dark"] .p0-apply-bar { background:#252622; }
.p0-style-art { display:block;width:100%;height:112px;background:var(--art-bg);color:var(--art-ink);padding:9px;border:1px solid var(--art-muted);overflow:hidden; }
.p0-art-cover { display:flex;align-items:center;justify-content:center;position:relative;height:66px; }
.p0-art-cover > i { position:absolute;inset:0;background:var(--art-muted);opacity:.5; }
.p0-art-cover > b { position:relative;font-family:var(--art-font),serif;font-size:16px;font-weight:400; }
.p0-art-grid { display:grid;grid-template-columns:repeat(3,1fr);gap:4px;margin-top:7px; }
.p0-art-grid i { display:block;height:20px;background:var(--art-muted); }
.p0-style-editorial .p0-art-cover { justify-content:flex-start;padding-left:7px; }
.p0-style-minimal .p0-art-cover > i { inset:8px 30%; }
.p0-style-warm .p0-art-cover { align-items:flex-end;padding-bottom:3px; }
.p0-style-warm .p0-art-cover > i { bottom:21px; }
.p0-preset { padding:12px; }
.p0-palette-swatches { display:flex;gap:3px; }
.p0-palette-grid .p0-palette-swatches i { width:13px;height:24px;border-radius:2px; }
.p0-shape-grid { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px; }
.p0-shape-option { display:grid;justify-items:center;gap:10px;padding:14px 5px; }
.p0-shape-option > span { display:grid;place-items:center;width:60px;height:32px;border:1px solid currentColor;font-size:13px; }
.p0-shape-option strong { font-size:11px; }
.p0-full-dialog { position:fixed;inset:0;width:100vw;max-width:none;height:100dvh;max-height:none;margin:0;padding:0;border:0;background:#f7f6f3;color:#25241f;overflow:hidden; }
.p0-full-dialog::backdrop { background:#20211f; }
.p0-full-toolbar { height:72px;box-sizing:border-box;display:flex;justify-content:space-between;align-items:center;gap:16px;padding:12px 22px;border-bottom:1px solid #d5d0c7;background:#f7f6f3;font-family:var(--font-ui); }
.p0-full-toolbar > div { display:grid;gap:4px; }
.p0-full-toolbar strong { font-size:14px;font-weight:500; }
.p0-full-toolbar span { font-size:12px;color:#68645c; }
.p0-full-toolbar button { color:#25241f;border-color:#aaa398;min-height:40px;font-size:12px; }
.p0-full-scroll { height:calc(100dvh - 72px);overflow:auto; }
.p0-full-dialog .client-gallery-view { --ink:#11110f;--muted:#716f68;--line:#d9d6ce;--warm-white:#f8f7f3;--warm-gray:#efede7;--white:#fff;color-scheme:light; }
.p0-full-dialog .client-gallery-hero { min-height:calc(100dvh - 72px);height:calc(100dvh - 72px); }
.p0-full-dialog .cover-template-vintage .client-gallery-hero { height:auto;min-height:0; }
.p0-full-dialog .masonry-open { cursor:default; }
@media(max-width:1050px){.p0-design .p0-apply-bar{top:122px;}}
@media(max-width:640px){.p0-action-buttons{width:100%;}.p0-action-buttons button{flex:1;padding:0 10px;}.p0-action-buttons #p0-full-preview{flex-basis:100%;}.p0-full-toolbar{height:96px;padding:10px 12px;}.p0-full-toolbar span{max-width:170px;line-height:1.4;}.p0-full-scroll{height:calc(100dvh - 96px);}.p0-full-dialog .client-gallery-hero{height:calc(100dvh - 96px);min-height:calc(100dvh - 96px);}}

/* Typography/Grid expansion: legacy type IDs and masonry rules are not overridden. */
@font-face { font-family:Allura;src:url('./fonts/Allura-Regular.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap; }
.tg-type-card { gap:12px;min-width:0; }
.tg-type-card > strong { font:500 13px var(--font-ui); }
.tg-type-card .tg-aa,.tg-type-card .tg-title { display:block;font-family:var(--tg-heading);font-weight:var(--tg-weight);letter-spacing:var(--tg-tracking);text-transform:var(--tg-transform); }
.tg-type-card .tg-aa { font-size:42px;line-height:1.2; }
.tg-type-card .tg-title { font-size:23px;line-height:1.2;overflow-wrap:anywhere; }
.tg-type-card .tg-body { font:400 13px/1.55 var(--tg-body);display:block; }
.tg-type-card small { font-size:11px; }
.client-gallery-view.typography-wedding-script .client-hero-copy h1 { line-height:1.15;letter-spacing:0; }
.client-gallery-view:is(.typography-fashion,.typography-warm,.typography-modern-serif,.typography-wedding-script) .client-hero-copy h1 { font-weight:var(--cover-title-weight);letter-spacing:var(--cover-title-spacing); }
.client-gallery-view:is(.typography-fashion,.typography-warm,.typography-modern-serif,.typography-wedding-script) .client-section-heading h2 { font-weight:var(--gallery-heading-weight);letter-spacing:var(--gallery-heading-spacing); }
.tg-grid-choices { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:24px; }
.tg-grid-choice { display:grid;gap:10px;padding:14px;min-width:0; }
.tg-grid-choice strong { font-size:13px; }
.tg-grid-choice small { color:var(--muted);font-size:12px;line-height:1.5; }
.tg-grid-art { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;height:92px;width:100%;overflow:hidden; }
.tg-grid-art i { background:var(--muted);opacity:.4;min-width:0;min-height:0; }
.tg-art-vertical-masonry { grid-template-rows:repeat(4,1fr); }
.tg-art-vertical-masonry i:nth-child(3n+1){grid-row:span 2;}
.tg-art-editorial-mosaic { grid-template-columns:repeat(4,1fr); }
.tg-art-editorial-mosaic i:first-child { grid-column:span 2;grid-row:span 2; }
.tg-art-large-images { grid-template-columns:repeat(2,1fr); }
.tg-art-storyline { grid-template-columns:1fr;padding-inline:25%;row-gap:8px; }
.tg-art-hero-grid i:nth-child(4n+1) { grid-column:1/-1; }
.tg-art-compact-event { grid-template-columns:repeat(4,1fr);gap:2px; }
.tg-art-alternating-editorial { grid-template-columns:repeat(2,1fr); }
.tg-art-alternating-editorial i:nth-child(3n+1) { grid-column:1/-1; }

/* New grids reuse the same photo items/actions, without rearranging photo order. */
.client-gallery-view[class*="grid-style-"] { container:gallery-appearance / inline-size; }
.client-gallery-view[class*="grid-style-"] .masonry-grid { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--grid-gap,12px);align-items:start; }
.client-gallery-view[class*="grid-style-"] .masonry-item { width:auto;height:auto;margin:0;min-width:0;max-width:100%;align-self:start; }
.client-gallery-view[class*="grid-style-"] .masonry-open { width:100%;height:auto;display:block; }
.client-gallery-view[class*="grid-style-"] .masonry-open img { width:100%;height:auto;object-fit:contain;display:block; }
.client-gallery-view.grid-style-classic-grid .masonry-open { height:var(--row-height,240px); }
.client-gallery-view.grid-style-classic-grid .masonry-open img { height:100%;aspect-ratio:auto!important; }
.client-gallery-view.grid-style-editorial-mosaic .masonry-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
.client-gallery-view.grid-style-editorial-mosaic .masonry-item:nth-child(7n+1) { grid-column:span 2; }
.client-gallery-view.grid-style-large-images .masonry-grid { grid-template-columns:repeat(2,minmax(0,1fr));gap:max(24px,var(--grid-gap,12px)); }
.client-gallery-view.grid-style-storyline .masonry-grid { grid-template-columns:minmax(0,1fr);max-width:980px;margin-inline:auto;row-gap:max(44px,var(--grid-gap,12px)); }
.client-gallery-view.grid-style-storyline .masonry-item { width:100%; }
.client-gallery-view.grid-style-storyline .masonry-open img { max-height:85vh;object-fit:contain;aspect-ratio:auto!important; }
.client-gallery-view.grid-style-hero-grid .masonry-item:nth-child(7n+1) { grid-column:1/-1; }
.client-gallery-view.grid-style-compact-event .masonry-grid { grid-template-columns:repeat(5,minmax(0,1fr));gap:8px; }
.client-gallery-view.grid-style-alternating-editorial .masonry-grid { grid-template-columns:repeat(2,minmax(0,1fr));row-gap:max(26px,var(--grid-gap,12px)); }
.client-gallery-view.grid-style-alternating-editorial .masonry-item:nth-child(3n+1) { grid-column:1/-1; }
@container gallery-appearance (max-width:900px) {
  .client-gallery-view.grid-style-compact-event .masonry-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .client-gallery-view.grid-style-editorial-mosaic .masonry-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@container gallery-appearance (max-width:640px) {
  .client-gallery-view[class*="grid-style-"] .masonry-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .client-gallery-view.grid-style-classic-grid .masonry-open { height:180px; }
  .client-gallery-view.grid-style-editorial-mosaic .masonry-item:nth-child(7n+1) { grid-column:1/-1; }
  .client-gallery-view:is(.grid-style-large-images,.grid-style-storyline) .masonry-grid { grid-template-columns:minmax(0,1fr); }
  .client-gallery-view.grid-style-storyline .masonry-grid { row-gap:32px; }
  .client-gallery-view.grid-style-compact-event .masonry-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media(max-width:640px) { .tg-grid-choices,.typography-grid { grid-template-columns:1fr; } }

/* Semantic palette interactions: opt-in client Appearance only. */
.client-gallery-view.appearance-v1 .client-gallery-footer,
.client-gallery-view.appearance-v1 .client-gallery-footer .footer-copyright { background:var(--g-surface);color:var(--g-surface-ink); }
.client-gallery-view.appearance-v1 .client-gallery-footer :is(.footer-location,.footer-copyright) { color:var(--g-surface-muted); }
.client-gallery-view.appearance-v1 .client-section-navigation { background:var(--g-surface);border-color:var(--g-border); }
.client-gallery-view.appearance-v1 .client-section-actions > button { background:var(--g-surface);color:var(--g-action-ink);border-color:var(--g-action-border); }
.client-gallery-view.appearance-v1 :is(.client-section-actions > button,.client-section-link,.client-section-more summary,.client-section-more-menu button,.view-gallery-button) { transition:background-color 140ms ease,color 140ms ease,border-color 140ms ease; }
.client-gallery-view.appearance-v1 :is(.client-section-link,.client-section-more summary,.client-section-more-menu button) { color:var(--g-action-ink); }
.client-gallery-view.appearance-v1 :is(.client-section-link.active,.client-section-more-menu button.active) { color:var(--g-active-ink);box-shadow:inset 0 -2px 0 var(--g-active-ink); }
.client-gallery-view.appearance-v1 :is(.client-section-actions > button,.client-section-link,.client-section-more summary,.client-section-more-menu button,.view-gallery-button):is(:hover,:active):not(:disabled) { background:var(--g-accent);color:var(--g-on-accent);border-color:var(--g-accent); }
.client-gallery-view.appearance-v1 :is(.client-section-actions > button,.client-section-link,.client-section-more-menu button):active:not(:disabled) { box-shadow:inset 0 0 0 1px var(--g-accent); }
.client-gallery-view.appearance-v1 :is(.client-section-actions > button,.client-section-link,.client-section-more summary,.client-section-more-menu button,.view-gallery-button):focus-visible { outline:2px solid var(--g-focus);outline-offset:3px; }
.client-gallery-view.appearance-v1 :is(.client-section-actions > button,.client-section-link,.client-section-more summary,.client-section-more-menu button,.view-gallery-button) svg { color:inherit;stroke:currentColor; }
.client-gallery-view.appearance-v1 .client-section-actions > button[aria-pressed="true"] { background:var(--g-accent);color:var(--g-on-accent);border-color:var(--g-accent); }
@media(prefers-reduced-motion:reduce){.client-gallery-view.appearance-v1 :is(.client-section-actions > button,.client-section-link,.client-section-more summary,.client-section-more-menu button,.view-gallery-button){transition:none;}}

/* Grid v2 is opt-in; saved legacy galleries keep their existing renderer. */
.gv-settings { display:grid;grid-template-columns:minmax(0,1fr);gap:16px; }
.gv-settings fieldset { min-width:0;margin:0;padding:14px;border:1px solid var(--line);border-radius:6px;display:grid;gap:10px; }
.gv-settings legend { font:500 13px var(--font-ui);padding:0 6px; }
.gv-settings fieldset>span { font-size:12px;color:var(--muted); }
.gv-choice-row { display:flex;gap:6px;flex-wrap:wrap; }
.gv-choice-row button { flex:1;min-width:35px;min-height:38px;padding:6px;font-size:12px; }
.gv-choice-row button[aria-pressed="true"] { border-color:var(--ink);box-shadow:inset 0 0 0 1px var(--ink); }
.tg-art-horizontal-justified { grid-template-columns:2fr 1fr 1.5fr;grid-template-rows:repeat(3,1fr); }
.tg-art-gallery-blocks { grid-template-rows:repeat(2,1fr) 10px repeat(2,1fr);grid-template-columns:repeat(3,1fr); }
.tg-art-gallery-blocks i:nth-child(n+7) { grid-row:4; }
.client-gallery-view.grid-v2 { container:gallery-appearance / inline-size; }
.client-gallery-view.grid-v2 .masonry-grid { position:relative;display:block!important;columns:auto;gap:0;padding:0;max-width:none;overflow:visible; }
.client-gallery-view.grid-v2 .masonry-grid>.masonry-item { position:absolute;display:block;margin:0!important;padding:0;min-width:0;max-width:none;min-height:0;align-self:auto; }
.client-gallery-view.grid-v2 .masonry-open { width:100%;height:100%;display:block;margin:0;padding:0;min-height:0;border:0; }
.client-gallery-view.grid-v2 .masonry-open img { display:block;width:100%;height:100%;max-width:none;max-height:none;aspect-ratio:auto!important;object-fit:contain!important; }
@media(max-width:900px){.gv-settings{grid-template-columns:1fr;}}
