/* nokatfood homepage — native CSS, no framework.
   Design targets: joshwcomeau (theming + tasteful motion), robbowen (fluid
   responsiveness). Self-contained: defines its own tokens (does not depend on
   the waiting-page style.css). Font (Raleway subset) + browser-theme.js come
   from site-common/. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, p, ul, ol { margin: 0; }

@font-face {
    font-family: "Raleway";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/static/fonts/raleway-latin.woff2") format("woff2");
}

/* Auto follows the OS via color-scheme + light-dark(); browser-theme.js pins
   light/dark by setting data-theme on <html>. One accent hue, tuned per theme
   for contrast. Convention: `rgb(from X r g b / a)` for an alpha of one token,
   `color-mix()` only where two colours are actually mixed. */
:root {
    color-scheme: light dark;
    --bg:        light-dark(#fbfbfa, #12131a);
    --bg-raised: light-dark(#ffffff, #1a1c26);
    --fg:        light-dark(#16171d, #e9e9ee);
    --muted:     light-dark(#5b5d6b, #9a9db0);
    --border:    light-dark(#e7e7e4, #282a37);
    --accent:    light-dark(#c2410c, #e2683c);
    --accent-fg: light-dark(#ffffff, #12131a);

    --measure: 42rem;
    --gutter: clamp(1.25rem, 5vw, 4rem);
    --section-gap: clamp(4rem, 12vh, 9rem);

    /* Motion */
    --t-fast: 0.15s;          /* buttons, nav links */
    --t-base: 0.25s;          /* cards */
    --lift: 2px;              /* hover lift unit (nav CTA ×0.5, buttons ×1, cards ×2) */
    --reveal-duration: 1.2s;  /* hero fade-in on load */
    --reveal-stagger: 120ms;  /* per-sibling delay step (hero) */
    --reveal-rise: 1.5rem;    /* fade-and-rise distance */
    --reveal-range: 5%;       /* scroll reveal: starts this far into view() entry… */
    --reveal-span: 40%;       /* …and completes over this much more */
    --reveal-step: 8%;        /* per-sibling range shift (sections) */

    /* Shape */
    --radius: 0.5rem;         /* buttons, toggle */
    --radius-card: 1rem;

    /* Hero glow */
    --glow-strength: 22%;     /* accent alpha at the centre (mid stop is 40% of it) */
    --glow-x: 30%;
    --glow-y: 40%;
    --glow-drift: 22s;

    /* Service cards: column minimum + gap. auto-fit gives
       n = floor((W + gap) / (min + gap)) columns → 2 from 31.5rem, 3 from 48rem.
       Size container queries can't read custom properties, so those two
       thresholds are literals in the @container rule below — keep in step. */
    --card-min: 15rem;
    --card-gap: 1.5rem;

    /* Fluid type scale (robbowen-style: scales smoothly, no breakpoint jumps). */
    --step--1: clamp(0.83rem, 0.78rem + 0.2vw, 0.94rem);
    --step-0:  clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
    --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
    --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
    --step-3:  clamp(2rem, 1.6rem + 2vw, 3.25rem);
    --step-4:  clamp(2.6rem, 1.9rem + 3.4vw, 4.75rem);
}
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"]  { color-scheme: dark; }

body {
    font: var(--step-0)/1.65 "Raleway", system-ui, sans-serif;
    background: var(--bg);
    color: var(--fg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.wrap { width: min(72rem, 100% - 2 * var(--gutter)); margin-inline: auto; }

a { color: var(--accent); text-underline-offset: 0.15em; }

/* --- header --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgb(from var(--bg) r g b / 82%);
    backdrop-filter: blur(10px);
}
.site-header .wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-block: 1rem;
}
.brand { font-weight: 700; letter-spacing: -0.02em; text-decoration: none; color: var(--fg); font-size: var(--step-1); }
.brand .dot { color: var(--accent); }
.nav { margin-left: auto; display: flex; align-items: center; gap: clamp(0.75rem, 2vw, 1.75rem); }
.nav a { color: var(--muted); text-decoration: none; font-size: var(--step--1); font-weight: 600; transition: color var(--t-fast); }
.nav a:hover { color: var(--fg); }
.nav .cta {
    color: var(--accent-fg); background: var(--accent);
    padding: 0.5em 0.9em; border-radius: var(--radius);
    transition: transform var(--t-fast) ease, filter var(--t-fast);
}
.nav .cta:hover { filter: brightness(1.08); transform: translateY(calc(-0.5 * var(--lift))); }
.theme-toggle {
    background: var(--bg-raised); color: var(--fg);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.4em 0.7em; font: inherit; font-size: var(--step--1); cursor: pointer;
    opacity: 0.75; transition: opacity var(--t-fast);
}
.theme-toggle:hover { opacity: 1; }
@media (max-width: 34rem) { .nav a:not(.cta) { display: none; } }

/* --- hero --- */
.hero { padding-block: clamp(4rem, 16vh, 11rem) var(--section-gap); position: relative; overflow: hidden; }
/* Soft drifting accent glow — cheap radial gradient, not an image. The
   ellipse is centred behind the headline (measured: the old -30% inset put
   its centre above the viewport, behind the sticky header), and the fade has
   a mid stop so the 70% cut-off doesn't read as an edge. */
.hero::before {
    content: "";
    position: absolute; inset: -10% -10% auto -10%; height: 70vh; z-index: -1;
    background: radial-gradient(60% 60% at var(--glow-x) var(--glow-y),
        rgb(from var(--accent) r g b / var(--glow-strength)),
        rgb(from var(--accent) r g b / calc(var(--glow-strength) * 0.4)) 38%,
        transparent 70%);
}
@keyframes drift { to { transform: translate3d(8%, 6%, 0) scale(1.15); } }
.hero h1 {
    font-size: var(--step-4); font-weight: 700; letter-spacing: -0.03em;
    line-height: 1.05; max-width: 18ch;
}
.hero h1 .grad {
    background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--fg)));
    background-clip: text; color: transparent;
    /* background-clip:text paints only to the advance box; a sliver of right
       padding keeps the last glyph's ink (the y's arm) from being clipped. */
    padding-right: 0.08em;
}
.hero .lede { font-size: var(--step-1); color: var(--muted); max-width: var(--measure); margin-top: 1.5rem; }
.hero .actions { margin-top: 2.25rem; display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; }
.btn {
    display: inline-block; text-decoration: none; font-weight: 600;
    color: var(--accent-fg); background: var(--accent);
    padding: 0.7em 1.3em; border-radius: var(--radius);
    transition: transform var(--t-fast) ease, filter var(--t-fast);
}
.btn:hover { filter: brightness(1.08); transform: translateY(calc(-1 * var(--lift))); }
.btn-ghost { background: transparent; color: var(--fg); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); }

/* --- sections --- */
section { padding-block: var(--section-gap); }
.section-label { font-size: var(--step--1); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.75rem; }
h2 { font-size: var(--step-3); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; max-width: 20ch; }
.section-intro { color: var(--muted); font-size: var(--step-1); max-width: var(--measure); margin-top: 1rem; }

/* services — each card is a 3-row subgrid (number / title / body) of the
   services grid, so a wrapping title can't push its body out of line with its
   neighbours' (no reserved-height hack needed). Column geometry: --card-min /
   --card-gap in :root (thresholds explained there). */
.services {
    display: grid; gap: var(--card-gap);
    grid-template-columns: repeat(auto-fit, minmax(var(--card-min), 1fr));
    margin-top: clamp(2rem, 5vw, 3.5rem);
    container-type: inline-size;
}
.card {
    display: grid; grid-template-rows: subgrid; grid-row: span 3; row-gap: 0;
    background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: var(--radius-card); padding: clamp(1.5rem, 3vw, 2rem);
    transition: transform var(--t-base) ease, border-color var(--t-base) ease, box-shadow var(--t-base) ease;
}
/* Two-column layout would leave the third card orphaned: let it span both.
   Thresholds derive from --card-min/--card-gap (see :root). */
@container (31.5rem <= width < 48rem) { .card:last-child { grid-column: span 2; } }
.card:hover { transform: translateY(calc(-2 * var(--lift))); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: 0 12px 40px -20px rgb(from var(--accent) r g b / 60%); }
.card .num { font-size: var(--step--1); font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.card h3 { font-size: var(--step-2); font-weight: 700; margin: 0.5rem 0 0.6rem; letter-spacing: -0.01em; line-height: 1.15; }
.card p { color: var(--muted); }

/* approach — numbered principles */
.principles { list-style: none; padding: 0; margin-top: clamp(2rem, 5vw, 3.5rem); display: grid; gap: 0; }
.principles li { display: grid; grid-template-columns: 3.5rem 1fr; gap: 1rem; padding-block: clamp(1.25rem, 3vw, 1.75rem); border-top: 1px solid var(--border); }
.principles li:last-child { border-bottom: 1px solid var(--border); }
.principles .p-num { font-size: var(--step-2); font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1; }
.principles .p-body h3 { font-size: var(--step-1); font-weight: 700; margin-bottom: 0.25rem; }
.principles .p-body p { color: var(--muted); max-width: var(--measure); }

/* contact */
.contact { text-align: center; }
.contact .wrap { display: grid; place-items: center; }
.contact h2 { max-width: none; }
.contact .email { font-size: var(--step-2); font-weight: 700; margin-top: 1.5rem; display: inline-block; }
.contact .privacy { color: var(--muted); font-size: var(--step--1); margin-top: 2rem; }

/* footer — carries the statutory company-information block (CA 2014 s.151(4)) */
.site-footer { border-top: 1px solid var(--border); padding-block: 2.5rem; color: var(--muted); font-size: var(--step--1); line-height: 1.6; }
.site-footer .wrap { display: grid; gap: 1rem; }
.site-footer .legal { margin: 0; max-width: 60rem; }
.site-footer .legal strong { color: var(--fg); font-weight: 700; }
.site-footer .foot-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--fg); }

/* prose pages (privacy, legal) */
.page { padding-block: clamp(3rem, 10vh, 6rem) var(--section-gap); }
.prose { max-width: var(--measure); }
.prose h1 { font-size: var(--step-3); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.prose h2 { font-size: var(--step-1); font-weight: 700; margin-top: 2.75rem; max-width: none; }
.prose p, .prose li { color: var(--fg); }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-block: 0.35rem; }
.prose .updated { color: var(--muted); font-size: var(--step--1); margin-block: 0.5rem 1.5rem; }
.prose p + p { margin-top: 1em; }
.prose .back { display: inline-block; margin-top: 3rem; }

/* --- reveal --- Pure CSS, no JS. `--i` is a stagger index derived from the
   element's position among its siblings (the CSP is style-src 'self', so
   inline style attributes are not an option).
   Hero: time-based fade on load. A CSS animation always completes, so nothing
   can be left hidden.
   Below the hero: scroll-driven fade-and-rise where view timelines exist
   (Chrome 115+, Safari 26+). Elsewhere (Firefox release) the block is ignored
   and content is simply visible. A delay isn't usable on a scroll timeline, so
   the stagger nudges the range instead. An element replays only after it has
   left the viewport and re-enters.
   All motion sits inside one positive gate: screen only (a view timeline
   evaluated against the print viewport would print sections at opacity 0),
   and no reduced-motion preference. Fails safe: gate false → no animation. */
.reveal { --i: 0; }
.reveal:nth-child(2) { --i: 1; }
.reveal:nth-child(3) { --i: 2; }
.reveal:nth-child(4) { --i: 3; }
/* Animates `translate`, not `transform`, so the final frame (fill-mode both)
   doesn't override hover lifts that use `transform`. */
@keyframes reveal-in {
    from { opacity: 0; translate: 0 var(--reveal-rise); }
    to   { opacity: 1; translate: none; }
}
@media screen and (prefers-reduced-motion: no-preference) {
    .hero::before { animation: drift var(--glow-drift) ease-in-out infinite alternate; }
    .hero .reveal { animation: reveal-in var(--reveal-duration) ease both; animation-delay: calc(var(--i) * var(--reveal-stagger)); }
    @supports (animation-timeline: view()) {
        section:not(.hero) .reveal {
            animation: reveal-in linear both;
            animation-timeline: view();
            animation-range: entry calc(var(--reveal-range) + var(--i) * var(--reveal-step))
                             entry calc(var(--reveal-range) + var(--reveal-span) + var(--i) * var(--reveal-step));
        }
    }
}

/* --- header hairline --- appears once the page is scrolled a few px. A state
   indicator, not motion, so not gated on reduced-motion. Firefox release
   lacks scroll timelines and simply never shows the 1px line. Animates the
   opacity of a pseudo-element rather than a colour: a var() inside a keyframe
   is resolved once and would not follow a theme toggle. */
@supports (animation-timeline: scroll()) {
    .site-header::after {
        content: ""; position: absolute; inset: auto 0 0; height: 1px;
        background: var(--border); opacity: 0;
        animation: hairline linear both; animation-timeline: scroll(root); animation-range: 0 8px;
    }
}
@keyframes hairline { to { opacity: 1; } }
