/* ==========================================================================
   Law by Jeff — single-page site
   Palette: navy accent, white, neutral grays (from the lettermark)
   ========================================================================== */

/* Light theme (default) --------------------------------------------------- */
:root {
    color-scheme: light;
    --navy: #0b4f81;        /* primary accent — matches the lettermark */
    --navy-dark: #0a4571;   /* hover / hero headline (same hue, deeper) */
    --ink: #2b2b2b;         /* body text */
    --ink-soft: #555;       /* secondary text */
    --ink-faint: #707070;   /* muted labels — lightest gray with 4.5:1 on --bg and --bg-soft */
    --line: #e6e6e6;        /* hairlines */
    --field-border: #8a8a8a; /* form field bottom edge — 3:1 on --bg and --bg-soft */
    --bg: #ffffff;
    --bg-soft: #f7f8f9;     /* alternating section bg */
    --accent-text: #ffffff;
    --accent-bright: #5cb0e8; /* accent for text on dark surfaces */
    --accent-contrast: #ffffff; /* text color on a filled --navy surface */
    --nav-bg: rgba(255, 255, 255, 0.92);
    --hero-scrim: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.15) 30%,
        rgba(255, 255, 255, 0.82) 62%,
        rgba(255, 255, 255, 0.94) 100%
    );
    --hero-h1: var(--ink);
    --hero-lede: var(--ink-soft);
    --focus-ring: rgba(11, 79, 129, 0.12);
    --maxw: 1100px;         /* shared content column — matches the nav container */
    --font: "Avenir Next", Avenir, "Open Sans", "Helvetica Neue", sans-serif;
}

/* Dark theme --------------------------------------------------------------
   Applied via <html data-theme="dark">. The <head> script and theme.js
   resolve "auto" to light or dark from the OS setting before setting it. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --navy: #5bb1f1;        /* brightened from the lettermark azure for dark surfaces */
    --navy-dark: #86c9f2;
    --ink: #e7eaee;
    --ink-soft: #a9b2bd;
    --ink-faint: #7f8894;
    --line: #262d35;
    --field-border: #64707c;
    --bg: #0e1216;
    --bg-soft: #151b21;
    --accent-text: #ffffff;
    --accent-bright: #5bb1f1;
    --accent-contrast: #06233a; /* dark text on the bright --navy fill */
    --nav-bg: rgba(18, 23, 28, 0.92);
    --hero-scrim: linear-gradient(
        90deg,
        rgba(10, 14, 18, 0) 0%,
        rgba(10, 14, 18, 0.35) 30%,
        rgba(10, 14, 18, 0.85) 62%,
        rgba(10, 14, 18, 0.96) 100%
    );
    --hero-h1: #f2f5f8;
    --hero-lede: #c4ccd5;
    --focus-ring: rgba(91, 177, 241, 0.25);
}

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

html {
    scroll-padding-top: 4rem; /* keep anchors clear of the sticky nav */
}

/* Glide to in-page anchors only for visitors who haven't asked their OS
   to reduce motion; everyone else jumps straight there. */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    font-family: var(--font);
    line-height: 1.65;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1; /* push the footer to the bottom on short pages */
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--navy);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}

a:hover,
a:focus {
    color: var(--navy-dark);
}

/* Layout helpers ---------------------------------------------------------- */

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section {
    padding: 4.5rem 0;
}

.section.alt {
    background: var(--bg-soft);
}

.section-inner {
    max-width: var(--maxw);
    /* Inset by the container's side padding so the content edges line up
       exactly with the lettermark (left) and the CTA button (right). */
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Prose in text-only sections spans the full shared content column,
   left-aligned (flush with the section heading). */
.section-inner .prose {
    max-width: none;
    margin: 0;
}

/* Navigation -------------------------------------------------------------- */

.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--line);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
}

.brand {
    display: flex;
    align-items: flex-end; /* bottom-align the wordmark with the glyph */
    gap: 0.6rem;
    text-decoration: none; /* the wordmark is a logo, not a text link */
    white-space: nowrap;
}

.brand img {
    width: 34px;
    height: 34px;
    flex: 0 0 auto; /* never shrink — the wordmark may be hidden on mobile */
    object-fit: contain;
}

/* Both lettermarks are in the markup: the shipped logo is navy-on-white
   (needs a light surface); the dark variant is white-on-transparent.
   data-theme is set in <head> before first paint, so the right one shows
   from the first frame instead of being swapped in by script. */
.brand .logo-dark {
    display: none;
}

:root[data-theme="dark"] .brand .logo-light {
    display: none;
}

:root[data-theme="dark"] .brand .logo-dark {
    display: block;
}

.brand-name {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--ink);
    letter-spacing: 0.01em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    list-style: none;
}

.nav-links a {
    color: var(--ink-soft);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none; /* nav links signal via weight + hover color, not underline */
}

.nav-links a:hover,
.nav-links a:focus {
    color: var(--navy);
}

.nav-links .nav-cta {
    background: var(--navy);
    color: var(--accent-contrast);
    padding: 0.5rem 1.1rem;
    border-radius: 6px;
    white-space: nowrap;
}

.nav-links .nav-cta:hover,
.nav-links .nav-cta:focus {
    background: var(--navy-dark);
    color: var(--accent-contrast);
}

/* Theme switcher (Light / Dark / Auto) ------------------------------------ */

.theme-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.15rem;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.theme-switch button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.35rem 0.55rem;
    min-width: 24px;
    min-height: 24px; /* WCAG 2.5.8 minimum target size */
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.theme-switch button:hover {
    color: var(--ink);
}

.theme-switch button.is-active {
    background: var(--navy);
    color: var(--accent-contrast);
}

.theme-switch button:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 1px;
}

/* Hero -------------------------------------------------------------------- */

.hero {
    position: relative;
    min-height: 70vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: var(--bg-soft);
}

.hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Frame as a deliberate chest-up portrait: face upper-left, clean space right */
    object-position: 18% 28%;
}

/* Scrim: guarantees text contrast on the right + softens the seam/flat area */
.hero-scrim {
    position: absolute;
    inset: 0;
    background: var(--hero-scrim);
}

.hero-content {
    position: relative;
    z-index: 2;
    margin-left: auto;               /* push to the calm right side */
    max-width: 560px;
    padding: 3rem 2rem;
    text-align: left;
}

.hero-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 1rem;
}

.hero h1 {
    font-size: clamp(2rem, 4.5vw, 3.1rem);
    line-height: 1.12;
    font-weight: 700;
    color: var(--hero-h1);
    margin-bottom: 1.1rem;
}

.hero p.lede {
    font-size: 1.15rem;
    color: var(--hero-lede);
    margin-bottom: 1.9rem;
    max-width: 46ch;
}

/* Buttons ----------------------------------------------------------------- */

.btn {
    display: inline-block;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.85rem 1.7rem;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none; /* buttons signal via fill/border, not underline */
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
    background: var(--navy);
    color: var(--accent-contrast);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--navy-dark);
    color: var(--accent-contrast);
}

.btn-ghost {
    background: transparent;
    color: var(--navy);
    border-color: var(--navy);
}

.btn-ghost:hover,
.btn-ghost:focus {
    background: var(--navy);
    color: var(--accent-contrast);
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

/* Section headings -------------------------------------------------------- */

.section h1,
.section h2 {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 1.4rem;
    line-height: 1.2;
}

.section h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

/* Subsections inside a page's prose are <h2> (under the page's <h1>) but
   keep the smaller <h3> look. */
.section .prose h2 {
    font-size: 1.2rem;
    color: var(--navy);
    margin-bottom: 0.5rem;
    line-height: inherit;
}

.section p {
    margin-bottom: 1.1rem;
    color: var(--ink-soft);
}

.section p:last-child {
    margin-bottom: 0;
}

/* "How I can help" cards -------------------------------------------------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.4rem;
    margin-top: 2rem;
    align-items: stretch; /* equal-height cards */
}

.card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.6rem;
    display: flex;
    flex-direction: column;
}

.card h3 {
    color: var(--navy);
}

.card p {
    margin-bottom: 0;
    font-size: 0.98rem;
}

/* Trust: two-column — bio text (left) + company list (right) -------------- */

.trust-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr; /* text gets a touch more room than the list */
    gap: 3rem;
    margin-top: 2rem;
    align-items: stretch; /* both columns share the taller one's height */
}

.trust-text {
    display: flex;
    flex-direction: column;
}

.trust-text p {
    margin-bottom: 1.1rem;
}

.trust-text p:last-child {
    margin-bottom: 0;
}

.trusted {
    display: flex;
    flex-direction: column;
}

.trusted .label {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink-faint);
    margin-bottom: 1.1rem;
}

/* Brand logos: small inline marks, each to the left of its name, in a tidy
   2-up grid (horizontal). Kept in color, but small so the block stays calm. */
.brand-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.25rem;
}

.brand-list li {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.brand-list img {
    width: 1.5rem;
    height: 1.5rem;
    flex: 0 0 auto;
    object-fit: cover;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 0 0 1px var(--line); /* even hairline on all (incl. white) tiles */
}

.brand-list .brand-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--ink-soft);
    line-height: 1.4;
}

.trusted-note {
    margin-top: 1.2rem;
    font-size: 0.95rem;
    color: var(--ink-faint);
}

/* Contact + booking ------------------------------------------------------- */

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: stretch; /* both columns share the taller one's height */
}

/* Left column: borderless, but padded to match the booking box so the
   subheadings line up vertically. */
.contact-form {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.6rem;
}

.contact-form h3 {
    margin-bottom: 0.6rem;
}

/* Shown after Web3Forms redirects back with ?sent=1 (js/contact.js). */
.contact-form .form-status {
    padding: 0.8rem 1rem;
    border: 1px solid var(--navy);
    border-radius: 8px;
    background: var(--bg-soft);
    color: var(--ink);
    font-size: 0.95rem;
    margin-bottom: 1.1rem;
}

/* Focused only so screen readers announce it; it isn't interactive and
   already has a visible border, so skip the focus ring. */
.contact-form .form-status:focus {
    outline: none;
}

.contact-form label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ink);
    margin-bottom: 0.35rem;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.7rem 0.8rem;
    margin-bottom: 1.1rem;
    /* Hairline box, with the bottom edge at 3:1 so the field stays
       identifiable (WCAG 1.4.11) without a heavy outline. */
    border: 1px solid var(--line);
    border-bottom-color: var(--field-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--ink);
    background: var(--bg);
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.contact-form textarea {
    min-height: 130px;
    resize: vertical;
}

.contact-form .fineprint {
    font-size: 0.82rem;
    color: var(--ink-faint);
    margin-top: 0.6rem;
    margin-bottom: 0;
}

.booking-box {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.6rem;
}

.booking-box h3 {
    margin-bottom: 0.6rem;
}

.booking-box p {
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.booking-embed {
    width: 100%;
    min-height: 480px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg);
}

.booking-alt {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--ink-soft);
}

/* Table of contents (Startup Packet) -------------------------------------- */

.toc {
    list-style: none;
    counter-reset: toc;
    margin: 2rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.toc li {
    counter-increment: toc;
    display: grid;
    grid-template-columns: 2.5rem 1fr;
    gap: 1rem;
    align-items: baseline;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--line);
}

.toc li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.toc li::before {
    content: counter(toc, decimal-leading-zero);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--navy);
    letter-spacing: 0.04em;
}

.toc a {
    display: block;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--ink);
}

.toc a:hover,
.toc a:focus {
    color: var(--navy);
}

.toc span {
    display: block;
    font-size: 0.95rem;
    color: var(--ink-soft);
    margin-top: 0.2rem;
}

/* Packet pagination (prev / next between topic pages) ---------------------- */

.packet-pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}

.packet-pager a {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--ink-soft);
}

.packet-pager a:hover,
.packet-pager a:focus {
    color: var(--navy);
}

.packet-pager .pager-label {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ink-faint);
    margin-bottom: 0.25rem;
}

/* Footer ------------------------------------------------------------------ */

.site-footer {
    border-top: 1px solid var(--line);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--ink-faint);
}

/* Footer links inherit the base link rule (accent color + underline),
   so they read consistently with body links rather than as muted text. */

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 860px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .trust-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero {
        min-height: 78vh;
    }

    .hero-bg {
        object-position: 30% 20%;
    }

    /* On mobile, drop the scrim and center the text over the image */
    .hero-scrim {
        background: linear-gradient(
            180deg,
            rgba(8, 38, 57, 0.45) 0%,
            rgba(8, 38, 57, 0.72) 100%
        );
    }

    .hero-content {
        margin-left: 0;
        margin: 0 auto;
        text-align: center;
        padding: 2.5rem 1.5rem;
    }

    .hero h1 {
        color: #fff;
    }

    .hero p.lede {
        color: rgba(255, 255, 255, 0.95);
        margin-left: auto;
        margin-right: auto;
    }

    .hero-eyebrow {
        color: #fff;
    }

    .btn-row {
        justify-content: center;
    }

    /* Secondary button needs a fill to stay legible over the photo */
    .hero .btn-ghost {
        background: rgba(255, 255, 255, 0.92);
        color: var(--navy);
        border-color: rgba(255, 255, 255, 0.92);
    }

    .hero .btn-ghost:hover,
    .hero .btn-ghost:focus {
        background: #fff;
        color: var(--navy-dark);
    }

    .nav-links {
        gap: 1rem;
    }

    .nav-links a:not(.nav-cta) {
        display: none; /* collapse to brand + CTA on small screens */
    }

    /* Hide the emptied <li>s too, or each still takes up a flex gap. Kept
       as its own rule: an unsupported :has() would void the rule above. */
    .nav-links li:has(> a:not(.nav-cta)) {
        display: none;
    }
}

/* Brand + CTA + theme switcher need ~520px. This sits above 480px because
   desktop browsers can't be resized much below ~500px, so a phone-only
   breakpoint never triggers there and the bar wraps. */
@media (max-width: 560px) {
    /* Keep the "Law by Jeff" wordmark (brand identity) and drop the CTA —
       the hero's "Schedule a Consultation" button sits directly below and
       is the real mobile CTA. */
    .nav-cta,
    .nav-links li:has(> .nav-cta) {
        display: none;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 3rem 0;
    }

    /* Compress the theme switcher + padding so the bar fits the narrowest
       phones (320px) without horizontal scroll. */
    .nav-inner {
        padding: 0 16px;
    }

    .theme-switch {
        padding: 3px;
        gap: 1px;
    }

    .theme-switch button {
        font-size: 0.72rem;
        padding: 0.3rem 0.35rem;
    }
}
