/*
 * CollatCred — Components
 * All reusable UI component styles for index.html.
 * Depends on: variables.css
 * CP5: body copy inside cards is text-neutral-400 minimum.
 * CP6: unified hover/active system, nav underline, touch targets.
 * CP8: scroll-aware nav, scroll progress bar, modal scale-in.
 * CP10: shimmer skeleton for iframe + charts.
 */

/* ══════════════════════════════════════════════════════
   BENTO CARD
   CP6: cards lift translateY(--lift-md), consistent spring.
   CP4: .bento-radius replaces arbitrary Tailwind rounded-[x] values.
   ══════════════════════════════════════════════════════ */

.bento-card {
    background: linear-gradient(180deg,
        var(--color-surface-card) 0%,
        rgba(10,10,15,0.9)        100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.06);
    border-top: 1px solid rgba(255,255,255,0.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), var(--shadow-card);
    transition:
        transform      var(--dur-slow) var(--ease-spring),
        border-color   var(--dur-base) ease,
        box-shadow     var(--dur-slow) ease;
    position: relative;
    overflow: hidden;
}

.bento-card:hover {
    transform: translateY(var(--lift-md));
    border-color: rgba(255,255,255,0.14);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), var(--shadow-card-hover);
}

/*
 * Token-based border-radius for bento cards.
 * Replaces arbitrary Tailwind rounded-[2rem], rounded-[2.5rem], etc.
 * Applied as an extra class: <div class="bento-card bento-radius">
 */
.bento-radius {
    border-radius: var(--radius-lg);
}
@media (min-width: 640px)  { .bento-radius { border-radius: var(--radius-xl);  } }
@media (min-width: 768px)  { .bento-radius { border-radius: var(--radius-2xl); } }

/* ══════════════════════════════════════════════════════
   CALCULATOR WRAPPER
   Outer frame for the calculator iframe embed.
   Static border only — no animation (CP4 requirement).
   ══════════════════════════════════════════════════════ */

.calculator-wrapper {
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-brand-border);
    box-shadow: var(--shadow-brand-sm);
    overflow: visible;
    position: relative;
    z-index: var(--z-base);
}

@media (min-width: 768px) {
    .calculator-wrapper { border-radius: calc(var(--radius-xl) + 4px); }
}

/* ══════════════════════════════════════════════════════
   VIDEO MODAL  (native <dialog>)
   CP8: .video-dialog-inner gets scale-in entry on open.
   ══════════════════════════════════════════════════════ */

.video-dialog {
    background: transparent;
    border: none;
    padding: 1rem;
    max-width: min(90vw, 1024px);
    width: 100%;
    position: fixed;
    inset: 0;
    margin: auto;
    z-index: var(--z-modal);
}

.video-dialog::backdrop {
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.video-dialog[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-dialog-inner {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #111113;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 40px 80px -20px rgba(0,0,0,0.9);
}

/* Scale-in entry when dialog opens */
.video-dialog[open] .video-dialog-inner {
    animation: modal-scale-in var(--dur-slow) var(--ease-spring) both;
}

/* ══════════════════════════════════════════════════════
   3D LADDER — POST CARDS
   ══════════════════════════════════════════════════════ */

.post-card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.96);
    border: 3px solid #111115;
    border-radius: var(--radius-2xl);
    box-shadow: 0 24px 48px -12px rgba(6, 182, 212, 0.15);
    overflow: hidden;
    transition:
        transform   0.4s var(--ease-spring),
        filter      0.4s ease,
        box-shadow  0.4s ease;
}

/* Iframes inside post-cards must never exceed the card width.
 * The iframe HTML attribute width="504" was overriding CSS — removed in
 * linkedin.js. This rule is the CSS-layer guarantee. */
.post-card iframe {
    width: 100% !important;
    max-width: 100%;
    display: block;
}

.post-card:hover {
    transform: translate3d(0, -10px, 80px) scale(1.02);
    z-index: 10;
    filter: brightness(1);
    box-shadow: 0 32px 64px -8px rgba(34, 211, 238, 0.25);
}

/* ══════════════════════════════════════════════════════
   LOADER SPINNER
   ══════════════════════════════════════════════════════ */

.loader {
    border: 3px solid rgba(255,255,255,0.08);
    border-top: 3px solid var(--color-brand);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 1s linear infinite;
}

/* ══════════════════════════════════════════════════════
   CP6 — BUTTON INTERACTION SYSTEM
   Primary: translateY(--lift-sm) + brightness on hover.
   All buttons: translateY(1px) :active press feedback.
   ══════════════════════════════════════════════════════ */

/* Hero primary button (Watch Concept) */
.hero-btn-primary {
    transition:
        transform   var(--dur-base) var(--ease-spring),
        filter      var(--dur-base) ease,
        box-shadow  var(--dur-base) ease;
}
.hero-btn-primary:hover {
    transform: translateY(var(--lift-sm));
    filter: brightness(1.06);
}
.hero-btn-primary:active {
    transform: translateY(1px);
    filter: brightness(0.96);
}

/* Hero secondary button (Try Product Demo) */
.hero-btn-secondary {
    transition:
        background-color  var(--dur-base) ease,
        transform         var(--dur-base) var(--ease-spring),
        border-color      var(--dur-base) ease;
}
.hero-btn-secondary:hover {
    transform: translateY(var(--lift-sm));
}
.hero-btn-secondary:active {
    transform: translateY(1px);
}

/* Hero tertiary CTA (CryptoBeacon — demoted, slightly smaller) */
.hero-btn-tertiary {
    transition:
        background     var(--dur-base) ease,
        transform      var(--dur-base) var(--ease-spring),
        border-color   var(--dur-base) ease;
    font-size: 0.8125rem; /* 13px — one step below primary pair */
}
.hero-btn-tertiary:hover {
    transform: translateY(var(--lift-sm));
}
.hero-btn-tertiary:active {
    transform: translateY(1px);
}

/* Generic :active press — catches ladder nav buttons, tier btns, etc. */
button:active,
[role="button"]:active {
    transform: translateY(1px) !important;
    transition-duration: var(--dur-instant) !important;
}

/* ══════════════════════════════════════════════════════
   CP6 — NAV LINK UNDERLINE SLIDE-IN
   ══════════════════════════════════════════════════════ */

.nav-link {
    position: relative;
    transition: color var(--dur-base) ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--color-brand);
    border-radius: 2px;
    transition: width var(--dur-base) var(--ease-spring);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* ══════════════════════════════════════════════════════
   CP6 — DATA ROOM ACCESS BUTTON (nav CTA)
   ══════════════════════════════════════════════════════ */

.nav-cta {
    transition:
        background-color  var(--dur-base) ease,
        color             var(--dur-base) ease,
        border-color      var(--dur-base) ease,
        transform         var(--dur-base) var(--ease-spring);
}

.nav-cta:hover {
    background-color: rgba(255,255,255,0.18);
    transform: translateY(var(--lift-sm));
}

.nav-cta:active {
    transform: translateY(1px);
}

/* ══════════════════════════════════════════════════════
   CP6 — ICON MICRO-ANIMATIONS
   ══════════════════════════════════════════════════════ */

/* Play icon on Watch Concept — scale pulse */
.icon-play {
    transition: transform var(--dur-base) var(--ease-spring);
    display: inline-flex;
}
.hero-btn-primary:hover .icon-play {
    transform: scale(1.2);
}

/* Sliders icon on Try Demo — tilt */
.icon-sliders {
    transition: transform var(--dur-base) var(--ease-spring);
    display: inline-flex;
}
.hero-btn-secondary:hover .icon-sliders {
    transform: rotate(-12deg) scale(1.15);
}

/* Robot icon on CryptoBeacon — wiggle */
.icon-robot {
    transition: transform var(--dur-base) var(--ease-spring);
    display: inline-flex;
}
.hero-btn-tertiary:hover .icon-robot {
    transform: rotate(10deg) scale(1.15);
}

/* Arrow on Connect with Us — slide right */
.icon-arrow-right {
    transition: transform var(--dur-base) var(--ease-spring);
    display: inline-flex;
}
.group:hover .icon-arrow-right {
    transform: translateX(3px);
}

/* ══════════════════════════════════════════════════════
   CP6 — TOUCH TARGETS
   Social/icon links get minimum 44×44px tap area.
   ══════════════════════════════════════════════════════ */

.icon-link-touch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    transition: color var(--dur-base) ease;
}

/* ══════════════════════════════════════════════════════
   CP8 — SCROLL PROGRESS BAR
   ══════════════════════════════════════════════════════ */

#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, var(--color-brand) 0%, var(--color-blue) 100%);
    z-index: calc(var(--z-nav) + 2);
    transition: width 0.1s linear;
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════
   CP8 — SCROLL-AWARE NAV
   .nav-scrolled toggled by JS when scrollY > 60px
   ══════════════════════════════════════════════════════ */

nav.nav-scrolled {
    background: rgba(2, 2, 2, 0.96) !important;
    border-bottom-color: rgba(255,255,255,0.1) !important;
    box-shadow: 0 4px 24px -8px rgba(0,0,0,0.6);
}

/* ══════════════════════════════════════════════════════
   CP8 — DOT INDICATOR (below 3D stage)
   ══════════════════════════════════════════════════════ */

.stage-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
}

.stage-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    transition: background var(--dur-base) ease, transform var(--dur-base) ease;
    cursor: pointer;
}

.stage-dot.active {
    background: var(--color-brand);
    transform: scale(1.25);
}

/* ══════════════════════════════════════════════════════
   CP10 — SHIMMER SKELETON
   Reusable for chart + iframe loading states.
   ══════════════════════════════════════════════════════ */

.shimmer {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0.03) 25%,
        rgba(255,255,255,0.07) 50%,
        rgba(255,255,255,0.03) 75%
    );
    background-size: 800px 100%;
    animation: shimmer-sweep 1.6s infinite linear;
    border-radius: var(--radius-md);
}

/* ── Iframe skeleton shown before calc loads */
/*
 * Baseline height matches the iframe's initial height attribute.
 * On mobile the calculator is shorter; the ResizeObserver bridge corrects
 * the final height, but setting a tighter initial value reduces CLS.
 */
.calc-skeleton {
    width: 100%;
    height: 600px;
    min-height: 400px;
}

@media (max-width: 599px) {
    /* Mobile calculator is naturally ~420–460px after the layout redesign.
       Starting closer to that height reduces the CLS from the height bridge. */
    .calc-skeleton {
        height: 460px;
        min-height: 340px;
    }
}

/* Chart container enforces min-height so shimmer has space */
.chart-container {
    position: relative;
    min-height: 160px;
}
