/* ==========================================================================
   Palkan Marine — main.css
   Design direction: "Precision instrument"
   Cool hull-navy + brass, engineered type, Plimsoll load-line signature.

   Colour tokens below are defaults. config.json's "theme" block is injected
   by header.php as :root overrides AFTER this file, so the palette (and every
   color-mix derived from it) is editable from config / the future dashboard.

   CONTENTS
     1.  Design tokens (colour, type, spacing, layout, motion)
     2.  Reset / base elements
     3.  Layout helpers (container, section, eyebrow, lead, skip-link)
     4.  Signature — the load line (Plimsoll mark)
     5.  Buttons
     6.  Site header — topbar, brand
     7.  Primary navigation (progressive enhancement; .js + .is-open)
     8.  Hero / page-hero / dark band (section--ink)
     9.  Cards / grids
     10. Forms (+ contact extras: split, contact-list, alerts, map)
     11. Site footer
     12. FAQ (details/summary)
     13. Stats
     14. Utilities
     15. Reduced motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
    /* Colour — overridable from config theme */
    --ink:        #0A2A43;   /* deep hull navy: headings, hero, primary       */
    --steel:      #4C6478;   /* muted text, labels                            */
    --fog:        #EEF2F6;   /* cool page background                          */
    --surface:    #FFFFFF;   /* cards, inputs                                 */
    --line:       #D4DDE5;   /* hairline rules, borders                       */
    --brass:      #B07D2B;   /* accent: rules, marks                          */
    --brass-dark: #8A6220;   /* AA-safe accent: link text, CTA backgrounds    */

    /* Derived roles */
    --bg:         var(--fog);
    --text:       var(--ink);
    --text-muted: var(--steel);
    --on-ink:     #F4F8FB;   /* text on navy fields                           */
    --ink-soft:   #163b58;   /* hover/elevated navy                           */

    /* Typography */
    --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
    --font-body:    "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system,
                    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    --fs-eyebrow: 0.78rem;
    --fs-sm:      0.875rem;
    --fs-base:    1rem;
    --fs-lg:      1.25rem;
    --fs-h3:      clamp(1.25rem, 1.05rem + 0.9vw, 1.6rem);
    --fs-h2:      clamp(1.6rem,  1.25rem + 1.7vw, 2.4rem);
    --fs-h1:      clamp(2.2rem,  1.6rem + 3vw,    3.4rem);

    --lh-tight: 1.12;
    --lh-snug:  1.3;
    --lh-base:  1.65;
    --tracking-eyebrow: 0.14em;

    /* Spacing scale */
    --space-2xs: 0.25rem;
    --space-xs:  0.5rem;
    --space-sm:  0.75rem;
    --space-md:  1rem;
    --space-lg:  1.5rem;
    --space-xl:  2rem;
    --space-2xl: 3rem;
    --space-3xl: 4.5rem;

    /* Layout */
    --container: 1200px;
    --gutter:    clamp(1rem, 4vw, 2rem);

    /* Surface treatment */
    --radius:    6px;
    --radius-sm: 4px;
    --shadow-sm: 0 1px 2px rgba(10, 42, 67, 0.06),
                 0 6px 16px rgba(10, 42, 67, 0.07);

    /* Motion */
    --transition: 180ms ease;
}

/* --------------------------------------------------------------------------
   2. Reset / base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: var(--lh-base);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    line-height: var(--lh-tight);
    color: var(--ink);
    margin: 0 0 var(--space-md);
    font-weight: 600;
}
h1 { font-size: var(--fs-h1); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.01em; }
h3 { font-size: var(--fs-h3); }

p { margin: 0 0 var(--space-md); }
p:last-child { margin-bottom: 0; }

a { color: var(--brass-dark); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

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

ul { margin: 0; padding: 0; }
li { list-style: none; }

address { font-style: normal; }

:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 2px;
    border-radius: 2px;
}

/* --------------------------------------------------------------------------
   3. Layout helpers
   -------------------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.section { padding-block: var(--space-3xl); }
.section--surface { background: var(--surface); }

.eyebrow {
    display: inline-block;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: var(--fs-eyebrow);
    text-transform: uppercase;
    letter-spacing: var(--tracking-eyebrow);
    color: var(--steel);
    margin-bottom: var(--space-sm);
}

.lead { font-size: var(--fs-lg); color: var(--steel); }

.skip-link {
    position: absolute;
    left: var(--space-md);
    top: -3rem;
    z-index: 1000;
    background: var(--ink);
    color: var(--on-ink);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: top var(--transition);
}
.skip-link:focus { top: var(--space-md); color: var(--on-ink); }

/* --------------------------------------------------------------------------
   4. Signature — the load line (Plimsoll mark)
   Drop <div class="loadline" role="presentation"></div> between sections.
   A full-width hairline crossed by a brass bisected circle.
   -------------------------------------------------------------------------- */
.loadline {
    position: relative;
    height: 20px;
    margin-block: var(--space-2xl);
}
.loadline::before {        /* the line through */
    content: "";
    position: absolute;
    inset-block: 50% auto;
    inset-inline: 0;
    height: 1px;
    background: var(--line);
}
.loadline::after {         /* the bisected circle */
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    transform: translate(-50%, -50%);
    border: 1.5px solid var(--brass);
    border-radius: 50%;
    background: transparent;
}
.loadline--start::after { left: 9px; }   /* left-aligned variant */

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--fs-sm);
    line-height: 1;
    padding: 0.8rem 1.3rem;
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition), color var(--transition),
                border-color var(--transition), transform var(--transition);
}
.btn:hover { transform: translateY(-1px); }
.btn .icon { font-size: 1.1em; }

.btn--primary { background: var(--brass-dark); color: #fff; }
.btn--primary:hover { background: #73511a; color: #fff; }

.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); color: var(--ink); }

/* On dark fields */
.on-dark .btn--ghost { border-color: rgba(255, 255, 255, 0.4); color: #fff; }
.on-dark .btn--ghost:hover { border-color: #fff; color: #fff; }

/* --------------------------------------------------------------------------
   6. Site header — topbar + brand + nav
   -------------------------------------------------------------------------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }

.topbar {
    background: var(--ink);
    color: var(--on-ink);
    font-size: var(--fs-sm);
}
.topbar a { color: var(--on-ink); text-decoration: none; }
.topbar a:hover { color: #fff; text-decoration: underline; }
.topbar__inner { display: flex; }
.topbar__contact {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md) var(--space-lg);
    padding-block: 0.55rem;
}
.topbar__contact li { display: inline-flex; align-items: center; gap: 0.4em; }
.topbar__contact .icon { color: var(--brass); }

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    padding-block: var(--space-md);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--ink);
}
.brand__logo { width: 48px; height: 48px; }
.brand__name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   7. Primary navigation
   Progressive enhancement: usable without JS (links visible/stacked on
   mobile). When <html class="js"> is present, the toggle takes over below
   the breakpoint. JS (Step 4) adds .is-open and flips aria-expanded.
   -------------------------------------------------------------------------- */
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.4rem;
    color: var(--ink);
    background: transparent;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.nav-toggle__close { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle__open { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle__close { display: inline-flex; }

.primary-nav__list {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}
.primary-nav__link {
    position: relative;
    display: inline-block;
    padding-block: 0.4rem;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: var(--fs-sm);
    color: var(--ink);
    text-decoration: none;
    letter-spacing: 0.01em;
}
/* brass underline indicator — a restrained nod to the load line */
.primary-nav__link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2px;
    background: var(--brass);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
}
.primary-nav__link:hover::after,
.primary-nav__link.is-active::after { transform: scaleX(1); }
.primary-nav__link.is-active { color: var(--brass-dark); }

/* Nav is a flex row so the search box sits beside the links (desktop) */
.primary-nav { display: flex; align-items: center; gap: var(--space-lg); }

.site-search { display: flex; align-items: center; }
.site-search input {
    width: 9rem;
    font: inherit;
    font-size: var(--fs-sm);
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    padding: 0.45rem 0.6rem;
}
.site-search input:focus { outline: none; border-color: var(--brass); }
.site-search button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.6rem;
    color: #fff;
    background: var(--brass-dark);
    border: 1.5px solid var(--brass-dark);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
}
.site-search button:hover { background: #73511a; }

@media (max-width: 768px) {
    html.js .nav-toggle { display: inline-flex; }

    html.js .primary-nav {
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        background: var(--surface);
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow-sm);
        max-height: 0;
        overflow: hidden;
        visibility: hidden;
        transition: max-height var(--transition), visibility var(--transition);
    }
    html.js .primary-nav.is-open { max-height: 80vh; visibility: visible; }

    .site-header__inner { position: relative; }

    .primary-nav__list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: var(--space-sm) var(--gutter);
    }
    .primary-nav__item { border-top: 1px solid var(--line); }
    .primary-nav__item:first-child { border-top: 0; }
    .primary-nav__link { display: block; padding: var(--space-md) 0; }
    .primary-nav__link::after { display: none; }
    .primary-nav__link.is-active {
        border-left: 3px solid var(--brass);
        padding-left: var(--space-sm);
    }

    .primary-nav { flex-direction: column; align-items: stretch; gap: 0; }
    .site-search { padding: var(--space-sm) var(--gutter) var(--space-md); }
    .site-search input { width: auto; flex: 1; }

    .topbar__hours { display: none; }   /* keep the topbar to one line on phones */
}

/* --------------------------------------------------------------------------
   8. Hero (shared base; pages refine content)
   -------------------------------------------------------------------------- */
.hero {
    background: var(--ink);
    color: var(--on-ink);
    padding-block: clamp(var(--space-2xl), 8vw, calc(var(--space-3xl) * 1.4));
}
.hero h1 { color: #fff; max-width: 22ch; }
.hero .eyebrow { color: var(--brass); }
.hero .lead { color: rgba(244, 248, 251, 0.82); max-width: 56ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-xl); }

/* Smaller hero for interior pages */
.page-hero { background: var(--ink); color: var(--on-ink); padding-block: var(--space-2xl); }
.page-hero h1 { color: #fff; margin-bottom: var(--space-xs); }
.page-hero .eyebrow { color: var(--brass); }
.page-hero p { color: rgba(244, 248, 251, 0.82); margin: 0; }

/* Dark band — closing CTA / emphasis sections */
.section--ink { background: var(--ink); color: var(--on-ink); }
.section--ink h2 { color: #fff; }
.section--ink .lead { color: rgba(244, 248, 251, 0.82); }

/* --------------------------------------------------------------------------
   9. Cards / grids
   -------------------------------------------------------------------------- */
.cards {
    display: grid;
    gap: var(--space-lg);
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--brass);
    border-radius: var(--radius);
    padding: var(--space-lg);
    transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.card h3 { margin-bottom: var(--space-xs); }
.card p { color: var(--steel); font-size: var(--fs-sm); }
.card__icon { color: var(--brass-dark); font-size: 1.75rem; margin-bottom: var(--space-sm); }

/* --------------------------------------------------------------------------
   10. Forms
   -------------------------------------------------------------------------- */
.field { margin-bottom: var(--space-md); }
.field label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--space-2xs);
}
.field input,
.field textarea,
.field select {
    width: 100%;
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.85rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.field textarea { min-height: 9rem; resize: vertical; }
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--brass);
    box-shadow: 0 0 0 3px rgba(176, 125, 43, 0.18);
}
.field input::placeholder,
.field textarea::placeholder { color: #91a2b1; }

/* Contact page extras: split layout, contact list, alerts, field errors, map */
.split { display: grid; gap: var(--space-2xl); grid-template-columns: 1fr; }
@media (min-width: 820px) { .split { grid-template-columns: 1fr 1fr; } }

.contact-list { list-style: none; display: grid; gap: var(--space-md); }
.contact-list li { display: flex; gap: var(--space-sm); align-items: flex-start; }
.contact-list .icon { color: var(--brass-dark); margin-top: 0.2em; flex: none; }
.contact-list a { color: var(--ink); }

.alert { padding: var(--space-md) var(--space-lg); border-radius: var(--radius-sm); border: 1px solid; margin-bottom: var(--space-lg); }
.alert--ok { background: #eaf5ee; border-color: #bce0c8; color: #1d6b3a; }
.alert--error { background: #fdecec; border-color: #f3c6c6; color: #9b2226; }

.field__error { display: block; color: #c0392b; font-size: var(--fs-sm); margin-top: var(--space-2xs); }
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"],
.field select[aria-invalid="true"] { border-color: #c0392b; }

.map { margin-top: var(--space-2xl); }
.map iframe { width: 100%; height: 420px; border: 0; border-radius: var(--radius); display: block; }

/* Search results page */
.search-form { display: flex; gap: var(--space-sm); max-width: 40rem; margin-bottom: var(--space-xl); }
.search-form input {
    flex: 1;
    min-width: 0;
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.85rem;
}
.search-form input:focus {
    outline: none;
    border-color: var(--brass);
    box-shadow: 0 0 0 3px rgba(176, 125, 43, 0.18);
}
.search-results { display: grid; gap: var(--space-lg); max-width: 46rem; }
.search-results__item { padding-bottom: var(--space-lg); border-bottom: 1px solid var(--line); }
.search-results__title { font-size: var(--fs-h3); margin-bottom: var(--space-2xs); }
.search-results__title a { text-decoration: none; }
.search-results__title a:hover { text-decoration: underline; }
.search-results__url { color: var(--steel); font-size: var(--fs-sm); margin: 0; }

/* --------------------------------------------------------------------------
   11. Site footer
   -------------------------------------------------------------------------- */
.site-footer { background: var(--ink); color: var(--on-ink); margin-top: var(--space-3xl); }
.site-footer a { color: var(--on-ink); }
.site-footer a:hover { color: #fff; }

.site-footer__grid {
    display: grid;
    gap: var(--space-2xl);
    grid-template-columns: 1.4fr 1fr 1.3fr;
    padding-block: var(--space-2xl);
}
.site-footer__heading {
    font-size: var(--fs-base);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.site-footer__col p { color: rgba(244, 248, 251, 0.8); }
.site-footer__links a {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    padding-block: 0.3rem;
    text-decoration: none;
}
.site-footer__links a:hover { text-decoration: underline; }
.site-footer__links .icon { color: var(--brass); }
.site-footer__contact p { display: flex; gap: 0.55em; align-items: flex-start; }
.site-footer__contact .icon { color: var(--brass); margin-top: 0.2em; flex: none; }

.site-footer__bar {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-block: var(--space-md);
    font-size: var(--fs-sm);
}
.site-footer__bar p { margin: 0; color: rgba(244, 248, 251, 0.7); }

@media (max-width: 768px) {
    .site-footer__grid { grid-template-columns: 1fr; gap: var(--space-xl); }
}

/* --------------------------------------------------------------------------
   12. FAQ  (uses <details>/<summary>: works without JS, good for GEO)
   -------------------------------------------------------------------------- */
.faq { display: grid; gap: var(--space-sm); max-width: 50rem; }
.faq__item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.faq__item summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--ink);
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after {
    content: "+";
    color: var(--brass-dark);
    font-weight: 700;
    font-size: 1.25em;
    line-height: 1;
}
.faq__item[open] summary::after { content: "\2013"; }
.faq__answer { padding: 0 var(--space-lg) var(--space-lg); color: var(--steel); }

/* --------------------------------------------------------------------------
   13. Stats
   -------------------------------------------------------------------------- */
.stats {
    display: grid;
    gap: var(--space-lg);
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    text-align: center;
}
.stat__num {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-h2);
    line-height: var(--lh-tight);
    color: var(--ink);
}
.stat__label {
    color: var(--steel);
    font-size: var(--fs-eyebrow);
    text-transform: uppercase;
    letter-spacing: var(--tracking-eyebrow);
}

/* --------------------------------------------------------------------------
   14. Utilities
   -------------------------------------------------------------------------- */
.icon { display: inline-block; vertical-align: -0.125em; flex: none; }
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.muted { color: var(--steel); }
.mt-0 { margin-top: 0; }

/* --------------------------------------------------------------------------
   15. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
