/* ============================
   Commerce Global Styles v1.0
   Requires: styles/tokens.css
   ============================ */

/* Base */
html {
    color-scheme: light dark;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--surface-2);
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: 0.02em;
}

/* Links */
a {
    color: var(--link-color);
    word-break: break-word;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

a:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: 3px;
}

/* Focus (generic) */
:where(a, button, [role="button"], input, textarea, select):focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: 3px;
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--focus-ring);
    color: var(--text-inverse);
    padding: 8px 16px;
    z-index: 1000;
}

.skip-link:focus {
    top: 0;
    box-shadow: var(--shadow-focus);
}

/* Containers */
.container,
.header-container,
.footer-container,
main {
    max-width: var(--layout-max-width);
    margin: 0 auto;
}

.header-container,
main {
    background: var(--surface-1);
}

main {
    box-shadow: var(--elevation-1);
}

/* Light mode default */
.logo-dark {
    display: none;
}

/* Auto‑switch in dark mode */
@media (prefers-color-scheme: dark) {
    .logo-light {
        display: none;
    }
    .logo-dark {
        display: inline;
    }
}

/* Headings */
h1,
h2,
h3 {
    margin-top: 0;
    color: var(--heading-color);
}

h1 {
    font-size: var(--heading-1-size);
    line-height: var(--heading-1-line);
}

h2 {
    font-size: var(--heading-2-size);
    line-height: var(--heading-2-line);
}

h3 {
    font-size: var(--heading-3-size);
    line-height: var(--heading-3-line);
}

/* Figures */
figure img {
    max-width: 400px;
    width: 100%;
    height: auto;
    margin: 0 auto;
    display: block;
    border: 1px solid var(--border-color);
}

figure figcaption {
    margin-top: 6px;
    font-size: var(--caption-size);
    color: var(--text-secondary);
    text-align: center;
}

/* Header layout */
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 30px;
}


/* Tagline container next to logo */
.header-tagline-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Tagline text */
.header-tagline {
    font-size: 1.6rem;
    font-weight: 700;
    display: flex;
    gap: 0.35rem;
    white-space: nowrap;
}

/* Color bar under the tagline, using your brand order */
.header-tagline-bar {
    height: 8px;
    margin-top: 8px;
    width: 100%;
    background: linear-gradient(to right,
            #9c0058 12.5%,
            #595b5c 12.5% 25%,
            #eb5f0c 25% 37.5%,
            #e3a900 37.5% 50%,
            #0383a1 50% 62.5%,
            #bdcf00 62.5% 75%,
            #00bde9 75% 87.5%,
            #5e3109 87.5% 100%);
    border-radius: 2px;
}

/* Light Mode — each word uses a readable brand color */
.tl-invest { color: #9c0058; } /* Deep magenta (safe) */
.tl-build  { color: #eb5f0c; } /* Orange (safe) */
.tl-serve  { color: #0383a1; } /* Teal/blue (safe) */

/* Mobile Header Fix */
@media (max-width: 640px) {
    .header-inner {
        flex-direction: column;     /* Stack logo and tagline */
        align-items: center;        /* Center horizontally */
        gap: 12px;                  /* Tighten spacing for mobile */
        text-align: center;
    }

    .header-tagline-block {
        align-items: center;        /* Center tagline + bar */
        white-space: normal;        /* Allow natural line breaking if needed */
    }

    .header-tagline {
        justify-content: center;
        flex-wrap: wrap;            /* Prevent overflow */
    }

    .header-tagline-bar {
        width: 80%;                 /* A bit narrower looks better on mobile */
        margin: 6px auto 0;
    }
}

/* Dark Mode overrides */
@media (prefers-color-scheme: dark) {
    .header-tagline .tl-word {
        color: #ffffff;       /* White tagline in dark mode */
        text-shadow: none;    /* Clean and crisp */
    }
}

/* Footer */
.footer-container {
    background: var(--footer-surface);
    width: 100%;
}

.footer-stripe img {
    width: 100%;
    height: 12px;
    display: block;
}

.footer-wrapper {
    display: flex;
    justify-content: space-between;   /* logo left / tagline right */
    align-items: center;
    padding: 20px 30px;
}


/* Logo stays left */
.footer-wrapper .footer-logo {
    max-width: 260px;
    height: auto;
}

.footer-wrapper img {
    max-width: 240px;
    height: auto;
    margin: 0 auto;
    padding: 0 30px;
    display: block;
}

/* Left side logo */
.footer-left img {
    max-width: 260px;
    height: auto;
}

/* Right side tagline */
.footer-right {
    text-align: right;
}

/* Right-side tagline container */
.footer-tagline-block {
    text-align: right;                 /* tagline right-aligned */
    margin-top: -25px;                 /* raise tagline + color bar */
}

/* Tagline text */
.footer-tagline {
    font-size: 1rem;
    margin-bottom: 4px;                /* space above mini-bar */
    color: #ffffff;                  /* always white */
    font-weight: 600;
}

/* Mini color bar under the tagline only */
.footer-tagline-stripe img {
    width: 180px;                      /* adjust width as needed */
    height: 8px;
    display: block;
    margin-left: auto;                 /* aligns bar to the right */
}

@media (prefers-color-scheme: dark) {
    .footer-tagline {
        color: #ffffff;
        text-shadow: none;
    }
}

/* Color bar under the tagline, using your brand order */
.footer-tagline-bar {
    height: 8px;
    margin-top: 8px;
    background: linear-gradient(to right,
            #9c0058 12.5%,
            #595b5c 12.5% 25%,
            #eb5f0c 25% 37.5%,
            #e3a900 37.5% 50%,
            #0383a1 50% 62.5%,
            #bdcf00 62.5% 75%,
            #00bde9 75% 87.5%,
            #5e3109 87.5% 100%);
    border-radius: 2px;
}

/* Brand bar (left → right) using your provided order */
.footer-colorbar {
    height: 8px;
    margin: 0 30px 0.5rem;
    border-radius: 2px;
    background: linear-gradient(to right,
            #9c0058 12.5%,
            #595b5c 12.5% 25%,
            #eb5f0c 25% 37.5%,
            #e3a900 37.5% 50%,
            #0383a1 50% 62.5%,
            #bdcf00 62.5% 75%,
            #00bde9 75% 87.5%,
            #5e3109 87.5% 100%);
}

/* Force white text specifically where requested */
.footer-tagline-inverse {
    color: #ffffff;
    /* optional: improve legibility on light gray footer */
    text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

/* Cards */
.card {
    background: var(--card-bg);
    color: var(--card-fg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    box-shadow: var(--card-shadow);
}

/* Alerts */
.alert {
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: var(--surface-1);
    color: var(--text-primary);
}

.alert-success {
    border-color: color-mix(in oklab, var(--status-success) 40%, var(--border-color));
}

.alert-danger {
    border-color: color-mix(in oklab, var(--status-danger) 40%, var(--border-color));
}

.alert-warning {
    border-color: color-mix(in oklab, var(--status-warning) 40%, var(--border-color));
}

.alert-info {
    border-color: color-mix(in oklab, var(--status-info) 40%, var(--border-color));
}

.alert [data-icon] {
    margin-right: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: var(--btn-padding-y) var(--btn-padding-x);
    border-radius: var(--btn-radius);
    font-weight: var(--btn-font-weight);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring);
    outline-offset: 3px;
}

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-fg);
}

.btn-primary:hover {
    background: var(--btn-primary-bg-hover);
}

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-fg);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--btn-secondary-bg-hover);
}

.btn-danger {
    background: var(--btn-danger-bg);
    color: var(--btn-danger-fg);
}

.btn-danger:hover {
    background: var(--btn-danger-bg-hover);
}

/* Remove all image borders everywhere */
img, figure img {
    border: 0 !important;
    box-shadow: none !important;
}

/* Optional: remove borders on figure container as well */
figure {
    border: 0 !important;
}

/* SR-only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Before-you-begin block */
.before-block {
    background: var(--surface-1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    box-shadow: var(--elevation-1);
}

.before-block-title {
    margin: 0 0 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--heading-color);
}

.before-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.before-list {
    margin: 0;
    padding-left: 1.25rem;
}

.before-list li {
    margin: 0.4rem 0;
    line-height: 1.45;
}

/* Step-by-step instruction block */
.step-block {
    background: var(--surface-1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    box-shadow: var(--elevation-1);
}

.step-block-title {
    margin: 0 0 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--heading-color);
}

.step-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.step-list {
    padding-left: 1.5rem;
    margin: 0;
}

.step-list li {
    margin: 0.4rem 0;
    line-height: 1.45;
}

/* Tip Card (lighter than alerts, aligned with content flow) */
.tip-card {
    background: var(--surface-1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 0.75rem 1rem;
    margin: 1.5rem 0;
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--elevation-1);
}

.tip-card-title {
    margin: 0 0 0.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--heading-color);
}

.tip-icon,
.before-icon,
.step-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.tip-card p+p {
    margin-top: 0.5rem;
}
