/* ==========================================================================
   toorey.com visual parity layer
   - Navigation: floating pill, blur, shadow, icon+wordmark, pink CTA
   - Typography: DM Sans 600 headings, Inter body
   - Cards: 12px radius, slate-200 border, slate palette
   These rules override Source's default screen.css where needed.
   ========================================================================== */

/* Google fonts (DM Sans + Inter) are loaded via <link> in default.hbs */

:root {
    --tr-font-display: "DM Sans", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    --tr-font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    --tr-ink:         #0f172a;
    --tr-ink-strong:  #0f172a;   /* hover ink for icons/links — matches toorey.com hover:text-slate-900 */
    --tr-ink-muted:   #475569;
    --tr-ink-subtle:  #64748b;
    --tr-line:        #e2e8f0;
    --tr-line-soft:   rgba(226, 232, 240, 0.6);
    --tr-surface:     #ffffff;
    --tr-surface-alt: #f8fafc;
    --tr-surface-hov: #f1f5f9;

    --tr-accent:       #c3609a;   /* pink CTA from toorey.com */
    --tr-accent-hover: #ad4f87;
    --tr-accent-ink:   #ffffff;

    --tr-radius:       12px;
    --tr-radius-pill:  999px;
    --tr-card-pad:     24px;

    --tr-nav-shadow:   0 4px 20px 0 rgba(0, 0, 0, 0.1);
    --tr-nav-border:   rgba(226, 232, 240, 0.5);
    --tr-nav-bg:       rgba(255, 255, 255, 0.5);
}

html.has-light-text {
    --tr-ink:         #f1f5f9;
    --tr-ink-strong:  #ffffff;   /* matches toorey.com dark:hover:text-white */
    --tr-ink-muted:   #cbd5e1;
    --tr-ink-subtle:  #94a3b8;
    --tr-line:        rgba(226, 232, 240, 0.14);
    --tr-surface:     rgba(30, 41, 59, 0.5);
    --tr-surface-alt: rgba(15, 23, 42, 0.6);
    --tr-nav-border:  rgba(71, 85, 105, 0.5);
    --tr-nav-bg:      rgba(15, 23, 42, 0.4);
    --tr-surface-hov: #1e293b;   /* slate-800, matches toorey.com dark:hover:bg-slate-800 */

    /* Flip the whole page when the user toggles dark mode */
    --background-color: #0b1220;
    background-color: #0b1220;
}

html.has-light-text body { background-color: #0b1220; }

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

body, .gh-canvas, .gh-content, .gh-container, .gh-feed {
    font-family: var(--tr-font-body);
    color: var(--tr-ink);
}

body.has-sans-title, body.has-serif-title {
    --font-sans: var(--tr-font-body);
    --font-serif: var(--tr-font-display);
}

h1, h2, h3, h4, h5, h6,
.gh-card-title,
.gh-container-title,
.gh-header-title,
.gh-article-title,
.post-card-title {
    font-family: var(--tr-font-display) !important;
    font-weight: 600 !important;
    color: var(--tr-ink);
    letter-spacing: -0.02em;
    line-height: 1.15;
}

h1, .gh-header-title, .gh-article-title {
    letter-spacing: -0.022em;
    line-height: 1.1;
}

h2.gh-container-title {
    font-weight: 500 !important;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--tr-ink-muted);
}

h3.gh-card-title, .gh-card-title {
    font-weight: 600 !important;
    letter-spacing: -0.018em;
    line-height: 1.2;
    color: var(--tr-ink);
}

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

/* Source's post layout is editorial — no card chrome (border/bg/radius/
   inner padding). Only the typographic treatment below is re-skinned
   with toorey.com's palette + type so the blog reads as toorey without
   fighting Source's information hierarchy. */

.gh-card .gh-card-excerpt, .gh-card .gh-excerpt {
    color: var(--tr-ink-muted);
    font-family: var(--tr-font-body);
    font-size: 15px;
    line-height: 1.55;
}

.gh-card .gh-card-meta, .gh-card .gh-card-footer, .gh-card time {
    color: var(--tr-ink-subtle);
    font-family: var(--tr-font-body);
    font-size: 13px;
}

.gh-card .gh-card-tag, .gh-card .post-card-tags a {
    color: var(--tr-ink-muted);
    font-family: var(--tr-font-body);
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.gh-content p, .gh-content li {
    color: var(--tr-ink);
    font-family: var(--tr-font-body);
    line-height: 1.7;
}

.gh-content blockquote {
    border-left: 3px solid var(--tr-line);
    color: var(--tr-ink-muted);
    font-style: normal;
}

/* --------------------------------------------------------------------------
   Navigation — floating pill, matches toorey.com exactly
   -------------------------------------------------------------------------- */

/* Neutralise Source's own nav layout so our pill takes over */
header.tr-nav-root {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 16px 24px 0;
    background: transparent;
    border: 0;
    height: auto;
    display: block;
}

.tr-nav-shell {
    max-width: 1280px;
    margin: 0 auto;
}

.tr-nav-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    height: 64px;
    padding: 0 16px 0 24px;
    border-radius: var(--tr-radius-pill);
    background: var(--tr-nav-bg);
    border: 1px solid var(--tr-nav-border);
    box-shadow: var(--tr-nav-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-family: var(--tr-font-body);
}

/* Give the page content room for the fixed pill */
.gh-viewport {
    padding-top: 96px;
}

/* ---- Brand (icon + wordmark) ------------------------------------------- */

.tr-nav-brand {
    display: inline-flex;
    align-items: flex-end;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
    padding-bottom: 10px;
}

.tr-nav-brand-icon {
    height: 34px;
    width: auto;
    display: block;
}

.tr-nav-brand-wordmark {
    height: 24px;
    width: auto;
    display: block;
}

/* Light/dark icon swap.
   Source's contrast script in default.hbs uses `has-dark-text` for a LIGHT
   background (dark-colored text) and `has-light-text` for a DARK background
   (light-colored text). So `html.has-light-text` = our dark mode. */
.tr-light-only { display: block; }
.tr-dark-only  { display: none; }

html.has-light-text .tr-light-only { display: none; }
html.has-light-text .tr-dark-only  { display: block; }

html.has-light-text .tr-nav-brand-wordmark {
    filter: brightness(0) invert(1);
}

/* ---- Primary nav links ------------------------------------------------- */

.tr-nav-links {
    flex: 1;
    display: flex;
    justify-content: center;
}

.tr-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.gh-navigation .tr-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    color: var(--tr-ink-muted) !important;
    text-decoration: none;
    border-radius: var(--tr-radius-pill);
    transition: color 0.15s ease, background-color 0.15s ease;
}

.gh-navigation .tr-nav-link:hover {
    color: var(--tr-ink-strong) !important;
    background: var(--tr-surface-hov);
}

/* Sign in + Book-a-demo use Tailwind's `tracking-tighter` on toorey.com
   (≈ -0.045em / -0.64 px at 14 px). Sign in colour is slate-700, not
   slate-900 like body ink, so override !important to beat global a-color. */
.gh-navigation .tr-nav-signin {
    color: #334155 !important;
    letter-spacing: -0.045em;
    line-height: 1;
}
.gh-navigation .tr-nav-cta {
    color: var(--tr-accent-ink) !important;
    letter-spacing: -0.045em;
}
.gh-navigation .tr-nav-cta:hover { color: var(--tr-accent-ink) !important; }

/* ---- Right-side actions ----------------------------------------------- */

.tr-nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* All nav icon buttons (theme toggle, Source's search + burger).
   !important beats Source's `.gh-navigation :is(.gh-icon-button) { color: inherit }`
   which otherwise paints the icons with the body ink instead of slate-600.
   NB: no `display` here on purpose — each button owns its own visibility so
   the burger can stay hidden on desktop without fighting specificity. */
.gh-navigation .tr-nav-icon-btn,
.gh-navigation .tr-nav-actions .gh-search,
.gh-navigation .tr-nav-burger {
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: var(--tr-radius-pill);
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--tr-ink-muted) !important;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* Always-visible icon buttons show inline; burger is mobile-only (below). */
.tr-nav-icon-btn,
.tr-nav-actions .gh-search { display: inline-flex; }

.gh-navigation .tr-nav-icon-btn:hover,
.gh-navigation .tr-nav-actions .gh-search:hover,
.gh-navigation .tr-nav-burger:hover {
    background: var(--tr-surface-hov) !important;
    color: var(--tr-ink-strong) !important;
}

/* Theme toggle — show sun in dark mode, moon in light mode */
.tr-theme-toggle .tr-icon-sun  { display: none; }
.tr-theme-toggle .tr-icon-moon { display: block; }
html.has-light-text .tr-theme-toggle .tr-icon-sun  { display: block; }
html.has-light-text .tr-theme-toggle .tr-icon-moon { display: none; }

.tr-nav-signin {
    font-size: 14px;
    font-weight: 500;
    color: var(--tr-ink);
    text-decoration: none;
    padding: 10px 16px;
    border-radius: var(--tr-radius-pill);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.gh-navigation .tr-nav-signin:hover {
    background: var(--tr-surface-hov) !important;
    color: var(--tr-ink-strong) !important;
}

/* Book a demo — the pink CTA */
.tr-nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 20px;
    background: var(--tr-accent);
    color: var(--tr-accent-ink);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    border-radius: var(--tr-radius-pill);
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
}

.tr-nav-cta:hover {
    background: var(--tr-accent-hover);
    color: var(--tr-accent-ink);
    transform: translateY(-1px);
}

.tr-nav-cta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---- Solutions dropdown (and any future nav dropdowns) ----------------- */

.tr-nav-item-has-dropdown {
    position: relative;
}

/* Trigger button must look identical to a .tr-nav-link, plus caret alignment.
   It already has .tr-nav-link so most rules apply; this adds the caret-row
   layout and resets the native <button> styles. */
.gh-navigation .tr-nav-link-button {
    background: transparent;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
}

.tr-nav-caret {
    color: var(--tr-ink-muted);
    transition: transform 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.tr-nav-item-has-dropdown:hover .tr-nav-caret,
.tr-nav-item-has-dropdown:focus-within .tr-nav-caret {
    color: var(--tr-ink-strong);
    transform: rotate(180deg);
}

/* Panel — anchored to the trigger li, opens on hover or keyboard focus.
   Pure-CSS; no JS toggle needed because the panel itself is keyboard-
   reachable via :focus-within once the trigger button is focused. */
.tr-nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    min-width: 224px;
    padding: 8px 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--tr-nav-border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
    overflow: hidden;
    z-index: 60;
}

.tr-nav-item-has-dropdown:hover .tr-nav-dropdown,
.tr-nav-item-has-dropdown:focus-within .tr-nav-dropdown {
    display: block;
}

/* A small invisible bridge so the dropdown stays open when the cursor
   travels from the trigger to the panel across the 8 px margin. */
.tr-nav-dropdown::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
}

.gh-navigation .tr-nav-dropdown-link {
    display: block;
    padding: 8px 16px;
    font-family: var(--tr-font-body);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--tr-ink-muted) !important;
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease;
    border-radius: 0;
    white-space: nowrap;
}

.gh-navigation .tr-nav-dropdown-link:hover,
.gh-navigation .tr-nav-dropdown-link:focus {
    color: var(--tr-ink-strong) !important;
    background: var(--tr-surface-hov);
}

/* Dark-mode panel surface — slate-900/95 to match toorey.com's dark variant */
html.has-light-text .tr-nav-dropdown {
    background: rgba(15, 23, 42, 0.95);
    border-color: rgba(71, 85, 105, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* ---- Mobile / responsive ---------------------------------------------- */

.tr-nav-burger { display: none; }
.tr-nav-mobile { display: none; }

@media (max-width: 1100px) {
    .tr-nav-links { display: none; }
    .tr-nav-signin { display: none; }
}

@media (max-width: 720px) {
    header.tr-nav-root { padding: 12px 16px 0; }

    .tr-nav-pill {
        padding: 0 8px 0 16px;
        height: 60px;
        gap: 8px;
    }

    .tr-nav-cta {
        padding: 0 14px;
        height: 36px;
        font-size: 13px;
    }
    .tr-nav-cta-icon { display: none; }

    .tr-nav-brand-wordmark { height: 20px; }
    .tr-nav-brand-icon { height: 28px; }

    .tr-nav-actions .gh-search,
    .tr-nav-burger,
    .tr-nav-icon-btn {
        width: 36px;
        height: 36px;
    }

    .tr-nav-burger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: 0;
        color: var(--tr-ink);
        border-radius: var(--tr-radius-pill);
    }

    .tr-nav-burger:hover { background: var(--tr-surface-hov); }

    /* When Source's burger toggles .gh-navigation-menu-open on <html>,
       reveal the mobile drawer */
    html.gh-navigation-menu-open .tr-nav-mobile {
        display: block;
        position: fixed;
        top: 72px;
        left: 16px;
        right: 16px;
        padding: 16px;
        background: var(--tr-surface);
        border: 1px solid var(--tr-line);
        border-radius: var(--tr-radius);
        box-shadow: var(--tr-nav-shadow);
        z-index: 49;
    }

    html.gh-navigation-menu-open .tr-nav-mobile ul {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    html.gh-navigation-menu-open .tr-nav-mobile a {
        display: block;
        padding: 12px 14px;
        color: var(--tr-ink);
        text-decoration: none;
        border-radius: 8px;
        font-weight: 500;
    }

    html.gh-navigation-menu-open .tr-nav-mobile a:hover {
        background: var(--tr-surface-hov);
    }
}

/* --------------------------------------------------------------------------
   Footer — matches toorey.com (slate-950 band, 5-col grid, hairline bottom bar)
   -------------------------------------------------------------------------- */

.tr-footer {
    background: #020617;                  /* slate-950 */
    color: #cbd5e1;                        /* slate-300 */
    position: relative;
    margin-top: 80px;                      /* breathing room above the dark band */
    padding: 96px 0 48px;
    font-family: var(--tr-font-body);
    border-top: 1px solid #1e293b;         /* slate-800 hairline */
}

.tr-footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

.tr-footer-columns {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 64px;
}

/* ---- Brand column ---- */

.tr-footer-logo {
    display: inline-flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 16px;
    text-decoration: none;
}

.tr-footer-logo-icon {
    height: 34px;
    width: auto;
    display: block;
}

.tr-footer-logo-wordmark {
    height: 24px;
    width: auto;
    display: block;
    filter: brightness(0) invert(1);       /* white wordmark on dark bg */
}

.tr-footer-tagline {
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.5;                      /* 21 px — matches toorey.com */
    max-width: 320px;
    margin: 0 0 24px;
}

.tr-footer-social {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tr-footer-social-link {
    color: #cbd5e1;
    display: inline-flex;
    transition: color 0.15s ease;
}

.tr-footer-social-link:hover { color: #ffffff; }

/* ---- Link columns ---- */

/* Force Inter on footer headings (beats the global DM Sans heading rule).
   toorey.com treats column labels as body type, not display type. */
.tr-footer-heading {
    font-family: var(--tr-font-body) !important;
    font-size: 14px;
    font-weight: 600 !important;
    color: #ffffff;
    letter-spacing: 0 !important;
    line-height: 1.2;
    margin: 0 0 16px;
}

/* Heading-as-link: inherits white but reacts to hover like the list items */
.tr-footer-heading a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}
.tr-footer-heading a:hover { color: #cbd5e1; }

.tr-footer-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tr-footer-list a {
    color: #cbd5e1 !important;
    font-size: 14px;
    line-height: 1.5;                      /* 21 px — matches toorey.com */
    text-decoration: none;
    transition: color 0.15s ease;
}

.tr-footer-list a:hover {
    color: #ffffff !important;
}

/* ---- Bottom bar ---- */

.tr-footer-bottom {
    border-top: 1px solid #1e293b;
    padding-top: 32px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tr-footer-copyright {
    color: #94a3b8;                        /* slate-400 */
    font-size: 14px;
    margin: 0;
}

.tr-footer-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8 !important;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.15s ease;
}

.tr-footer-status:hover { color: #cbd5e1 !important; }

.tr-footer-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;                   /* green-500 */
    display: inline-block;
    flex-shrink: 0;
}

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

@media (max-width: 900px) {
    .tr-footer-columns {
        grid-template-columns: 1fr 1fr;
        gap: 40px 32px;
    }
    .tr-footer-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 520px) {
    .tr-footer { padding: 64px 0 32px; }
    .tr-footer-columns { gap: 32px; }
    .tr-footer-bottom {
        justify-content: flex-start;
        flex-direction: column;
        align-items: flex-start;
    }
}
