/* Shared components. Keep screen-specific layout in product.css. */
:is(.primary,.secondary,.pill-button) {
  min-height:var(--btn-height); height:auto; border-radius:var(--radius-pill);
  white-space:normal; overflow-wrap:anywhere; line-height:1.4;
}
.pill-button { display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:12px 24px;border:1px solid transparent;font-family:inherit;font-size:1rem;font-weight:600;cursor:pointer;text-decoration:none; }
.pill-button-primary {background:var(--brand-green);color:white}
.pill-button-secondary {background:var(--surface-card);color:var(--brand-green);border-color:var(--border-subtle)}
.pill-button-danger {background:var(--text-destructive);color:white}
.premium-card {background:var(--surface-card);border:1px solid var(--border-subtle);border-radius:var(--radius-card);padding:var(--card-padding);margin-bottom:var(--element-gap)}
.action-pill-row {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--action-gap);margin-top:var(--element-gap);align-items:stretch}
.action-pill-row>button,.action-pill-row>a {display:flex;align-items:center;justify-content:center;width:100%;min-width:0;margin:0;min-height:var(--btn-height);height:auto;padding:12px 10px;border-radius:var(--radius-pill);font-size:.9rem;line-height:1.4;white-space:normal;overflow-wrap:anywhere}
:is(.primary,.secondary,.pill-button):focus-visible {outline:3px solid var(--focus-color);outline-offset:3px}
.pill-button:disabled {opacity:.55;cursor:not-allowed}
.pill-button[hidden],.action-pill-row[hidden]{display:none}
@media(prefers-reduced-motion:reduce){.pill-button{transition:none}}

/* The page stays fixed; only the active sheet owns vertical scrolling. */
body.no-scroll {position:fixed;width:100%;overflow:hidden}
dialog[open] {max-height:calc(100dvh - 32px);overflow-y:auto;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}
.family-story-dialog .story-source-list {max-height:none;overflow:visible}

/* Chapter actions and a print surface that never navigates away from the app. */
.chapter-utility-actions{border-top:1px solid var(--border-subtle);padding-top:20px;margin-top:24px}
.chapter-utility-actions>button:only-child{grid-column:1/-1}
.chapter-remove{display:block;margin:18px 0 0 auto;min-height:44px;padding:8px 10px;border:0;background:transparent;color:var(--text-destructive);font:600 .85rem/1.4 Manrope,sans-serif;cursor:pointer}
.chapter-remove:focus-visible{outline:3px solid var(--focus-color);outline-offset:3px}
#storyPrintDialog[open]{display:flex;flex-direction:column;box-sizing:border-box;padding:0;overflow:hidden;max-height:calc(100dvh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 32px);margin:auto;inset:env(safe-area-inset-top,0px) 0 env(safe-area-inset-bottom,0px);background:var(--surface-card)}
.story-print-toolbar{position:relative;flex-shrink:0;z-index:2;margin:0;padding:20px;background:var(--surface-card);border-bottom:1px solid var(--border-subtle)}
.storybook-preview-content-pane{min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:32px 20px 24px;scroll-padding-block:16px}
.storybook-preview-content-pane .album-layout-editor{margin-top:12px}
select.pill-select{box-sizing:border-box;width:100%;max-width:100%;min-width:0;min-height:var(--btn-height);padding:10px 18px;border:1px solid var(--border-subtle);border-radius:var(--radius-pill);background-color:white;color:var(--brand-green);font-family:inherit;font-size:1rem}
select.pill-select:focus-visible{outline:3px solid var(--focus-color);outline-offset:3px}
.story-print-controls{margin-bottom:24px;padding-bottom:20px;border-bottom:1px solid var(--border-subtle)}
.story-print-controls p{font-size:.85rem;line-height:1.5;color:var(--muted)}
.story-print-dialog h1{font-family:Georgia,serif;font-size:clamp(1.6rem,5vw,2.2rem);line-height:1.2;overflow-wrap:anywhere}
.story-print-copy{white-space:pre-wrap;font:1rem/1.8 Georgia,serif;overflow-wrap:anywhere}
@media print {
 body:has(#storyPrintDialog[open]){position:static!important;overflow:visible!important;width:auto!important;height:auto!important;padding:0!important;margin:0!important}
 html:has(#storyPrintDialog[open]){overflow:visible!important}
 body:has(#storyPrintDialog[open])>*:not(#storyPrintDialog){display:none!important}
 #storyPrintDialog[open]{display:block!important;position:static!important;inset:auto!important;width:auto!important;max-width:none!important;height:auto!important;max-height:none!important;overflow:visible!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;box-shadow:none!important;outline:0!important;background:white!important;color:#173d37!important}
 #storyPrintDialog::backdrop{display:none!important;background:transparent!important}
 #storyPrintDialog .story-print-controls,#storyPrintDialog .story-print-toolbar{display:none!important}
 #storyPrintDialog .storybook-preview-content-pane{display:block;overflow:visible;max-height:none;padding:0;margin:0}
 #storyPrintDialog h1{font-size:24pt;break-after:avoid}
 #storyPrintDialog .story-print-copy{font-size:12pt;orphans:3;widows:3}
 @page{margin:18mm}
}

.profile-card-heading{display:flex;align-items:center;gap:var(--element-gap)}
.profile-card-heading .profile-avatar{flex-shrink:0}
.profile-card-heading h3{margin:0 0 4px}.profile-card-heading p{margin:0}
.profile-access-row{margin-top:var(--element-gap);border-top:1px solid var(--border-subtle)}
.add-child-profile{margin-top:var(--element-gap)}

/* One readable action per row, including long labels and larger text settings. */
.action-pill-stack{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--action-gap);width:100%;min-width:0}
.action-pill-stack>button,.action-pill-stack>a{display:flex;align-items:center;justify-content:center;width:100%;min-width:0;min-height:var(--btn-height);height:auto;margin:0;padding:12px 20px;border-radius:var(--radius-pill);white-space:normal;word-break:normal;overflow-wrap:normal;line-height:1.4}
.circle-hero{flex-direction:column;align-items:stretch}
.circle-actions.action-pill-stack{max-width:none}
.card-edit-button{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:1px solid var(--border-subtle);border-radius:50%;background:var(--surface-card);color:var(--brand-green);font:1.4rem/1 sans-serif;cursor:pointer}
.card-edit-button:focus-visible{outline:3px solid var(--focus-color);outline-offset:3px}
.card-edit-button:hover{background:var(--mint)}
.circle-feed-item{position:relative;grid-template-columns:50px minmax(0,1fr)}
.circle-feed-item:has(.card-edit-button) .card-edit-button{position:absolute;top:12px;right:12px}
.circle-feed-item:has(.card-edit-button)>div>small{display:block;padding-right:48px;min-height:44px}

/* Extension names share the same tokens as the existing components. */
.premium-modal-sheet{background:var(--surface-card);border:0;border-radius:var(--radius-modal);padding:24px 20px;box-shadow:0 -12px 40px #1c2e2426}
.premium-choice-row-grid,.milestone-injector-pill-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:12px 0}
.premium-choice-row-grid.two-col,.milestone-injector-pill-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.choice-chip-toggle{min-height:var(--btn-height);height:auto;min-width:0;border:1px solid var(--border-subtle);background:var(--surface-card);border-radius:var(--radius-pill);color:var(--brand-green);font-family:inherit;font-size:.9rem;font-weight:600;line-height:1.4;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;text-align:center;padding:10px 12px;white-space:normal;word-break:normal}
.choice-chip-toggle.is-active,.choice-chip-toggle[aria-pressed="true"]{background:#1B43320f;border-color:var(--brand-green)}
.horizontal-pill-row-stack{display:flex;flex-direction:column;gap:var(--action-gap);margin:var(--element-gap) 0}
.pill-action-trigger{width:100%;min-height:var(--btn-height);height:auto;border-radius:var(--radius-pill);font-family:inherit;font-size:1rem;font-weight:700;line-height:1.4;display:flex;align-items:center;justify-content:center;gap:8px;padding:12px 20px;cursor:pointer;border:1px solid transparent;white-space:normal}
.pill-action-primary{background:var(--brand-green);color:white}.pill-action-secondary{background:var(--surface-card);color:var(--brand-green);border-color:var(--border-subtle)}
.pill-action-trigger:active{filter:brightness(.95)}
.safe-remove-utility-link{display:inline-flex;align-items:center;min-height:44px;color:var(--text-destructive);background:transparent;border:0;font-size:.85rem;font-weight:600;text-decoration:none;padding:6px 8px;cursor:pointer}
.browser-native-file-picker{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.custom-media-upload-frame{width:100%;min-height:52px;height:auto;padding:12px;border:1px dashed var(--border-subtle);background:var(--surface-card);border-radius:var(--radius-input);display:flex;align-items:center;justify-content:center;gap:8px;color:var(--brand-green);font-size:.95rem;font-weight:600;cursor:pointer}
.custom-media-upload-frame:focus-within,.cover-theme-thumb-card:focus-within{outline:3px solid var(--focus-color);outline-offset:3px}
.parenting-tip-callout-card{background:#1B43320a;border-radius:var(--radius-input);padding:14px 16px;font-size:.9rem;line-height:1.5;color:var(--ink);font-style:italic;display:flex;gap:10px;align-items:flex-start;margin:12px 0}
.flexible-text-container-card{width:100%;height:auto;min-height:80px;padding-bottom:16px;overflow:visible}
.horizontal-cover-swiper{display:flex;gap:var(--action-gap);overflow-x:auto;padding:8px 4px 16px;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch}
.cover-theme-thumb-card{flex:0 0 120px;min-height:150px;height:auto;background:var(--surface-card);border:1px solid var(--border-subtle);border-radius:var(--radius-input);padding:10px;display:flex;flex-direction:column;justify-content:space-between;gap:12px;cursor:pointer;scroll-snap-align:start;color:var(--brand-green);text-align:left;white-space:normal}
.cover-theme-thumb-card.is-selected{border-color:var(--brand-green);box-shadow:0 6px 16px #1B433214;background:#1B433205}
.cover-thumb-preview-title{font:700 .85rem/1.4 Georgia,serif;color:var(--brand-green)}
:is(.choice-chip-toggle,.pill-action-trigger,.safe-remove-utility-link,.cover-theme-thumb-card):focus-visible{outline:3px solid var(--focus-color);outline-offset:3px}
:is(.choice-chip-toggle,.pill-action-trigger):disabled{opacity:.55;cursor:not-allowed}
.album-print-cover,.album-print-divider{box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;border-radius:12px;margin-bottom:24px;break-inside:avoid;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.album-print-cover{min-height:280px;padding:40px 24px;background:var(--brand-green);border:2px solid var(--brand-gold);box-shadow:0 8px 24px rgba(11,60,38,.15)}
.album-print-cover .storybook-cover-brand-meta{color:var(--brand-gold);font-family:-apple-system,BlinkMacSystemFont,sans-serif;font-size:.8rem;font-weight:800;text-transform:uppercase;letter-spacing:2px;margin:0 0 16px}
.album-print-cover .storybook-cover-main-title{color:#fff;font-family:Georgia,serif;font-size:1.8rem;font-weight:800;line-height:1.3;letter-spacing:-.5px;margin:0;max-width:100%}
.album-print-divider{position:relative;min-height:180px;padding:36px 20px;background:var(--bg-cream);border:1px solid rgba(197,160,89,.4);box-shadow:0 6px 16px rgba(0,0,0,.02)}
.album-print-divider::before{content:"";position:absolute;inset:10px;border:1px dashed rgba(197,160,89,.4);border-radius:8px;pointer-events:none}
.storybook-divider-icon-marker{font-size:1.2rem;color:var(--brand-gold);margin-bottom:8px}
.album-print-divider .storybook-divider-main-title{font-family:Georgia,serif;font-size:1.5rem;font-weight:700;color:var(--brand-green);letter-spacing:.5px;line-height:1.3;margin:0;max-width:100%}
.album-print-cover img{display:block;max-width:100%;max-height:65vh;object-fit:contain;margin:0 auto 24px}
.album-divider-editor{border-top:1px solid var(--border-subtle);padding-top:16px;margin-top:16px}
.album-divider-editor [data-divider-remove]{padding:4px 0 12px;min-height:44px}
.album-print-chapter{margin:24px 0}
@media(max-width:360px){.premium-choice-row-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media print{.album-print-cover,.album-print-divider{break-after:page;box-shadow:none}.album-print-cover img{max-height:200mm}.album-print-chapter{break-before:page}}

.safe-remove-utility-link[hidden],.pill-action-trigger[hidden],.choice-chip-toggle[hidden]{display:none}
@media print{#storyPrintDialog:has(#albumPrintPages) .storybook-preview-content-pane>#storyPrintTitle,#storyPrintDialog:has(#albumPrintPages) .storybook-preview-content-pane>small{display:none!important}}

/* Memory capture keeps its exit and submit actions outside the scrolling fields. */
#momentDialog[open]{box-sizing:border-box;width:min(560px,calc(100% - 32px));padding:0;overflow:hidden;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 32px);border-radius:var(--radius-modal)}
#momentForm{display:flex;flex-direction:column;min-height:0;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 32px)}
.memory-form-scroll{min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:24px 20px 8px}
#momentForm .memory-form-footer{flex-shrink:0;margin:0;padding:16px 20px;border-top:1px solid var(--border-subtle);background:var(--surface-card)}
#memoryCaptureTitle:focus{outline:none}
.storybook-photo-selection-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:12px 0 16px}
.selectable-image-wrapper-card{min-width:0;width:100%;aspect-ratio:1;min-height:64px;padding:0;border-radius:var(--radius-input);overflow:hidden;border:2px solid var(--border-subtle);position:relative;cursor:pointer;background:var(--surface-card);color:var(--brand-green)}
.selectable-image-wrapper-card img{display:block;width:100%;height:100%;object-fit:cover}
.selectable-image-wrapper-card.image-is-selected{border-color:var(--brand-green)}
.selectable-image-wrapper-card.image-is-selected::after{content:'✓';position:absolute;top:6px;right:6px;background:var(--brand-green);color:white;width:22px;height:22px;border-radius:50%;display:grid;place-items:center}
.selectable-image-wrapper-card:focus-visible{outline:3px solid var(--focus-color);outline-offset:3px}
.album-featured-photos img{display:block;max-width:100%;max-height:180mm;object-fit:contain;margin:20px auto}
.album-photo-controls{border-top:1px solid var(--border-subtle);padding-top:16px;margin-top:20px}
