/* Inter */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/Inter-Regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('fonts/Inter-Medium.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/Inter-SemiBold.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/Inter-Bold.woff2') format('woff2');
}

/* Outfit */
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('fonts/Outfit-Light.woff2') format('woff2');
}

@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/Outfit-Regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/Outfit-Bold.woff2') format('woff2');
}

:root {
    --bg: #09090b;
    --surface: #18181b;
    --border: #27272a;
    --primary: #FF6719;
    /* Substack Orange */
    --primary-hover: #e55a14;
    --text: #e4e4e7;
    --text-muted: #a1a1aa;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    text-decoration: none;
    position: relative;
}

.logo-icon {
    position: relative;
    width: 48px;
    height: 48px;
}

.logo-icon span {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    background: var(--primary);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo-icon span:nth-child(1) {
    transform: rotate(-10deg) translate(0, 0);
    opacity: 0.4;
}

.logo-icon span:nth-child(2) {
    transform: rotate(-5deg) translate(2px, -2px);
    opacity: 0.7;
}

.logo-icon span:nth-child(3) {
    transform: rotate(0deg) translate(4px, -4px);
    opacity: 1;
    box-shadow: -2px 4px 12px rgba(255, 103, 25, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Little lines on the top paper */
.logo-icon span:nth-child(3)::after {
    content: '';
    width: 24px;
    height: 3px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 2px;
    box-shadow: 0 6px 0 rgba(255, 255, 255, 0.9);
}

.logo:hover .logo-icon span:nth-child(1) {
    transform: rotate(-12deg) translate(-2px, 2px);
}

.logo:hover .logo-icon span:nth-child(2) {
    transform: rotate(-6deg) translate(1px, -3px);
}

.logo:hover .logo-icon span:nth-child(3) {
    transform: rotate(0deg) translate(6px, -6px);
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 2.5rem;
    color: #fff;
    letter-spacing: -0.03em;
    position: relative;
}

.badge {
    font-size: 0.75rem;
    background: rgba(255, 103, 25, 0.15);
    color: var(--primary);
    padding: 0.2rem 0.5rem;
    border-radius: 99px;
    font-weight: 700;
    position: absolute;
    top: 4px;
    right: -42px;
    letter-spacing: 0;
}

/* Header */
header {
    padding: 4rem 2rem 1rem;
    background: transparent;
    position: relative;
    z-index: 10;
    width: 100%;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hero */
.hero {
    text-align: center;
    padding: 1rem 2rem 2rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #fff, #a1a1aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.hero p {
    font-size: 1.125rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Main App */
.container {
    display: flex;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    gap: 3rem;
    flex: 1;
}

.sidebar {
    width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.config-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

input[type="text"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(255, 103, 25, 0.2);
}

.color-picker-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.color-input {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.5rem;
    border-radius: 8px;
}

input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.range-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
}

.range-value {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 3ch;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0;
    /* Prevents flex item from overflowing */
}

.preview-card {
    background: #000;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    background-image: radial-gradient(#27272a 1px, transparent 1px);
    background-size: 24px 24px;
    overflow: hidden;
    /* Contains the preview */
}

.code-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-top: .1rem;
}

.code-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-title {
    font-size: 0.9rem;
    font-weight: 600;
}

textarea {
    width: 100%;
    height: 300px;
    background: #0f0f11;
    border: none;
    color: #a1a1aa;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    padding: 1.5rem;
    box-sizing: border-box;
    resize: none;
    line-height: 1.5;
}

textarea:focus {
    outline: none;
}

.copy-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: var(--primary-hover);
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    padding: 2rem;
    margin-top: 8rem;
    background: var(--surface);
    width: 100%;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

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

.back-to-top {
    background: var(--border);
    color: var(--text);
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: background 0.2s;
}

.back-to-top:hover {
    background: #3f3f46;
}

/* Privacy Page Styles */
.privacy-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.privacy-content h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: #fff;
    text-align: center;
}

.privacy-content h2 {
    font-size: 1.5rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: #fff;
}

.privacy-content p {
    line-height: 1.7;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.privacy-content ul {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    color: var(--text-muted);
}

.privacy-content li {
    margin-bottom: 0.5rem;
}

/* 404 Page Styles */
.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 2rem;
}

.error-code {
    font-size: 8rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 1rem;
    opacity: 0.2;
}

.error-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #fff;
}

.error-message {
    font-size: 1.125rem;
    color: var(--text-muted);
    max-width: 400px;
    margin-bottom: 2rem;
}

.home-btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s;
}

.home-btn:hover {
    background: var(--primary-hover);
}

/* FAQ Section */
.faq-section {
    max-width: 800px;
    margin: 8rem auto 0;
    padding: 0 2rem;
    width: 100%;
}

.faq-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
    color: #fff;
}

.faq-item {
    border-bottom: 1px solid var(--border);
}

.faq-item:first-child {
    border-top: 1px solid var(--border);
}

details {
    padding: 1.5rem 0;
    cursor: pointer;
    transition: background 0.2s;
}

summary {
    font-weight: 600;
    color: var(--text);
    list-style: none;
    position: relative;
    padding-right: 2rem;
    font-size: 1.125rem;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: '+';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 400;
    color: var(--primary);
    font-size: 1.5rem;
    transition: transform 0.2s;
}

details[open] summary::after {
    transform: translateY(-50%) rotate(45deg);
}

details p {
    margin-top: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0;
}

/* Sponsored Box */
.sponsor-card {
    background: linear-gradient(180deg, rgba(255, 103, 25, 0.03) 0%, rgba(255, 103, 25, 0.0) 100%);
    border: 1px solid rgba(255, 103, 25, 0.2);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    max-width: 800px;
    margin: 6rem auto 0;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.sponsor-eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 600;
}

.sponsor-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.75rem;
}

.sponsor-title span {
    color: var(--primary);
}

.sponsor-desc {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto 2rem;
    line-height: 1.5;
}

.sponsor-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
}

.sponsor-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Media Queries */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
        padding: 1.5rem;
    }

    .sidebar {
        width: 100%;
    }

    .preview-card {
        position: static;
    }

    .footer-content {
        flex-direction: column;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    header {
        padding: 5rem 1rem 2rem;
    }

    .logo-icon {
        width: 38px;
        height: 38px;
    }

    .logo-icon span:nth-child(3)::after {
        width: 16px;
        height: 2px;
        box-shadow: 0 4px 0 rgba(255, 255, 255, 0.9);
    }

    .logo-text {
        font-size: 2rem;
    }

    .badge {
        top: -4px;
        right: -32px;
        font-size: 0.65rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .preview-card {
        padding: 2rem 1rem;
    }

    .privacy-content {
        padding: 2rem 1rem;
    }

    .privacy-content h1 {
        font-size: 2rem;
    }

    .sponsor-card {
        padding: 2rem 1.5rem;
        margin: 4rem auto 0;
        max-width: 600px;
        width: 90%;
    }

    .sponsor-title {
        font-size: 1.5rem;
    }

    .sponsor-desc {
        font-size: 1rem;
    }
}