/* ============================================================
   Tribevillage — design system
   Deep charcoal with a single warm terracotta accent, on an off-white surface.
   Mobile-first, no JS dependency. One self-hosted display font for
   headings/wordmark (Plus Jakarta Sans — OFL licensed, see fonts/OFL.txt);
   body text stays on the system font stack.
   ============================================================ */

/* Single variable-range file; the three weights below all resolve against
   it (see wwwroot/fonts/OFL.txt for license). */
@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/fonts/plus-jakarta-sans.woff2") format("woff2");
}

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/plus-jakarta-sans.woff2") format("woff2");
}

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url("/fonts/plus-jakarta-sans.woff2") format("woff2");
}

:root {
    --color-navy-950: #15181d;
    --color-navy-900: #20252b;
    --color-navy-800: #2b3138;
    --color-slate-700: #334155;
    --color-slate-600: #475569;
    --color-slate-500: #64748b;
    --color-slate-200: #e2e8f0;
    --color-slate-100: #f4f1ea;
    --color-surface: #f4f1ea;
    /* --color-white means "elevated surface" (cards, inputs, the alt section band) and is
       redefined per-theme below to a dark navy in dark mode — correct for that role, but it is
       NOT a safe "always light" colour. Never use it for text/icons on the header, footer or hero,
       which stay a fixed dark navy regardless of theme (--color-navy-900/950, not themed) — those
       need --color-slate-100 instead, which never changes with theme. Mixing the two up here once
       made the mobile nav's hamburger icon and the active nav link invisible in dark mode. */
    --color-white: #ffffff;
    --color-text: #20252b;
    --color-accent: #c96f3d;
    --color-accent-dark: #9c4a22;
    --color-success: #1a7f4e;
    --color-error: #b3261e;

    /* Link/muted text — tuned per-theme since the light-mode shades don't have
       enough contrast once the surface flips dark (see dark-mode overrides below). */
    --color-link: var(--color-accent-dark);
    --color-muted: var(--color-slate-600);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-heading: "Plus Jakarta Sans", var(--font-sans);

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2rem;
    --space-6: 3rem;
    --space-7: 4.5rem;
    --space-8: 6rem;

    --max-width: 72rem;
    --radius: 0.375rem;
    --border: 1px solid rgba(32, 37, 43, 0.08);
    --border-strong: 1px solid rgba(32, 37, 43, 0.14);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-surface: #15181d;
        --color-white: #20252b;
        --color-text: #f4f1ea;
        --border: 1px solid rgba(255, 255, 255, 0.08);
        --border-strong: 1px solid rgba(255, 255, 255, 0.14);
        --color-link: var(--color-accent);
        --color-muted: #b8b2a6;
    }
}

:root[data-theme="dark"] {
    --color-surface: #15181d;
    --color-white: #20252b;
    --color-text: #f4f1ea;
    --border: 1px solid rgba(255, 255, 255, 0.08);
    --border-strong: 1px solid rgba(255, 255, 255, 0.14);
    --color-link: var(--color-accent);
    --color-muted: #b8b2a6;
}

*, *::before, *::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-surface);
    line-height: 1.6;
    font-size: 1.0625rem;
}

/* Static (non-animated — deliberately, for performance and motion sensitivity)
   grain texture. Pure CSS/SVG, no image request, breaks up flat colour fields
   without being a decorative distraction. */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
    opacity: 0.025;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--color-navy-900);
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 var(--space-3);
    font-weight: 700;
}

h1 { font-weight: 800; line-height: 1.08; letter-spacing: -0.025em; }
h2 { letter-spacing: -0.015em; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) h1,
    :root:not([data-theme="light"]) h2,
    :root:not([data-theme="light"]) h3,
    :root:not([data-theme="light"]) h4 {
        color: var(--color-slate-100);
    }
}

:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] h4 {
    color: var(--color-slate-100);
}

h1 { font-size: clamp(2rem, 1.6rem + 2vw, 3rem); }
h2 { font-size: clamp(1.5rem, 1.3rem + 1vw, 2rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 var(--space-3); }

ul, ol { padding-left: 1.25rem; }

a {
    color: var(--color-link);
    text-decoration-line: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.15s ease, text-decoration-color 0.2s ease;
}

a:hover,
a:focus-visible {
    color: var(--color-accent);
    text-decoration-color: currentColor;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.nav-toggle-label:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

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

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--color-navy-900);
    color: var(--color-slate-100);
    padding: var(--space-2) var(--space-3);
    z-index: 100;
}

.skip-link:focus {
    left: var(--space-3);
    top: var(--space-3);
}

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    max-width: var(--max-width);
    margin-inline: auto;
    padding-inline: var(--space-4);
}

/* ---------- Header / nav ---------- */

.site-header {
    background: var(--color-navy-900);
    position: sticky;
    top: 0;
    z-index: 50;
}

.site-header__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: var(--space-3);
    position: relative;
}

.site-header__logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-slate-100);
    text-decoration: none;
}

.site-header__logo .logo-mark {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
}

.site-header__logo .logo-wordmark {
    height: 1.125rem;
    width: auto;
}

.site-header__logo:hover { color: var(--color-accent); }

/* ---------- Theme toggle ---------- */

/* Hidden until theme-init.js confirms JS actually works — a control that does
   nothing without JS shouldn't be shown (site already respects OS dark-mode
   preference with zero JS; this button only adds a manual override). */
.theme-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-left: auto;
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: var(--color-slate-100);
    cursor: pointer;
}

.js-enabled .theme-toggle {
    display: inline-flex;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    color: var(--color-accent);
}

.theme-toggle__icon {
    width: 1.25rem;
    height: 1.25rem;
}

.theme-toggle__icon--moon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle__icon--sun { display: none; }
    :root:not([data-theme="light"]) .theme-toggle__icon--moon { display: block; }
}

:root[data-theme="dark"] .theme-toggle__icon--sun { display: none; }
:root[data-theme="dark"] .theme-toggle__icon--moon { display: block; }

@media (min-width: 60rem) {
    .theme-toggle { margin-left: var(--space-4); order: 1; }
}

.nav-toggle-input { display: none; }

.nav-toggle-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    cursor: pointer;
    border-radius: var(--radius);
}

.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
    display: block;
    width: 1.5rem;
    height: 2px;
    background: var(--color-slate-100);
    position: relative;
    transition: transform 0.2s ease;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
    content: "";
    position: absolute;
}

.nav-toggle-icon::before { top: -7px; }
.nav-toggle-icon::after { top: 7px; }

.site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-navy-900);
    border-top: 1px solid var(--color-navy-800);
}

.nav-toggle-input:checked ~ .site-nav {
    display: block;
}

.site-nav ul {
    list-style: none;
    margin: 0;
    padding: var(--space-3) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.site-nav a {
    display: block;
    position: relative;
    padding: var(--space-2) 0;
    color: var(--color-slate-100);
    text-decoration: none;
    font-weight: 500;
}

.site-nav a:hover,
.site-nav a:focus-visible {
    color: var(--color-accent);
}

.site-nav a.active {
    color: var(--color-slate-100);
    font-weight: 700;
}

@media (min-width: 60rem) {
    .site-nav a.active::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: -2px;
        height: 2px;
        background: var(--color-accent);
        border-radius: 1px;
    }
}

.site-nav__cta {
    margin-top: var(--space-2);
    display: inline-block !important;
    background: var(--color-accent);
    color: var(--color-navy-950) !important;
    padding: var(--space-2) var(--space-4) !important;
    border-radius: var(--radius);
    font-weight: 700;
}

.site-nav__cta:hover { background: #d97d4b; }

@media (min-width: 60rem) {
    .nav-toggle-label { display: none; }

    .site-nav {
        display: block;
        position: static;
        background: none;
        border: 0;
    }

    .site-nav ul {
        flex-direction: row;
        align-items: center;
        gap: var(--space-5);
        padding: 0;
    }

    .site-nav__cta { margin-top: 0; margin-left: var(--space-2); }
}

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

.site-footer {
    background: var(--color-navy-950);
    color: var(--color-slate-200);
    margin-top: var(--space-8);
    padding-block: var(--space-6) var(--space-4);
}

.site-footer a { color: var(--color-slate-100); }
.site-footer a:hover { color: var(--color-accent); }

.site-footer__brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-slate-100);
}

.site-footer__brand .logo-mark {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.site-footer__brand .logo-wordmark {
    height: 1rem;
    width: auto;
}

.site-footer__grid {
    display: grid;
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

.site-footer__grid nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.site-footer__legal {
    border-top: 1px solid var(--color-navy-800);
    padding-top: var(--space-4);
    font-size: 0.875rem;
    color: var(--color-slate-500);
}

@media (min-width: 48rem) {
    .site-footer__grid {
        grid-template-columns: 2fr 1fr 1fr;
    }
}

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

.hero {
    background: linear-gradient(180deg, var(--color-navy-900) 0%, var(--color-navy-950) 100%);
    color: var(--color-slate-100);
    padding-block: var(--space-7) var(--space-8);
    position: relative;
    overflow: hidden;
}

/* A single, static ambient glow — not animated, not repeated elsewhere on the site. */
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(44rem 26rem at 82% -10%, rgba(201, 111, 61, 0.16), transparent 60%),
        radial-gradient(30rem 20rem at 8% 110%, rgba(148, 163, 184, 0.08), transparent 60%);
    pointer-events: none;
}

.hero .container {
    position: relative;
    z-index: 2;
}

.hero h1 { color: var(--color-slate-100); max-width: 40rem; }

/* ---------- Hero background photography ----------
   Used on one hero at a time, never stacked with other photo treatment.
   The photo sits beneath the existing gradient/glow, desaturated and
   darkened so hero text keeps its contrast untouched by whatever the
   source photo looked like. A single, slow "settle" zoom (triggered once,
   on load, by hero-photo.js adding .is-settled) gives it a little life
   without turning into a distraction — and like every transition on this
   site, it's switched off completely under prefers-reduced-motion (see the
   Motion rules at the end of this file). */
.hero__photo {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.hero__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(0.5) saturate(0.85) contrast(1.05) brightness(0.55);
    transform: scale(1.06);
    transition: transform 16s ease-out;
}

.hero--photo.is-settled .hero__photo img {
    transform: scale(1);
}

.hero__photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(21, 24, 29, 0.82) 0%, rgba(21, 24, 29, 0.93) 100%);
}

/* Inline section illustrations (service pages). */
.illustration {
    margin: 0 0 var(--space-5);
    max-width: 30rem;
    transition: opacity 0.5s ease, translate 0.5s ease;
}

.illustration img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.illustration--wide {
    max-width: 40rem;
}

/* A single supporting photo dropped into body copy (e.g. About). Framed the
   same way as the illustrations so photography and the hand-drawn SVGs read
   as one system rather than two different eras of the site. */
.photo-figure {
    margin: 0 0 var(--space-5);
    max-width: 30rem;
    overflow: hidden;
    border-radius: var(--radius);
    transition: opacity 0.5s ease, translate 0.5s ease;
}

.photo-figure img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.photo-figure figcaption {
    margin-top: var(--space-2);
    font-size: 0.875rem;
    color: var(--color-muted);
}

/* Shared hover micro-interaction for every inline image (illustration, pillar
   card media or photo) — a small lift in scale, nothing that moves layout. */
.illustration img,
.card__media,
.photo-figure img {
    transition: transform 0.4s ease;
}

.illustration:hover img,
.card:hover .card__media,
.photo-figure:hover img {
    transform: scale(1.015);
}

/* Pillar card header illustrations. */
.card__media {
    display: block;
    width: 100%;
    height: auto;
    margin-bottom: var(--space-3);
    border-radius: var(--radius);
}

.hero__lede {
    max-width: 36rem;
    font-size: 1.125rem;
    color: var(--color-slate-200);
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.hero__tagline {
    list-style: none;
    margin: var(--space-6) 0 0;
    padding-left: var(--space-4);
    border-left: 3px solid var(--color-accent);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.0625rem;
    color: var(--color-slate-100);
    max-width: 18rem;
}

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

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 700;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

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

.btn-primary:hover { background: #d97d4b; color: var(--color-navy-950); }

.btn-secondary {
    background: transparent;
    border-color: var(--color-slate-200);
    color: var(--color-slate-100);
}

.btn-secondary:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* ---------- Sections ---------- */

.section {
    padding-block: var(--space-7);
}

.section--alt {
    background: var(--color-white);
    border-block: var(--border);
}

.section__heading {
    max-width: 40rem;
    margin-bottom: var(--space-5);
    transition: opacity 0.5s ease, translate 0.5s ease;
}

/* ---------- Scroll-reveal (progressive enhancement) ----------
   Content is fully visible with zero JS. The hiding rule below is gated on
   "reveal-enabled", which scroll-reveal.js adds to <html> itself, right
   before it guarantees every target will get "is-visible" one way or
   another (observed into view, or immediately if IntersectionObserver/the
   script itself has a problem) — so a failed/blocked script can't leave
   content permanently invisible. */
.reveal-enabled .card,
.reveal-enabled .section__heading,
.reveal-enabled .illustration,
.reveal-enabled .photo-figure {
    opacity: 0;
    translate: 0 1rem;
}

.reveal-enabled .card.is-visible,
.reveal-enabled .section__heading.is-visible,
.reveal-enabled .illustration.is-visible,
.reveal-enabled .photo-figure.is-visible {
    opacity: 1;
    translate: 0 0;
}

/* Accent is reserved for CTAs/interactive moments — eyebrow labels stay neutral
   so the copper tone keeps its weight instead of being spent on every label. */
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--color-muted);
}

.hero .eyebrow {
    color: rgba(241, 245, 249, 0.7);
}

/* ---------- Cards / grid ---------- */

.card-grid {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: 1fr;
}

@media (min-width: 48rem) {
    .card-grid--2 { grid-template-columns: repeat(2, 1fr); }
    .card-grid--3 { grid-template-columns: repeat(3, 1fr); }
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease,
                opacity 0.5s ease, translate 0.5s ease;
}

.card:hover {
    border-color: rgba(201, 111, 61, 0.35);
    box-shadow: 0 4px 16px rgba(32, 37, 43, 0.08);
    transform: translateY(-2px);
}

.card h3 { margin-bottom: var(--space-2); }

.card__link {
    display: inline-block;
    margin-top: auto;
    padding-top: var(--space-2);
    font-weight: 700;
}

/* ---------- Layout utilities ---------- */

.text-center { text-align: center; }
.mx-auto { margin-inline: auto; }
.mt-5 { margin-top: var(--space-5); }
.section--spacious { padding-block: var(--space-8); }

.measure { max-width: 42rem; }
.measure-sm { max-width: 36rem; }
.measure-xs { max-width: 32rem; }

/* ---------- Lists with checkmarks ---------- */

.check-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.check-list li {
    padding-left: 1.75rem;
    position: relative;
    margin-bottom: var(--space-2);
}

.check-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--color-link);
    font-weight: 700;
}

/* ---------- Forms ---------- */

.form-field {
    margin-bottom: var(--space-4);
}

.form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.form-field input,
.form-field textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--color-slate-500);
    border-radius: var(--radius);
    font: inherit;
    background: var(--color-white);
    color: var(--color-text);
}

.form-field .field-validation-error,
.validation-summary-errors {
    color: var(--color-error);
    font-size: 0.875rem;
    display: block;
    margin-top: var(--space-1);
}

.form-field input[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] {
    border-color: var(--color-error);
}

.form-success {
    background: #e7f5ec;
    border: 1px solid var(--color-success);
    color: #0f5132;
    padding: var(--space-4);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
}

/* ---------- Contact layout ---------- */

.contact-layout {
    display: grid;
    gap: var(--space-6);
    align-items: start;
    max-width: 56rem;
}

@media (min-width: 56rem) {
    .contact-layout {
        grid-template-columns: minmax(0, 28rem) 1fr;
    }
}

.contact-aside {
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
}

.contact-aside h2 {
    font-size: 1.0625rem;
}

.contact-aside ol {
    padding-left: 1.25rem;
    margin: 0;
}

.contact-aside li {
    margin-bottom: var(--space-2);
}

.contact-aside li:last-child {
    margin-bottom: 0;
}

/* Honeypot field — hidden from sighted users, present for bots */
.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
