/*
 * Brand CMS Core — Default Theme Foundation CSS (V3 Sprint 14G-U2-A)
 * ============================================================
 * Loaded AFTER theme.css (layout/header.php). Additive-only layer:
 * theme.css is a sealed U1 baseline and is never modified.
 *
 * Cascade boundary (workcard §4):
 *   - Global shell / page-specific selectors only.
 *   - No U1 Content Block selectors are reset here (no .carousel*,
 *     .block--hero*, .block__header/.block__title/.block__subtitle,
 *     .block__cta-row, .grid-item__actions).
 *   - No !important. No external URLs.
 *
 * Structure:
 *   Design Tokens → Utilities → Skip Link → Focus Baseline →
 *   Mobile Navigation (768px, no-JS fallback) → Page Containers →
 *   Prose → Forms → Contact → FAQ → Quote → Error/Empty →
 *   Reduced Motion
 * ============================================================
 */

/* ── Design Tokens (Tech Minimalist / White-label SaaS) ──────
   Mapping strategy: existing theme.css :root tokens are reused, not
   rebuilt. Only the two text tokens are overridden (Proposal §3);
   brand / bg / border tokens already match the style contract. */
/* ── Public compatibility aliases + --public-* namespace (V3 Sprint 14H-U1-I1) ──
   foundation.css loads AFTER sealed theme.css and BEFORE design-tokens.css.
   Legacy --color-* / --radius-* / --shadow-* names are repointed (one-way) at
   the canonical --ds-* source (design-tokens.css, loaded LAST). The two drift
   values that diverged from the sealed theme (#0f172a / #475569) are reconciled
   to canonical here; every sealed-theme value is preserved 1:1 (no visual
   change). NO !important; aliases win purely by cascade order. */
:root {
    --color-text:        var(--ds-color-neutral-800);  /* drift #0f172a → canonical #1e293b */
    --color-text-muted:  var(--ds-color-neutral-500);  /* drift #475569 → canonical #64748b */

    --radius-sm:         var(--ds-radius-sm);
    --radius-md:         var(--ds-radius-md);
    --shadow-sm:         var(--ds-shadow-sm);

    /* Public semantic tokens (brand-themeable per client; default = sealed theme). */
    --public-brand-primary:        #2563eb;
    --public-brand-primary-hover:  #1d4ed8;
    --public-brand-secondary:      var(--public-brand-primary-hover);
    --public-brand-accent:         #f59e0b;
    --public-text:                 var(--ds-color-neutral-800);
    --public-text-muted:           var(--ds-color-neutral-500);
    --public-surface:              #ffffff;
    --public-surface-alt:          var(--ds-color-neutral-50);
    --public-border:               var(--ds-color-neutral-200);
    --public-accent:               var(--public-brand-primary);
    --public-section-space:        var(--ds-space-18);
    --public-content-width:        var(--ds-container-core);
    --public-content-width-narrow: var(--ds-container-narrow);
    --public-content-width-wide:   var(--ds-container-wide);
    --public-hero-min-height:      clamp(380px, 60vw, 520px);
    --public-hero-overlay:         linear-gradient(100deg, rgba(15, 23, 42, .78), rgba(15, 23, 42, .42) 55%, rgba(15, 23, 42, .18));

    /* Public hooks: sealed-theme legacy names → canonical (1:1; no visual change). */
    --color-bg:            var(--public-surface);
    --color-bg-alt:        var(--public-surface-alt);
    --color-border:        var(--public-border);
    --color-primary:       var(--public-brand-primary);
    --color-primary-hover: var(--public-brand-primary-hover);
    --color-accent:        var(--public-brand-accent);
    --font-sans:           var(--ds-font-sans);
    --container:           var(--public-content-width);
    --space-block:         var(--public-section-space);
    --radius:              var(--ds-radius-md);
    --radius-lg:           var(--ds-radius-lg);
}

/* ── Utilities ─────────────────────────────────────────────── */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ── Skip Link (keyboard only) ─────────────────────────────── */
.skip-link {
    position: absolute;
    top: -48px;
    left: 16px;
    z-index: 200;
    padding: 10px 18px;
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-md);
    font-size: .9rem;
    font-weight: 600;
    transition: top .15s ease;
}
.skip-link:focus-visible {
    top: 8px;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ── Focus Baseline (formal site-wide a11y contract) ─────────
   Provides a visible keyboard focus for interactive elements that
   have no more specific rule. U1 block-level :focus-visible rules
   in theme.css are more specific and continue to win in-cascade. */
.site-nav a:focus-visible,
.site-footer__links a:focus-visible,
.site-footer__social a:focus-visible,
.float-cta__btn:focus-visible,
.f-input:focus-visible,
.f-textarea:focus-visible,
.f-checkbox:focus-visible,
.faq-card__q:focus-visible,
.link-primary:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 2px;
}
.float-cta__btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
}

/* ── Mobile Navigation (collapse ≤768px, no-JS fallback) ─────
   theme.css ships the same panel at ≤480px; this layer widens the
   collapse breakpoint to 768px and makes the no-JS state reachable:
   html.js   → collapsible panel driven by the existing toggle JS
               (hooks .site-nav-toggle / #site-nav / .is-open /
                aria-expanded — all unchanged);
   html:not(.js) → panel always expanded below the header. */
@media (max-width: 768px) {
    .site-nav-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 40px;
        height: 40px;
        padding: 0;
        border: 1px solid var(--color-border);
        background: #fff;
        border-radius: var(--radius-md);
        cursor: pointer;
        align-self: center;
    }
    .site-nav-toggle__bar {
        display: block;
        width: 20px;
        height: 2px;
        background: var(--color-text);
        border-radius: 1px;
        margin: 0 auto;
        transition: transform .15s ease, opacity .15s ease;
    }
    .site-nav-toggle[aria-expanded="true"] .site-nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .site-nav-toggle[aria-expanded="true"] .site-nav-toggle__bar:nth-child(2) { opacity: 0; }
    .site-nav-toggle[aria-expanded="true"] .site-nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .site-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        border-bottom: 1px solid var(--color-border);
        box-shadow: 0 8px 16px rgba(0, 0, 0, .08);
    }
    html.js .site-nav {
        max-height: 0;
        overflow: hidden;
        transition: max-height .2s ease;
    }
    html.js .site-nav.is-open { max-height: 80vh; overflow-y: auto; }

    .site-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 16px;
    }
    .site-nav li a {
        display: block;
        padding: 12px 4px;
        border-bottom: 1px solid var(--color-border);
    }
    .site-nav li:last-child a { border-bottom: none; }
}
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    html.js .site-nav,
    .site-nav-toggle__bar { transition: none; }
}

/* ── Page Containers ───────────────────────────────────────── */
.page-container {
    margin: 0 auto;
    padding: 0 20px 72px;
}
.page-container--page   { max-width: 800px; }
.page-container--legal  { max-width: 800px;  padding-top: 48px; padding-bottom: 64px; }
.page-container--faq    { max-width: 760px;  padding-top: 48px; }
.page-container--contact{ max-width: 1080px; padding-top: 48px; padding-bottom: 48px; }

/* ── Prose (long-form content rhythm) ──────────────────────── */
.prose {
    line-height: 1.85;
    color: var(--ds-color-neutral-700);
    font-size: .975rem;
    overflow-wrap: anywhere;
}
.prose a {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.prose h2, .prose h3 { color: var(--color-text); line-height: 1.35; }
.prose h2 { font-size: 1.25rem; margin: 1.6em 0 .6em; }
.prose h3 { font-size: 1.1rem;  margin: 1.4em 0 .5em; }
.prose p  { margin: 0 0 1em; }
.prose ul, .prose ol { list-style: revert; padding-left: 1.4em; margin: 0 0 1em; }
.prose img { border-radius: var(--radius-md); }

.prose-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin-bottom: 32px;
}
.page-back { margin-top: 40px; }
.link-primary {
    color: var(--color-primary);
    font-size: .85rem;
    text-decoration: none;
}
.link-primary:hover { text-decoration: underline; }

/* ── Forms (public form foundation) ────────────────────────── */
.f-form { display: flex; flex-direction: column; gap: 18px; }
.f-label {
    display: block;
    font-size: .85rem;
    font-weight: 500;
    margin-bottom: 6px;
}
.f-required { color: #ef4444; }
.f-input, .f-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: .9rem;
    font-family: inherit;
    color: var(--color-text);
    background: #fff;
}
.f-textarea { resize: vertical; }
.f-input:focus-visible, .f-textarea:focus-visible {
    border-color: var(--color-primary);
}
.f-checkbox { margin-top: 3px; flex-shrink: 0; accent-color: var(--color-primary); }
.f-terms {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: .85rem;
    line-height: 1.5;
}
.f-submit {
    padding: 12px 32px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}
.f-submit:hover { background: var(--color-primary-hover); }
.f-submit:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
.f-submit:active { background: var(--color-primary-hover); }

/* ── Contact Page ──────────────────────────────────────────── */
.contact-layout-grid { display: grid; grid-template-columns: 1fr 1.8fr; gap: 40px; align-items: start; }
.contact-field-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.contact-field-grid input, .contact-field-grid textarea { box-sizing: border-box; }
@media (max-width: 640px) {
    .contact-layout-grid { grid-template-columns: 1fr; gap: 24px; }
    .contact-field-grid  { grid-template-columns: 1fr; gap: 14px; }
}

.contact-source-banner {
    grid-column: 1 / -1;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: .9rem;
    color: #1e40af;
}
.contact-source-banner__type { font-size: .8rem; color: var(--color-primary); }

.contact-info-card {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: var(--shadow-sm);
}
.contact-info-card__title { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.contact-info-row { display: flex; gap: 12px; align-items: flex-start; }
.contact-info-row__icon { font-size: 1.25rem; margin-top: 2px; }
.contact-info-row__label { font-size: .8rem; color: var(--color-text-muted); margin-bottom: 2px; }
.contact-info-row__value { color: var(--color-text); font-weight: 500; overflow-wrap: anywhere; }
.contact-info-divider { border: none; border-top: 1px solid var(--color-border); }
.contact-social__label { font-size: .8rem; color: var(--color-text-muted); margin-bottom: 10px; }
.contact-social__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.contact-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: .85rem;
    color: var(--color-text);
    text-decoration: none;
}
.contact-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }

.contact-flash-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 20px;
    color: #b91c1c;
    font-size: .9rem;
}
.contact-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
}
.contact-success__icon { font-size: 2.5rem; margin-bottom: 12px; }
.contact-success__title { font-size: 1.25rem; font-weight: 600; color: #15803d; margin-bottom: 8px; }
.contact-success__text { color: #166534; margin-bottom: 20px; }
.contact-success__action {
    display: inline-block;
    padding: 10px 24px;
    background: #15803d;
    color: #fff;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: .9rem;
}

/* ── FAQ Page ──────────────────────────────────────────────── */
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-cat-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 36px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-border);
}
.faq-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #fff;
}
.faq-card__q {
    padding: 16px 20px;
    font-size: .975rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--color-text);
    user-select: none;
}
.faq-card__q::-webkit-details-marker { display: none; }
.faq-card__icon {
    display: inline-block;
    font-size: 1.25rem;
    color: var(--ds-color-neutral-400);
    flex-shrink: 0;
    margin-left: 12px;
    line-height: 1;
    transition: transform .2s;
}
.faq-card[open] > .faq-card__q .faq-card__icon { transform: rotate(45deg); }
.faq-card__a {
    padding: 0 20px 18px;
    color: var(--color-text-muted);
    line-height: 1.75;
    font-size: .9rem;
    border-top: 1px solid var(--ds-color-neutral-100);
    background: var(--color-bg-alt);
    overflow-wrap: anywhere;
}

/* ── Quote Page ────────────────────────────────────────────── */
.quote-container { max-width: 800px; margin: 40px auto; padding: 0 20px; }
.quote-title { font-size: 1.5rem; margin-bottom: 8px; }
.quote-meta { color: var(--color-text-muted); font-size: .85rem; margin-bottom: 24px; }
.quote-customer { font-size: .9rem; margin-bottom: 16px; }
.quote-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.quote-card--content { line-height: 1.7; font-size: .95rem; overflow-wrap: anywhere; }
.quote-card--empty { color: var(--color-text-muted); }
.quote-card--form { padding: 20px; }
.quote-notice {
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
    font-size: .9rem;
}
.quote-notice--accepted { background: #f0fdf4; border: 1px solid #86efac; }
.quote-notice--warning { background: #fef3c7; border: 1px solid #fde68a; color: #92400e; padding: 16px; }
.quote-notice__title { font-weight: 600; color: #15803d; margin-bottom: 8px; }
.quote-notice__text { font-size: .85rem; color: #166534; }
.quote-terms { margin-bottom: 16px; }
.quote-terms__summary { cursor: pointer; font-weight: 500; font-size: .9rem; color: var(--color-text-muted); }
.quote-terms__body {
    margin-top: 12px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: .85rem;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
}
.quote-confirm {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
    cursor: pointer;
    font-size: .9rem;
}
.quote-confirm__checkbox { margin-top: 3px; accent-color: var(--color-primary); }
.quote-back { margin-top: 24px; font-size: .8rem; color: var(--color-text-muted); }
.quote-back__link { color: var(--color-primary); text-decoration: none; }
.quote-back__link:hover { text-decoration: underline; }

/* ── Error / Empty States ──────────────────────────────────── */
.error-page { max-width: 640px; margin: 0 auto; padding: 96px 20px; text-align: center; }
.error-page__code {
    font-size: 6rem;
    font-weight: 800;
    color: var(--color-border);
    line-height: 1;
    margin-bottom: 8px;
}
.error-page__title { font-size: 1.5rem; font-weight: 700; color: var(--color-text); margin-bottom: 16px; }
.error-page__text { color: var(--color-text-muted); line-height: 1.7; margin-bottom: 40px; }
.empty-text { color: var(--ds-color-neutral-400); }

/* ── Listing Pages（14G-U2-B）────────────────────────────── */
/* 頁首與麵包屑 */
.listing-head { text-align: center; margin-bottom: 40px; }
.listing-head__sub { color: var(--color-text-muted); margin-top: 8px; font-size: .9rem; }
.breadcrumb {
    font-size: .85rem;
    color: var(--color-text-muted);
    margin-bottom: 28px;
    overflow-wrap: anywhere;
}
.breadcrumb__link { color: var(--color-primary); text-decoration: none; }
.breadcrumb__link:hover { text-decoration: underline; }

/* 空狀態（語意文字由各模板保留） */
.empty-state { text-align: center; color: var(--color-text-muted); padding: 40px 0; }

/* Badge／Tag／Chip（差異化模組色；狀態同時以文字呈現，不只依顏色） */
.badge {
    display: inline-block;
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: .72rem;
    text-decoration: none;
    margin-bottom: 6px;
    overflow-wrap: anywhere;
}
a.badge:hover { text-decoration: underline; }
.badge--orange  { background: #fff7ed; color: #ea580c; }
.badge--green   { background: #f0fdf4; color: #16a34a; }
.badge--purple  { background: #faf5ff; color: #7c3aed; }
.badge--blue    { background: #eff6ff; color: var(--color-primary); }
.badge--success { background: #dcfce7; color: #166534; }
.badge--danger  { background: #fee2e2; color: #991b1b; }
.badge--warning { background: #fef3c7; color: #92400e; }
.badge--grey    { background: var(--ds-color-neutral-100); color: var(--color-text-muted); }

.price-line {
    font-size: .85rem;
    color: var(--color-primary);
    font-weight: 600;
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}
.meta-line { font-size: .8rem; color: var(--color-text-muted); margin-bottom: 6px; overflow-wrap: anywhere; }
.tag-list { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
    padding: 2px 8px;
    background: var(--ds-color-neutral-100);
    border-radius: 20px;
    font-size: .75rem;
    color: var(--color-text-muted);
    overflow-wrap: anywhere;
}
.chip-list {
    font-size: .78rem;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.chip { display: inline-block; padding: 2px 8px; background: var(--ds-color-neutral-100); border-radius: var(--radius-sm); }

/* 卡片 CTA（margin-top:auto 讓不同高度卡片之操作列對齊） */
.card-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: auto; padding-top: 12px; }
.card-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    font-size: .85rem;
    color: var(--color-primary);
    font-weight: 500;
    text-decoration: none;
}
.card-link:hover { text-decoration: underline; }
.card-link--accent { color: #ea580c; }

/* Blog 列表（featured 雙欄 → 768px 單欄，修復 F-UX-4） */
.blog-listing { max-width: 960px; margin: 0 auto; padding: 48px 20px 72px; }
.blog-featured {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: center;
    margin-bottom: 56px;
    padding-bottom: 48px;
    border-bottom: 1px solid var(--color-border);
}
.blog-featured__image { display: block; border-radius: var(--radius-md); overflow: hidden; }
.blog-featured__img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.blog-featured__date { font-size: .8rem; color: var(--color-text-muted); margin-bottom: 10px; }
.blog-featured__title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 14px;
    line-height: 1.35;
    color: var(--color-text);
    overflow-wrap: anywhere;
}
.blog-featured__title a { text-decoration: none; color: inherit; }
.blog-featured__title a:hover { color: var(--color-primary); }
.blog-featured__excerpt {
    color: var(--color-text-muted);
    line-height: 1.7;
    font-size: .95rem;
    margin-bottom: 18px;
    overflow-wrap: anywhere;
}
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px; }
.post-card {
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
}
.post-card__image { display: block; }
.post-card__img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.post-card__body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.post-card__date { font-size: .75rem; color: var(--color-text-muted); margin-bottom: 8px; }
.post-card__title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
    color: var(--color-text);
    flex: 1;
    overflow-wrap: anywhere;
}
.post-card__title a { text-decoration: none; color: inherit; }
.post-card__title a:hover { color: var(--color-primary); }
.post-card__excerpt {
    font-size: .85rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 14px;
    overflow-wrap: anywhere;
}
.post-card__link { margin-top: auto; }

@media (max-width: 768px) {
    .blog-featured { grid-template-columns: 1fr; gap: 24px; margin-bottom: 40px; padding-bottom: 32px; }
}

@media (max-width: 480px) {
    .blog-listing { padding: 32px 16px 56px; }
    .blog-grid { grid-template-columns: 1fr; }
    .blog-featured__title { font-size: 1.25rem; }
}

/* ── Reduced Motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .skip-link,
    .contact-chip,
    .f-submit,
    .faq-card__icon { transition: none; }
    html { scroll-behavior: auto; }
}

/* ── Detail Pages (14G-U2-C1) — module-specific detail IA ─────
   Namespace: .dx-* shared detail components + .dtabs/.dtoc for the
   Course accessible tabs / Blog H2 TOC (progressive enhancement via
   assets/detail.js). Additive only: no U1 block selectors, no
   !important, no external URLs, no unscoped element selectors.
   Shell width override is scoped per entity modifier so the shared
   detail-shell.php stays byte-identical. ─────────────────────── */

/* Shell body widening for the three shell-based detail pages */
.detail--product .detail__body,
.detail--course .detail__body,
.detail--space .detail__body { max-width: 1080px; }

/* Containers */
.dx-container { max-width: 1080px; margin: 0 auto; padding: 48px 20px 72px; }
.dx-container--900 { max-width: 900px; }
.dx-reading { max-width: 760px; margin: 0 auto; padding: 48px 20px 72px; }

/* Full-width cover (self-built detail pages: service / case / blog) */
.dx-cover { width: 100%; max-height: 480px; overflow: hidden; background: var(--color-bg-alt); }
.dx-cover__img { display: block; width: 100%; height: 480px; object-fit: cover; }
.dx-cover--420 { max-height: 420px; }
.dx-cover--420 .dx-cover__img { height: 420px; }

/* Two-column commerce-style hero (image | info panel) */
.dx-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 40px;
    align-items: start;
    margin-bottom: 48px;
}
.dx-hero__media {
    margin: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    min-width: 0;
}
.dx-hero__img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.dx-hero__placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-linear-gradient(45deg, var(--ds-color-neutral-100), var(--ds-color-neutral-100) 10px, #e9eef5 10px, #e9eef5 20px);
    color: var(--ds-color-neutral-400);
    font-size: .85rem;
}
.dx-hero__panel { min-width: 0; }
.dx-hero__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.dx-hero__title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--color-text);
    margin: 0 0 16px;
    overflow-wrap: anywhere;
}
.dx-hero__actions { margin-top: 24px; }

/* Single-column page head (service / case / blog info block) */
.dx-pagehead { margin-bottom: 36px; }
.dx-pagehead .dx-hero__title { margin-bottom: 12px; }

/* Price / lead / meta */
.dx-price { font-size: 1.5rem; font-weight: 700; color: var(--color-text); margin: 0 0 16px; }
.dx-price-note { font-size: .85rem; font-weight: 400; color: var(--ds-color-neutral-500); line-height: 1.6; margin: -8px 0 16px; overflow-wrap: anywhere; }
.dx-price-line {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 16px;
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    font-size: .95rem;
    color: var(--ds-color-neutral-700);
    margin: 0 0 16px;
}
.dx-price-line__item { font-weight: 600; }
.dx-lead {
    font-size: 1.075rem;
    color: var(--color-text-muted);
    line-height: 1.7;
    margin: 0 0 24px;
    overflow-wrap: anywhere;
}
.dx-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    font-size: .85rem;
    color: var(--ds-color-neutral-500);
    margin-bottom: 8px;
}
.dx-meta time { color: var(--ds-color-neutral-400); }
.dx-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--ds-color-neutral-100);
    border-radius: 20px;
    font-size: .75rem;
    color: var(--ds-color-neutral-500);
}

/* Primary CTA (inquiry — URL contract lives in the templates) */
.dx-cta {
    display: inline-block;
    padding: 12px 28px;
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: .95rem;
    font-weight: 600;
}
.dx-cta:hover { background: var(--color-primary-hover); }

/* Facts grid (space capacity / area / location) */
.dx-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
    padding: 16px;
    background: var(--color-bg-alt);
    border-radius: var(--radius-md);
    margin: 0 0 16px;
}
.dx-facts__label {
    font-size: .72rem;
    color: var(--ds-color-neutral-500);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 2px;
}
.dx-facts__value { font-size: .975rem; color: var(--color-text); font-weight: 600; }

/* Content sections + tab-style single label (semantic heading) */
.dx-section { margin-bottom: 48px; }
.dx-tabbar { border-bottom: 1px solid var(--color-border); margin-bottom: 24px; }
.dx-tabbar__label {
    display: inline-block;
    padding: 10px 4px;
    font-size: .95rem;
    font-weight: 600;
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
    margin: 0 0 -1px;
}
.dx-section__title { font-size: 1.125rem; font-weight: 600; color: var(--color-text); margin: 0 0 12px; }

/* Prose (trusted clean_html-on-write content) */
.dx-prose { line-height: 1.85; color: var(--ds-color-neutral-700); font-size: .975rem; overflow-wrap: anywhere; min-width: 0; }
.dx-prose > :last-child { margin-bottom: 0; }
.dx-prose img { max-width: 100%; height: auto; }
.dx-prose table { display: block; max-width: 100%; overflow-x: auto; }
.dx-prose pre { overflow-x: auto; }
.dx-prose blockquote {
    margin: 1.5em 0;
    padding: 4px 16px;
    border-left: 3px solid var(--color-border);
    color: var(--color-text-muted);
}

/* Back row (self-built detail pages) */
.dx-backrow { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--color-border); }
.dx-back { font-size: .85rem; color: var(--ds-color-neutral-500); text-decoration: none; }
.dx-back:hover { color: var(--color-text); }

/* Accessible Tabs (Course; enhanced by detail.js — no-JS shows all panels) */
.dtabs { margin-bottom: 48px; }
.dtabs__list {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
}
.dtabs__tab {
    background: none;
    border: 0;
    padding: 10px 16px;
    font-size: .95rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.dtabs__tab:hover { color: var(--color-text); }
.dtabs__tab[aria-selected="true"] { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.dtabs__tab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.dtabs__panel { padding: 24px 0 0; }
.dtabs--enhanced .dtabs__panel[hidden] { display: none; }

/* Blog H2 TOC (built client-side by detail.js; absent without JS) */
.dtoc {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-alt);
    padding: 16px 20px;
    margin-bottom: 36px;
}
.dtoc__title { font-size: .85rem; font-weight: 600; color: var(--color-text); margin: 0 0 8px; }
.dtoc__list { margin: 0; padding-left: 18px; }
.dtoc__link { color: var(--color-text-muted); text-decoration: none; font-size: .9rem; line-height: 1.8; }
.dtoc__link:hover { color: var(--color-primary); text-decoration: underline; }

/* Detail responsive stacking */
@media (max-width: 900px) {
    .dx-hero { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 640px) {
    .dx-container,
    .dx-reading { padding: 32px 16px 56px; }
    .dx-hero__title { font-size: 1.5rem; }
    .dx-cover__img { height: 260px; }
    .dx-cover--420 .dx-cover__img { height: 240px; }
    .dx-cta { display: block; text-align: center; }
}

/* ── 14G-U2-C3-C: module authoring public components (additive) ──────────
   Shared secondary gallery (.dgallery), specifications definition list
   (.dspec), module FAQ accordion (.dfaq) and case before/after pairs
   (.dba). Class-only, mobile-first, 320px-safe; no effect on any sealed
   selector above. */

/* Secondary gallery (product / space) — featured image stays primary */
.dgallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.dgallery__item {
    margin: 0;
    border-radius: 10px;
    overflow: hidden;
    background: var(--ds-color-neutral-50);
    border: 1px solid var(--color-border);
    min-width: 0;
}
.dgallery__img {
    width: 100%;
    display: block;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}
.dgallery__placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-linear-gradient(45deg, var(--ds-color-neutral-100), var(--ds-color-neutral-100) 10px, #e9eef5 10px, #e9eef5 20px);
    color: var(--ds-color-neutral-400);
    font-size: .85rem;
}
.dgallery__caption {
    padding: 10px 14px;
    font-size: .8rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* Specifications definition list (product) — no horizontal overflow */
.dspec { margin: 0; }
.dspec__row {
    display: grid;
    grid-template-columns: minmax(96px, 200px) 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    min-width: 0;
}
.dspec__row:last-child { border-bottom: 0; }
.dspec__term { font-weight: 600; color: var(--color-text); font-size: .925rem; overflow-wrap: anywhere; min-width: 0; }
.dspec__desc { margin: 0; color: var(--ds-color-neutral-700); font-size: .925rem; line-height: 1.7; overflow-wrap: anywhere; min-width: 0; }

/* Variant price list (product, 14I-P3) — name + formatted price per active
   variant. Mirrors .dspec visually but uses flex+wrap so a long variant name or
   long price reflows on mobile without horizontal scroll or truncating a value. */
.dvar { margin: 0; }
.dvar__row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    min-width: 0;
}
.dvar__row:last-child { border-bottom: 0; }
.dvar__term { font-weight: 600; color: var(--color-text); font-size: .925rem; line-height: 1.7; overflow-wrap: anywhere; min-width: 0; flex: 1 1 60%; }
.dvar__desc { margin: 0; color: var(--ds-color-neutral-700); font-size: .925rem; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; min-width: 0; flex: 1 1 40%; text-align: right; }

/* Module FAQ accordion (native details/summary — keyboard operable, no-JS readable) */
.dfaq__item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0;
    margin-bottom: 10px;
    background: var(--color-bg);
}
.dfaq__q {
    cursor: pointer;
    padding: 14px 18px;
    font-weight: 600;
    font-size: .95rem;
    color: var(--color-text);
    list-style: none;
    overflow-wrap: anywhere;
}
.dfaq__q::-webkit-details-marker { display: none; }
.dfaq__q::before {
    content: '\FF0B'; /* ＋ */
    display: inline-block;
    margin-right: 8px;
    color: var(--color-primary);
    font-weight: 700;
}
.dfaq__item[open] .dfaq__q::before { content: '\FF0D'; /* － */ }
.dfaq__q:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: var(--radius-md); }
.dfaq__a {
    padding: 0 18px 16px;
    color: var(--ds-color-neutral-700);
    font-size: .925rem;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

/* Case before/after pairs — desktop side-by-side, mobile natural stacking */
.dba__list { display: grid; gap: 24px; }
.dba__pair { margin: 0; }
.dba__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.dba__cell {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: var(--ds-color-neutral-50);
    border: 1px solid var(--color-border);
    min-width: 0;
}
.dba__img {
    width: 100%;
    display: block;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}
.dba__label {
    position: absolute;
    left: 10px;
    bottom: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .72);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
}
.dba__caption {
    margin-top: 10px;
    font-size: .85rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* Blog author byline (plain text in the metadata row) */
.dx-author { color: var(--color-text-muted); font-size: .85rem; }

@media (max-width: 640px) {
    .dgallery__grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .dspec__row { grid-template-columns: 1fr; gap: 2px; padding: 12px 0; }
    .dba__grid { grid-template-columns: 1fr; }
}

/* ── 14G-U2-C3-C-R2: hero decision card + persistent booking anchors ──────
   Data-driven registration/booking summary card inside the Course/Space hero
   panel, sub-headings inside combined tab panels, and scroll margins for the
   persistent #course-registration / #space-booking regions. Class/id-scoped
   only — zero effect on Product/Service/Case/Blog or any listing page. */
.dx-decision {
    margin-top: 24px;
    padding: 16px 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-alt);
    min-width: 0;
}
.dx-decision__title {
    font-size: .85rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}
.dx-decision__list { margin: 0 0 12px; padding: 0; list-style: none; }
.dx-decision__list li {
    display: flex;
    gap: 8px;
    font-size: .85rem;
    line-height: 1.7;
    min-width: 0;
}
.dx-decision__label { color: var(--color-text-muted); flex-shrink: 0; }
.dx-decision__value { color: var(--color-text); overflow-wrap: anywhere; min-width: 0; }
.dx-decision__cta {
    display: inline-block;
    padding: 10px 18px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
}
.dx-decision__cta:hover { filter: brightness(.94); }
.dx-decision__cta:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.dx-subhead {
    font-size: .95rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 8px;
}
.dx-subhead:not(:first-child) { margin-top: 20px; }

/* Persistent booking regions sit below every tab set; anchors must not land
   under the site header. */
#course-registration,
#space-booking { scroll-margin-top: 80px; }

@media (max-width: 640px) {
    .dx-decision { padding: 14px; }
    .dx-decision__cta { display: block; text-align: center; }
    #course-registration,
    #space-booking { scroll-margin-top: 64px; }
}

/* ── V3 Sprint 14G-U2-C2: Related content + prev/next navigation ──────────
   Additive, narrow scope. Cards reuse the shared .grid-items/.grid-item
   listing vocabulary (theme.css); only section chrome and the prev/next
   nav are defined here. No shadows beyond the shared card token, no
   gradient, no carousel, no JS dependency. */
.drel {
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid var(--ds-color-neutral-200);
}
.drel__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ds-color-neutral-900);
    margin: 0 0 20px;
}
.drel__grid { margin: 0; }

.dprevnext {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--ds-color-neutral-200);
}
.dprevnext__link {
    flex: 1 1 240px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--ds-color-neutral-200);
    border-radius: 8px;
    text-decoration: none;
    color: var(--ds-color-neutral-900);
    background: #fff;
}
.dprevnext__link:hover { border-color: var(--color-primary, #2563eb); }
.dprevnext__link:focus-visible { outline: 2px solid var(--color-primary, #2563eb); outline-offset: 2px; }
.dprevnext__label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--color-primary, #2563eb);
}
.dprevnext__title {
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.5;
    word-break: break-word;
}
.dprevnext__link--next { text-align: right; }

@media (max-width: 640px) {
    .drel { margin-top: 36px; padding-top: 22px; }
    .dprevnext { flex-direction: column; }
    .dprevnext__link { flex-basis:auto; }
    .dprevnext__link--next { text-align: left; }
}

/* ── V3 Sprint 14H-U1-I1: canonical token adoption (additive) ──────────────
   Forced-colors baseline + a uniform canonical focus ring for interactive
   elements that have no more specific :focus-visible rule above. Additive
   only: no existing selector removed, no class renamed, no !important. The
   focus baseline uses 0-specificity :where() so every per-component
   :focus-visible rule above (higher specificity) continues to win; it only
   fills gaps with the canonical --ds-focus-ring. ───────────────────────── */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: var(--ds-focus-ring);
    border-radius: var(--ds-radius-sm);
}

/* Forced-colors (Windows High Contrast): keep actions legible and preserve
   semantic status chips. Only active under forced-colors — zero effect on the
   normal rendered palette (and thus zero visual regression). */
@media (forced-colors: active) {
    .f-submit,
    .dx-cta,
    .dx-decision__cta,
    .contact-success__action {
        border: 1px solid CanvasText;
    }
    .badge,
    .tag,
    .chip,
    .contact-chip {
        forced-color-adjust: none;
    }
}

/* ── P3 Header / Mobile Header / Footer Layout Presets ─────────────
   Additive layer: the stable, semantic Header/Footer DOM is never duplicated.
   A server-side allowlist maps a selected preset id to a FIXED <body> class
   (hp-* desktop header / mp-* mobile header / fp-* footer), emitted by
   core/LayoutPresets::bodyClass(). The DEFAULT preset of each region is the
   sealed pre-P3 baseline and emits NO class, so legacy sites / unknown ids /
   "restore default" render completely unchanged (zero visual change).
   Consumes P2 --color-* / --public-* tokens only; no !important, no external
   URL, no U1 block selectors. Preserved hooks: .site-nav-toggle / #site-nav /
   .is-open / aria-expanded / Escape (single shared mobile toggle JS, unchanged). */

/* ── System Credit (P3 §17): always rendered at the very bottom of every
   footer preset; never hidden via display:none / visibility / transparency /
   zero font. Uses the P2 footer_text token (contrast ≥4.5:1 vs footer bg is
   enforced by ThemeTokens); #94a3b8 fallback is high-contrast on the default
   dark footer. ── */
.site-footer__credit {
    width: 100%;
    font-size: .75rem;
    line-height: 1.5;
    text-align: center;
    margin-top: 8px;
    color: var(--color-footer-text, #94a3b8);
}

/* ── Desktop Header presets (≥769px only; mobile header bar stays standard
   on mobile where the toggle is shown). Defaults (left-brand) emit no class. ── */
@media (min-width: 769px) {
    /* centered-brand: logo centered above a centered nav row */
    .hp-centered-brand .site-header__inner {
        flex-direction: column;
        height: auto;
        min-height: 64px;
        padding: 12px 24px;
        justify-content: center;
        gap: 8px;
    }
    .hp-centered-brand .site-nav ul {
        justify-content: center;
        flex-wrap: wrap;
    }
    /* two-row: row1 logo (left), row2 nav (left) */
    .hp-two-row .site-header__inner {
        flex-direction: column;
        align-items: stretch;
        height: auto;
        min-height: 64px;
        padding: 10px 24px;
        gap: 8px;
    }
    .hp-two-row .site-nav ul {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    /* compact-centered: low-height centered bar (nav keeps baseline ≥.9rem CJK) */
    .hp-compact-centered .site-header__inner {
        height: 52px;
        padding: 0 20px;
        gap: 16px;
        justify-content: center;
    }
    .hp-compact-centered .site-logo img {
        height: 32px;
    }
    .hp-compact-centered .site-nav ul {
        gap: 20px;
        flex-wrap: wrap;
        justify-content: center;
    }
    /* Taller (centered / two-row) headers: keep in-page anchor targets clear of the bar. */
    .hp-centered-brand :target,
    .hp-two-row :target {
        scroll-margin-top: 100px;
    }
}

/* ── Mobile Header presets (≤768px). The legacy default (no mp-* class) is the
   current full-width dropdown panel — unchanged. These reuse the single shared
   toggle JS (.is-open / aria-expanded / Escape); JS-only visuals are scoped to
   html.js so the no-JS panel stays reachable. Touch targets ≥44px. ── */
@media (max-width: 768px) {
    /* drawer-right: right-side panel sliding in from the right. Reuses the shared
       toggle JS and the base absolute dropdown mechanism (anchored to the page
       header) — absolute + transform only, so the sealed R2 foundation.css overlay
       invariant (H17: no viewport-locked / adhered overlay) holds. */
    html.js .mp-drawer-right .site-nav {
        top: 100%;
        right: 0;
        left: auto;
        width: min(320px, 85vw);
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        border-left: 1px solid var(--color-border);
        box-shadow: -8px 8px 16px rgba(0, 0, 0, .08);
        transform: translateX(100%);
        transition: transform .2s ease;
    }
    html.js .mp-drawer-right .site-nav.is-open {
        transform: translateX(0);
    }
    html.js .mp-drawer-right .site-nav li a {
        padding: 14px 16px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* fullscreen-overlay: full-width, tall menu fading in below the header. Same
       absolute dropdown mechanism as the base — absolute + opacity only (H17). */
    html.js .mp-fullscreen-overlay .site-nav {
        top: 100%;
        left: 0;
        right: 0;
        min-height: calc(100vh - 64px);
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        padding: 32px 24px env(safe-area-inset-bottom);
        display: flex;
        flex-direction: column;
        justify-content: center;
        visibility: hidden;
        opacity: 0;
        transition: opacity .2s ease, visibility .2s ease;
    }
    html.js .mp-fullscreen-overlay .site-nav.is-open {
        visibility: visible;
        opacity: 1;
    }
    html.js .mp-fullscreen-overlay .site-nav li a {
        padding: 14px 4px;
        min-height: 44px;
        font-size: 1.0625rem;
        justify-content: center;
        text-align: center;
    }
}
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    html.js .mp-drawer-right .site-nav,
    html.js .mp-fullscreen-overlay .site-nav {
        transition: none;
    }
}

/* ── Footer presets. Defaults (brand-columns) emit no class. All keep the
   System Credit visible; only `legal` hides user social data (never the credit). ── */
.fp-centered-minimal .site-footer__inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
}
.fp-centered-minimal .site-footer__links,
.fp-centered-minimal .site-footer__social {
    justify-content: center;
}
.fp-centered-minimal .site-footer__copy,
.fp-centered-minimal .site-footer__credit {
    text-align: center;
}

.fp-split .site-footer__inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: start;
}
.fp-split .site-footer__copy,
.fp-split .site-footer__credit {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 16px;
}
@media (max-width: 640px) {
    .fp-split .site-footer__inner {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.fp-legal .site-footer__social {
    display: none;
}
.fp-legal .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}
.fp-legal .site-footer__copy,
.fp-legal .site-footer__credit {
    width: auto;
    text-align: left;
    margin-top: 8px;
}

/* ─────────────────────────────────────────────────────────────────
   P4 — Homepage Block Style Presets (V3 下一主線 P4; additive layer)
   Fixed selectors target the stable block DOM via bst-* classes emitted by
   core/BlockStyleRegistry::sectionClass(). Defaults (hero/cta/faq = legacy,
   collection layout = grid, mobile = stack) emit NO bst-* class → these rules
   never match → the sealed baseline renders byte-identical (zero visual change).
   Domain boundary: P3 smoke O3 / detail_templates forbid the U1 baseline block
   element selectors from living in this file. P4 therefore scopes the collection
   layout/mobile rules to the bst-* class placed ON the grid container (rendered
   by the templates) and uses generic child combinators (first-child / any-child)
   for items, never naming the U1 element. Hero/CTA/FAQ use their own non-forbidden
   element selectors (hero panel / cta text+action / faq list). P2 tokens reused;
   contrast inherits P2 WCAG AA. No carousel library: horizontal scroll is native
   overflow + scroll-snap. ─────────────────────────────────────────── */

/* ═══ Hero Style Presets (bst-hero-* on <section>) ═══ */
.bst-hero-centered .hero__content { align-items: center; text-align: center; }
.bst-hero-centered .hero__panel {
    background: var(--color-surface); color: var(--color-text);
    padding: 36px 40px; border-radius: var(--radius-lg); max-width: 640px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
}
.bst-hero-centered .hero__heading { color: var(--color-text); }
.bst-hero-centered .hero__text { color: var(--color-text-muted); }

.bst-hero-split-media .hero__panel {
    background: var(--color-surface); color: var(--color-text);
    padding: 36px 40px; border-radius: var(--radius-lg); max-width: 520px;
    margin-left: 5%; box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
}
.bst-hero-split-media .hero__heading { color: var(--color-text); }
.bst-hero-split-media .hero__text { color: var(--color-text-muted); }
@media (max-width: 768px) {
    .bst-hero-split-media .hero__panel { margin-left: 0; }
    .bst-hero-split-media .hero__content { align-items: center; }
}

.bst-hero-minimal-banner { min-height: 320px; }
.bst-hero-minimal-banner .hero__content { padding: 28px 24px; }
.bst-hero-minimal-banner .hero__heading { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }

/* ═══ CTA Style Presets (bst-cta-* on <section>; container targeted via > *) ═══ */
.bst-cta-centered > * { flex-direction: column; align-items: center; text-align: center; gap: 16px; }
.bst-cta-centered .cta__text { max-width: 640px; }
.bst-cta-split > * { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
@media (max-width: 640px) {
    .bst-cta-split > * { grid-template-columns: 1fr; justify-items: stretch; }
}
.bst-cta-inline > * { flex-wrap: nowrap; gap: 16px; }
.bst-cta-inline .cta__text { flex: 1 1 auto; min-width: 0; }

/* ═══ FAQ Style Presets (bst-faq-* on <section>; details/summary native) ═══ */
@media (min-width: 769px) {
    .bst-faq-two-column .faq-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 32px; }
}
.bst-faq-compact-list .faq-list { gap: 4px; }

/* ═══ Collection Desktop Layout (bst-layout-* ON the grid container rendered
   by the templates; items via generic children — no U1 selector names) ═══ */
.bst-layout-featured-grid { grid-template-columns: repeat(3, 1fr); }
.bst-layout-featured-grid > :first-child { grid-column: span 2; grid-row: span 2; }
@media (max-width: 768px) {
    .bst-layout-featured-grid { grid-template-columns: 1fr; }
    .bst-layout-featured-grid > :first-child { grid-column: auto; grid-row: auto; }
}
.bst-layout-compact-list { display: flex; flex-direction: column; gap: 12px; }
.bst-layout-compact-list > * { flex-direction: row; align-items: stretch; }
.bst-layout-compact-list > * > :first-child { flex: 0 0 140px; max-width: 140px; }
.bst-layout-compact-list > * > :first-child img { aspect-ratio: 1 / 1; height: 100%; }

/* ═══ Collection Mobile Layout (bst-mobile-* ON the container; ≤768px; native overflow + scroll-snap) ═══ */
@media (max-width: 768px) {
    .bst-mobile-compact-list { display: flex; flex-direction: column; gap: 10px; }
    .bst-mobile-compact-list > * { flex-direction: row; align-items: stretch; }
    .bst-mobile-compact-list > * > :first-child { flex: 0 0 110px; max-width: 110px; }
    .bst-mobile-compact-list > * > :first-child img { aspect-ratio: 1 / 1; height: 100%; }

    .bst-mobile-horizontal-scroll {
        display: flex; flex-wrap: nowrap; overflow-x: auto;
        scroll-snap-type: x mandatory; gap: 16px;
        padding-inline: 16px; padding-block: 4px; scroll-padding-inline: 16px;
        -webkit-overflow-scrolling: touch;
    }
    .bst-mobile-horizontal-scroll > * { flex: 0 0 78vw; max-width: 78vw; scroll-snap-align: start; }

    .bst-mobile-featured-scroll {
        display: flex; flex-wrap: nowrap; overflow-x: auto;
        scroll-snap-type: x mandatory; gap: 16px;
        padding-inline: 16px; padding-block: 4px; scroll-padding-inline: 16px;
        -webkit-overflow-scrolling: touch;
    }
    .bst-mobile-featured-scroll > * { flex: 0 0 70vw; max-width: 70vw; scroll-snap-align: start; }
    .bst-mobile-featured-scroll > :first-child { flex: 0 0 92vw; max-width: 92vw; }
}
/* Reduced motion: P4 uses only native scroll-snap (not animation) + no JS-driven scroll,
   so prefers-reduced-motion needs no override. Scrollbar left visible (never hidden). */

/* ── C5-A: commerce product-detail grammar ────────────────────────────────
   Product-only composition. The shared content and inquiry contracts remain
   untouched; these roles place real media, prices, variants and the existing
   contact action into one decision hierarchy without implying cart/checkout. */
.detail--product .detail__body { max-width: 1180px; }
.dx-product-hero {
    grid-template-columns: minmax(0, 1.12fr) minmax(320px, .88fr);
    gap: clamp(32px, 4vw, 56px);
    margin-bottom: 56px;
}
.dx-product-media { min-width: 0; }
.dx-product-media__stage {
    border-radius: var(--radius-lg);
    box-shadow: var(--ds-shadow-sm);
}
.dx-product-media__stage .dx-hero__img,
.dx-product-media__stage .dx-hero__placeholder { aspect-ratio: 1 / 1; }
.dx-product-gallery { margin-top: 14px; min-width: 0; }
.dx-product-gallery .dgallery__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.dx-product-gallery .dgallery__item { border-radius: var(--radius-md); }
.dx-product-gallery .dgallery__img,
.dx-product-gallery .dgallery__placeholder { aspect-ratio: 1 / 1; }
.dx-product-gallery .dgallery__caption {
    min-height: 42px;
    padding: 8px 10px;
    overflow-wrap: anywhere;
}
.dx-product-summary {
    padding: clamp(24px, 3vw, 36px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg);
    box-shadow: var(--ds-shadow-md);
}
.dx-product-summary .dx-hero__title {
    font-size: clamp(1.8rem, 2.8vw, 2.65rem);
    line-height: 1.16;
}
.dx-product-summary .dx-price {
    margin-bottom: 10px;
    font-size: clamp(1.6rem, 2.3vw, 2rem);
    letter-spacing: -.015em;
}
.dx-product-summary .dx-lead { margin-bottom: 0; }
.dx-product-options {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}
.dx-product-options__title {
    margin: 0 0 8px;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--color-text-muted);
}
.dx-product-options .dvar__row { padding: 9px 0; }
.dx-product-action-card {
    margin-top: 24px;
    padding: 18px;
    border-radius: var(--radius-md);
    background: var(--color-bg-alt);
}
.dx-product-action-card__label {
    margin: 0 0 10px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--color-text-muted);
}
.dx-product-action-card .dx-hero__actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-top: 0;
}
.dx-product-summary .dx-cta,
.dx-product-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 11px 20px;
    border-radius: var(--radius-md);
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
}
.dx-product-secondary {
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text);
}
.dx-product-secondary:hover { border-color: var(--color-primary); color: var(--color-primary); }
.dx-product-summary .dx-cta:focus-visible,
.dx-product-secondary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .38);
}
.dx-product-action-card__note {
    margin: 12px 0 0;
    font-size: .8rem;
    line-height: 1.65;
    color: var(--color-text-muted);
    overflow-wrap: anywhere;
}
.dx-product-information { scroll-margin-top: 96px; }

@media (max-width: 900px) {
    .dx-product-hero { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
    .dx-product-hero { gap: 24px; margin-bottom: 40px; }
    .dx-product-summary { padding: 22px 18px; }
    .dx-product-gallery .dgallery__grid {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(112px, 38vw);
        grid-template-columns: none;
        gap: 10px;
        overflow-x: auto;
        padding: 2px 2px 10px;
        scroll-padding-inline: 2px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }
    .dx-product-gallery .dgallery__item { scroll-snap-align: start; }
}

