/* =========================================================
   DreamPal กค Pattern Analysis page
   Header rules are copied from the home page CSS (main3a.css)
   so the header looks the same on every page.
   (Leave faq.css in place for faq.html.)
   ========================================================= */

:root {
    --blue: #0d47a1;
    --blue-hover: #1565c0;
    --green: #2e7d32;        /* page buttons: white text passes WCAG AA (~5:1) */
    --green-hover: #1b5e20;
    --green-accent: #4CAF50; /* header + decorative */
    --ink: #1e2a3a;
    --muted: #4f6f8f;
    --bg: #f9fafc;
    --line: #eef2f6;
    --header-h: 140px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    background: var(--bg);
    color: var(--ink);
}

img { max-width: 100%; }

a:focus-visible, summary:focus-visible, .btn:focus-visible {
    outline: 3px solid #ffb347;
    outline-offset: 2px;
}

/* ===== Page wrapper ===== */
.page-wrapper {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 1.25rem 20px 0;
}

/* =========================================================
   HEADER (same as home page)
   ========================================================= */
.site-header {
    position: sticky;            /* home uses fixed + body padding; looks the same */
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100vw;
    background: white;
    box-shadow: 0 4px 16px rgba(0, 20, 40, 0.08);
    z-index: 1000;
    line-height: 1.5;            /* home body line-height */
}

.logo-row {
    background: white;
    padding: 0.6rem 2rem;
    border-bottom: 1px solid rgba(13, 71, 161, 0.1);
}

.company-logo {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.company-logo img {
    height: 56px;
    width: auto;
    display: block;
    border-radius: 12px;
}

.slogan-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--blue);
    letter-spacing: -0.01em;
    background: #e3f2fd;
    padding: 0.4rem 1.4rem;
    border-radius: 40px;
    white-space: nowrap;
    border: 1px solid rgba(13, 71, 161, 0.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.header-cta {
    display: flex;
    gap: 12px;
}

.header-cta a {
    background: var(--blue);
    color: white;
    text-decoration: none;
    padding: 0.4rem 1.4rem;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: 0.2s;
    white-space: nowrap;
}

.header-cta a:hover { background: #1565c0; }
.header-cta a.signup { background: #4CAF50; }
.header-cta a.signup:hover { background: #3d8b40; }

.nav-row {
    background: var(--blue);
    color: white;
    padding: 0;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
}

.main-nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0.1rem 2rem;
}

.nav-links {
    display: flex;
    list-style: none;
    flex-wrap: wrap;
    gap: 0.2rem;
}

.nav-links li a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 0.4rem 1.2rem;
    font-weight: 500;
    border-radius: 30px;
    transition: background 0.2s;
    font-size: 0.95rem;
}

.nav-links li a:hover { background: var(--green-accent); }

.nav-links li a.active {
    border-bottom: 5px solid var(--green-accent);
    background: transparent;
    border-radius: 0;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.8rem;
    border-radius: 40px;
    font-weight: 600;
    font-size: 1.05rem;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-hover); }
.btn-ghost { background: transparent; color: var(--blue); border: 2px solid var(--blue); padding: calc(0.75rem - 2px) calc(1.8rem - 2px); }
.btn-ghost:hover { background: #e3f2fd; }
.btn-light { background: #fff; color: var(--blue); }
.btn-light:hover { background: #e3f2fd; }

/* ===== Hero ===== */
.hero {
    background: #fff;
    border: 1px solid rgba(13, 71, 161, 0.06);
    border-radius: 32px;
    padding: 2.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 20px rgba(0, 20, 50, 0.06);
}
.feature-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ffd700, #ffb347);
    color: #1a237e;
    padding: 0.2rem 0.9rem;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.9rem;
}
.hero h1 {
    font-size: clamp(1.7rem, 6vw, 2.4rem);
    line-height: 1.2;
    color: var(--blue);
    font-weight: 700;
    margin-bottom: 0.8rem;
}
.hero-lead {
    font-size: 1.15rem;
    color: #2c3e50;
    max-width: 620px;
}
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.hero-note {
    margin-top: 0.9rem;
    font-size: 0.9rem;
    color: var(--muted);
}

/* ===== Cards / sections ===== */
.card {
    background: #fff;
    border: 1px solid rgba(13, 71, 161, 0.06);
    border-radius: 32px;
    padding: 2.25rem 2.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 20px rgba(0, 20, 50, 0.06);
}
.card h2 {
    font-size: 1.5rem;
    color: var(--blue);
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.section-intro { color: #2c3e50; margin-bottom: 1.25rem; }

/* ===== Feature grid ===== */
.feature-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
}
.feature-grid li {
    background: #f4f8fd;
    border-radius: 18px;
    padding: 1.1rem 1.2rem;
}
.feature-grid i {
    font-size: 1.3rem;
    color: var(--blue);
    margin-bottom: 0.5rem;
}
.feature-grid h3 {
    font-size: 1.05rem;
    color: var(--blue);
    margin-bottom: 0.25rem;
}
.feature-grid p { font-size: 0.95rem; color: #2c3e50; }

/* ===== Highlight box ===== */
.pro-highlight {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-left: 4px solid var(--green-accent);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin: 1.25rem 0 0.25rem;
}
.pro-highlight strong { color: var(--green-hover); }

/* ===== Sample ===== */
.sample {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.sample-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1.1rem 1.2rem;
    background: #fff;
}
.sample-card h3 {
    font-size: 1rem;
    color: var(--blue);
    margin-bottom: 0.75rem;
}
.sample-card h3 i { margin-right: 6px; }
.sample-note, .bar-label { font-size: 0.92rem; color: #2c3e50; }
.sample-note { margin-top: 0.5rem; color: var(--muted); }

.stages { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.stages li {
    background: #f4f8fd;
    border-radius: 12px;
    padding: 0.5rem 0.8rem;
    font-weight: 600;
    color: var(--ink);
}
.stage-month {
    display: inline-block;
    min-width: 3.6rem;
    font-weight: 500;
    color: var(--muted);
}

.bar {
    height: 12px;
    background: #e3f2fd;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 0.5rem;
}
.bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--green-accent));
    border-radius: 10px;
}

.arc { list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 0.4rem; }
.arc li {
    counter-increment: step;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
}
.arc li::before {
    content: counter(step);
    flex: 0 0 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 0.8rem;
    display: grid;
    place-items: center;
}

.sample-prediction { background: #f4f8fd; }

.cta-inline { text-align: center; margin-top: 1.5rem; }

/* ===== FAQ (native <details>) ===== */
.faq-item { border-bottom: 1px solid var(--line); padding: 0.9rem 0; }
.faq-item:last-of-type { border-bottom: 0; }
.faq-item summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    list-style: none;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--blue);
    padding: 0.3rem 0;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--blue-hover); }
.faq-item summary::after {
    content: '';
    flex: 0 0 auto;
    width: 0.6rem;
    height: 0.6rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 0.25s ease;
    margin-right: 0.3rem;
}
.faq-item[open] summary::after { transform: rotate(-135deg); }
.faq-answer { padding: 0.6rem 0.25rem 0.2rem; color: #2c3e50; line-height: 1.7; }
.faq-answer p + p, .faq-answer ul + p, .faq-answer p + ul { margin-top: 0.6rem; }
.faq-answer ul { padding-left: 1.25rem; }
.faq-answer li + li { margin-top: 0.3rem; }
.faq-answer a, .section-intro a {
    color: var(--blue);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dotted rgba(13, 71, 161, 0.4);
}
.faq-answer a:hover { border-bottom-style: solid; }

.disclaimer {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    font-size: 0.88rem;
    color: var(--muted);
}

/* ===== Bottom CTA band ===== */
.cta-band {
    background: linear-gradient(135deg, #0d47a1, #1565c0);
    color: #fff;
    border-radius: 32px;
    padding: 2.25rem 2.5rem;
    text-align: center;
    margin-bottom: 2rem;
}
.cta-band h2 { font-size: 1.5rem; margin-bottom: 0.4rem; }
.cta-band p { opacity: 0.92; margin-bottom: 1.2rem; }

/* ===== Sticky mobile CTA (hidden on desktop) ===== */
.sticky-cta { display: none; }

/* =========================================================
   MOBILE
   ========================================================= */
@media (max-width: 768px) {

    body { padding-bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
    html { scroll-padding-top: 12px; }

    /* ----- Header (same as home page) ----- */
    .site-header {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        box-shadow: 0 2px 8px rgba(0, 20, 40, 0.05);
    }

    .logo-row { padding: 0.5rem 1rem; }

    .company-logo {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 0.5rem;
    }

    .logo-group {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .company-logo img { height: 42px; }

    .slogan-text { display: none; }

    .header-cta {
        display: flex;
        flex-direction: column;
        gap: 6px;
        margin-left: auto;
        flex: 0 0 auto;
    }

    .header-cta a {
        padding: 0.25rem 1rem;
        font-size: 1rem;
        text-align: center;
        min-width: 70px;
        display: block;
    }

    .nav-row {
        position: relative;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .main-nav {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 0.2rem 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .main-nav::-webkit-scrollbar { height: 3px; }
    .main-nav::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.15); border-radius: 10px; }
    .main-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.4); border-radius: 10px; }

    .nav-links {
        display: flex;
        overflow-x: visible;
        white-space: nowrap;
        flex-wrap: nowrap;
        gap: 0.25rem;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .nav-links::-webkit-scrollbar { display: none; }

    .nav-links::after {
        content: '';
        flex: 0 0 70vw; /* trailing space so the last link can scroll fully left */
    }

    .nav-links li a {
        padding: 0.4rem 0.85rem;
        font-size: 1rem;
        white-space: nowrap;
    }

    .nav-links li a.active {
        border-bottom: 2px solid #4CAF50;
        background: transparent;
        border-radius: 0;
    }

    /* ----- Page content ----- */
    .page-wrapper { padding: 1rem 14px 0; }
    .hero, .card, .cta-band { border-radius: 22px; padding: 1.5rem 1.25rem; }
    .hero-lead { font-size: 1.05rem; }
    .hero-actions .btn { flex: 1 1 100%; }
    .card h2, .cta-band h2 { font-size: 1.3rem; }
    .faq-item summary { font-size: 1.05rem; }
    .btn-primary, .btn-light { width: 100%; }
    .cta-inline .btn { width: 100%; }

    .sticky-cta {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 900;
        padding: 0.6rem 14px calc(0.6rem + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 -4px 16px rgba(0, 20, 40, 0.1);
    }

    /* ----- Phone scaling: same as the home page and faq.css -----
       Matches on iOS Safari AND Android Chrome (both support -webkit-hyphens).
       To make everything smaller or larger, change the one font-size below. */
    @supports (-webkit-hyphens: none) {
        html { font-size: 22px; }
        .company-logo img { height: 52px; }
        .header-cta a { font-size: 0.95rem; padding: 0.4rem 1.1rem; }
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}