/*
 * Egregius Digital — base stylesheet (light theme).
 *
 * Every page links this file. It holds the design tokens, reset, type, shared
 * components (buttons, cards, chips) and the Egregius site chrome (pill nav +
 * footer). Spacing and radii follow the Hootenanny landing page.
 *
 * App pages add /css/app-page.css plus /css/apps/<slug>.css, which only
 * override the tokens below — so everything here re-themes per app.
 */

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

:root {
    color-scheme: light;

    /* Ground & ink */
    --bg: #FAF9F7;
    --surface: #FFFFFF;
    --surface-sunk: #F3F1EE;
    --border: #E4E1DC;
    --ink: #202428;
    --ink-2: #555B61;
    --ink-3: #62686E;

    /* Brand */
    --primary: #CB3F28;
    --primary-pressed: #A8321F;
    --primary-tint: #FBE9E5;
    --on-primary: #FFFFFF;
    --accent: #CB3F28;
    --link: #A8321F;
    --grad-from: #CB3F28;
    --grad-to: #B8452A;
    --glow: rgba(203, 63, 40, 0.18);

    /* Type */
    --font-display: Merriweather, Georgia, serif;
    --font-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --font-wordmark: Montserrat, system-ui, sans-serif;
    --display-weight: 700;
    --display-tracking: -0.015em;

    /* Shape & depth (Hootenanny scale) */
    --radius-input: 12px;
    --radius-btn: 16px;
    --radius-card: 24px;
    --shadow-sm: 0 1px 2px rgba(32, 36, 40, 0.06);
    --shadow-md: 0 4px 12px rgba(32, 36, 40, 0.08);
    --shadow-lg: 0 12px 28px rgba(32, 36, 40, 0.12);

    /* Layout */
    --container: 1152px;
    --gutter: 24px;
    --focus: #0A66FF;
}

/* ---------------------------------------------------------------- reset */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

main { flex: 1 0 auto; }

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

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.5em;
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    letter-spacing: var(--display-tracking);
    line-height: 1.2;
    color: var(--heading, var(--ink));
}

p { margin: 0 0 1em; color: var(--ink-2); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
    border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

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

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.section { padding-block: 64px; }
.band { background: var(--surface-sunk); }
@media (min-width: 1024px) { .section { padding-block: 80px; } }

.eyebrow {
    margin: 0;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--eyebrow, var(--primary-pressed));
}

.h-hero { font-size: clamp(40px, 6vw, 60px); line-height: 1.05; margin: 16px 0 0; }
.h-section { font-size: clamp(28px, 3.4vw, 36px); line-height: 1.15; margin: 0; }
.lead { font-size: 18px; line-height: 1.65; color: var(--ink-2); max-width: 36rem; margin: 16px 0 0; }
.fine-print { font-size: 14px; color: var(--ink-3); margin: 20px 0 0; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 24px;
    border: 1px solid transparent;
    border-radius: var(--radius-btn);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn--primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-md); }
.btn--primary:hover { background: var(--primary-pressed); color: var(--on-primary); }

.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn--secondary:hover { border-color: var(--ink-3); color: var(--ink); }

.btn--inverse { background: #FFFFFF; color: var(--ink); box-shadow: var(--shadow-md); }
.btn--inverse:hover { background: #FFFFFF; color: var(--ink); }

.btn--sm { min-height: 40px; padding: 8px 16px; font-size: 14px; border-radius: 999px; }
.btn--lg { min-height: 56px; padding: 14px 28px; font-size: 17px; }

/* ------------------------------------------------------ cards and chips */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.chip--dev { background: #FFF4DB; border-color: #F1D79A; color: #6B4E00; }
.chip--dev::before {
    content: "";
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #D99A00;
}

/* App icon tile. Icons with transparent art get a background via --tile. */
.app-icon {
    display: block;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 22.5%;
    overflow: hidden;
    background: var(--tile, var(--surface));
    box-shadow: 0 0 0 1px rgba(32, 36, 40, 0.06), var(--shadow-sm);
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-icon--pad img { object-fit: contain; padding: 16%; }

/* Store badges */
.store-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.store-badges img { height: 48px; width: auto; }

/* Copy-able email (button filled in by nav-loader.js) */
.copy-email {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 15px;
    color: var(--ink-2);
}
.copy-email a { font-weight: 600; }
.copy-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-2);
    font: 600 12px/1.4 var(--font-body);
    cursor: pointer;
}
.copy-btn:hover { border-color: var(--ink-3); color: var(--ink); }

/* ---------------------------------------------------- skip link */

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--primary);
    color: var(--on-primary);
    font-weight: 600;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ------------------------------------------------ Egregius pill nav */
/* Markup: header.topbar > a (logo) + button.hamburger + nav#primary-nav.nav */

.topbar {
    position: sticky;
    top: 12px;
    z-index: 50;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    width: calc(100% - 32px);
    max-width: calc(var(--container) - 2 * var(--gutter));
    margin: 12px auto 0;
    padding: 8px 8px 8px 20px;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-md);
}

.topbar > a:first-of-type { display: flex; align-items: center; }
.topbar img { height: 34px; width: auto; }

.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.nav a {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--ink-2);
    font-size: 15px;
    font-weight: 600;
}
.nav a:hover, .nav a:focus-visible { background: var(--surface-sunk); color: var(--ink); text-decoration: none; }
.nav a.is-active { background: var(--surface-sunk); color: var(--ink); }

.nav a.nav-cta { background: var(--primary); color: var(--on-primary); margin-left: 4px; }
.nav a.nav-cta:hover { background: var(--primary-pressed); color: var(--on-primary); }

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    margin-left: auto;
    padding: 10px;
    background: none;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
    transition: transform .25s ease, opacity .25s ease;
    pointer-events: none;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
    .topbar { border-radius: 26px; padding: 8px 8px 8px 16px; }
    .topbar img { height: 30px; }
    .hamburger { display: flex; }
    .nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        margin: 0 0 4px;
        gap: 2px;
    }
    .nav.menu-open { display: flex; }
    .nav a { padding: 12px 14px; border-radius: 14px; }
    .nav a.nav-cta { margin: 4px 0 0; text-align: center; }
}

/* ---------------------------------------------------------- footer */

footer {
    flex-shrink: 0;
    margin-top: auto;
    border-top: 1px solid var(--border);
    background: var(--surface-sunk);
    color: var(--ink-2);
    font-size: 14px;
}

.site-footer .container { padding-block: 40px; }
.site-footer__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.site-footer__brand p { margin: 8px 0 0; max-width: 24rem; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.site-footer__links a { color: var(--ink); font-weight: 600; }
.site-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    color: var(--ink-3);
}
.site-footer__bottom p { margin: 0; color: inherit; }

/* Legacy footer markup (footer > .foot-wrap) until every page is migrated */
.foot-wrap {
    max-width: var(--container);
    margin: 0 auto;
    padding: 24px var(--gutter);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.foot-links { display: flex; gap: 12px; flex-wrap: wrap; }

/* Brand wordmark text. Every visible "EGREGIUS DIGITAL" uses this, in capitals:
   <span class="wordmark"><span class="brand-egregius">EGREGIUS</span> <span class="brand-digital">DIGITAL</span></span> */
.brand-egregius { font-family: var(--font-wordmark); font-weight: 800; letter-spacing: 0.02em; }
.brand-digital { font-family: var(--font-wordmark); font-weight: 500; letter-spacing: 0.02em; }
.wordmark { white-space: nowrap; font-size: 0.95em; }

/* Logo lockup: leaf mark + live-text wordmark (legible at any size, unlike the PNG lockup) */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; mix-blend-mode: multiply; }
/* Stacked and centred like the original logo, so each word's box (and so its gradient)
   is only as wide as the word — the red→charcoal shift lands mid-word on both lines. */
.brand-word { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.brand-word .brand-egregius,
.brand-word .brand-digital {
    background: linear-gradient(90deg, #E4432A 0%, #E4432A 48%, #202428 78%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.brand-word .brand-egregius { font-size: 18px; letter-spacing: 0.04em; }
/* padding-left balances the trailing letter-space so DIGITAL centres under EGREGIUS
   and the gradient midpoint sits on the letters, not the trailing gap. */
.brand-word .brand-digital { margin-top: 4px; padding-left: 0.55em; font-size: 9.5px; font-weight: 600; letter-spacing: 0.55em; }

/* ------------------------------------------- long-form content pages */
/* Blog, support, privacy, terms and 404 wrap their content in .wrap */

.wrap {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 48px var(--gutter) 64px;
}

.wrap h1 { font-size: clamp(32px, 4.5vw, 44px); line-height: 1.1; margin-bottom: 16px; }
.wrap h2 { font-size: clamp(22px, 2.6vw, 28px); margin-top: 40px; }
.wrap h3 { font-size: 19px; margin-top: 28px; }
.wrap ul, .wrap ol { color: var(--ink-2); padding-left: 1.25rem; }
.wrap li { margin: 6px 0; }
.wrap strong { color: var(--ink); }
.wrap a { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }

.wrap table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0 24px;
    font-size: 15px;
    color: var(--ink-2);
}
.wrap th, .wrap td { padding: 10px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.wrap th { background: var(--surface-sunk); color: var(--ink); }

/* Generic form controls (light) */
label { color: var(--ink); font-weight: 600; }
input, textarea, select {
    font: inherit;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    padding: 10px 12px;
}
input:focus, textarea:focus, select:focus { outline: 3px solid var(--focus); outline-offset: 1px; }
