/*!
 * setcookie.dev / jvkuechen.com — "Protocol Atelier" theme
 * Originally derived from Start Bootstrap Agency (Apache License v2.0),
 * rewritten around the design tokens in theme-vars.css.
 *
 * Shared by index.html, 404.html, demos/, and tools/ pages — the
 * navbar, buttons, section headings, and footer rules below are a
 * cross-page contract. Hero visuals are scoped to header.masthead so
 * subpage headers (e.g. .security-header) style themselves.
 */

/* ---------------------------------------------------------------------------
 * Base
 * ------------------------------------------------------------------------ */

html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--color-text);
    background-color: var(--color-bg);
}

p {
    font-size: 1rem;
    line-height: 1.65;
}

.text-muted {
    color: var(--color-text-muted) !important;
}

.text-primary {
    color: var(--color-primary) !important;
}

a {
    color: var(--color-primary);
    transition: color var(--transition-color),
                background-color var(--transition-color),
                border-color var(--transition-color);
}

a:hover,
a:focus,
a:active,
a.active {
    color: var(--color-primary-hover);
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.navbar-toggler:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 3px;
    box-shadow: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-heading);
    margin-top: 0;
    margin-bottom: var(--space-3);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

img {
    display: block;
    height: auto;
    max-width: 100%;
}

::selection {
    text-shadow: none;
    color: var(--color-on-primary);
    background: var(--color-primary);
}

img::selection {
    background: transparent;
}

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

.btn {
    transition: color var(--transition-color),
                background-color var(--transition-color),
                border-color var(--transition-color),
                transform var(--transition-move),
                box-shadow var(--transition-move);
}

.btn-primary {
    border-color: var(--color-primary);
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--color-on-primary);
    background-color: var(--color-primary);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active {
    border-color: var(--color-primary-hover);
    color: var(--color-on-primary);
    background-color: var(--color-primary-hover);
}

.btn-primary.disabled,
.btn-primary[disabled] {
    border-color: var(--color-primary);
    background-color: var(--color-primary);
}

.btn-xl {
    padding: 0.75rem 2rem;
    border: 1px solid var(--color-primary);
    border-radius: var(--border-radius);
    font-family: var(--font-heading);
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--color-on-primary);
    background-color: var(--color-primary);
}

.btn-xl:hover,
.btn-xl:focus,
.btn-xl:active,
.btn-xl.active {
    border-color: var(--color-primary-hover);
    color: var(--color-on-primary);
    background-color: var(--color-primary-hover);
}

/* Ghost button for use on the dark hero */
.btn-hero-ghost {
    padding: 0.75rem 2rem;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: var(--border-radius);
    font-family: var(--font-heading);
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #fff;
    background-color: transparent;
}

.btn-hero-ghost:hover,
.btn-hero-ghost:focus,
.btn-hero-ghost:active {
    border-color: #fff;
    color: #fff;
    background-color: rgba(255, 255, 255, 0.10);
}

/* ---------------------------------------------------------------------------
 * Navbar
 * ------------------------------------------------------------------------ */

.navbar {
    border-color: transparent;
    background-color: var(--color-dark);
    font-size: 0.875rem;
}

.navbar .navbar-brand {
    font-family: var(--font-brand);
    font-size: 1.125rem;
    letter-spacing: 0.01em;
    color: #f5b678;
}

@media (prefers-color-scheme: dark) {
    .navbar .navbar-brand {
        color: var(--color-primary);
    }
}

.navbar .navbar-brand:hover,
.navbar .navbar-brand:focus,
.navbar .navbar-brand:active,
.navbar .navbar-brand.active {
    color: #ffd9ae;
}

.navbar .navbar-collapse {
    border-color: rgba(255, 255, 255, 0.02);
}

.navbar .navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background-color: transparent;
}

.navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='white' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar .navbar-nav .nav-link {
    text-transform: uppercase;
    font-family: var(--font-heading);
    font-weight: 500;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.9);
}

.navbar .navbar-nav .nav-link:hover,
.navbar .navbar-nav .nav-link:focus {
    color: #f5b678;
}

.navbar .navbar-nav .nav-link.active {
    border-radius: var(--border-radius);
    color: #fff;
    background-color: rgba(255, 255, 255, 0.12);
}

@media (min-width: 992px) {
    .navbar {
        padding: 1.25rem 0;
        border: 0;
        background-color: transparent;
        transition: padding var(--transition-move),
                    background-color var(--transition-color),
                    box-shadow var(--transition-move);
    }

    .navbar.navbar-shrink {
        padding: 0.5rem 0;
        background-color: var(--color-dark);
        box-shadow: var(--shadow-md);
    }
}

/* ---------------------------------------------------------------------------
 * Hero (index landing only — header.masthead)
 * ------------------------------------------------------------------------ */

header.masthead {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64vh;
    min-height: 64svh;
    text-align: center;
    color: #fff;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 24%, rgba(245, 158, 11, 0.28), transparent 28rem),
        radial-gradient(circle at 82% 18%, rgba(45, 212, 191, 0.22), transparent 24rem),
        linear-gradient(135deg, var(--color-dark) 0%, var(--color-dark-secondary) 48%, #2b2118 100%);
}

/* Subtle grid overlay, fading out toward the bottom */
header.masthead::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.55) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.55) 1px, transparent 1px);
    background-size: 42px 42px;
    opacity: 0.22;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
    mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
    pointer-events: none;
    z-index: 0;
}

@media (min-width: 768px) {
    header.masthead {
        min-height: 78vh;
        min-height: 78svh;
    }
}

header.masthead .intro-text {
    position: relative;
    z-index: 2;
    padding: var(--space-8) 0 var(--space-7);
}

header.masthead .intro-heading {
    margin-bottom: var(--space-4);
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3.75rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #fff;
}

header.masthead .intro-support {
    margin: 0 auto var(--space-6);
    max-width: 34rem;
    font-size: 1.125rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.78);
}

header.masthead .intro-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-4);
}

/* Cookie-crumb / packet-trace dots */
header.masthead .crumb {
    position: absolute;
    border-radius: 50%;
    background-color: #f59e0b;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
    opacity: 0.55;
    z-index: 1;
    pointer-events: none;
}

header.masthead .crumb:nth-of-type(1)  { width: 14px; height: 14px; top: 18%; left: 9%; }
header.masthead .crumb:nth-of-type(2)  { width: 8px;  height: 8px;  top: 32%; left: 17%; opacity: 0.4; }
header.masthead .crumb:nth-of-type(3)  { width: 18px; height: 18px; top: 64%; left: 12%; opacity: 0.35; }
header.masthead .crumb:nth-of-type(4)  { width: 10px; height: 10px; top: 78%; left: 26%; }
header.masthead .crumb:nth-of-type(5)  { width: 12px; height: 12px; top: 22%; right: 11%; }
header.masthead .crumb:nth-of-type(6)  { width: 8px;  height: 8px;  top: 44%; right: 7%;  opacity: 0.4; }
header.masthead .crumb:nth-of-type(7)  { width: 16px; height: 16px; top: 70%; right: 15%; opacity: 0.35; }
header.masthead .crumb:nth-of-type(8)  { width: 9px;  height: 9px;  top: 84%; right: 30%; }
header.masthead .crumb:nth-of-type(9)  { width: 11px; height: 11px; top: 10%; left: 42%;  opacity: 0.4; }
header.masthead .crumb:nth-of-type(10) { width: 8px;  height: 8px;  top: 88%; left: 55%;  opacity: 0.45; }

/* Generic intro-* rules kept minimal for subpages (security dashboard
   headers restyle these under their own scope). */
.intro-text {
    position: relative;
}

.intro-lead-in {
    font-size: 1.125rem;
}

.intro-heading {
    font-weight: 700;
}

/* ---------------------------------------------------------------------------
 * Sections
 * ------------------------------------------------------------------------ */

section {
    padding: var(--space-9) 0;
    scroll-margin-top: 84px;
}

section h2.section-heading {
    margin-top: 0;
    margin-bottom: var(--space-4);
    font-size: clamp(2rem, 5vw, 3.75rem);
    letter-spacing: -0.02em;
}

section h3.section-subheading {
    margin-bottom: var(--space-7);
    text-transform: none;
    font-family: var(--font-body);
    font-size: 1.0625rem;
    font-weight: 400;
    color: var(--color-text-muted);
}

.bg-light-gray {
    background-color: var(--color-surface);
}

.bg-darkest-gray {
    background-color: var(--color-dark);
}

/* ---------------------------------------------------------------------------
 * About — unboxed capability blocks
 * ------------------------------------------------------------------------ */

.about-intro {
    max-width: 68ch;
    margin: 0 auto var(--space-7);
    font-size: 1.0625rem;
    line-height: 1.75;
    color: var(--color-text-muted);
}

.about-intro a {
    font-weight: 600;
}

.capability {
    padding-top: var(--space-5);
    margin-bottom: var(--space-6);
    border-top: 2px solid var(--color-border);
    text-align: left;
    max-width: 68ch;
}

.capability--primary { border-top-color: var(--color-primary); }
.capability--accent  { border-top-color: var(--color-accent); }

.capability h4 {
    margin-bottom: var(--space-2);
    font-size: 1.0625rem;
}

.capability p {
    margin-bottom: 0;
    font-size: 0.9375rem;
    color: var(--color-text-muted);
}

/* ---------------------------------------------------------------------------
 * Cards — projects + demos (shared card language)
 * The demos hub page and the status-badge leg adopt these classes.
 * ------------------------------------------------------------------------ */

.project-card,
.demo-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.25rem;
    border: 1px solid var(--color-border-light);
    border-radius: var(--border-radius-lg);
    background-color: var(--color-surface-raised);
    box-shadow: var(--shadow-sm);
    text-align: left;
    transition: transform var(--transition-move),
                box-shadow var(--transition-move),
                border-color var(--transition-color);
}

@media (hover: hover) {
    .project-card:hover,
    .demo-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
    }
}

.project-card h4,
.demo-card h4 {
    margin-bottom: var(--space-2);
    font-size: 1.0625rem;
}

.project-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
}

.project-card-desc,
.demo-card-desc {
    flex-grow: 1;
    margin-bottom: var(--space-3);
    font-size: 0.9375rem;
    color: var(--color-text-muted);
}

.project-card-links,
.demo-card-links {
    font-size: 0.875rem;
    font-weight: 600;
}

/* Language badge (project cards) */
.lang-badge {
    display: inline-block;
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background-color: var(--color-surface-muted);
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Demo cards: left status rail + status badge.
   Status modifiers double as the contract for the demos hub +
   online/offline checker landing from other legs. */
.demo-card {
    border-left: 3px solid var(--color-text-light);
    color: var(--color-text);
    text-decoration: none;
}

a.demo-card:hover,
a.demo-card:focus {
    color: var(--color-text);
    text-decoration: none;
}

.demo-card--online   { border-left-color: var(--color-success); }
.demo-card--offline  { border-left-color: var(--color-warning); }
.demo-card--checking { border-left-color: var(--color-text-light); }

.demo-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2);
}

.demo-card-icon {
    color: var(--color-primary);
    margin-bottom: var(--space-3);
}

.status-badge {
    display: inline-block;
    padding: 0.1rem 0.55rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge--online {
    color: var(--color-success);
    background-color: var(--color-success-bg);
}

.status-badge--offline {
    color: var(--color-warning);
    background-color: var(--color-warning-bg);
}

.status-badge--checking {
    color: var(--color-text-light);
    background-color: var(--color-surface-muted);
}

/* Demos-hub variants: browser-only demos and externally hosted sites */
.status-badge--available {
    color: var(--color-success);
    background-color: var(--color-success-bg);
}

.status-badge--external {
    color: var(--color-text-muted);
    background-color: var(--color-surface-muted);
}

/* ---------------------------------------------------------------------------
 * Contact — compact action rows
 * ------------------------------------------------------------------------ */

.contact-rows {
    max-width: 30rem;
    margin: 0 auto;
}

.contact-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-height: 48px;
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
    border-radius: var(--border-radius);
    color: var(--color-text);
    text-decoration: none;
    text-align: left;
    transition: background-color var(--transition-color),
                color var(--transition-color);
}

.contact-row:hover,
.contact-row:focus {
    color: var(--color-text);
    background-color: var(--color-surface-muted);
    text-decoration: none;
}

.contact-row svg {
    flex-shrink: 0;
    color: var(--color-primary);
}

.contact-row-label {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--color-heading);
}

.contact-row-value {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.contact-row-note {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

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

footer {
    padding: var(--space-6) 0;
    text-align: center;
    font-size: 0.875rem;
}

footer span.copyright {
    font-family: var(--font-body);
    line-height: 40px;
    color: var(--color-text-muted);
}

footer ul.quicklinks {
    margin-bottom: 0;
    font-family: var(--font-body);
    line-height: 40px;
}

ul.social-buttons {
    margin-bottom: 0;
}

ul.social-buttons li a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    color: #fff;
    background-color: var(--color-dark);
    transition: background-color var(--transition-color),
                color var(--transition-color);
}

ul.social-buttons li a:hover,
ul.social-buttons li a:focus,
ul.social-buttons li a:active {
    color: var(--color-on-primary);
    background-color: var(--color-primary);
}

.footer {
    color: var(--color-text-muted);
}

.footer a {
    color: var(--color-text);
}

/* ---------------------------------------------------------------------------
 * Misc shared utilities kept for subpages
 * ------------------------------------------------------------------------ */

.img-centered {
    margin: 0 auto;
}

.info {
    font-size: 0.75rem;
    margin-top: var(--space-5);
}

blockquote ol:last-child,
blockquote p:last-child,
blockquote ul:last-child {
    margin-bottom: 0;
    margin-top: 0;
}

/* ---------------------------------------------------------------------------
 * Reduced motion
 * ------------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
