/* ====================================================================
   Orange Duck Cycling Tools - shared site styles
   --------------------------------------------------------------------
   Linked by every page (the homepage and each tool). It holds the brand
   tokens and the shared "chrome": the top strip, the angled duck
   watermark, the site nav, the divider rule and the tool masthead.
   Page-specific CSS - the homepage
   layout, each calculator's UI - stays in that page's own inline
   <style> block, which loads after this file and so can override it.
   ==================================================================== */

:root {
    --bg:           #ECEDE8;
    --surface:      #FFFFFF;
    --surface-2:    #F5F5F2;
    --ink:          #15171B;
    --ink-soft:     #44474D;
    --muted:        #80848B;
    --line:         #E2E3DD;
    --line-strong:  #CFD0C8;
    --accent:       #BF360C;
    --accent-deep:  #9A2C09;
    --accent-soft:  rgba(191, 54, 12, 0.09);

    --font-display: "Bricolage Grotesque", "Hanken Grotesk", system-ui, sans-serif;
    --font-body:    "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-mono:    "JetBrains Mono", "SF Mono", "Menlo", ui-monospace, monospace;

    --page-pad-x:   clamp(1.25rem, 5vw, 2.5rem);
    --page-pad-y:   clamp(2rem, 5vw, 3.75rem);
    --max-w:        800px;
    --radius:       13px;
    --radius-sm:    9px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html { background: var(--bg); }
body { background: transparent; }   /* the page colour lives on <html>, so the watermark below shows through */

/* ===== Brand watermark =====
   The line-duck mark - big, gently rotated and faint - fixed behind the
   content of every page. The duck is rotated *inside* the SVG itself, so
   this box stays axis-aligned and can never widen the viewport. It sits
   at z-index -1; <body> is transparent (the page colour is on <html>)
   so it shows through, with the white tool cards covering it as they
   scroll past. The %23BF360C strokes are the brand --accent; the low
   opacity dials it down to a faint orange wash. */
body::before {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    width: min(720px, 88vw);
    aspect-ratio: 118 / 84;
    transform: translate(-50%, -50%);
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-9 4 118 84'><g transform='rotate(-18 47 45)'><g stroke='%23BF360C' stroke-width='5' stroke-linecap='round'><line x1='8' y1='33' x2='24' y2='33'/><line x1='3' y1='46' x2='22' y2='46'/><line x1='9' y1='59' x2='25' y2='59'/></g><circle cx='52' cy='45' r='21' fill='none' stroke='%23BF360C' stroke-width='6'/><path d='M70 35 L91 45 L70 55' fill='none' stroke='%23BF360C' stroke-width='6' stroke-linejoin='round' stroke-linecap='round'/><circle cx='58' cy='39' r='3.6' fill='%23BF360C'/></g></svg>") center / contain no-repeat;
    opacity: 0.09;
    z-index: -1;
    pointer-events: none;
}
@media print { body::before { display: none; } }

/* ===== Top accent strip ===== */
.topbar { height: 5px; background: var(--accent); }

/* ===== Site navigation ===== */
.site-nav {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0.75rem var(--page-pad-x);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem 1.5rem;
    flex-wrap: wrap;
}
.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: var(--ink);
    transition: color 0.15s;
}
.site-brand .brand-mark { height: 1.6rem; width: auto; display: block; }
.site-brand:hover { color: var(--accent); }
.site-nav-links {
    display: grid;                            /* a deliberate 3×2 grid, not an accidental wrap */
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    width: 100%;          /* drops the link grid onto its own line below the brand */
}
.site-nav-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-family: var(--font-mono);
    font-size: 0.73rem;
    font-weight: 500;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ink-soft);
    text-decoration: none;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    transition: background 0.15s, color 0.15s;
}
/* Each link carries its tool's line-style mark. The mark's main strokes
   use currentColor, so they take the link colour - and turn fully orange
   on the current page; its accent details stay orange throughout. */
.site-nav-links a .nav-icon {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
}
.site-nav-links a:hover { color: var(--ink); background: var(--surface-2); }
.site-nav-links a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* Two columns, then one, as the bar narrows - the grid stays tidy */
@media (max-width: 560px) {
    .site-nav-links { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) {
    .site-nav-links { grid-template-columns: 1fr; }
}

/* ===== Divider rule (hairline with an accent tab) ===== */
.rule {
    position: relative;
    height: 1px;
    background: var(--line-strong);
    margin: 2.25rem 0;
}
.rule::before {
    content: "";
    position: absolute;
    left: 0;
    top: -1px;
    width: 52px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

/* ===== Tool masthead =====
   Just the page heading and its tagline - each tool's icon now lives in
   the site nav, not here. The heading itself - .masthead h1 - is sized in
   each tool's own stylesheet, since the tools use different heading scales. */
.masthead { margin-bottom: 1.75rem; }
.masthead .tagline {
    margin-top: 1rem;
    color: var(--ink-soft);
    font-size: 1.08rem;
    line-height: 1.5;
    max-width: 62ch;
}

/* ===== No-JavaScript notice =====
   Every tool does its sums in the browser, so each shows this if a
   visitor has JavaScript switched off. Lives here (not in site-forms.css)
   so Fueller - which doesn't link site-forms.css - can use it too. */
.noscript-note {
    margin-bottom: 1.5rem;
    padding: 0.85rem 1.1rem;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    line-height: 1.5;
}
