/* Caddick & Brown — shared design system
   Serif display, sans body, monospace only for labels and stamps.
   Loaded by every page; page modules live in styles.css. */

:root {
    --bg: #0e0e0f;
    --bg-deep: #0b0b0c;
    --surface: #131315;
    --line: #27272b;
    --line-soft: #1e1e21;

    --ink: #f1ede5;
    --ink-dim: #bdb6aa;
    --ink-mute: #8c857c;

    --accent: #ff6a2a;
    --accent-soft: #ffa06b;

    --font-display: 'Gloock', Georgia, 'Times New Roman', serif;
    --font-body: 'Chivo', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

    --page: 1180px;
    --gutter: 3.5rem;
}

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

/* Short pages don't fill the viewport; painting the canvas the footer's colour
   stops a stray lighter band appearing under it. */
html { scroll-behavior: smooth; background: var(--bg-deep); }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; line-height: 1.1; }

a { color: var(--accent); }
a:hover { color: var(--accent-soft); }

.shell { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }

/* The three places monospace is allowed: eyebrows, tags, stamps. */
.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
}

.tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: var(--ink-mute);
}

.stamp {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    line-height: 1.8;
    letter-spacing: 0.04em;
    color: var(--ink-mute);
}

.skip-link {
    position: absolute;
    top: -60px;
    left: 0;
    background: var(--accent);
    color: var(--bg);
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    z-index: 200;
}
.skip-link:focus { top: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

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

header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(14, 14, 15, 0.94);
    backdrop-filter: blur(8px);
    border-bottom: 2px solid var(--accent);
}

header nav {
    max-width: var(--page);
    margin: 0 auto;
    padding: 1.4rem var(--gutter) 1.1rem;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 2rem;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.45rem;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
}
.logo:hover { color: var(--ink); }

.nav-links { display: flex; align-items: baseline; gap: 1.75rem; }

.nav-links a,
.nav-dropdown-toggle {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-dim);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s;
}

.nav-links a:hover,
.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle { color: var(--accent); }

.nav-links a.active { color: var(--ink); border-bottom: 1px solid var(--accent); padding-bottom: 2px; }
.nav-links a.nav-contact { color: var(--accent); }

/* Apps dropdown */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-toggle { display: inline-flex; align-items: center; gap: 0.4rem; }
.nav-dropdown-caret { font-size: 0.55rem; transition: transform 0.15s; }
.nav-dropdown.open .nav-dropdown-caret { transform: rotate(180deg); }

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 1.1rem;
    min-width: 10rem;
    background: var(--bg-deep);
    border: 1px solid var(--line);
    padding: 0.35rem 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
}

/* Bridge the gap so hover survives the trip to the menu */
.nav-dropdown-menu::before {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 100%;
    height: 1.1rem;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu { opacity: 1; visibility: visible; }

.nav-dropdown-menu a { display: block; padding: 0.55rem 1.1rem; white-space: nowrap; }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    z-index: 110;
}
.nav-toggle span { display: block; width: 22px; height: 1px; background: var(--ink); transition: transform 0.25s, opacity 0.25s; }
.nav-toggle.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

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

.btn,
.btn-ghost {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 0.95rem 1.9rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn { background: var(--accent); color: var(--bg); }
.btn:hover { background: var(--accent-soft); color: var(--bg); }

.btn-ghost { background: transparent; color: var(--ink); border: 1px solid #3a3a40; }
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Section scaffolding ---------- */

/* padding-block only: .section is used together with .shell, whose
   horizontal gutter a padding shorthand here would wipe out. */
.section { border-top: 1px solid var(--line); padding-block: 3.25rem; }

.section-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 2.25rem;
}

.section-index {
    font-size: 0.75rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--accent);
    white-space: nowrap;
}

.section-head h2 { font-size: 2rem; }
.section-rule { flex-grow: 1; height: 1px; background: var(--line); }

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

footer {
    border-top: 1px solid var(--line);
    background: var(--bg-deep);
    padding: 2.25rem 0;
    margin-top: 0;
}

.footer-content {
    max-width: var(--page);
    margin: 0 auto;
    padding: 0 var(--gutter);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2.5rem;
}

.footer-brand { font-family: var(--font-display); font-size: 1.1rem; color: var(--ink); }

.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-links a {
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    color: var(--ink-dim);
    text-decoration: none;
}
.footer-links a:hover { color: var(--accent); }

.footer-meta { text-align: right; }

.contact-button {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    background: var(--accent);
    color: var(--bg);
    padding: 0.7rem 1.4rem;
}
.contact-button:hover { background: var(--accent-soft); color: var(--bg); }

.copyright { font-family: var(--font-mono); font-size: 0.7rem; line-height: 1.8; color: var(--ink-mute); margin: 0; }

/* ---------- Secondary page shell ---------- */

.page-content {
    max-width: var(--page);
    margin: 0 auto;
    padding: 3.5rem var(--gutter) 4.5rem;
    min-height: 60vh;
}

.page-content h1 { font-size: 3rem; margin-bottom: 1.5rem; }
.page-content h2 { font-size: 1.75rem; margin: 2.25rem 0 0.85rem; }
.page-content p { font-size: 1.05rem; line-height: 1.85; color: var(--ink-dim); margin-bottom: 1.1rem; max-width: 62ch; }
.page-content strong { color: var(--ink); font-weight: 400; }
.page-content a { text-decoration: none; border-bottom: 1px solid rgba(255, 106, 42, 0.4); }
.page-content a:hover { border-bottom-color: var(--accent); }

/* ---------- 404 ---------- */

.page-content .error-code {
    font-family: var(--font-display);
    font-size: clamp(5rem, 16vw, 11rem);
    line-height: 0.9;
    color: var(--accent);
    margin-bottom: 1rem;
}

.error-links { list-style: none; max-width: 26rem; margin-top: 2rem; }
.error-links li { border-top: 1px solid var(--line); }
.error-links li:last-child { border-bottom: 1px solid var(--line); }
.error-links a {
    display: flex;
    justify-content: space-between;
    padding: 0.85rem 0;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.95rem;
}
.error-links a:hover { color: var(--accent); }
.error-links .tag { align-self: center; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    :root { --gutter: 1.5rem; }

    /* backdrop-filter makes an element a containing block for its
       position: fixed descendants, which would size the menu overlay to the
       header instead of the viewport. The header is near-opaque anyway. */
    header { backdrop-filter: none; background: var(--bg); }

    .nav-toggle { display: flex; }

    .nav-links {
        position: fixed;
        inset: 0;
        height: 100dvh;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        background: var(--bg);
        overflow-y: auto;
        overscroll-behavior: contain;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s, visibility 0.25s;
        z-index: 105;
    }
    .nav-links.active { opacity: 1; visibility: visible; }
    /* Tap targets: 44px minimum. */
    .nav-links a, .nav-dropdown-toggle {
        font-size: 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: 0 1.25rem;
    }

    /* Apps is a group heading, not a destination, so it takes the label
       language used elsewhere on the site: mono, small, wide-tracked, muted.
       Orange is reserved for links, which is why it read as one before. */
    .nav-dropdown { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }

    .nav-dropdown-toggle { gap: 0.55rem; }
    .nav-dropdown-toggle:hover,
    .nav-dropdown.open .nav-dropdown-toggle { color: var(--ink); }
    .nav-dropdown-caret { display: inline-block; font-size: 0.6rem; }

    .nav-dropdown-menu {
        position: static; transform: none; margin: 0;
        border: none;
        display: none;
        flex-direction: column; align-items: center; gap: 0.25rem;
    }

    /* The children sit in an enclosed panel, so they read as contents of
       the heading above rather than as siblings of Home and About. */
    .nav-dropdown.open .nav-dropdown-menu {
        display: flex;
        opacity: 1;
        visibility: visible;
        background: rgba(255, 255, 255, 0.04);
        border-top: 1px solid var(--line);
        border-bottom: 1px solid var(--line);
        padding: 0.35rem 2.75rem;
    }
    .nav-dropdown-menu::before { display: none; }
    .nav-dropdown-menu a { font-size: 1rem; color: var(--ink-dim); }

    /* Underline the word, not the anchor's padding box. */
    .nav-links a.active {
        border-bottom: none;
        padding-bottom: 0;
        text-decoration: underline;
        text-decoration-color: var(--accent);
        text-decoration-thickness: 1px;
        text-underline-offset: 7px;
    }

    .footer-content { flex-direction: column; align-items: flex-start; gap: 1.5rem; }
    .footer-meta { text-align: left; }

    .page-content h1 { font-size: 2.25rem; }
}

@media (max-width: 560px) {
    .section-head { flex-wrap: wrap; gap: 0.5rem 0.85rem; }
    .section-head h2 { font-size: 1.6rem; }
    .section-rule { display: none; }
    .btn, .btn-ghost { display: block; text-align: center; }
}
