:root {
    --accent: #ff6b35;
    --fg: #111;
    --fg-muted: #666;
    --bg: #f8f8f8;
    --border: #ddd;
    --border-focus: #111;
    --radius: 18px;
    --font-sans: "Satoshi", system-ui, sans-serif;
    --font-mono: "Geist Mono", monospace;
}

html[data-theme="dark"] {
    --accent: #ff6b35;
    --fg: #f0f0f0;
    --fg-muted: #888;
    --bg: #0a0a0a;
    --border: #333;
    --border-focus: #f0f0f0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    color-scheme: dark light;
}

body {
    font-family: var(--font-sans);
    color: var(--fg);
    background-color: var(--bg);
    transition: background-color 0.2s ease, color 0.2s ease;
    -webkit-font-smoothing: antialiased;
}

button, input, textarea {
    font: inherit;
    color: inherit;
    border: none;
    background: none;
}

button {
    cursor: pointer;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.top-bar {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem clamp(1rem, 5vw, 4rem);
    z-index: 10;
}

.wordmark {
    font-weight: 700;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
}
.theme-toggle:hover {
    background-color: var(--border);
}
.theme-toggle .icon {
    width: 1.25rem;
    height: 1.25rem;
}
.icon-sun, html[data-theme="dark"] .icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: block; }


.stage {
    display: grid;
    gap: clamp(1.5rem, 3vh, 2.5rem);
    width: min(100%, 960px);
    margin: 0 auto;
    padding: clamp(0.5rem, 1vh, 1rem) clamp(2rem, 8vw, 8rem) clamp(2rem, 4vh, 4rem);
}

.intro {
    text-align: center;
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fg-muted);
    margin-bottom: 1rem;
}

.headline {
    font-size: clamp(2.75rem, 6vw, 5.5rem);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -0.04em;
    max-width: 12ch;
    margin: 0 auto;
}

.lede {
    font-size: 1.0625rem;
    color: var(--fg-muted);
    max-width: 40ch;
    margin: 0.75rem auto 0;
    line-height: 1.5;
}

#packager-form {
    display: grid;
    gap: clamp(1.25rem, 2.5vh, 2rem);
}

#dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: clamp(160px, 28vh, 240px);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

#dropzone:hover, #dropzone.is-active {
    border-color: var(--accent);
    transform: translateY(-4px);
    background-color: color-mix(in srgb, var(--bg) 95%, var(--accent) 5%);
}

.dropzone-content {
    display: grid;
    gap: 1.5rem;
    justify-items: center;
    text-align: center;
    color: var(--fg-muted);
    transition: color 0.2s ease;
}

#dropzone:hover .dropzone-content,
#dropzone.is-active .dropzone-content {
    color: var(--accent);
}

.dropzone-icon {
    transition: transform 0.2s ease;
}

#dropzone:hover .dropzone-icon {
    transform: translateY(-4px) scale(1.05);
}

.file-preview {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
}

#dropzone.is-invalid {
    border-color: #e53e3e;
    background-color: color-mix(in srgb, var(--bg) 95%, #e53e3e 5%);
}
#dropzone.is-invalid .dropzone-content {
    color: #e53e3e;
}


.meta-fields {
    display: grid;
    gap: 1.25rem;
}

.field-group {
    display: grid;
    gap: 0.75rem;
}

.field-group label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.field-group input, .field-group textarea {
    font-size: 1rem;
    padding: 0.5rem 0.1rem;
    border-bottom: 1px solid var(--border);
    width: 100%;
}
.field-group input:focus, .field-group textarea:focus {
    outline: none;
    border-bottom-color: var(--border-focus);
}
.field-group textarea {
    resize: vertical;
    min-height: 4rem;
}

input[aria-invalid="true"] {
    border-bottom-color: #e53e3e !important;
}


.actions {
    display: grid;
    justify-items: center;
    gap: 1rem;
}

#pack-button {
    width: 100%;
    max-width: 480px;
    height: 56px;
    border-radius: 999px;
    background-color: var(--accent);
    color: var(--bg);
    font-weight: 900;
    font-size: 1.125rem;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

#pack-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -8px var(--accent);
}

#pack-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#pack-button.is-packaging::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.1) 10px,
        rgba(255,255,255,0.1) 20px
    );
    animation: packing-progress 1s linear infinite;
}

@keyframes packing-progress {
    from { background-position: 0 0; }
    to { background-position: -28px 0; }
}


#form-status {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--fg-muted);
    text-align: center;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translate(-50%, 2rem);
    min-width: min(90vw, 320px);
    padding: 1rem 1.5rem;
    border-radius: 999px;
    background-color: var(--fg);
    color: var(--bg);
    text-align: center;
    font-weight: 700;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 640px) {
    .stage {
        padding: 0.5rem 1rem 3rem;
    }
    .top-bar {
        padding: 0.5rem 1rem;
    }
    #dropzone {
        min-height: 28vh;
    }
}
