/* ============================================================
   CrowdTrade Coin — Public Pages (landing + auth)
   Layered on top of main.css. Coin animation + richer hero.
   ============================================================ */

:root {
    --gold-grad: linear-gradient(135deg, #F5D98B 0%, #E3B341 40%, #B8860B 100%);
    --hero-glow: radial-gradient(ellipse at 50% 0%, rgba(227,179,65,0.18) 0%, rgba(13,17,28,0) 60%);
}

/* ---------- Shared public shell ---------- */
html { overflow-x: hidden; }
.pub-body {
    min-height: 100vh;
    overflow-x: hidden;
    background:
        var(--hero-glow),
        radial-gradient(ellipse at 80% 90%, rgba(22,163,74,0.06) 0%, rgba(13,17,28,0) 55%),
        var(--navy);
    background-attachment: fixed;
}

.pub-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 6vw;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 200;
}
.pub-nav .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pub-nav .brand img { height: 40px; display: block; max-width: 100%; }

.pub-nav-links { display: flex; align-items: center; gap: 22px; }
.pub-nav-links a { color: var(--text-light); text-decoration: none; font-weight: 500; white-space: nowrap; }
.pub-nav-links a:hover { color: var(--gold); }

/* Hamburger (3-bar) toggle — hidden on desktop, functional on mobile */
.pub-nav-toggle-cb { display: none !important; }
.pub-nav-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    width: 46px; height: 42px;
    padding: 0 11px;
    border: 1px solid rgba(227,179,65,0.4);
    border-radius: 10px;
    background: rgba(227,179,65,0.07);
    flex-shrink: 0;
    box-sizing: border-box;
    transition: background 0.2s ease;
}
.pub-nav-burger span {
    width: 100%; height: 2px; border-radius: 2px;
    background: var(--gold); display: block;
    transition: transform 0.25s ease, opacity 0.2s ease;
}
.pub-nav-burger:hover { background: rgba(227,179,65,0.15); }
.pub-nav-toggle-cb:checked ~ .pub-nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.pub-nav-toggle-cb:checked ~ .pub-nav-burger span:nth-child(2) { opacity: 0; }
.pub-nav-toggle-cb:checked ~ .pub-nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.btn-gold {
    background: var(--gold-grad);
    color: #1a1400 !important;
    padding: 11px 22px;
    border-radius: 10px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 6px 18px rgba(227,179,65,0.25);
    transition: transform .15s ease, box-shadow .15s ease;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(227,179,65,0.38); }
.btn-ghost {
    border: 1px solid rgba(227,179,65,0.5);
    color: var(--gold) !important;
    padding: 11px 22px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    background: transparent;
    transition: background .15s ease;
}
.btn-ghost:hover { background: rgba(227,179,65,0.08); }

/* ---------- Hero ---------- */
.hero-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 6vw 80px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 40px;
    align-items: center;
}
.hero-copy h1 {
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    line-height: 1.05;
    margin: 0 0 8px;
    background: linear-gradient(90deg, #F5F0E1 0%, #E3B341 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-copy .tagline { font-size: 1.25rem; color: #C9C4B4; margin: 0 0 24px; }
.hero-points { list-style: none; padding: 0; margin: 0 0 28px; }
.hero-points li { padding: 6px 0 6px 28px; position: relative; color: #E8E3D4; }
.hero-points li::before {
    content: "◆"; color: var(--gold); position: absolute; left: 0; top: 6px; font-size: 0.85em;
}
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------- The spinning coin ---------- */
/* NOTE: this used to be a "real" 3D flip (perspective + preserve-3d +
   backface-visibility + rotateY). That's the technique most tutorials use,
   but a lot of Android/mobile GPUs either don't support compositing nested
   3D layers properly or silently fall back to a flattened 2D approximation
   for them — and that fallback is exactly what reads as "sliding sideways"
   instead of spinning in place. Repositioning `perspective` wasn't enough
   because the underlying problem is the 3D transform itself being
   unreliable on these devices, not where perspective was anchored.
   Switching to a 2D scaleX "fake flip" (below) sidesteps the whole
   category of bug: it only ever asks the browser for a 2D transform, which
   every device handles identically and predictably, so there's no 3D
   compositing path left to fall back out of. */
.coin-stage {
    display: flex;
    justify-content: center;
    align-items: center;
}
/* Outer layer handles the float — ONLY translateY, its own compositor layer */
.coin-float {
    animation: coin-float 4s ease-in-out infinite;
    will-change: transform;
}
/* Inner layer handles the spin. scaleX goes 1 → 0 → -1 → 0 → 1, i.e. cos(angle)
   for a full 360° turn — that's the same horizontal squash a real rotateY
   flip would produce, but done as a plain 2D transform so it can't wobble
   or drift off its own center. */
.coin {
    width: min(320px, 70vw);
    height: min(320px, 70vw);
    position: relative;
    animation: coin-spin-2d 7s linear infinite;
    will-change: transform;
}
.coin img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: absolute;
    inset: 0;
    box-shadow: 0 0 60px rgba(227,179,65,0.35), inset 0 0 40px rgba(0,0,0,0.4);
}
/* The container above handles the squash/widen; these two just swap
   which face is visible at the exact moments the container is edge-on
   (scaleX passes through 0, at 25% and 75% of the cycle) so it reads as
   one coin turning over, not two images crossfading. */
.coin-front {
    animation: coin-face-front 7s linear infinite;
}
.coin-back {
    filter: brightness(0.55) saturate(1.2);
    animation: coin-face-back 7s linear infinite;
}
.coin-glow {
    position: absolute;
    width: 120%;
    height: 120%;
    left: -10%;
    top: -10%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(227,179,65,0.25) 0%, rgba(13,17,28,0) 65%);
    animation: coin-pulse 4s ease-in-out infinite;
    will-change: opacity, transform;
    z-index: -1;
}

@keyframes coin-spin-2d {
    0%   { transform: scaleX(1); }
    25%  { transform: scaleX(0); }
    50%  { transform: scaleX(-1); }
    75%  { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}
@keyframes coin-face-front {
    0%, 25%    { opacity: 1; }
    25.01%, 75% { opacity: 0; }
    75.01%, 100% { opacity: 1; }
}
@keyframes coin-face-back {
    0%, 25%    { opacity: 0; }
    25.01%, 75% { opacity: 1; }
    75.01%, 100% { opacity: 0; }
}
@keyframes coin-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-16px); }
}
@keyframes coin-pulse {
    0%, 100% { opacity: 0.5; transform: scale(0.95); }
    50%      { opacity: 0.9; transform: scale(1.05); }
}
@media (prefers-reduced-motion: reduce) {
    .coin, .coin-float { animation: none; }
    .coin-glow { animation: none; }
}
/* On very small / low-power devices, drop the float bob to keep the spin buttery */
@media (max-width: 400px) {
    .coin-float { animation: none; }
}

/* ---------- Live vault strip ---------- */
.vault-strip {
    max-width: 1200px;
    margin: 0 auto 60px;
    padding: 0 6vw;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}
.vault-card {
    background: rgba(22,27,41,0.8);
    border: 1px solid rgba(227,179,65,0.15);
    border-radius: 14px;
    padding: 22px;
    text-align: center;
}
.vault-card .label { color: #9A957F; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
.vault-card .value { color: var(--gold); font-size: 1.8rem; font-weight: 700; margin-top: 6px; }
.vault-live-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--green); margin-right: 6px; animation: blink 1.6s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ---------- Live price ticker (pinned CTC card + Binance widget) ---------- */
.ticker-section { max-width: 1200px; margin: 0 auto 60px; padding: 0 6vw; }
.ticker-wrap {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: rgba(22,27,41,0.8);
    border: 1px solid rgba(227,179,65,0.15);
    border-radius: 14px;
    overflow: hidden;
}
.ctc-ticker-pin {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(227,179,65,0.14), rgba(227,179,65,0.04));
    border-right: 1px solid rgba(227,179,65,0.2);
    white-space: nowrap;
}
.ctc-ticker-icon {
    width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(227,179,65,0.4);
    object-fit: cover;
}
.ctc-ticker-body { display: flex; flex-direction: column; gap: 3px; }
.ctc-ticker-meta { display: flex; align-items: center; gap: 6px; }
.ctc-ticker-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--gold); animation: blink 1.6s ease-in-out infinite;
}
.ctc-ticker-symbol { font-weight: 800; color: var(--gold); font-size: 0.95rem; }
.ctc-ticker-name { color: #9A957F; font-size: 0.8rem; display: none; }
.ctc-ticker-figures { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.ctc-ticker-price { color: #fff; font-weight: 700; font-size: 1.05rem; line-height: 1; }
.ctc-ticker-change { font-size: 0.78rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.ctc-ticker-change.up { color: var(--green); background: rgba(61,187,126,0.14); }
.ctc-ticker-change.down { color: #E06A54; background: rgba(224,106,84,0.14); }
.ctc-ticker-change.flat { color: #9A957F; background: rgba(154,149,127,0.12); }
.ticker-widget-frame { flex: 1; min-width: 0; display: flex; align-items: center; padding: 4px 10px; }
@media (min-width: 700px) { .ctc-ticker-name { display: inline; } }
@media (max-width: 560px) {
    .ticker-wrap { flex-direction: column; }
    .ctc-ticker-pin { border-right: none; border-bottom: 1px solid rgba(227,179,65,0.2); justify-content: center; flex-wrap: wrap; }
}

/* ---------- How it works ---------- */
.how-section { max-width: 1200px; margin: 0 auto; padding: 0 6vw 80px; }
.how-section h2 { text-align: center; font-size: 2rem; margin-bottom: 8px; }
.how-section .sub { text-align: center; color: #9A957F; margin-bottom: 36px; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.how-step {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 28px 24px;
    border-top: 3px solid var(--gold);
}
.how-step .num {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--gold-grad); color: #1a1400;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; margin-bottom: 14px;
}
.how-step h3 { margin: 0 0 8px; }
.how-step p { color: #C9C4B4; margin: 0; line-height: 1.5; }

.pub-footer {
    text-align: center;
    padding: 40px 6vw;
    color: #6E6A5C;
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* ---------- Auth pages (login / register / forgot) ---------- */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.auth-visual {
    background:
        var(--hero-glow),
        linear-gradient(160deg, #10141f 0%, #0D111C 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    position: relative;
    overflow: hidden;
}
.auth-visual .coin { width: min(240px, 60vw); height: min(240px, 60vw); }
.auth-visual h2 { margin: 34px 0 6px; text-align: center; }
.auth-visual p { color: #9A957F; text-align: center; max-width: 320px; }

.auth-form-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 7vw;
    background: var(--navy);
}
.auth-form-side .auth-inner { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-form-side h1 { font-size: 1.8rem; margin: 0 0 4px; }
.auth-form-side .lead { color: #9A957F; margin: 0 0 26px; }
.auth-form-side label { display: block; margin-bottom: 14px; font-size: 0.9rem; color: #C9C4B4; }
.auth-form-side input[type="text"],
.auth-form-side input[type="email"],
.auth-form-side input[type="password"] {
    width: 100%;
    margin-top: 6px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: #11151f;
    color: var(--text-light);
    font-size: 1rem;
}
.auth-form-side input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(227,179,65,0.15);
}
.auth-form-side .btn-gold { width: 100%; text-align: center; margin-top: 6px; padding: 13px; font-size: 1rem; }
.auth-links { margin-top: 20px; font-size: 0.9rem; color: #9A957F; }
.auth-links a { color: var(--gold); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .hero-wrap { grid-template-columns: 1fr; text-align: center; }
    .hero-points { display: inline-block; text-align: left; }
    .hero-cta { justify-content: center; }
    .coin-stage { order: -1; margin-bottom: 20px; }
    .vault-strip { grid-template-columns: 1fr; }
    .how-grid { grid-template-columns: 1fr; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
}

@media (max-width: 760px) {
    .pub-nav-burger { display: flex; }

    .pub-nav-links {
        position: absolute;
        top: 100%;
        left: 0; right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: linear-gradient(180deg, #12151F 0%, #0D111C 100%);
        border-top: 1px solid rgba(227,179,65,0.2);
        border-bottom: 1px solid rgba(227,179,65,0.2);
        box-shadow: 0 20px 50px rgba(0,0,0,0.55);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.32s ease;
    }
    .pub-nav-toggle-cb:checked ~ .pub-nav-links {
        max-height: 80vh;
        overflow-y: auto;
    }
    .pub-nav-links a {
        padding: 16px 6vw;
        border-top: 1px solid rgba(255,255,255,0.05);
        width: 100%;
        box-sizing: border-box;
        font-size: 0.98rem;
    }
    .pub-nav-links a:first-child { border-top: none; }
    .pub-nav-links a:active { background: rgba(227,179,65,0.1); }
    .pub-nav-links a.btn-gold, .pub-nav-links a.btn-ghost {
        margin: 14px 6vw 18px;
        width: auto;
        text-align: center;
        border-top: none;
        padding: 13px 22px;
    }
}

@media (max-width: 480px) {
    .pub-nav { padding: 14px 5vw; }
    .pub-nav .brand img { height: 28px; }
    .hero-wrap { padding: 24px 5vw 50px; }
    .how-section { padding: 0 5vw 50px; }
    .auth-form-side { padding: 30px 6vw; }
}