/* ==========================================================================
   Site building blocks - Cosmos DataSec
   Shared, refined-minimal page pieces on pure black. Load on every page
   after main.css / components.css / responsive.css / cosmos-footer.css,
   then add page-specific CSS only for what is unique to that page.
   See DESIGN.md for the rules behind these.
   ========================================================================== */

/* ---- Theme tokens ----------------------------------------------------------
   Dark (pure black) is the default. html[data-theme="light"] - set by
   assets/js/theme.js from the header toggle - switches to the light theme
   (overrides at the end of this file). Text colours are written as
   rgba(var(--ink), alpha) so one token flips them all.
   products/orr.html doesn't load this file and always stays dark. */
:root {
    --ink: 255, 255, 255;
    --page-bg: #000000;
    --surface: #0a0a0a;
    --btn-solid-bg: rgba(245, 245, 243, 0.92);
    --btn-solid-fg: #000000;
    color-scheme: dark;
}

html[data-theme="light"] {
    --ink: 10, 10, 10;
    --page-bg: #ffffff;
    --surface: #f5f5f3;
    --btn-solid-bg: #0a0a0a;
    --btn-solid-fg: #ffffff;
    color-scheme: light;

    /* main.css tokens */
    --bg-primary: #ffffff;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f5f3;
    --bg-card: #f5f5f3;
    --bg-card-hover: #eeeeec;
    --text-primary: #0a0a0a;
    --text-secondary: #0a0a0a;
    --text-tertiary: rgba(10, 10, 10, 0.8);
    --border-color: rgba(10, 10, 10, 0.12);
    --border-color-hover: rgba(10, 10, 10, 0.24);
}

/* ---- Page shell ---------------------------------------------------------- */

/* Content measure - tighter than the site-wide .container */
.page-inner {
    max-width: 1040px;
    margin: 0 auto;
}

.page-inner--narrow {
    max-width: 720px;
}

/* Page hero - clears the fixed header */
.page-hero {
    padding: calc(160px + var(--spacing-8)) 0 var(--spacing-24);
}

/* Standard section: generous spacing, hairline divider on top */
.page-section {
    padding: var(--spacing-20) 0;
    border-top: 1px solid var(--border-color);
}

/* ---- Typography roles (homepage scale) ----------------------------------- */

.page-eyebrow {
    font-size: var(--font-size-sm);
    font-weight: 400;
    color: rgba(var(--ink), 0.45);
    margin-bottom: var(--spacing-6);
}

.page-title {
    font-size: clamp(2.1rem, 5vw, 3.6rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.15;
    max-width: 17ch;
    margin-bottom: var(--spacing-6);
}

.page-lead {
    font-size: clamp(1.05rem, 1.6vw, 1.2rem);
    font-weight: 400;
    line-height: 1.7;
    color: rgba(var(--ink), 0.7);
    max-width: 46ch;
    margin-bottom: 0;
}

.section-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: rgba(var(--ink), 0.45);
    margin-bottom: var(--spacing-12);
}

.section-heading {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: var(--spacing-6);
}

.item-title {
    font-size: var(--font-size-lg);
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.4;
    margin-bottom: var(--spacing-2);
}

.lead {
    font-size: var(--font-size-lg);
    font-weight: 400;
    line-height: 1.6;
    color: rgba(var(--ink), 0.7);
    max-width: 58ch;
}

.body-text {
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: 1.6;
    color: rgba(var(--ink), 0.65);
    max-width: 62ch;
}

.text-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(var(--ink), 0.35);
    text-underline-offset: 3px;
    transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

.text-link:hover {
    color: rgb(var(--ink));
    text-decoration-color: rgb(var(--ink));
}

/* ---- Lists of items (principles, benefits, steps) ------------------------ */

.item-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-10) var(--spacing-8);
}

.item-grid--2 {
    grid-template-columns: repeat(2, 1fr);
}

.item-grid p {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .item-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .item-grid,
    .item-grid--2 {
        grid-template-columns: 1fr;
    }
}

/* Main column + side column (e.g. form + details) */
.split-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: var(--spacing-16);
    align-items: start;
}

@media (max-width: 900px) {
    .split-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-12);
    }
}

/* Plain ruled list - one line per item */
.rule-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rule-list li {
    padding: var(--spacing-4) 0;
    border-top: 1px solid var(--border-color);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: rgba(var(--ink), 0.75);
}

.rule-list li:last-child {
    border-bottom: 1px solid var(--border-color);
}

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

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-3);
    margin-top: var(--spacing-8);
}

/* Primary: solid off-white, same as the header CTA */
.btn-solid,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    padding: 0.8rem 1.4rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: opacity var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.btn-solid {
    background: var(--btn-solid-bg);
    color: var(--btn-solid-fg);
    border: 1px solid transparent;
}

.btn-solid:hover {
    color: var(--btn-solid-fg);
    opacity: 0.85;
}

.btn-solid:disabled {
    opacity: 0.6;
    cursor: default;
}

/* Secondary: hairline outline */
.btn-ghost {
    background: transparent;
    color: rgb(var(--ink));
    border: 1px solid rgba(var(--ink), 0.2);
}

.btn-ghost:hover {
    color: rgb(var(--ink));
    border-color: rgba(var(--ink), 0.5);
}

/* ---- Forms ----------------------------------------------------------------- */

.site-form {
    display: grid;
    gap: var(--spacing-5);
    max-width: 640px;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-5);
}

@media (max-width: 600px) {
    .form-row-2 {
        grid-template-columns: 1fr;
    }
}

.form-field {
    display: grid;
    gap: var(--spacing-2);
}

.form-field label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: rgba(var(--ink), 0.7);
}

.form-field .optional,
.choice-group .optional {
    font-weight: 400;
    color: rgba(var(--ink), 0.4);
}

.site-form input[type="text"],
.site-form input[type="email"],
.site-form input[type="tel"],
.site-form select,
.site-form textarea {
    width: 100%;
    padding: 0.8rem 0.95rem;
    background: var(--surface);
    border: 1px solid rgba(var(--ink), 0.12);
    border-radius: 8px;
    color: rgb(var(--ink));
    font-family: inherit;
    font-size: var(--font-size-base);
    line-height: 1.4;
    transition: border-color var(--transition-fast);
}

.site-form textarea {
    resize: vertical;
    min-height: 8rem;
}

.site-form select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, rgba(var(--ink), 0.55) 50%),
        linear-gradient(135deg, rgba(var(--ink), 0.55) 50%, transparent 50%);
    background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2.5rem;
}

.site-form select option {
    background: var(--surface);
    color: rgb(var(--ink));
}

.site-form input::placeholder,
.site-form textarea::placeholder {
    color: rgba(var(--ink), 0.35);
}

.site-form input:focus,
.site-form select:focus,
.site-form textarea:focus {
    outline: none;
    border-color: rgba(var(--ink), 0.45);
}

/* Checkbox group (e.g. "interested in") */
.choice-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-2) var(--spacing-5);
    border: 0;
    padding: 0;
    margin: 0;
}

.choice-group legend {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: rgba(var(--ink), 0.7);
    margin-bottom: var(--spacing-2);
    padding: 0;
}

.choice-group label {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    font-size: var(--font-size-base);
    color: rgba(var(--ink), 0.8);
    cursor: pointer;
}

.choice-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: rgb(var(--ink));
}

/* Honeypot - hidden from people, visible to bots */
.form-honeypot {
    display: none !important;
}

.form-note {
    font-size: var(--font-size-sm);
    color: rgba(var(--ink), 0.45);
    margin: 0;
}

.form-message {
    margin: var(--spacing-5) 0 0;
    font-size: var(--font-size-base);
    line-height: 1.6;
}

.form-message--success {
    color: rgba(var(--ink), 0.9);
}

.form-message--error {
    color: #ef6b6b;
}

/* ---- Long-form text (legal pages) ----------------------------------------- */

.prose {
    max-width: 68ch;
}

.prose h2 {
    font-size: var(--font-size-xl);
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.4;
    margin: var(--spacing-12) 0 var(--spacing-4);
}

.prose h2:first-child {
    margin-top: 0;
}

.prose p,
.prose li {
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: 1.7;
    color: rgba(var(--ink), 0.72);
}

.prose p {
    margin-bottom: var(--spacing-4);
}

.prose ul {
    margin: 0 0 var(--spacing-4);
    padding-left: 1.2rem;
}

.prose li {
    margin-bottom: var(--spacing-2);
}

.prose a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(var(--ink), 0.35);
    text-underline-offset: 3px;
}

.prose strong {
    font-weight: 500;
    color: rgb(var(--ink));
}

/* Visible draft marker for pages that still need review */
.draft-notice {
    display: inline-block;
    margin-bottom: var(--spacing-8);
    padding: var(--spacing-2) var(--spacing-3);
    border: 1px solid rgba(240, 168, 75, 0.45);
    border-radius: 6px;
    font-size: var(--font-size-sm);
    color: #f0a84b;
}

@media (max-width: 600px) {
    .page-hero {
        padding-top: calc(120px + var(--spacing-6));
    }
}

/* ==========================================================================
   Theme toggle (footer bottom row, beside the copyright). Hidden by default
   in components.css; shown on pages that load assets/js/theme.js (which
   adds html.theme-enabled).
   ========================================================================== */
.footer-copyright {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--spacing-4);
}

@media (max-width: 768px) {
    .footer-copyright {
        flex-direction: column;
        align-self: stretch;
    }

    /* Wrap between the two phrases, not inside them */
    .footer-copyright p {
        flex-wrap: wrap;
        row-gap: var(--spacing-1);
    }

    .footer-copyright p > span {
        white-space: nowrap;
    }
}

html.theme-enabled .theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    padding: 0;
    background: transparent;
    border: 1px solid rgba(var(--ink), 0.14);
    border-radius: 8px;
    color: rgba(var(--ink), 0.65);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

html.theme-enabled .theme-toggle-btn:hover {
    color: rgb(var(--ink));
    border-color: rgba(var(--ink), 0.35);
}

.theme-toggle-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Sun in dark mode (switch to light), moon in light mode */
.theme-toggle-btn .theme-icon-dark,
html[data-theme="light"] .theme-toggle-btn .theme-icon-light {
    display: none;
}

html[data-theme="light"] .theme-toggle-btn .theme-icon-dark {
    display: inline;
}

/* ==========================================================================
   Light theme - base elements, header and footer
   (page content follows automatically through the tokens above)
   ========================================================================== */
html[data-theme="light"] body {
    background: var(--page-bg);
    color: rgb(var(--ink));
}

/* Element defaults from main.css; :where keeps specificity low so the
   classes above still set their own tints */
:where(html[data-theme="light"]) :is(h1, h2, h3, h4, h5, h6, p) {
    color: rgb(var(--ink));
}

html[data-theme="light"] .form-message--error {
    color: #c53030;
}

html[data-theme="light"] .draft-notice {
    color: #9a5b00;
    border-color: rgba(154, 91, 0, 0.4);
}

/* ---- Header ---- */
html[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(10, 10, 10, 0.1);
}

html[data-theme="light"] .header.scrolled {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(10, 10, 10, 0.14);
}

/* The logo is light line art; render it as dark ink on light */
html[data-theme="light"] .site-logo {
    filter: brightness(0);
    mix-blend-mode: normal;
}

html[data-theme="light"] .nav-link,
html[data-theme="light"] .nav-link i {
    color: rgba(10, 10, 10, 0.6);
}

html[data-theme="light"] .nav-link:hover,
html[data-theme="light"] .nav-link:hover i {
    color: #0a0a0a;
}

html[data-theme="light"] .header .btn-outline,
html[data-theme="light"] .header .btn-outline:hover,
html[data-theme="light"] .header .btn-outline i {
    background: #0a0a0a;
    color: #ffffff;
}

html[data-theme="light"] .dropdown-menu {
    background: #ffffff;
    border-color: rgba(10, 10, 10, 0.1);
}

html[data-theme="light"] .dropdown-link {
    color: rgba(10, 10, 10, 0.7);
}

html[data-theme="light"] .dropdown-link:hover {
    background: rgba(10, 10, 10, 0.05);
    color: #0a0a0a;
}

@media (max-width: 768px) {
    html[data-theme="light"] .header {
        background: rgba(255, 255, 255, 0.92) !important;
        border-bottom: 1px solid rgba(10, 10, 10, 0.1) !important;
    }

    html[data-theme="light"] .header.scrolled {
        background: rgba(255, 255, 255, 0.96) !important;
    }

    html[data-theme="light"] .navbar-menu {
        background: #ffffff !important;
    }

    html[data-theme="light"] .navbar-toggle span {
        background: #0a0a0a !important;
    }

    html[data-theme="light"] .nav-item {
        border-bottom-color: rgba(10, 10, 10, 0.08);
    }

    html[data-theme="light"] .nav-link,
    html[data-theme="light"] .nav-link:hover,
    html[data-theme="light"] .nav-link:focus,
    html[data-theme="light"] .nav-link i {
        color: #0a0a0a;
    }

    html[data-theme="light"] .dropdown-menu {
        background: rgba(10, 10, 10, 0.03);
    }

    html[data-theme="light"] .dropdown-link,
    html[data-theme="light"] .dropdown-link:hover,
    html[data-theme="light"] .dropdown-link:focus {
        color: rgba(10, 10, 10, 0.75);
        background: transparent;
    }

    html[data-theme="light"] .navbar-actions {
        border-top-color: rgba(10, 10, 10, 0.1);
    }
}

/* ---- Footer ---- */
html[data-theme="light"] .cosmos-footer {
    background: var(--page-bg);
    color: #0a0a0a;
    border-top-color: rgba(10, 10, 10, 0.1);
}

html[data-theme="light"] .footer-statement {
    color: rgba(10, 10, 10, 0.9);
}

html[data-theme="light"] .footer-column h4 {
    color: rgba(10, 10, 10, 0.45);
}

html[data-theme="light"] .footer-column a {
    color: rgba(10, 10, 10, 0.65);
}

html[data-theme="light"] .footer-legal a {
    color: rgba(10, 10, 10, 0.55);
}

html[data-theme="light"] .footer-column a:hover,
html[data-theme="light"] .footer-legal a:hover {
    color: #0a0a0a;
}

html[data-theme="light"] .footer-bottom {
    border-top-color: rgba(10, 10, 10, 0.1);
}

html[data-theme="light"] .footer-copyright {
    color: rgba(10, 10, 10, 0.45);
}
