/* ==========================================================================
   agpdev.net: calm ink and paper, Inter for text, JetBrains Mono for the
   developer details, and a warm gold accent shared with groenbaekpedersen.dk.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
    color-scheme: dark;
    --bg: oklch(0.17 0.012 260);
    --bg-2: oklch(0.2 0.014 260);
    --card: oklch(0.22 0.014 260);
    --fg: oklch(0.95 0.008 85);
    --muted: oklch(0.72 0.015 260);
    --line: oklch(0.32 0.015 260);
    --accent: oklch(0.8 0.11 80);
    --accent-fg: oklch(0.2 0.03 80);
    --ok: oklch(0.8 0.14 150);
    --danger: oklch(0.72 0.16 25);
    --shadow: 0 1px 0 oklch(1 0 0 / 0.04) inset, 0 24px 48px -24px oklch(0 0 0 / 0.6);

    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

    --gutter: clamp(1rem, 4vw, 2.5rem);
    --maxw: 70rem;
    --radius: 0.75rem;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
        --bg: oklch(0.975 0.005 85);
        --bg-2: oklch(0.95 0.008 85);
        --card: oklch(1 0 0);
        --fg: oklch(0.2 0.015 260);
        --muted: oklch(0.47 0.015 260);
        --line: oklch(0.88 0.01 85);
        --accent: oklch(0.55 0.11 70);
        --accent-fg: oklch(0.99 0 0);
        --ok: oklch(0.55 0.14 150);
        --danger: oklch(0.55 0.18 25);
        --shadow: 0 24px 40px -28px oklch(0.3 0.03 260 / 0.35);
    }
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: oklch(0.975 0.005 85);
    --bg-2: oklch(0.95 0.008 85);
    --card: oklch(1 0 0);
    --fg: oklch(0.2 0.015 260);
    --muted: oklch(0.47 0.015 260);
    --line: oklch(0.88 0.01 85);
    --accent: oklch(0.55 0.11 70);
    --accent-fg: oklch(0.99 0 0);
    --ok: oklch(0.55 0.14 150);
    --danger: oklch(0.55 0.18 25);
    --shadow: 0 24px 40px -28px oklch(0.3 0.03 260 / 0.35);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.75rem; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; }
p { margin: 0 0 1rem; }

a { color: inherit; }
a:hover { color: var(--accent); }

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

.wrap { width: min(100% - 2 * var(--gutter), var(--maxw)); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.lead { font-size: clamp(1.075rem, 1.6vw, 1.2rem); color: var(--muted); }
.narrow { max-width: 42rem; }

.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }

.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { color: var(--accent-fg); background: color-mix(in oklch, var(--accent) 85%, var(--fg)); }

.btn-ghost { border-color: var(--line); color: var(--fg); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Top bar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in oklch, var(--bg) 85%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    width: min(100% - 2 * var(--gutter), var(--maxw));
    margin-inline: auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 4rem;
}

.brand { text-decoration: none; margin-right: auto; }
.brand:hover { color: inherit; }

.brand-mark {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}
.brand-dev { color: var(--accent); }
.brand-caret {
    display: inline-block;
    width: 0.55em;
    height: 0.15em;
    margin-left: 0.1em;
    background: currentColor;
    vertical-align: baseline;
    animation: blink 1.2s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.topnav { display: flex; align-items: center; gap: 1.5rem; }
.topnav-link { text-decoration: none; font-size: 0.95rem; color: var(--muted); }
.topnav-link:hover { color: var(--fg); }
.topnav-link.cta {
    color: var(--fg);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
}
.topnav-link.cta:hover { border-color: var(--accent); color: var(--accent); }

.topbar-tools { display: flex; align-items: center; gap: 0.5rem; }

.lang-switch { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.lang-switch button {
    font: inherit;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

.icon-btn {
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--fg);
    cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 720px) {
    .topnav-link:not(.cta) { display: none; }
    .topbar-inner { gap: 0.75rem; }
}

/* ---------- Hero ---------- */
.hero {
    padding-block: clamp(3.5rem, 10vw, 7rem) clamp(3rem, 8vw, 6rem);
    background:
        radial-gradient(60rem 30rem at 85% -10%, color-mix(in oklch, var(--accent) 14%, transparent), transparent 70%),
        var(--bg);
    border-bottom: 1px solid var(--line);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}

.hero-title { font-size: clamp(2.3rem, 5.5vw, 3.75rem); letter-spacing: -0.035em; margin-bottom: 1.25rem; }
.hero-copy .lead { max-width: 36rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }

.terminal {
    background: oklch(0.15 0.012 260);
    color: oklch(0.92 0.01 85);
    border: 1px solid oklch(0.3 0.015 260);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.terminal-bar { display: flex; gap: 0.4rem; padding: 0.75rem 0.9rem; border-bottom: 1px solid oklch(0.26 0.015 260); }
.terminal-bar span { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: oklch(0.35 0.015 260); }
.terminal pre {
    margin: 0;
    padding: 1.1rem 1.25rem 1.3rem;
    font-family: var(--font-mono);
    font-size: clamp(0.78rem, 1.3vw, 0.9rem);
    line-height: 1.8;
    overflow-x: auto;
}
.t-prompt { color: oklch(0.8 0.11 80); }
.t-key { color: oklch(0.68 0.02 260); }
.t-ok { color: oklch(0.8 0.14 150); }

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

/* ---------- Sections ---------- */
.section { padding-block: clamp(4rem, 9vw, 6.5rem); }
.section.alt { background: var(--bg-2); border-block: 1px solid var(--line); }

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1.25rem;
    margin-top: 2.5rem;
}
.service {
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
}
.service h3::before {
    content: "›";
    font-family: var(--font-mono);
    color: var(--accent);
    margin-right: 0.5rem;
}
.service p { color: var(--muted); margin: 0; }

.stack-label { margin: 2.5rem 0 0.75rem; font-size: 0.9rem; color: var(--muted); }
.stack { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.stack li {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
}

/* ---------- Products ---------- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.product-card {
    display: flex;
    flex-direction: column;
    padding: clamp(1.5rem, 3vw, 2rem);
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) * 1.4);
    background: var(--card);
    box-shadow: var(--shadow);
}

.product-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.product-logo {
    width: 4rem;
    height: 4rem;
    flex: none;
    border-radius: 1rem;
    background: #fff;
    padding: 0.4rem;
    border: 1px solid var(--line);
}
.product-name { font-size: 1.5rem; margin: 0; }
.product-tagline { margin: 0.15rem 0 0; font-size: 0.9rem; color: var(--accent); font-weight: 500; }
.product-text { color: var(--muted); }

.product-features { list-style: none; padding: 0; margin: 0.25rem 0 1.75rem; display: grid; gap: 0.5rem; }
.product-features li { position: relative; padding-left: 1.5rem; font-size: 0.97rem; }
.product-features li::before {
    content: "";
    position: absolute;
    left: 0.15rem;
    top: 0.55em;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 2px;
    background: var(--accent);
}

.product-link { margin-top: auto; align-self: flex-start; }

/* ---------- Contact ---------- */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: clamp(2rem, 6vw, 5rem);
    align-items: start;
}
@media (max-width: 860px) {
    .contact-grid { grid-template-columns: 1fr; }
}

.contact-form, .form-done {
    padding: clamp(1.25rem, 3vw, 2rem);
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) * 1.4);
    background: var(--card);
    box-shadow: var(--shadow);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) {
    .field-row { grid-template-columns: 1fr; }
}

.field { display: grid; gap: 0.35rem; margin-bottom: 1rem; }
.field label { font-size: 0.9rem; font-weight: 500; }
.field input, .field textarea {
    width: 100%;
    font: inherit;
    font-size: 1rem;
    color: var(--fg);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    padding: 0.65rem 0.8rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { resize: vertical; min-height: 9rem; }
.field input:focus, .field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 25%, transparent);
}
.field.invalid input, .field.invalid textarea { border-color: var(--danger); }
.field-error { margin: 0; font-size: 0.85rem; color: var(--danger); }

.form-error {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background: color-mix(in oklch, var(--danger) 12%, transparent);
    color: var(--danger);
    font-size: 0.95rem;
}

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 0.5rem; }
.form-actions p { margin: 0; }

/* Honeypot: off-screen rather than display:none, which some bots skip. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-done { display: grid; justify-items: start; gap: 0.5rem; }
.form-done svg { color: var(--ok); }
.form-done p { font-size: 1.1rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 2.5rem 2rem; background: var(--bg-2); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; }
.footer-inner .muted { margin: 0.35rem 0 0; font-size: 0.95rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; align-items: center; font-size: 0.95rem; }
.footer-links a, .footer-fine a { text-decoration: none; }
.footer-fine { margin-top: 2rem; font-size: 0.85rem; }

/* ---------- 404 ---------- */
.not-found { padding-block: clamp(4rem, 12vw, 8rem); min-height: 60vh; }
.nf-code { font-family: var(--font-mono); font-size: clamp(3rem, 10vw, 6rem); color: var(--accent); margin: 0; line-height: 1; }

/* ---------- Blazor error UI ---------- */
#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1000;
    padding: 0.75rem 1.25rem;
    background: var(--danger);
    color: white;
}
#blazor-error-ui .reload { color: white; margin-left: 0.5rem; }
#blazor-error-ui .dismiss { float: right; background: none; border: 0; color: white; font-size: 1.25rem; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .brand-caret { animation: none; }
    * { transition: none !important; }
}
