/* controntech.uk: clean bevelled glass. No external fonts, no inline styles (strict CSP). */
:root {
    --bg-1: #050405;
    --bg-2: #110a0e;
    --text: #f4eef1;
    --muted: #b8a9b1;
    --accent: #ff4f9a;
    --accent-2: #ff3b4f;
    --glass: rgba(255, 255, 255, 0.06);
    --glass-strong: rgba(255, 255, 255, 0.09);
    --rim: rgba(255, 255, 255, 0.14);
    --hi: rgba(255, 255, 255, 0.22);      /* bevel highlight (top-left) */
    --lo: rgba(0, 0, 0, 0.35);            /* bevel shade (bottom-right) */
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

    /* Fluid sizing: everything scales with the viewport between sensible min/max values */
    --page: min(96vw, 2400px);                    /* content fills the screen (96%), capped only on huge displays */
    --gap: clamp(12px, 1.4vw, 24px);              /* grid gaps */
    --pad: clamp(18px, 2.4vw, 40px);              /* panel padding */
    --section: clamp(20px, 3vw, 44px);            /* space between sections */
    --fs-body: clamp(0.95rem, 0.88rem + 0.25vw, 1.1rem);
    --fs-h1: clamp(1.75rem, 1.1rem + 2.6vw, 3.4rem);
    --fs-h2: clamp(1.2rem, 1rem + 0.8vw, 1.7rem);
    --fs-h3: clamp(1rem, 0.95rem + 0.3vw, 1.2rem);
    --card-min: clamp(260px, 21vw, 520px);        /* min card width -> column count adapts */
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    line-height: 1.6;
    font-size: var(--fs-body);
    overflow-x: hidden;
    background: linear-gradient(160deg, var(--bg-1), var(--bg-2) 60%, #080507);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ---------- soft colour blobs behind the glass ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.blob {
    position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.35;
    animation: drift 28s ease-in-out infinite alternate;
}
.blob-a { width: 520px; height: 520px; background: #ff2d87; top: -120px; left: -80px; }
.blob-b { width: 460px; height: 460px; background: #e11d48; bottom: -140px; right: -60px; animation-delay: -9s; }
.blob-c { width: 380px; height: 380px; background: #9d174d; top: 40%; left: 55%; opacity: 0.22; animation-delay: -17s; }
@keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(60px, 40px) scale(1.08); }
}

/* ---------- glass + bevel ---------- */
.glass {
    background: var(--glass);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid var(--rim);
    border-radius: var(--radius);
    box-shadow:
        inset 1px 1px 0 var(--hi),          /* top-left bevel */
        inset -1px -1px 0 var(--lo),        /* bottom-right bevel */
        var(--shadow);
}
.bevel {
    background: linear-gradient(145deg, var(--glass-strong), var(--glass));
    box-shadow:
        inset 2px 2px 0 var(--hi),
        inset -2px -2px 0 var(--lo),
        inset 0 0 0 1px rgba(255, 255, 255, 0.04),
        var(--shadow);
}

/* ---------- layout ---------- */
main { width: var(--page); margin: 0 auto; padding: 0 0 var(--section); }
section { margin: var(--section) 0; }
section.glass { padding: var(--pad); }
.section-title { font-size: var(--fs-h2); font-weight: 600; letter-spacing: 0.01em; margin: 0 0 calc(var(--gap) * 0.9); }
.section-title.inline { margin-top: 0; }
/* Column count follows the screen: 1 on phones, 2 on tablets, 3 on laptops, 4 on wide monitors.
   min(100%, …) means a card can never be wider than the screen (no horizontal overflow). */
.grid { display: grid; gap: var(--gap); }
.grid-2, .grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--card-min)), 1fr)); }
.muted { color: var(--muted); }

/* ---------- nav ---------- */
.nav {
    position: sticky; top: 12px; z-index: 10;
    width: var(--page); margin: 12px auto 0; padding: 12px clamp(14px, 2vw, 26px);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: 0.02em; }
.nav nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav nav a {
    color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}
.nav nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

/* ---------- hero ---------- */
.hero { padding: clamp(28px, 5vw, 72px) clamp(22px, 5vw, 72px); margin-top: var(--section); }
.hero h1 { font-size: var(--fs-h1); line-height: 1.12; margin: 0 0 0.5em; font-weight: 700; max-width: 30ch; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: clamp(20px, 4vw, 64px); }
.greeting { margin: 0 0 6px; color: var(--accent-2); font-weight: 600; letter-spacing: 0.04em; font-size: calc(var(--fs-body) * 0.95); }
.hero-media:empty { display: none; }
.hero-img {
    display: block; width: clamp(150px, 17vw, 340px); height: auto; aspect-ratio: 193 / 218; object-fit: cover; border-radius: 22px;
    border: 1px solid var(--rim);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05), 6px 6px 0 rgba(0,0,0,0.25), 0 18px 40px rgba(0,0,0,0.45);
    outline: 6px solid rgba(255,255,255,0.05); outline-offset: 0;
}
.lead { font-size: calc(var(--fs-body) * 1.1); color: #eadde3; max-width: 95ch; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* ---------- cards ---------- */
.card { padding: clamp(18px, 1.8vw, 28px); transition: transform 0.25s ease, box-shadow 0.25s ease; }
.card:hover { transform: translateY(-3px); box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 var(--lo), 0 16px 40px rgba(0, 0, 0, 0.45); }
.card h3 { margin: 0 0 8px; font-size: var(--fs-h3); }
.skill-icon {
    width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 14px;
    color: var(--accent); border-radius: 12px;
    background: linear-gradient(145deg, rgba(255, 79, 154, 0.16), rgba(255, 59, 79, 0.06));
    border: 1px solid rgba(255, 79, 154, 0.25);
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.18), inset -1px -1px 0 rgba(0, 0, 0, 0.3);
}
.project header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.project .year { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.project .summary { color: #eadde3; margin: 0 0 6px; }
.project footer { margin-top: 14px; }

/* ---------- spotlight ("Elsewhere") ----------
   top row: image | title + tag      below: full-width summary, text, buttons */
.spotlight { display: flex; flex-direction: column; gap: clamp(14px, 1.6vw, 22px); }
.spot-head { display: flex; align-items: center; gap: clamp(14px, 1.8vw, 24px); }
.spot-img {
    display: block; width: clamp(84px, 7vw, 128px); height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 18px;
    border: 1px solid rgba(255, 79, 154, 0.55);
    box-shadow: inset 1px 1px 0 var(--hi), 0 0 0 3px rgba(255, 79, 154, 0.12), 0 10px 26px rgba(0, 0, 0, 0.45);
}
.spot-titles h3 { margin: 0 0 6px; font-size: calc(var(--fs-h3) * 1.25); }
.platform {
    display: inline-block; font-size: 0.8rem; color: #ffd0e2; padding: 3px 10px; border-radius: 999px;
    background: rgba(255, 79, 154, 0.12); border: 1px solid rgba(255, 79, 154, 0.3);
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.1), inset -1px -1px 0 rgba(0, 0, 0, 0.25);
}
.spot-body {
    padding: clamp(14px, 1.4vw, 20px); border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.35), inset -1px -1px 0 rgba(255, 255, 255, 0.05);  /* inset (sunken) panel */
}
.spot-body .summary { margin: 0 0 8px; }
.spot-body footer { margin-top: 14px; }

/* ---------- tags ---------- */
.tags { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    font-size: 0.78rem; padding: 3px 10px; border-radius: 999px; color: #ffe0ec;
    background: rgba(255, 79, 154, 0.10);
    border: 1px solid rgba(255, 79, 154, 0.25);
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.12), inset -1px -1px 0 rgba(0, 0, 0, 0.25);
}

/* ---------- buttons (bevelled, press in) ---------- */
.btn {
    display: inline-block; text-decoration: none; color: var(--text);
    padding: 10px 18px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.95rem;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
    border: 1px solid var(--rim);
    box-shadow: inset 1px 1px 0 var(--hi), inset -1px -1px 0 var(--lo), 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s;
}
.btn:hover { background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06)); }
.btn:active { transform: translateY(1px); box-shadow: inset -1px -1px 0 var(--hi), inset 1px 1px 0 var(--lo), 0 1px 4px rgba(0, 0, 0, 0.25); }
.btn-primary {
    background: linear-gradient(145deg, rgba(255, 79, 154, 0.35), rgba(255, 59, 79, 0.18));
    border-color: rgba(255, 79, 154, 0.45);
}
.btn-small { padding: 7px 14px; font-size: 0.85rem; }
.btn:focus-visible, .nav a:focus-visible, .prose a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- prose (rendered Markdown) ---------- */
.prose p { margin: 0 0 10px; }
.prose p:last-child { margin-bottom: 0; }
.prose a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(255, 79, 154, 0.35); }
.prose a:hover { border-bottom-color: var(--accent); }
.prose ul { padding-left: 20px; margin: 8px 0; }
.prose li { margin: 3px 0; }
.prose code { font-size: 0.9em; background: rgba(255, 255, 255, 0.08); padding: 1px 6px; border-radius: 6px; }
.prose strong { color: #ffffff; }

/* ---------- GitHub repo cards (filled by site.js) ---------- */
.repo { padding: 16px 18px; text-decoration: none; color: var(--text); display: block; }
.repo h3 { margin: 0 0 6px; font-size: 0.98rem; }
.repo p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.repo .lang { margin-top: 10px; font-size: 0.78rem; color: var(--accent-2); }

/* ---------- footer ---------- */
.footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 26px 0 36px; }

/* ---------- small screens / accessibility ---------- */
/* Phones: brand on its own line, links wrap underneath (no squashed bar, no horizontal scroll) */
@media (max-width: 640px) {
    .hero { grid-template-columns: 1fr; }
    .hero-media { order: -1; }
    .nav { flex-direction: column; align-items: flex-start; gap: 6px; top: 6px; }
    .nav nav { gap: 2px; margin-left: -10px; }
    .nav nav a { padding: 6px 10px; }
    .project header { flex-direction: column; gap: 2px; }
    .blob { filter: blur(70px); opacity: 0.28; }
}
/* Very wide screens: let readable text stay readable */
@media (min-width: 2600px) {
    .prose { max-width: 110ch; }
}
@media (prefers-reduced-motion: reduce) {
    .blob { animation: none; }
    .card, .btn { transition: none; }
    html { scroll-behavior: auto; }
}

/* Elsewhere: cards keep a natural width (one card doesn't stretch across the page) */
#elsewhere .grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); }

/* Page-wide sparkles: fixed canvas behind everything (drawn by site.js) */
.backdrop .sparkles { position: absolute; inset: 0; width: 100%; height: 100%; }
/* The moving orbs (site.js) replace the fixed CSS glows. */
.backdrop .blob { display: none; }

/* Glows: visible slow wander + gentle breathing (each blob on its own path/timing) */
.blob-a { animation: wander-a 34s ease-in-out infinite alternate, breathe 9s ease-in-out infinite; }
.blob-b { animation: wander-b 41s ease-in-out infinite alternate, breathe 11s ease-in-out infinite -3s; }
.blob-c { animation: wander-c 29s ease-in-out infinite alternate, breathe 13s ease-in-out infinite -6s; }
@keyframes wander-a { 0% { transform: translate(0, 0) } 50% { transform: translate(28vw, 18vh) } 100% { transform: translate(8vw, 46vh) } }
@keyframes wander-b { 0% { transform: translate(0, 0) } 50% { transform: translate(-30vw, -22vh) } 100% { transform: translate(-12vw, -48vh) } }
@keyframes wander-c { 0% { transform: translate(0, 0) } 50% { transform: translate(-22vw, 20vh) } 100% { transform: translate(14vw, -14vh) } }
@keyframes breathe { 0%, 100% { opacity: 0.22 } 50% { opacity: 0.38 } }

@media (prefers-reduced-motion: reduce) {
    /* sparkles stay (they only twinkle in place, see site.js); the glows hold still */
    .blob-a, .blob-b, .blob-c { animation: none; }
}

/* ---------- speech bubbles on images (text from front matter "bubble:") ---------- */
.bubble-wrap { position: relative; display: inline-block; border-radius: 22px; outline: none; }
.bubble-wrap::after {
    content: attr(data-bubble);
    position: absolute; left: 50%; bottom: calc(100% + 14px); z-index: 20;
    width: max-content; max-width: min(260px, 70vw); text-align: center;
    padding: 8px 14px; border-radius: 14px;
    background: linear-gradient(145deg, #ffffff, #ffe6f0); color: #2a0d1a;
    font-weight: 600; font-size: 0.9rem; line-height: 1.35;
    box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 rgba(0,0,0,0.08), 0 10px 26px rgba(0,0,0,0.45);
    opacity: 0; transform: translate(-50%, 8px) scale(0.94); transform-origin: 50% 100%;
    transition: opacity 0.18s ease, transform 0.22s cubic-bezier(.2,.9,.3,1.3);
    pointer-events: none;
}
.bubble-wrap::before {          /* the bubble's tail */
    content: ""; position: absolute; left: 50%; bottom: calc(100% + 4px); z-index: 21;
    border: 8px solid transparent; border-top-color: #ffe6f0; border-bottom: 0;
    transform: translate(-50%, 8px); opacity: 0;
    transition: opacity 0.18s ease, transform 0.22s ease; pointer-events: none;
}
.bubble-wrap:hover::after, .bubble-wrap:focus-visible::after { opacity: 1; transform: translate(-50%, 0) scale(1); }
.bubble-wrap:hover::before, .bubble-wrap:focus-visible::before { opacity: 1; transform: translate(-50%, 0); }
.bubble-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) { .bubble-wrap::after, .bubble-wrap::before { transition: opacity 0.15s; } }

/* ---------- sound toggle ---------- */
.sound-toggle {
    display: inline-grid; place-items: center; width: 34px; height: 34px; margin-left: 4px;
    color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 8px; cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.sound-toggle:hover { color: var(--text); background: rgba(255,255,255,0.06); border-color: var(--rim); }
.sound-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sound-toggle .ico-off { display: none; }
.sound-toggle[aria-pressed="false"] .ico-on { display: none; }
.sound-toggle[aria-pressed="false"] .ico-off { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* footer credit line */
.footer-note { margin-top: 6px; font-size: 0.78rem; opacity: 0.8; max-width: 90ch; margin-left: auto; margin-right: auto; padding: 0 16px; }
.footer-note p { margin: 0; }
.footer-note a { color: var(--accent); text-decoration: none; }

/* Elsewhere images sit near the card's left edge: anchor their bubbles left so they never leave the screen */
.spot-media .bubble-wrap::after { left: 0; max-width: min(380px, 80vw); transform: translate(0, 8px) scale(0.94); transform-origin: 20px 100%; }
.spot-media .bubble-wrap::before { left: 26px; transform: translate(0, 8px); }
.spot-media .bubble-wrap:hover::after, .spot-media .bubble-wrap:focus-visible::after { transform: translate(0, 0) scale(1); }
.spot-media .bubble-wrap:hover::before, .spot-media .bubble-wrap:focus-visible::before { transform: translate(0, 0); }

/* Hover combo mini-game pill (built by site.js) */
.hover-meter {
    position: fixed; right: clamp(10px, 1.5vw, 24px); bottom: clamp(10px, 1.5vw, 24px); z-index: 50;
    display: flex; gap: 14px; padding: 8px 14px; border-radius: 999px;
    font-size: 0.82rem; color: var(--muted); pointer-events: none; user-select: none;
    opacity: 0.35; transform: translateY(0); transition: opacity .4s ease, box-shadow .3s ease;
}
.hover-meter.on { opacity: 1; }
.hover-meter b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.hover-meter.hot b { color: var(--accent); }
.hover-meter.hot { box-shadow: 0 0 0 1px rgba(255,79,154,.45), 0 0 24px rgba(255,79,154,.25); }
.hover-meter.pop { animation: hm-pop .35s ease; }
@keyframes hm-pop { 50% { transform: scale(1.12); } }
@media (hover: none) { .hover-meter { display: none; } }
@media (prefers-reduced-motion: reduce) { .hover-meter.pop { animation: none; } }

/* Source visibility pill on project cards: green = public source, red = private */
.tag.vis { font-weight: 600; letter-spacing: .02em; }
.tag.vis-public  { color: #7ee2a8; background: rgba(46,160,90,.16);  border-color: rgba(76,200,120,.45); }
.tag.vis-private { color: #ff8a8a; background: rgba(220,50,60,.16);  border-color: rgba(255,90,100,.45); }
