/* LovAPI dashboard. The landing page's tokens and header, buttons and
   footer (frontend/lovapi/landing/styles_*.css), copied rather than linked so
   the two sites deploy independently, plus forms, the key list and the
   revoke dialog. */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-code: #f6f7f9;
    --border-subtle: #e6e8eb;
    --text-primary: #111111;
    --text-body: #333333;
    --text-secondary: #666666;
    --accent: #2447b3;
    --cta-bg: #111111;
    --cta-hover: #333333;
    --cta-text: #ffffff;
    --danger: #b3261e;
    --danger-hover: #8c1d17;
    --warning-bg: #fdf6e3;
    --warning-border: #e8d9a8;

    --font-heading: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --radius-sm: 4px;
    --radius-md: 8px;
    --max-w: 72rem;
    --max-w-narrow: 46rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #111214;
        --bg-secondary: #16181b;
        --bg-code: #1b1d21;
        --border-subtle: #2a2d32;
        --text-primary: #f2f3f5;
        --text-body: #d4d6da;
        --text-secondary: #9a9fa8;
        --accent: #8ea8ff;
        --cta-bg: #f2f3f5;
        --cta-hover: #d4d6da;
        --cta-text: #111214;
        --danger: #f2b8b5;
        --danger-hover: #f6cfcd;
        --warning-bg: #262115;
        --warning-border: #4a3f22;
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    color: var(--text-body);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

main {
    flex: 1;
    width: 100%;
    padding-top: 3rem;
    padding-bottom: 4rem;
}

[hidden] {
    display: none !important;
}

h1,
h2,
h3 {
    color: var(--text-primary);
    font-family: var(--font-heading);
    line-height: 1.2;
    margin: 0;
    letter-spacing: -0.01em;
}

h1 {
    font-size: clamp(1.75rem, 3.6vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

p {
    margin: 0;
}

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

a:hover {
    text-decoration: underline;
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
}

.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

.container-narrow {
    max-width: var(--max-w-narrow);
}

.lead {
    font-size: 1.05rem;
    margin-bottom: 2rem;
}

.muted {
    color: var(--text-secondary);
    font-size: 0.925rem;
}

.note {
    margin-top: 2.5rem;
    font-size: 0.925rem;
    color: var(--text-secondary);
}

/* Header */

.site-header {
    border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 4rem;
}

.wordmark {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
}

.wordmark:hover {
    text-decoration: none;
}

.wordmark-mark {
    color: var(--accent);
    font-family: var(--font-heading);
    margin-right: 0.3rem;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.925rem;
}

.site-nav a {
    color: var(--text-secondary);
}

.site-nav a:hover {
    color: var(--text-primary);
    text-decoration: none;
}

/* On small phones the header drops Priser; the plan section links to
   the same prices. */
@media (max-width: 480px) {
    .site-nav {
        gap: 1rem;
    }

    .nav-wide {
        display: none;
    }
}

/* The smallest phones also drop Dokumentation, so the language switch
   and Log ud keep one row when signed in. */
@media (max-width: 400px) {
    .nav-docs {
        display: none;
    }
}

/* Buttons */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--cta-bg);
    background: var(--cta-bg);
    color: var(--cta-text);
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.15s ease;
    white-space: nowrap;
}

.button:hover {
    background: var(--cta-hover);
    border-color: var(--cta-hover);
}

.button:disabled {
    opacity: 0.55;
    cursor: default;
}

.button-secondary {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.button-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--text-secondary);
}

.button-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: var(--bg-primary);
}

.button-danger:hover {
    background: var(--danger-hover);
    border-color: var(--danger-hover);
}

.button-small {
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
}

/* A running call (busy() in the script). */
.button[aria-busy="true"]::before {
    content: '';
    width: 0.9em;
    height: 0.9em;
    margin-right: 0.5em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Loading */

/* Shown only after a moment, so a fast load does not flash it. */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 4rem 0;
    opacity: 0;
    animation: appear 0.2s ease 0.3s forwards;
}

.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@keyframes appear {
    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .spinner,
    .button[aria-busy="true"]::before {
        animation-duration: 2.4s;
    }
}

/* Forms */

.stack {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

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

.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

input {
    flex: 1 1 14rem;
    min-width: 0;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font: inherit;
}

input:focus-visible,
.button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Messages */

.error {
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    color: var(--danger);
}

.warning {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--warning-border);
    border-radius: var(--radius-sm);
    background: var(--warning-bg);
}

.notice {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

/* Account */

.block {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-subtle);
}

.block h2 {
    margin-bottom: 0.75rem;
}

.block-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.plan-line {
    margin-bottom: 0.4rem;
}

.plan-line strong {
    color: var(--text-primary);
    margin-right: 0.4rem;
}

.keys,
.plans {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}

.plans {
    margin: 1.5rem 0 0.75rem;
}

.keys li,
.plans li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.keys li:has([aria-busy="true"]) {
    opacity: 0.6;
}

.keys li:first-child,
.plans li:first-child {
    border-top: 1px solid var(--border-subtle);
}

.keys li > div,
.plans li > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.plans .price {
    white-space: nowrap;
}

.plans li > span {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.billing {
    margin-top: 1.5rem;
}

.billing .muted {
    margin-top: 0.5rem;
}

.keys strong,
.plans strong {
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

#keys-empty {
    margin-bottom: 1.5rem;
}

/* The one-time key */

.new-key {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border: 1px solid var(--text-secondary);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.new-key h3 {
    overflow-wrap: anywhere;
}

.copy-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
}

.copy-row code {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-code);
    color: var(--text-primary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Revoke dialog */

dialog {
    width: min(28rem, calc(100vw - 2rem));
    padding: 1.5rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-body);
}

dialog::backdrop {
    background: rgb(0 0 0 / 0.4);
}

dialog h2 {
    margin-bottom: 0.75rem;
    overflow-wrap: anywhere;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* Footer */

.site-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 2rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem 2rem;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.site-footer nav a {
    color: var(--text-secondary);
}
