/*
 * custom.css - CoPackHQ project overrides
 *
 * Load LAST, after header.css, via the layout's css render section:
 *
 *   <?php echo $this->renderSection('css') ?>
 *
 * or unconditionally in base.php if these are site-wide:
 *
 *   <link rel="stylesheet" href="<?php echo base_url('assets/css/custom.css?v=' . esc(env('app.version'))) ?>">
 *
 * SCOPE: markup-shape rules that only make sense for this project's
 * page structure. Anything reusable across brands belongs in main.css;
 * anything colour or type related belongs in theme-{color|brand}.css.
 *
 * CONTRACT: no raw colour values. Use the tokens the theme supplies.
 */

/* ============================================================
   HERO GRID OVERLAY
   ============================================================ */
/*
 * Faint graph-paper backdrop behind hero content. Needs a
 * position:relative parent (.hero-gradient provides one).
 * The radial mask fades the grid out toward the edges so it
 * never collides with the section boundary.
 */
.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--bs-border-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--bs-border-color) 1px, transparent 1px);
    background-size: 64px 64px;
    opacity: 0.5;
    pointer-events: none;
}


/* ============================================================
   HERO DOTS
   ============================================================ */

/* Breathing dot field. Alternative backdrop to .hero-grid. */
.hero-dots {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--bs-border-color) 1.5px, transparent 1.5px);
    background-size: 28px 28px;
    animation: dotsBreathe 5s ease-in-out infinite;
    z-index: -1;
}

@keyframes dotsBreathe {
    0%, 100%  { opacity: 0.55; }
    50%       { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-dots { animation: none; opacity: 0.55; }
}

/* ============================================================
   HERO CUSTOM ITEMS
   ============================================================ */

/* Glow */
.qcard-glow {
    position: absolute;
    inset: -1rem;
    border-radius: 1rem;
    background: rgba(var(--bs-primary-rgb), 0.08);
    filter: blur(24px);
    pointer-events: none;
}

.qcard-title {
    font-family: var(--theme-font-editorial);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
}
.qcard-label {font-size: .625rem;letter-spacing: 0.1em;}
.qcard-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    background: rgba(var(--bs-body-color-rgb), 0.08);
    font-family: var(--theme-font-monospace);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--bs-secondary-color);
}
.qcard-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bs-success);
    animation: qpulse 2s ease-in-out infinite;
}

@keyframes qpulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.qcost-label {
    font-family: var(--theme-font-monospace);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bs-tertiary-color);
    margin-bottom: 0.125rem;
}

.qtotal {
    font-family: var(--theme-font-editorial);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.qgp {
    font-family: var(--theme-font-editorial);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

.qcard-skus {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-height: 5rem;
}

.qcard-skus li {
    font-family: var(--theme-font-monospace);
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    padding-left: 0.875rem;
    position: relative;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.2s, transform 0.2s;
}
.qcard-skus li.is-visible {opacity: 1;transform: translateX(0);}

.qcard-skus li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.45em;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--bs-border-color);
}
.qfade {transition: opacity 0.25s, transform 0.3s;}
.qfade.is-out {opacity: 0;transform: translateY(4px);}
.qcard-dot {
    height: 4px;
    border-radius: 9999px;
    background: var(--bs-border-color);
    transition: width 0.3s, background 0.3s;
}
.qcard-dot.is-active {
    width: 1.5rem !important;
    background: var(--bs-secondary-color);
}

/* Marquee Items */
.marquee-wrap {
    overflow: hidden;
    background: var(--bs-card-bg);
    border-bottom: 1px solid var(--bs-border-color);
}

.marquee-track {
    display: flex;
    gap: 52px;
    width: max-content;
    animation: marquee 30s linear infinite;
}

.marquee-item {
    font-family: var(--theme-font-editorial);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bs-tertiary-color);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
}
.marquee-item span { font-size: 0.875rem; color: var(--bs-success); }

@keyframes marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}


/* =========================================================
   POST SINGLE
   ========================================================= */
:root {--toc-top: 4.5rem;}

.toc {position: sticky;top: var(--toc-top);}
.toc-inner {max-height: calc(100vh - var(--toc-top) - 2rem);overflow-y: auto;}
.toc-label {font-size: 0.75rem;margin-bottom: 0.75rem;}
.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid var(--bs-border-color);
}
.toc-item {line-height: 1.35;}
.toc-link {
    display: block;
    padding: 0.35rem 0 0.35rem 1rem;
    margin-left: -1px;
    border-left: 1px solid transparent;
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.toc-link:hover,
.toc-link:focus-visible,
.toc-link.active {
    color: var(--theme);
    border-left-color: var(--theme);
}
.toc-link.active {font-weight: 500;}

/* Indent by heading level. Posts only, legal has one level. */
.toc-l3 .toc-link {padding-left: 2rem;}
.toc-l4 .toc-link {padding-left: 3rem;font-size: 0.78125rem;}

/* Anchor jumps land under the fixed header. */
.toc-target {
    scroll-margin-top: var(--toc-top);
}