/*
 * Brand CMS Core — Default Theme CSS
 * ============================================================
 * Customize per client:
 *   1. Override CSS custom properties (:root block) — colours, fonts, spacing
 *   2. Add client-specific rules after the base layer
 *   3. Replace this file entirely in a different theme directory
 *
 * Structure:
 *   Custom Properties → Reset → Layout → Header → Footer →
 *   Buttons → Hero → Carousel → Grid → CTA → FAQ → Blog →
 *   Custom HTML block → Utilities → Responsive
 * ============================================================
 */

/* ── Custom Properties ─────────────────────────────────────── */
:root {
    /* Brand colours — override these per client */
    --color-primary:      #2563eb;
    --color-primary-hover:#1d4ed8;
    --color-accent:       #f59e0b;

    /* Neutrals */
    --color-text:         #1e293b;
    --color-text-muted:   #64748b;
    --color-bg:           #ffffff;
    --color-bg-alt:       #f8fafc;
    --color-border:       #e2e8f0;

    /* Hero */
    --color-hero-overlay: rgba(0, 0, 0, 0.45);
    --hero-min-height:    520px;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "Noto Sans TC", sans-serif;

    /* Layout */
    --container:     1200px;
    --space-block:   72px;
    --radius:        8px;
    --radius-lg:     12px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html   { scroll-behavior: smooth; }
body   { font-family: var(--font-sans); color: var(--color-text);
         background: var(--color-bg); line-height: 1.7; -webkit-font-smoothing: antialiased; }
img    { max-width: 100%; height: auto; display: block; }
a      { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── Layout ────────────────────────────────────────────────── */
.site-main { min-height: 60vh; }

.block__inner {
    max-width: var(--container);
    margin:    0 auto;
    padding:   var(--space-block) 24px;
}

/* ── Site Header ───────────────────────────────────────────── */
.site-header {
    position: sticky;
    top:       0;
    z-index:   100;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.site-header__inner {
    max-width: var(--container);
    margin:    0 auto;
    padding:   0 24px;
    height:    64px;
    display:   flex;
    align-items:     center;
    justify-content: space-between;
    gap: 24px;
}

.site-logo {
    font-size:   1.25rem;
    font-weight: 800;
    color:       var(--color-primary);
    flex-shrink: 0;
}
.site-logo img { height: 40px; width: auto; }

.site-nav ul { display: flex; align-items: center; gap: 28px; }
.site-nav a  {
    font-size:  .9rem;
    font-weight: 500;
    color:       var(--color-text-muted);
    transition:  color .2s;
}
.site-nav a:hover { color: var(--color-primary); }

/* ── Site Footer ───────────────────────────────────────────── */
.site-footer {
    background: var(--color-text);
    color:      #94a3b8;
    padding:    48px 0 32px;
}

.site-footer__inner {
    max-width:  var(--container);
    margin:     0 auto;
    padding:    0 24px;
    display:    flex;
    flex-wrap:  wrap;
    gap:        16px;
    align-items: center;
    justify-content: space-between;
}

.site-footer__links { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer__links a { color: #94a3b8; font-size: .85rem; transition: color .2s; }
.site-footer__links a:hover { color: #fff; }

.site-footer__social { display: flex; gap: 14px; flex-wrap: wrap; }
.site-footer__social a { color: #94a3b8; font-size: .85rem; transition: color .2s; }
.site-footer__social a:hover { color: #fff; }

.site-footer__copy {
    width: 100%;
    font-size: .78rem;
    text-align: center;
    margin-top: 16px;
    color: #64748b;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
    gap:             8px;
    padding:         12px 28px;
    border-radius:   var(--radius);
    font-size:       .95rem;
    font-weight:     600;
    cursor:          pointer;
    transition:      background .2s, color .2s, border-color .2s;
    text-decoration: none;
    white-space:     nowrap;
}

.btn--hero {
    background: var(--color-primary);
    color:      #fff;
    border:     2px solid transparent;
}
.btn--hero:hover { background: var(--color-primary-hover); }

.btn--cta {
    background: #fff;
    color:      var(--color-primary);
    border:     2px solid transparent;
}
.btn--cta:hover { background: #eff6ff; }

.btn--outline {
    background: transparent;
    color:      var(--color-primary);
    border:     2px solid var(--color-primary);
}
.btn--outline:hover { background: var(--color-primary); color: #fff; }

/* ── Block Base ────────────────────────────────────────────── */
.block__section-label {
    font-size:     clamp(1.5rem, 2.5vw, 2.1rem);
    font-weight:   800;
    margin-bottom: 8px;
    color:         var(--color-text);
    line-height:   1.25;
}

.block__subtitle {
    font-size:     1rem;
    color:         var(--color-text-muted);
    margin-bottom: 36px;
    max-width:     640px;
}

.block__cta-row { margin-top: 36px; text-align: center; }

/* Dev-only empty notice */
.block__empty-notice {
    padding:      24px;
    background:   #fffbeb;
    border:       1px dashed #fcd34d;
    border-radius: var(--radius);
    color:        #92400e;
    font-size:    .85rem;
    margin-bottom: 16px;
}

/* ── Block: Hero (shared) ──────────────────────────────────── */
.block--hero {
    position:    relative;
    min-height:  var(--hero-min-height);
    background:  #1e293b center / cover no-repeat;
    display:     flex;
    align-items: center;
}

.block--hero::after {
    content:  '';
    position: absolute;
    inset:    0;
    background: var(--color-hero-overlay);
}

.hero__content {
    position:        relative;
    z-index:         1;
    width:           100%;
    max-width:       var(--container);
    margin:          0 auto;
    padding:         48px 24px;
    display:         flex;
    flex-direction:  column;
    align-items:     flex-start;
    gap:             20px;
}

.hero__heading {
    font-size:   clamp(2rem, 4.5vw, 3.2rem);
    font-weight: 800;
    color:       #fff;
    line-height: 1.18;
    max-width:   680px;
}

.hero__text {
    font-size:  1.1rem;
    color:      rgba(255, 255, 255, .88);
    max-width:  560px;
    line-height: 1.6;
}

/* ── Block: Carousel ───────────────────────────────────────── */
.carousel          { position: relative; overflow: hidden; }
.carousel__track   { display: flex; transition: transform .5s cubic-bezier(.4,0,.2,1); }
.carousel__slide   { min-width: 100%; min-height: var(--hero-min-height);
                     background: #1e293b center / cover no-repeat;
                     display: flex; align-items: center; }

.carousel__btn {
    position:   absolute;
    top:        50%;
    transform:  translateY(-50%);
    z-index:    5;
    background: rgba(255,255,255,.18);
    backdrop-filter: blur(4px);
    color:      #fff;
    border:     2px solid rgba(255,255,255,.3);
    width:      48px; height: 48px;
    border-radius: 50%;
    font-size:  1rem;
    cursor:     pointer;
    display:    flex; align-items: center; justify-content: center;
    transition: background .2s;
}
.carousel__btn:hover { background: rgba(255,255,255,.35); }
.carousel__btn--prev { left: 20px; }
.carousel__btn--next { right: 20px; }

.carousel__dots {
    position:  absolute;
    bottom:    20px;
    left:      50%;
    transform: translateX(-50%);
    display:   flex;
    gap:       8px;
    z-index:   5;
}
.carousel__dot {
    width:        10px; height: 10px;
    border-radius: 50%;
    background:   rgba(255,255,255,.45);
    border:       2px solid rgba(255,255,255,.5);
    cursor:       pointer;
    transition:   background .2s;
}
.carousel__dot.is-active { background: #fff; border-color: #fff; }

/* ── Block: Grid (services + cases) ───────────────────────── */
.block--grid      { background: var(--color-bg-alt); }
.block--services  { background: var(--color-bg); }

.grid-items {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap:                   24px;
}

.grid-item {
    background:    #fff;
    border:        1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow:      hidden;
    transition:    box-shadow .25s, transform .25s;
}
.grid-item:hover {
    box-shadow: 0 12px 32px rgba(0,0,0,.09);
    transform:  translateY(-3px);
}

.grid-item__image img { width: 100%; height: 200px; object-fit: cover; }

.grid-item__body { padding: 20px 22px 22px; }

.grid-item__title {
    font-size:     1rem;
    font-weight:   700;
    margin-bottom: 8px;
    line-height:   1.4;
}
.grid-item__title a:hover { color: var(--color-primary); }

.grid-item__meta {
    font-size:     .78rem;
    color:         var(--color-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.grid-item__desc {
    font-size:   .875rem;
    color:       var(--color-text-muted);
    line-height: 1.55;
}

/* ── Block: CTA ────────────────────────────────────────────── */
.block--cta { background: var(--color-primary); }

.block--cta .block__inner {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    flex-wrap:       wrap;
    gap:             24px;
    padding-top:     56px;
    padding-bottom:  56px;
}

.cta__text {
    font-size:  1.25rem;
    font-weight: 600;
    color:      #fff;
    max-width:  620px;
    line-height: 1.5;
}

/* ── Block: FAQ ────────────────────────────────────────────── */
.faq-list { display: flex; flex-direction: column; gap: 10px; }

.faq-item details {
    border:        1px solid var(--color-border);
    border-radius: var(--radius);
    overflow:      hidden;
    background:    #fff;
}

.faq-item__q {
    display:         flex;
    justify-content: space-between;
    align-items:     center;
    padding:         18px 22px;
    font-weight:     600;
    font-size:       .95rem;
    cursor:          pointer;
    transition:      background .2s;
    list-style:      none;
}
.faq-item__q::-webkit-details-marker { display: none; }
.faq-item__q::after {
    content:     '+';
    font-size:   1.3rem;
    font-weight: 300;
    color:       var(--color-primary);
    flex-shrink: 0;
    margin-left: 12px;
    transition:  transform .2s;
}
details[open] .faq-item__q           { background: var(--color-bg-alt); }
details[open] .faq-item__q::after    { content: '−'; }

.faq-item__a {
    padding:       18px 22px;
    color:         var(--color-text-muted);
    font-size:     .9rem;
    line-height:   1.75;
    border-top:    1px solid var(--color-border);
    white-space:   pre-wrap;
}

/* ── Block: Blog ───────────────────────────────────────────── */
.blog-cards {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap:                   24px;
}

.blog-card {
    background:    #fff;
    border:        1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow:      hidden;
    transition:    box-shadow .25s;
}
.blog-card:hover { box-shadow: 0 12px 32px rgba(0,0,0,.09); }

.blog-card__image img { width: 100%; height: 210px; object-fit: cover; }

.blog-card__body { padding: 20px 22px 22px; }

.blog-card__date {
    display:    block;
    font-size:  .75rem;
    color:      var(--color-text-muted);
    margin-bottom: 6px;
}

.blog-card__title {
    font-size:     1rem;
    font-weight:   700;
    margin-bottom: 8px;
    line-height:   1.4;
}
.blog-card__title a:hover { color: var(--color-primary); }

.blog-card__excerpt {
    font-size:   .875rem;
    color:       var(--color-text-muted);
    line-height: 1.55;
}

/* ── Block: Custom HTML ────────────────────────────────────── */
/* Let the embedded HTML control its own layout */
.block--custom .block__inner { padding: 0; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
    :root { --space-block: 52px; }
    .grid-items    { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .blog-cards    { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

@media (max-width: 640px) {
    :root { --space-block: 40px; --hero-min-height: 380px; }

    .site-header__inner { padding: 0 16px; }
    .site-nav ul        { gap: 16px; }

    .block--cta .block__inner {
        flex-direction: column;
        text-align:     center;
    }
    .cta__text { max-width: 100%; }

    .site-footer__inner { flex-direction: column; gap: 14px; align-items: flex-start; }
    .site-footer__copy  { text-align: left; }

    .hero__content { padding: 36px 16px; }
}

@media (max-width: 480px) {
    /* Mobile nav — hamburger to be implemented per theme in v2 */
    .site-nav { display: none; }
}

/* ── Floating CTA ──────────────────────────────────────────── */
.float-cta {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999;
}

.float-cta__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    transition: transform .15s ease, box-shadow .15s ease;
}

.float-cta__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.24);
}

.float-cta__btn--phone     { background: #25d366; }
.float-cta__btn--line      { background: #06c755; }
.float-cta__btn--messenger { background: #0084ff; }

@media (max-width: 640px) {
    .float-cta {
        bottom: 16px;
        right: 16px;
        gap: 8px;
    }
    .float-cta__btn {
        width: 44px;
        height: 44px;
    }
}
