
:root {
    --bg: #020617;
    --fg: #e5e7eb;
    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.25);
    --accent-2: #a855f7;
    --danger: #f97373;
}

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

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    color: var(--fg);
    background: radial-gradient(circle at top, #0f172a 0, #020617 45%, #000 100%);
    overflow-x: hidden;
}

body {
    position: relative;
}

.bg-orbit {
    position: fixed;
    border-radius: 999px;
    filter: blur(40px);
    opacity: 0.45;
    z-index: -2;
    pointer-events: none;
}

.bg-orbit-1 {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.35), transparent);
    top: -80px;
    left: -80px;
    animation: drift 22s infinite alternate ease-in-out;
}

.bg-orbit-2 {
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.35), transparent);
    bottom: -120px;
    right: -80px;
    animation: drift 28s infinite alternate-reverse ease-in-out;
}

.bg-orbit-3 {
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.28), transparent);
    bottom: 10%;
    left: 20%;
    animation: drift 26s infinite alternate ease-in-out;
}

@keyframes drift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(30px, -40px, 0) scale(1.1); }
}

.nav {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 3.5rem;
    backdrop-filter: blur(20px);
    background: linear-gradient(to bottom, rgba(2, 6, 23, 0.92), rgba(2, 6, 23, 0.4));
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-orb {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #e5e7eb, #38bdf8);
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.8);
    position: relative;
    overflow: hidden;
}

.logo-orb::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: inherit;
    border: 1px solid rgba(15, 23, 42, 0.9);
}

.logo-text {
    font-weight: 700;
    letter-spacing: 0.08em;
    font-size: 1.05rem;
    text-transform: uppercase;
}

.logo-accent {
    color: var(--accent);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-pill {
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.65));
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #cbd5f5;
}

.page {
    padding: 2.5rem 3.5rem 3.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 3.5rem;
    align-items: center;
}

.hero-title {
    font-size: clamp(2.4rem, 3vw, 3.1rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero-title.small {
    font-size: clamp(1.9rem, 2.4vw, 2.4rem);
}

.glitch {
    position: relative;
    display: inline-block;
    color: var(--accent);
    text-shadow:
        0 0 16px rgba(56, 189, 248, 0.8),
        2px 0 rgba(168, 85, 247, 0.6),
        -2px 0 rgba(34, 197, 94, 0.6);
    animation: glitch 3.2s infinite;
}

@keyframes glitch {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-1px, 1px); }
    20% { transform: translate(-2px, -1px); }
    30% { transform: translate(1px, 2px); }
    40% { transform: translate(1px, -1px); }
    50% { transform: translate(-1px, 1px); }
    60% { transform: translate(-1px, -2px); }
    70% { transform: translate(2px, 1px); }
    80% { transform: translate(1px, -1px); }
    90% { transform: translate(-1px, 1px); }
}

.hero-subtitle {
    margin: 0 0 1.6rem;
    max-width: 32rem;
    color: #cbd5f5;
    font-size: 0.98rem;
}

.prompt-card {
    margin-top: 1rem;
    padding: 1.4rem 1.5rem 1.3rem;
    border-radius: 1.4rem;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background:
        radial-gradient(circle at top, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.7)),
        linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(168, 85, 247, 0.1));
    box-shadow:
        0 18px 45px rgba(15, 23, 42, 0.85),
        0 0 0 1px rgba(15, 23, 42, 0.9);
}

.prompt-label {
    font-size: 0.8rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #9ca3af;
    display: block;
    margin-bottom: 0.6rem;
}

.prompt-input {
    width: 100%;
    resize: vertical;
    min-height: 120px;
    border-radius: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.8);
    padding: 0.9rem 1rem;
    color: var(--fg);
    font-size: 0.95rem;
    outline: none;
    transition: border 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.prompt-input::placeholder {
    color: #6b7280;
}

.prompt-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.7);
    background: rgba(15, 23, 42, 0.95);
}

.prompt-footer {
    margin-top: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.hint-text {
    font-size: 0.75rem;
    color: #9ca3af;
}

.btn-primary {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.7rem 1.4rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.9);
    background: radial-gradient(circle at top left, #38bdf8, #0f172a);
    color: #e5e7eb;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    box-shadow:
        0 10px 30px rgba(15, 23, 42, 0.9),
        0 0 24px rgba(56, 189, 248, 0.8);
    transition: transform 0.12s ease-out, box-shadow 0.12s ease-out, border-color 0.15s ease-out;
}

.btn-primary.secondary {
    background: radial-gradient(circle at top left, var(--accent-2), #0f172a);
}

.btn-primary.ghost {
    background: transparent;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.7);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow:
        0 16px 40px rgba(15, 23, 42, 1),
        0 0 32px rgba(56, 189, 248, 1);
}

.btn-primary:active {
    transform: translateY(0px) scale(0.99);
}

.btn-orb {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #e5e7eb;
    box-shadow: 0 0 12px rgba(248, 250, 252, 0.9);
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.4rem;
}

.badge {
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #9ca3af;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.6));
}

.hero-right {
    display: flex;
    justify-content: flex-end;
}

.preview-card {
    width: 100%;
    max-width: 360px;
    border-radius: 1.6rem;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background:
        radial-gradient(circle at top, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.9)),
        linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(168, 85, 247, 0.18));
    overflow: hidden;
    box-shadow:
        0 24px 60px rgba(15, 23, 42, 0.95),
        0 0 0 1px rgba(15, 23, 42, 0.9);
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    background: linear-gradient(to right, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.8));
    font-size: 0.75rem;
    color: #9ca3af;
}

.preview-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #4b5563;
}

.dot-1 { background: #f97316; }
.dot-2 { background: #eab308; }
.dot-3 { background: #22c55e; }

.preview-title {
    margin-left: auto;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 0.68rem;
}

.preview-body {
    position: relative;
    padding: 1.3rem 1.1rem 1.2rem;
    overflow: hidden;
}

.preview-orbit {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 0, rgba(56, 189, 248, 0.25), transparent),
                radial-gradient(circle at 80% 100%, rgba(168, 85, 247, 0.25), transparent);
    opacity: 0.9;
    mix-blend-mode: screen;
    animation: orbit-pulse 16s infinite alternate ease-in-out;
}

@keyframes orbit-pulse {
    0% { transform: scale(1); opacity: 0.85; }
    100% { transform: scale(1.1); opacity: 1; }
}

.preview-core {
    position: relative;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.5);
    padding: 0.9rem 0.9rem 0.8rem;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.95));
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.75rem;
    color: #e5e7eb;
}

.preview-line {
    display: block;
    margin-bottom: 0.25rem;
    opacity: 0.85;
}

.flash-container {
    margin-bottom: 1rem;
}

.flash {
    padding: 0.7rem 1rem;
    border-radius: 0.9rem;
    font-size: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.9);
}

.flash-error {
    border-color: rgba(248, 113, 113, 0.8);
    color: #fecaca;
}

.result {
    margin-top: 1.5rem;
}

.result-header {
    margin-bottom: 1.3rem;
}

.result-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.result-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.pdf-frame-container {
    border-radius: 1.3rem;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.96));
    box-shadow:
        0 20px 50px rgba(15, 23, 42, 0.95),
        0 0 0 1px rgba(15, 23, 42, 0.9);
    overflow: hidden;
}

.pdf-frame {
    width: 100%;
    height: min(75vh, 900px);
    border: none;
    border-radius: inherit;
    background: #111827;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease-in-out;
}

.loading-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.loading-core {
    position: relative;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-orbit {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    border: 2px dashed rgba(148, 163, 184, 0.5);
    animation: orbit-spin 12s linear infinite;
}

.orbit-2 {
    inset: 10px;
    border-style: solid;
    border-color: rgba(56, 189, 248, 0.7);
    animation-duration: 8s;
    animation-direction: reverse;
}

.orbit-3 {
    inset: 22px;
    border-style: solid;
    border-color: rgba(168, 85, 247, 0.7);
    animation-duration: 6s;
}

@keyframes orbit-spin {
    to { transform: rotate(360deg); }
}

.loading-pulse {
    width: 64px;
    height: 64px;
    border-radius: 999px;
    background: radial-gradient(circle, #38bdf8, #0f172a);
    box-shadow:
        0 0 32px rgba(56, 189, 248, 0.8),
        0 0 0 1px rgba(15, 23, 42, 0.95);
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
}

.loading-text {
    position: absolute;
    top: calc(100% + 1.4rem);
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    max-width: 320px;
}

#loading-message-main {
    display: block;
    font-size: 0.86rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
    color: #e5e7eb;
}

#loading-message-sub {
    display: block;
    font-size: 0.8rem;
    color: #9ca3af;
}

.hidden {
    display: none;
}

@media (max-width: 960px) {
    .nav {
        padding-inline: 1.5rem;
    }
    .page {
        padding-inline: 1.5rem;
    }
    .hero {
        grid-template-columns: minmax(0, 1fr);
    }
    .hero-right {
        order: -1;
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .nav {
        padding-inline: 1rem;
    }
    .page {
        padding-inline: 1rem;
    }
    .prompt-footer {
        flex-direction: column;
        align-items: flex-start;
    }
    .result-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-primary {
        width: 100%;
        justify-content: center;
    }
}


/* Center everything below the top bar */
.page {
    padding: 2.5rem 1.5rem 3.5rem;
    max-width: 900px;
    margin: 0 auto;
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-inner {
    width: 100%;
    max-width: 640px;
    text-align: center;
}

.hero-center-text {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.prompt-centered {
    margin-left: auto;
    margin-right: auto;
}

.prompt-footer-centered {
    justify-content: center;
}

.result-centered {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.result-layout-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}

.result-controls-centered {
    justify-content: center;
}

.pdf-frame-centered {
    margin: 0 auto;
}


/* Adjust PDF viewer to better match 8.5x11 aspect ratio */
.pdf-frame-container {
    max-width: 720px;
    margin: 0 auto;
}

.pdf-frame {
    width: 100%;
    height: auto;
    aspect-ratio: 8.5 / 11;
    border: none;
    border-radius: inherit;
    background: #111827;
}

/* Nudge hero content slightly upward on the home page */
.hero-inner {
    width: 100%;
    max-width: 640px;
    text-align: center;
    transform: translateY(-4vh);
}
