/* kareld.be design system. Source of truth: docs/styleguide/index.html (approved draft 1). */

:root {
    --ink: #0F1729; --paper: #F5F6F9; --card: #FFFFFF;
    --text: #0F1729; --muted: #5A6580; --line: rgba(15, 23, 41, .10);
    --signal: #3355FF; --signal-ink: #FFFFFF; --signal-soft: rgba(51, 85, 255, .10);
    --data: #12B5A6; --data-soft: rgba(18, 181, 166, .12);
    --key: #F2A81D; --key-soft: rgba(242, 168, 29, .16);
    --ok: #14915B; --err: #D13B3B;
    --glass: rgba(255, 255, 255, .62);
    --shadow: 0 1px 2px rgba(15, 23, 41, .06), 0 12px 32px -12px rgba(15, 23, 41, .18);
    --r-s: 10px; --r-m: 18px; --r-l: 28px; --r-pill: 999px;
    --font: 'Inter Variable', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
    --ease: cubic-bezier(.22, 1, .36, 1);
}

:root[data-theme="dark"] {
    --paper: #0A0F1D; --card: #121A2E; --text: #EEF1F8; --muted: #9AA6C2; --line: rgba(238, 241, 248, .10);
    --signal: #6C86FF; --signal-ink: #08102B; --signal-soft: rgba(108, 134, 255, .16);
    --data: #35D6C6; --data-soft: rgba(53, 214, 198, .14);
    --key: #FFC24A; --key-soft: rgba(255, 194, 74, .14);
    --glass: rgba(18, 26, 46, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -14px rgba(0, 0, 0, .6);
}

@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] {
        --paper: #0A0F1D; --card: #121A2E; --text: #EEF1F8; --muted: #9AA6C2; --line: rgba(238, 241, 248, .10);
        --signal: #6C86FF; --signal-ink: #08102B; --signal-soft: rgba(108, 134, 255, .16);
        --data: #35D6C6; --data-soft: rgba(53, 214, 198, .14);
        --key: #FFC24A; --key-soft: rgba(255, 194, 74, .14);
        --glass: rgba(18, 26, 46, .6);
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -14px rgba(0, 0, 0, .6);
    }
}

@layer base {
    html { scroll-behavior: smooth; }
    body {
        margin: 0; background: var(--paper); color: var(--text);
        font: 400 17px/1.6 var(--font); -webkit-font-smoothing: antialiased;
    }
    h1, h2, h3 { line-height: 1.08; letter-spacing: -.03em; margin: 0; }
    h1 { font-size: clamp(2.6rem, 7vw, 5.2rem); font-weight: 700; }
    h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 650; }
    h3 { font-size: 1.2rem; font-weight: 600; letter-spacing: -.015em; }
    p { margin: 0; max-width: 62ch; }
    a { color: var(--signal); }
    :focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; border-radius: 6px; }
}

@layer components {
    .wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
    .muted { color: var(--muted); }
    .skip {
        position: absolute; left: 16px; top: -60px; z-index: 50; background: var(--card); color: var(--text);
        padding: 10px 16px; border-radius: var(--r-s); transition: top .2s;
    }
    .skip:focus { top: 12px; }

    /* Navigation */
    .nav {
        position: sticky; top: 0; z-index: 20; background: var(--glass);
        backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
        border-bottom: 1px solid var(--line);
    }
    .nav .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
    .brand { font-weight: 700; letter-spacing: -.03em; text-decoration: none; color: var(--text); margin-right: auto; }

    /* Buttons */
    .btn {
        display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
        font: 600 .95rem var(--font); padding: 12px 22px; border-radius: var(--r-pill); text-decoration: none;
        transition: transform .25s var(--ease), box-shadow .25s, background .2s;
    }
    .btn:active { transform: scale(.97); }
    .btn-primary { background: var(--signal); color: var(--signal-ink); box-shadow: 0 8px 22px -8px var(--signal); }
    .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -10px var(--signal); }
    .btn-secondary { background: var(--signal-soft); color: var(--signal); }
    .btn-text { background: none; color: var(--signal); padding-inline: 6px; }
    .btn-text:hover { text-decoration: underline; }
    .btn-key { background: var(--key-soft); color: var(--text); }
    .btn[disabled] { opacity: .45; cursor: not-allowed; }

    /* Cards and tags */
    .card {
        background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m);
        padding: 26px; box-shadow: var(--shadow); transition: transform .35s var(--ease), box-shadow .35s;
    }
    a.card, .card.lift { display: block; color: inherit; text-decoration: none; }
    .card.lift:hover { transform: translateY(-4px); }
    .tag { display: inline-block; padding: 3px 11px; border-radius: var(--r-pill); background: var(--signal-soft); color: var(--signal); font-size: .8rem; font-weight: 550; }
    .tag.data { background: var(--data-soft); color: var(--data); }
    .tag.key { background: var(--key-soft); color: var(--text); }

    /* Metric card */
    .metric { padding: 26px; border-radius: var(--r-m); background: var(--card); border: 1px solid var(--line); }
    .metric .num { font-size: 3.2rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
    .metric .label { margin-top: 8px; font-weight: 600; }
    .metric .ctx { color: var(--muted); font-size: .9rem; }
    .metric.up .num { color: var(--data); }

    /* Hero */
    .hero { position: relative; overflow: hidden; padding: 112px 0 96px; }
    .aurora {
        position: absolute; inset: -20% -10% auto -10%; height: 560px; z-index: -1; filter: blur(70px); opacity: .55;
        background: radial-gradient(40% 50% at 25% 40%, var(--signal), transparent 70%), radial-gradient(35% 45% at 70% 30%, var(--data), transparent 70%);
        animation: drift 18s ease-in-out infinite alternate;
    }
    .hero h1 span { display: block; opacity: 0; transform: translateY(24px); animation: rise .9s var(--ease) forwards; }
    .hero h1 span:nth-child(2) { animation-delay: .12s; }
    .hero .lead { font-size: 1.2rem; color: var(--muted); margin-top: 22px; opacity: 0; animation: rise .9s .3s var(--ease) forwards; }
    .hero .cta { margin-top: 30px; display: flex; gap: 12px; flex-wrap: wrap; opacity: 0; animation: rise .9s .45s var(--ease) forwards; }

    .section { padding: 88px 0; border-top: 1px solid var(--line); }
    .grid-auto { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

    .footer { padding: 40px 0; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); }
}

@layer components {
    .links { display: flex; gap: 4px; align-items: center; }
    .links a { color: var(--text); text-decoration: none; padding: 8px 12px; border-radius: var(--r-pill); font-size: .95rem; font-weight: 500; transition: background .2s; }
    .links a:hover, .links a.active { background: var(--signal-soft); color: var(--signal); }
    .lock { display: inline-flex; vertical-align: middle; margin-left: 4px; color: var(--key); }
    .icon { display: inline-block; vertical-align: -3px; }
    kbd { font: 500 .72rem var(--font); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin-left: 6px; color: var(--muted); }
    @media (max-width: 760px) { .links { display: none; } kbd { display: none; } }

    .viewbar { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; background: var(--key-soft); color: var(--text); padding: 8px 16px; font-size: .9rem; }
    .viewbar form { margin: 0; }
    .flash { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--r-s); background: var(--signal-soft); }
    .flash.ok { background: var(--data-soft); }

    .hero.small { padding: 72px 0 48px; }
    .h-page { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 700; }
    .h-sub { font-size: 1.5rem; margin: 40px 0 16px; }
    .lead { font-size: 1.2rem; margin-top: 16px; }
    .narrow .wrap { width: min(760px, 100% - 40px); }
    .eyebrow { color: var(--key); font-weight: 600; margin-bottom: 8px; }
    .small { font-size: .88rem; }
    .row-between { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; flex-wrap: wrap; }
    .stack { display: grid; gap: 20px; }
    .tags { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
    .chips { display: flex; gap: 8px; flex-wrap: wrap; }
    .chip { display: inline-flex; gap: 6px; align-items: center; padding: 6px 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--card); color: var(--text); text-decoration: none; font-size: .92rem; cursor: pointer; }
    .chip.on { background: var(--signal); color: var(--signal-ink); border-color: transparent; }
    .cover { width: 100%; height: auto; border-radius: var(--r-s); margin-bottom: 14px; aspect-ratio: 16/9; object-fit: cover; }
    .cover.big { border-radius: var(--r-m); margin: 24px 0; }

    .prose { font-size: 1.08rem; margin-top: 28px; }
    .prose > * + * { margin-top: 1.1em; }
    .prose h2 { margin-top: 1.8em; } .prose h3 { margin-top: 1.5em; }
    .prose p, .prose li { max-width: 68ch; }
    .prose img { max-width: 100%; height: auto; border-radius: var(--r-s); }
    .prose pre { background: var(--card); border: 1px solid var(--line); padding: 14px; border-radius: var(--r-s); overflow-x: auto; }
    .prose blockquote { border-left: 3px solid var(--signal); margin-left: 0; padding-left: 16px; color: var(--muted); }

    .form { display: grid; gap: 10px; }
    .form label { font-weight: 600; font-size: .92rem; }
    .form input[type=text], .form input[type=email], .form input[type=search], .form textarea, .form input:not([type]) {
        width: 100%; box-sizing: border-box; font: inherit; color: var(--text); background: var(--paper);
        border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px 14px;
    }
    .form input:focus, .form textarea:focus { outline: 3px solid var(--signal-soft); border-color: var(--signal); }
    .form fieldset { border: 1px solid var(--line); border-radius: var(--r-s); padding: 12px 16px; margin: 0; }
    .form legend { font-weight: 600; padding: 0 6px; }
    .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400 !important; padding: 6px 0; }
    .check input { margin-top: 5px; }
    .error { color: var(--err); font-size: .9rem; margin: 0; }
    .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
    .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .rating { display: flex; gap: 8px; }
    .inline-form { margin-top: 8px; }

    .linklike { background: none; border: 0; color: var(--signal); cursor: pointer; font: inherit; padding: 0; }
    .linklike:hover { text-decoration: underline; }
    form.inline { display: inline; }
    .foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
    .foot-links { display: flex; gap: 16px; flex-wrap: wrap; }
    .foot-links a { color: var(--muted); }

    .timeline { list-style: none; margin: 28px 0 0; padding: 0 0 0 22px; border-left: 2px solid var(--line); display: grid; gap: 28px; }
    .timeline > li { position: relative; }
    .timeline > li::before { content: ''; position: absolute; left: -29px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 4px var(--signal-soft); }
    .timeline ul { margin: 8px 0 0; padding-left: 18px; }
    .locked { border-style: dashed; border-color: var(--key); background: var(--key-soft); }
    .timeline > li.locked::before { background: var(--key); }
    .star { margin-top: 16px; } .star summary { cursor: pointer; font-weight: 600; color: var(--signal); }
    .star dt { font-weight: 650; margin-top: 10px; } .star dd { margin: 2px 0 0; }
    .skills, .plain { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
    .skills li { display: flex; justify-content: space-between; gap: 12px; }
    .dots { display: inline-flex; gap: 4px; align-items: center; } .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); } .dots i.on { background: var(--data); }

    .palette { border: 1px solid var(--line); border-radius: var(--r-m); padding: 0; width: min(560px, 92vw); background: var(--card); color: var(--text); box-shadow: var(--shadow); margin-top: 12vh; }
    .palette::backdrop { background: rgba(10, 15, 29, .45); backdrop-filter: blur(4px); }
    .palette-box { padding: 14px; display: grid; gap: 10px; margin: 0; }
    .palette input { width: 100%; box-sizing: border-box; font: inherit; padding: 12px 14px; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--paper); color: var(--text); }
    .palette ul { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
    .palette li a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--r-s); color: var(--text); text-decoration: none; }
    .palette li a:hover, .palette li a.sel { background: var(--signal-soft); }
    .palette li .type { color: var(--muted); font-size: .8rem; }

    .retro-cols { display: grid; gap: 18px; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); margin-top: 24px; align-items: start; }
    @media (max-width: 900px) { .retro-cols { grid-template-columns: 1fr; } }
    .retro-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-m); padding: 16px; display: grid; gap: 10px; }
    .retro-col h2 { font-size: 1.1rem; }
    .rcard { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 12px; }
    .rcard.voted { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
    .rcard p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
    .rcard-body { all: unset; cursor: pointer; display: block; width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
    .rcard-foot { display: flex; justify-content: space-between; margin-top: 6px; font-size: .85rem; color: var(--muted); }
    .votes { color: var(--data); font-weight: 600; }
}

@keyframes drift { to { transform: translate3d(4%, 6%, 0) scale(1.08); } }
@keyframes rise { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: no-preference) {
    .rv { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
    .rv.in { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .hero h1 span, .hero .lead, .hero .cta { opacity: 1; transform: none; }
}

@layer components {
    .hero-grid { display: grid; gap: 40px; align-items: center; }
    @media (min-width: 860px) { .hero-grid { grid-template-columns: 1fr 360px; } .hero-grid:has(.portrait.sm) { grid-template-columns: 1fr 180px; gap: 32px; } }
    .portrait { width: 100%; max-width: 360px; aspect-ratio: 1; object-fit: cover; object-position: center 20%; border-radius: 32px; box-shadow: 0 24px 60px -24px rgb(0 0 0 / .35); animation: rise .9s .2s var(--ease) both; }
    .portrait.sm { max-width: 180px; border-radius: 28px; order: 2; justify-self: end; }
    .portrait { justify-self: end; }
    @media (max-width: 859px) { .portrait { justify-self: start; order: 2; } .portrait.sm { max-width: 140px; } }
}

@layer components {
    .project-context { margin: 4px 0 2px; font-weight: 600; color: var(--data); }
    .project-context .muted { font-weight: 400; margin-right: 4px; }
}

/* additions for the PHP version */
.nav .links a .lock svg { vertical-align: -2px; }
.tag.key svg { vertical-align: -2px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.metric .num:empty { display: none; }
@media (max-width: 760px) {
    .links { display: flex; overflow-x: auto; gap: 0; }
    .nav .wrap { gap: 10px; }
    .brand { white-space: nowrap; }
}
@media print {
    .nav, .footer, .viewbar, .cta, .skip, .aurora { display: none !important; }
    body { background: #fff; color: #000; font-size: 11pt; }
    .section { padding: 18px 0; } .hero.small { padding: 0 0 12px; }
    .card, .metric { box-shadow: none; break-inside: avoid; }
    .rv { opacity: 1 !important; transform: none !important; }
    a { color: inherit; text-decoration: none; }
}
