/*
 * DVLA Dealer Listings — How It Works page CSS
 *
 * Design language matches the landing page (dealer-landing.css):
 *   navy hero, gold accents, Poppins font, light-grey content sections.
 *
 * Layout differs: this page uses a two-column body — sticky TOC sidebar
 * on the right (240px), main content column on the left. On mobile, the
 * TOC collapses into a select-dropdown "Jump to section" at the top of
 * the content.
 *
 * Naming: BEM-ish, prefixed `ddl-howto`.
 *
 * Sections:
 *   1. Page width overrides (Hello Elementor constraint override + title hide)
 *   2. Root + utilities
 *   3. Hero
 *   4. Body layout (2-column)
 *   5. TOC (sticky sidebar)
 *   6. Mobile jump dropdown
 *   7. Content sections
 *   8. Callouts
 *   9. Lists, code, defs, Q&A details
 *  10. CTA + buttons
 *  11. Mobile responsive
 */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* ── 1. Page width overrides ─────────────────────────────── */
body.ddl-howto-page main,
body.ddl-howto-page main.site-main,
body.ddl-howto-page .site-main,
body.ddl-howto-page #content,
body.ddl-howto-page .page-content,
body.ddl-howto-page .entry-content,
body.ddl-howto-page article.page,
body.ddl-howto-page .elementor-section-wrap {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.ddl-howto-page {
    overflow-x: hidden;
}

/* Suppress theme-rendered page title (the white "How this works" header
   that appears above the_content) — our hero replaces it. */
body.ddl-howto-page .page-title,
body.ddl-howto-page .entry-title,
body.ddl-howto-page .elementor-widget-theme-post-title,
body.ddl-howto-page header.entry-header {
    display: none !important;
}

/* ── 2. Root + utilities ─────────────────────────────────── */

.ddl-howto {
    --navy: #1a2744;
    --navy-soft: #2c326b;
    --gold: #f5c518;
    --gold-deep: #d4a813;
    --blue: #2E3687;
    --light: #f7f8fb;
    --light-2: #eef0f6;
    --border: #e5e7eb;
    --text-dark: #1a2744;
    --text-body: #3a3f55;
    --text-muted: #64748b;
    --subtitle: #c7cbe6;
    --code-bg: #1e293b;
    --warn-bg: #fffbeb;
    --warn-border: #f59e0b;
    --warn-text: #92400e;
    --info-bg: #eff6ff;
    --info-border: #3b82f6;
    --info-text: #1e3a8a;
    --tip-bg: #f0fdf4;
    --tip-border: #16a34a;
    --tip-text: #14532d;

    line-height: 1.6;
    background: #ffffff;
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
}

.ddl-howto,
.ddl-howto * { box-sizing: border-box; }

.ddl-howto__inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
    color: var(--text-body);
}

.ddl-howto .ddl-howto__h1 {
    font-family: 'Poppins', sans-serif !important;
    font-size: 48px !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    margin: 12px 0 16px !important;
    line-height: 1.1 !important;
    letter-spacing: -0.02em !important;
}

.ddl-howto .ddl-howto__h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--navy);
    margin: 0 0 12px;
    line-height: 1.2;
    letter-spacing: -0.01em;
    scroll-margin-top: 80px; /* for jump-link anchor offset */
}

.ddl-howto .ddl-howto__h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--navy);
    margin: 28px 0 10px;
    line-height: 1.3;
}

.ddl-howto .ddl-howto__eyebrow {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--gold) !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
    margin-bottom: 8px !important;
}

.ddl-howto .ddl-howto__lede {
    font-size: 18px !important;
    color: #e1e5f2 !important; /* near-white with hint of warmth, much higher contrast than periwinkle on navy */
    font-weight: 300 !important;
    line-height: 1.6 !important;
    margin: 0 !important;
    max-width: 720px !important;
}

.ddl-howto p {
    font-size: 15.5px;
    color: var(--text-body);
    line-height: 1.7;
    margin: 0 0 16px;
}

.ddl-howto code {
    background: var(--light-2);
    color: var(--navy);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', 'Roboto Mono', monospace;
    border: 1px solid var(--border);
}

.ddl-howto a {
    color: var(--blue);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.ddl-howto a:hover { color: var(--navy); }

/* ── 3. Hero ─────────────────────────────────────────────── */

.ddl-howto__hero {
    background: linear-gradient(135deg, var(--navy) 0%, #232f55 100%);
    padding: 80px 0 70px;
    border-bottom: 1px solid var(--navy-soft);
    position: relative;
    overflow: hidden;
}

.ddl-howto__hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--gold) 0%, transparent 70%);
}

/* ── 4. Body layout ──────────────────────────────────────── */

.ddl-howto__body {
    background: var(--light);
    padding: 60px 0 100px;
}

/* Layout: flexbox in row reverse so TOC sits on the right despite
   appearing first in source order. Using flex (not grid) is deliberate:
   flex is more forgiving when wpautop or other filters inject unexpected
   wrapper elements between our intended children. Stray <p> tags become
   flex items that we can zero out. Grid would push our intended children
   to wrong cells. */
.ddl-howto .ddl-howto__layout {
    display: flex !important;
    flex-direction: row-reverse !important;
    align-items: flex-start !important;
    gap: 48px !important;
    width: 100% !important;
    max-width: 1180px !important;
    margin: 0 auto !important;
    padding: 0 20px !important;
    flex-wrap: nowrap !important;
}

/* Zero out any stray <p> tags wpautop may inject between our siblings,
   so they don't create empty flex items that mess with the layout. */
.ddl-howto .ddl-howto__layout > p:empty,
.ddl-howto .ddl-howto__layout > br {
    display: none !important;
}

.ddl-howto .ddl-howto__content {
    background: #fff !important;
    border-radius: 16px !important;
    padding: 48px 56px !important;
    border: 1px solid var(--border) !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    flex: 1 1 auto !important; /* takes remaining space */
    min-height: 200px;
}

/* ── 5. TOC sidebar ──────────────────────────────────────── */

.ddl-howto .ddl-howto__toc {
    /* Sticky inside the flex item, offset from top so it sits below
       the site header. Adjust top value if the theme header is taller. */
    position: sticky !important;
    top: 100px;
    align-self: flex-start;
    flex: 0 0 260px !important;
    width: 260px !important;
    max-width: 260px !important;
    margin: 0 !important;
    display: block !important;
}

.ddl-howto__toc-inner {
    background: #fff;
    border-radius: 12px;
    padding: 20px 22px;
    border: 1px solid var(--border);
}

.ddl-howto__toc-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold-deep);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.ddl-howto__toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: tocnum;
}

.ddl-howto__toc-list li {
    margin: 0;
    counter-increment: tocnum;
}

.ddl-howto__toc-list a {
    display: block;
    padding: 7px 0 7px 26px;
    color: var(--text-body);
    text-decoration: none;
    font-size: 13.5px;
    line-height: 1.4;
    border-left: 2px solid transparent;
    margin-left: -2px;
    transition: color .12s, border-color .12s, background .12s;
    position: relative;
}

.ddl-howto__toc-list a::before {
    content: counter(tocnum);
    position: absolute;
    left: 8px;
    top: 7px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ddl-howto__toc-list a:hover {
    color: var(--navy);
    border-left-color: var(--gold);
    background: var(--light);
}

.ddl-howto__toc-cta {
    display: block;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--blue) !important;
    text-decoration: none !important;
}
.ddl-howto__toc-cta:hover {
    color: var(--navy) !important;
}

/* ── 6. Mobile jump dropdown ─────────────────────────────── */

.ddl-howto__jump-mobile {
    display: none;
    margin-bottom: 24px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
}

.ddl-howto__jump-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--gold-deep);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 8px;
}

.ddl-howto__jump-mobile select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--navy);
}

/* ── 7. Content sections ─────────────────────────────────── */

.ddl-howto__section {
    margin-bottom: 56px;
    scroll-margin-top: 40px;
}

.ddl-howto__section:last-child {
    margin-bottom: 0;
}

.ddl-howto__summary {
    background: var(--light);
    border-left: 3px solid var(--gold);
    padding: 14px 18px;
    margin: 0 0 24px;
    font-size: 14.5px;
    color: var(--text-body);
    line-height: 1.6;
    border-radius: 0 6px 6px 0;
    font-style: italic;
}

/* ── 8. Callouts ─────────────────────────────────────────── */

.ddl-howto__callout {
    border-radius: 8px;
    padding: 16px 20px;
    margin: 20px 0;
    border-left: 4px solid;
    font-size: 14.5px;
    line-height: 1.6;
}

.ddl-howto__callout strong {
    display: inline;
    margin-right: 4px;
}

.ddl-howto__callout--info {
    background: var(--info-bg);
    border-left-color: var(--info-border);
    color: var(--info-text);
}
.ddl-howto__callout--info strong { color: var(--info-text); }
.ddl-howto__callout--info a { color: var(--info-text); }

.ddl-howto__callout--warn {
    background: var(--warn-bg);
    border-left-color: var(--warn-border);
    color: var(--warn-text);
}
.ddl-howto__callout--warn strong { color: var(--warn-text); }
.ddl-howto__callout--warn a { color: var(--warn-text); }

.ddl-howto__callout--tip {
    background: var(--tip-bg);
    border-left-color: var(--tip-border);
    color: var(--tip-text);
}
.ddl-howto__callout--tip strong { color: var(--tip-text); }
.ddl-howto__callout--tip a { color: var(--tip-text); }

/* ── 9. Lists, code, defs, Q&A ───────────────────────────── */

.ddl-howto__list {
    padding-left: 20px;
    margin: 12px 0 18px;
}

.ddl-howto__list li {
    margin-bottom: 10px;
    font-size: 15.5px;
    line-height: 1.65;
    color: var(--text-body);
}

.ddl-howto__list--numbered {
    list-style: none;
    padding-left: 0;
    counter-reset: stepcount;
}

.ddl-howto__list--numbered li {
    counter-increment: stepcount;
    padding: 12px 16px 12px 56px;
    background: var(--light);
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
}

.ddl-howto__list--numbered li::before {
    content: counter(stepcount);
    position: absolute;
    left: 16px;
    top: 12px;
    width: 28px;
    height: 28px;
    background: var(--navy);
    color: var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.ddl-howto__code {
    background: var(--code-bg);
    color: #f1f5f9;
    padding: 16px 20px;
    border-radius: 8px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', 'Roboto Mono', monospace;
    font-size: 13.5px;
    line-height: 1.6;
    overflow-x: auto;
    margin: 14px 0 20px;
    white-space: pre;
}

.ddl-howto__defs {
    margin: 14px 0 20px;
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 10px 24px;
    background: var(--light);
    padding: 18px 20px;
    border-radius: 8px;
}

.ddl-howto__defs dt {
    font-weight: 600;
    color: var(--navy);
    font-size: 14.5px;
}

.ddl-howto__defs dd {
    margin: 0;
    font-size: 14.5px;
    color: var(--text-body);
    line-height: 1.5;
}

.ddl-howto__qa {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 10px;
}

.ddl-howto__qa summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--navy);
    font-size: 15px;
    list-style: none;
    padding-right: 30px;
    position: relative;
    user-select: none;
}
.ddl-howto__qa summary::-webkit-details-marker { display: none; }
.ddl-howto__qa summary::after {
    content: '+';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--text-muted);
    font-weight: 300;
}
.ddl-howto__qa[open] summary::after { content: '−'; }

.ddl-howto__qa p {
    margin: 12px 0 4px;
    font-size: 14.5px;
    line-height: 1.65;
}

/* ── 10. CTA + buttons ───────────────────────────────────── */

.ddl-howto__cta-block {
    text-align: center;
    margin: 32px 0 8px;
    padding: 28px;
    background: linear-gradient(135deg, var(--navy) 0%, #232f55 100%);
    border-radius: 12px;
}

.ddl-howto__btn {
    display: inline-block;
    padding: 14px 28px;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color .15s, transform .1s;
    line-height: 1.3;
    border: 2px solid transparent;
}
.ddl-howto__btn:active { transform: translateY(1px); }

.ddl-howto__btn--primary {
    background: var(--gold);
    color: var(--navy) !important;
    border-color: var(--gold);
}
.ddl-howto__btn--primary:hover {
    background: var(--gold-deep);
    border-color: var(--gold-deep);
    color: var(--navy) !important;
}

/* ── 11. Mobile responsive ───────────────────────────────── */

@media (max-width: 900px) {
    .ddl-howto .ddl-howto__layout {
        flex-direction: column !important;
        gap: 0 !important;
    }
    .ddl-howto .ddl-howto__toc {
        display: none !important; /* hide sticky sidebar — replaced by mobile dropdown */
    }
    .ddl-howto__jump-mobile {
        display: block;
        order: -1; /* above content (irrelevant in column, but keeps intent clear) */
    }
    .ddl-howto .ddl-howto__content {
        padding: 36px 32px !important;
        width: 100% !important;
        flex: 1 1 auto !important;
    }
}

@media (max-width: 720px) {
    .ddl-howto__hero { padding: 60px 0 50px; }
    .ddl-howto__h1 { font-size: 36px; }
    .ddl-howto__lede { font-size: 16px; }
    .ddl-howto__h2 { font-size: 24px; }
    .ddl-howto__h3 { font-size: 16px; }
    .ddl-howto__body { padding: 32px 0 60px; }
    .ddl-howto__content { padding: 24px 22px; border-radius: 12px; }
    .ddl-howto__section { margin-bottom: 40px; }
    .ddl-howto__defs {
        grid-template-columns: 1fr;
        gap: 4px 0;
        padding: 14px 16px;
    }
    .ddl-howto__defs dt { margin-top: 8px; }
    .ddl-howto__defs dt:first-child { margin-top: 0; }
    .ddl-howto__list--numbered li {
        padding: 12px 14px 12px 50px;
    }
    .ddl-howto__code {
        font-size: 12px;
        padding: 12px 14px;
    }
    .ddl-howto p,
    .ddl-howto__list li { font-size: 15px; }
}

@media (max-width: 480px) {
    .ddl-howto__h1 { font-size: 30px; }
    .ddl-howto__content { padding: 20px 18px; }
    .ddl-howto__cta-block { padding: 22px 18px; }
}
