/* =========================================================
   Seal — design tokens
   A lockbox, not a form: deep ink background, a single
   wax-seal amber accent, monospace for anything secret.
   ========================================================= */

:root {
    --ink: #11151c;
    --surface: #1b212b;
    --surface-raised: #222a35;
    --border: #2a323d;
    --border-soft: #232b35;

    --text: #edeff2;
    --text-muted: #8b95a3;
    --text-faint: #5b6573;

    --signal: #e8a33d;
    --signal-strong: #f0b85e;
    --signal-ink: #2a1d0c;

    --success: #4fd1a5;
    --danger: #e2685a;

    --font-display: "Space Grotesk", "Inter", sans-serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;

    --control-h: 56px;

    --space-1: 8px;
    --space-2: 14px;
    --space-3: 22px;
    --space-4: 32px;
    --space-5: 48px;
    --space-6: 72px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--ink);
    background-image:
        radial-gradient(ellipse 900px 600px at 50% -10%, rgba(232, 163, 61, 0.07), transparent 60%);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--signal-strong);
    text-decoration: none;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-5) var(--space-3) var(--space-6);
}

/* ---------------------------------------------------------
   Brand mark — the seal icon doubles as the page's signature
   --------------------------------------------------------- */

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(150deg, var(--signal-strong), var(--signal));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--signal-ink);
    flex-shrink: 0;
}

.brand-mark svg {
    width: 20px;
    height: 20px;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* ---------------------------------------------------------
   Layout
   --------------------------------------------------------- */

.stage {
    width: 100%;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.intro {
    text-align: center;
    margin-bottom: var(--space-5);
}

.intro h1 {
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 36px);
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 var(--space-2);
    letter-spacing: -0.01em;
}

.intro p {
    color: var(--text-muted);
    font-size: 16px;
    margin: 0;
    max-width: 440px;
    margin-inline: auto;
}

.card {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--signal), transparent 80%);
}

/* ---------------------------------------------------------
   Form elements — large, calm, unmistakable
   --------------------------------------------------------- */

.field {
    margin-bottom: var(--space-3);
}

.field:last-child {
    margin-bottom: 0;
}

.field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: var(--space-1);
    letter-spacing: 0.01em;
}

.field .hint {
    font-size: 13px;
    color: var(--text-faint);
    margin-top: var(--space-1);
}

.input,
.select {
    width: 100%;
    min-height: var(--control-h);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    padding: 16px 18px;
    transition: border-color 0.15s ease, background 0.15s ease;
    appearance: none;
}

.select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b95a3' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
}

.input::placeholder {
    color: var(--text-faint);
}

.input:focus,
.select:focus {
    outline: none;
    border-color: var(--signal);
    background: var(--surface);
}

.input-row {
    display: flex;
    gap: var(--space-2);
}

.input-row .input {
    flex: 1;
}

.input-mono {
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

/* Icon buttons — generate / reveal toggle */

.icon-btn {
    width: 54px;
    min-height: var(--control-h);
    flex-shrink: 0;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.icon-btn:hover {
    color: var(--signal-strong);
    border-color: var(--signal);
}

.icon-btn:active {
    transform: scale(0.95);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

/* Stepper for max opens */

.stepper {
    display: flex;
    align-items: stretch;
    height: var(--control-h);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface-raised);
}

.stepper button {
    width: 54px;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

.stepper button:hover {
    color: var(--signal-strong);
}

.stepper input {
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--text);
    text-align: center;
    font-size: 16px;
    font-family: var(--font-mono);
}

.stepper input:focus {
    outline: none;
}

/* Toggle row (notify-me, destroy-after-view) */

.field .toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    cursor: pointer;
}

.toggle-row .toggle-copy {
    display: block;
}

.toggle-row .toggle-copy strong {
    display: block;
    font-size: 15px;
    margin-bottom: 2px;
}

.toggle-row .toggle-copy span {
    font-size: 13px;
    color: var(--text-muted);
}

.switch {
    position: relative;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.switch .track {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 999px;
    transition: background 0.15s ease;
}

.switch .thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.15s ease, background 0.15s ease;
}

.switch input:checked + .track {
    background: rgba(232, 163, 61, 0.35);
}

.switch input:checked ~ .thumb {
    transform: translateX(20px);
    background: var(--signal);
}

.switch input:focus-visible ~ .track {
    outline: 2px solid var(--signal);
    outline-offset: 2px;
}

/* Buttons */

.btn {
    width: 100%;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    padding: 18px 24px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
}

.btn-primary {
    background: var(--signal);
    color: var(--signal-ink);
}

.btn-primary:hover {
    background: var(--signal-strong);
    box-shadow: 0 8px 24px rgba(232, 163, 61, 0.25);
}

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

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--text-faint);
}

/* ---------------------------------------------------------
   Result panel (link created)
   --------------------------------------------------------- */

.result-seal {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(79, 209, 165, 0.12);
    border: 1px solid rgba(79, 209, 165, 0.35);
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-3);
}

.result-seal svg {
    width: 30px;
    height: 30px;
}

.link-box {
    display: flex;
    align-items: stretch;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.link-display {
    flex: 1;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--signal-strong);
    overflow-x: auto;
    white-space: nowrap;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    font-size: 13px;
    color: var(--text-faint);
    margin-top: var(--space-2);
}

.meta-row span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---------------------------------------------------------
   Retrieval page — locked / unlocked states
   --------------------------------------------------------- */

.lock-seal {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-3);
    transition: all 0.3s ease;
}

.lock-seal.unlocked {
    background: rgba(232, 163, 61, 0.12);
    border-color: rgba(232, 163, 61, 0.4);
    color: var(--signal-strong);
}

.lock-seal svg {
    width: 34px;
    height: 34px;
}

.password-reveal {
    background: var(--surface-raised);
    border: 1px solid var(--signal);
    border-radius: var(--radius-sm);
    padding: 22px 18px;
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.password-reveal .value {
    font-family: var(--font-mono);
    font-size: 19px;
    color: var(--text);
    word-break: break-all;
}

.status-banner {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: var(--space-3);
}

.status-banner.success {
    background: rgba(79, 209, 165, 0.1);
    border: 1px solid rgba(79, 209, 165, 0.3);
    color: var(--success);
}

.status-banner.danger {
    background: rgba(226, 104, 90, 0.1);
    border: 1px solid rgba(226, 104, 90, 0.3);
    color: var(--danger);
}

.error-state {
    text-align: center;
}

.error-state .lock-seal {
    color: var(--danger);
    background: rgba(226, 104, 90, 0.1);
    border-color: rgba(226, 104, 90, 0.3);
}

.error-state h2 {
    font-family: var(--font-display);
    font-size: 22px;
    margin: 0 0 var(--space-1);
}

.error-state p {
    color: var(--text-muted);
    margin: 0;
}

.footer-note {
    margin-top: var(--space-5);
    text-align: center;
    color: var(--text-faint);
    font-size: 13px;
    max-width: 440px;
}

.hidden {
    display: none !important;
}

.spin {
    animation: seal-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .spin {
        animation: none;
    }
}

@media (max-width: 480px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .card {
        padding: var(--space-3);
    }

    .password-reveal {
        flex-direction: column;
        align-items: stretch;
    }
}
