/* ==========================================================================
   Tesla Referral Code — Styles
   Minimal look inspired by tesla.com (own wordmark, free Inter font)
   ========================================================================== */

:root {
    --color-bg: #ffffff;
    --color-surface: #f4f4f4;
    --color-text: #171a20;
    --color-text-secondary: #393c41;
    --color-text-light: #5c5e62;
    --color-border: #d0d1d2;
    --color-primary: #3e6ae1;
    --color-primary-hover: #3457b1;
    --color-on-primary: #ffffff;
    --color-secondary-bg: rgba(23, 26, 32, 0.07);
    --color-secondary-hover: rgba(23, 26, 32, 0.12);
    --color-success: #12bb00;
    --color-hover-bg: rgba(0, 0, 0, 0.05);
    --hero-gradient: linear-gradient(180deg, #e9eaec 0%, #f7f7f8 55%, #ffffff 100%);
    --font: "Inter", -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --container: 960px;
    --radius: 4px;
    --radius-lg: 12px;
    --transition: 0.33s cubic-bezier(0.5, 0, 0, 0.75);
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #171a20;
        --color-surface: #22252b;
        --color-text: #f4f4f4;
        --color-text-secondary: #d0d1d2;
        --color-text-light: #a2a3a5;
        --color-border: #393c41;
        --color-secondary-bg: rgba(255, 255, 255, 0.12);
        --color-secondary-hover: rgba(255, 255, 255, 0.18);
        --color-hover-bg: rgba(255, 255, 255, 0.08);
        --hero-gradient: linear-gradient(180deg, #0d0e11 0%, #15171c 55%, #171a20 100%);
    }
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; color-scheme: light dark; }
body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
.icon { flex-shrink: 0; vertical-align: middle; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input { font: inherit; }

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}
.container--narrow { max-width: 640px; }

/* ==========================================================================
   Header
   ========================================================================== */
.header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}
.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    max-width: none;
    padding: 0 32px;
}
.header__logo {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
}
.header__lang {
    display: flex;
    gap: 2px;
}
.lang-link {
    padding: 4px 10px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    transition: background var(--transition);
}
.lang-link:hover,
.lang-link--active {
    background: var(--color-hover-bg);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
    min-height: min(92vh, 880px);
    display: flex;
    align-items: center;
    padding: 112px 0 72px;
    background: var(--hero-gradient);
    text-align: center;
}
.hero__inner { width: 100%; }
.hero__title {
    font-size: clamp(32px, 5vw, 40px);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.2px;
    margin-bottom: 8px;
}
.hero__title span { color: inherit; }
.hero__subtitle {
    font-size: 15px;
    color: var(--color-text-secondary);
    margin-bottom: 48px;
}

/* Code box */
.code-box {
    max-width: 440px;
    margin: 0 auto;
    text-align: left;
}
.code-box__code-wrap {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}
.code-box__input {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 17px;
    font-weight: 500;
    color: var(--color-text);
    text-align: center;
    outline: none;
    transition: border-color var(--transition);
}
.code-box__input:focus { border-color: var(--color-text); }
.code-box__btn {
    min-width: 112px;
    height: 48px;
    padding: 0 20px;
    background: var(--color-secondary-bg);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
}
.code-box__btn:hover { background: var(--color-secondary-hover); }
.code-box__btn.copied {
    background: var(--color-success);
    color: #fff;
}
.code-box__meta {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 12px;
    font-size: 12px;
    color: var(--color-text-light);
}
.code-box__counter { display: flex; gap: 4px; }

/* Buttons */
.hero__actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-top: 40px;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 264px;
    height: 40px;
    padding: 0 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.btn--primary {
    background: var(--color-primary);
    color: var(--color-on-primary);
}
.btn--primary:hover { background: var(--color-primary-hover); }
.btn--secondary {
    background: var(--color-secondary-bg);
    color: var(--color-text-secondary);
}
.btn--secondary:hover { background: var(--color-secondary-hover); }

/* ==========================================================================
   Sections
   ========================================================================== */
.section { padding: 88px 0; }
.section--muted { background: var(--color-surface); }
.section__title {
    font-size: clamp(24px, 4vw, 28px);
    font-weight: 500;
    text-align: center;
    margin-bottom: 40px;
}

/* Steps */
.steps {
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.step {
    display: flex;
    align-items: baseline;
    gap: 20px;
}
.step__number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-text);
    border-radius: 50%;
    font-size: 13px;
    font-weight: 500;
    transform: translateY(-2px);
}
.step__text {
    font-size: 17px;
    color: var(--color-text-secondary);
}
.step__text strong { font-weight: 500; color: var(--color-text); }
.step__text a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}
.step__text a:hover { text-decoration-thickness: 2px; }

/* About */
.about-text {
    font-size: 16px;
    line-height: 1.75;
    color: var(--color-text-secondary);
}
.about-text p + p { margin-top: 20px; }

/* FAQ */
.faq-list {
    border-top: 1px solid var(--color-border);
}
.faq-item {
    border-bottom: 1px solid var(--color-border);
}
.faq-item summary {
    position: relative;
    padding: 18px 40px 18px 4px;
    font-size: 16px;
    font-weight: 500;
    list-style: none;
    cursor: pointer;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: "";
    position: absolute;
    right: 8px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 1.5px solid var(--color-text);
    border-bottom: 1.5px solid var(--color-text);
    transform: translateY(-75%) rotate(45deg);
    transition: transform var(--transition);
}
.faq-item[open] summary::after { transform: translateY(-25%) rotate(-135deg); }
.faq-item p {
    padding: 0 4px 20px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--color-text-secondary);
}

/* Troubleshooting */
.troubleshoot-card {
    max-width: 560px;
    margin: 0 auto;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}
.troubleshoot-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 18px 4px;
    font-size: 16px;
    font-weight: 500;
    text-align: left;
}
.troubleshoot-toggle__arrow {
    margin-left: auto;
    transition: transform var(--transition);
}
.troubleshoot-toggle[aria-expanded="true"] .troubleshoot-toggle__arrow {
    transform: rotate(180deg);
}
.troubleshoot-list {
    padding: 0 4px 20px;
    counter-reset: trouble;
}
.troubleshoot-list[hidden] { display: none; }
.troubleshoot-list li {
    position: relative;
    padding: 10px 0 10px 20px;
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
}
.troubleshoot-list li + li { border-top: 1px solid var(--color-border); }
.troubleshoot-list li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 19px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-text-light);
}
.troubleshoot-list strong { font-weight: 500; color: var(--color-text); }

/* Closing */
.section--closing {
    padding: 72px 0 96px;
    text-align: center;
}
.section--closing .section__title { margin-bottom: 28px; }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    padding: 32px 0 40px;
    text-align: center;
}
.footer__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 20px;
    margin-bottom: 16px;
}
.footer__links a {
    font-size: 12px;
    color: var(--color-text-light);
    transition: color var(--transition);
}
.footer__links a:hover { color: var(--color-text); }
.footer__text {
    max-width: 640px;
    margin: 0 auto;
    font-size: 12px;
    color: var(--color-text-light);
    line-height: 1.6;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 600px) {
    .header__inner { padding: 0 16px; }
    .header__logo { font-size: 12px; letter-spacing: 2px; }
    .lang-link { padding: 4px 6px; font-size: 12px; }

    .container { padding: 0 16px; }
    .hero { min-height: 0; padding: 104px 0 56px; }
    .hero__subtitle { margin-bottom: 36px; }
    .hero__actions { flex-direction: column; align-items: stretch; gap: 12px; margin-top: 28px; }
    .btn { min-width: 0; width: 100%; }
    .section--closing .btn { width: 100%; }

    .code-box__code-wrap { flex-direction: column; }
    .code-box__input { flex: none; width: 100%; }
    .code-box__btn { width: 100%; }
    .code-box__meta { flex-direction: column; }

    .section { padding: 64px 0; }
    .step__text { font-size: 16px; }
}

/* Counter animation */
@keyframes countPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.counter-pulse { animation: countPulse 0.3s ease; }

@keyframes copyFlash {
    0% { box-shadow: 0 0 0 0 rgba(18, 187, 0, 0.35); }
    100% { box-shadow: 0 0 0 10px rgba(18, 187, 0, 0); }
}
.copy-flash { animation: copyFlash 0.5s ease; }
