/* ==========================================================================
   Max H / BleakBubbles
   Flat dark theme, no gradients. Depth comes from layered surfaces
   (page → surface → raised) and borders. The flying 3D shapes (shapes.js)
   pass behind the solid cards, and the nearer half fly in front of them.
   Everything that moves in CSS animates transform/opacity on real elements,
   so pixel-freeze can pause it and copy its mid-motion state.
   ========================================================================== */

:root {
  /* Vertical spacing, on an 8px scale. */
  --intro-gap: 96px;     /* header → intro card; the freeze button's top lines up with the card */
  --section-gap: 144px;  /* space between the content of neighbouring sections; halves sit on each side */
  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --page: #0c0c10;
  --surface: #15151b;
  --raised: #1d1d25;
  --line: #262630;
  --line-strong: #363642;
  --ink: #ececf1;
  --muted: #9a9aa8;
  --faint: #5c5c6a;
  --accent: #8fa8ff;
}

* { box-sizing: border-box; }
/* overscroll: no rubber-band bounce past the top/bottom (Firefox/Zen, Safari).
   scrollbar: thin and dim, so it blends into the page until you look for it. */
html { background: var(--page); color-scheme: dark; overscroll-behavior-y: none;
       scrollbar-width: thin; scrollbar-color: #2a2a33 transparent; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 17px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
#app { background: var(--page); position: relative; overflow-x: clip; }  /* clip, not hidden: hidden would make #app its own scroll box */
#shapes, #shapes-front { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
#shapes-front { z-index: 2; }  /* above the content; clicks pass straight through */
#app > :not(canvas) { position: relative; z-index: 1; }

/* Solid cards behind the content (intro, project rows, Contact), so
   the shapes flying behind don't pass under the words. */
.hero-card,
.contact-card,
.project { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px; }
.project { margin-bottom: 16px; }
.project:last-child { margin-bottom: 0; }

h1, h2, h3 { font-family: var(--font-head); line-height: 1.1; margin: 0; }
h1 { font-size: clamp(3rem, 9vw, 6.2rem); letter-spacing: -0.03em; font-weight: 700; }
h2 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.02em; margin-bottom: 32px; }
h3 { font-size: 1.9rem; margin-bottom: 12px; }
p { margin: 0 0 14px; }
a { color: inherit; }
.mono, code { font-family: var(--font-mono); font-size: .9em; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

/* ---------- nav ---------- */
.nav { background: var(--surface); border-bottom: 1px solid var(--line); }  /* a subtle bar: the same surface colour as the cards */
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font: 600 1.05rem var(--font-body); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand img { border-radius: 50%; border: 1px solid var(--line-strong); }
.nav ul { list-style: none; display: flex; gap: 24px; margin: 0; padding: 0; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 500; font-size: .95rem; }
.nav a:hover { color: var(--ink); }
.nav .brand { color: var(--ink); }

/* ---------- hero ---------- */
.hero { padding: var(--intro-gap) 0 calc(var(--section-gap) / 2); }  /* header → intro: a bit tighter than between sections */
/* Avatar left, intro right. The name's cap tops and the sentence's last baseline line up with
   the avatar's edges; the "aka" line sits above, outside that alignment. */
/* Avatar size tracks the heading + subtitle (both sized in vw), so the space
   above the sentence stays about the same at every width: 240px at ~1024px wide. */
.hero-grid { --avatar: clamp(180px, calc(14.2vw + 94px), 240px);
             display: grid; grid-template-columns: auto 1fr; grid-template-areas: ". kicker" "avatar text"; gap: 10px 48px; }
.hero-grid .kicker { grid-area: kicker; margin: 0; }
.hero-grid .avatar { grid-area: avatar; align-self: stretch; width: var(--avatar); height: auto; min-height: var(--avatar); object-fit: cover; } /* grows with the text if it ever gets taller, cropping slightly instead of misaligning */
.hero-text { grid-area: text; min-width: 0; min-height: var(--avatar); display: flex; flex-direction: column; }
.hero-text h1 { margin-top: -0.18em; } /* pulls the cap tops up to the box edge (Space Grotesk, line-height 1.1) */
.hero-text .rotator { margin: 6px 0 16px; }
.hero-text .lede { margin-top: auto; margin-bottom: -0.39em; } /* name + subtitle at the top; the last line's baseline sits on the avatar's bottom edge */
.avatar { width: 240px; height: 240px; border-radius: 32px; border: 1px solid var(--line-strong); background: var(--surface); display: block; }
.kicker { font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.rotator { font-family: var(--font-head); font-size: clamp(1.5rem, 3.6vw, 2.3rem); font-weight: 500; margin: 18px 0 28px; display: flex; align-items: baseline; gap: .35em; flex-wrap: wrap; }
.words { display: inline-block; height: 1.25em; overflow: hidden; vertical-align: bottom; color: var(--accent); }
.words-track { display: flex; flex-direction: column; animation: words 10s cubic-bezier(.7,0,.2,1) infinite; }
.words-track span { height: 1.25em; line-height: 1.25em; }
@keyframes words {
  0%, 20%   { transform: translateY(0); }
  25%, 45%  { transform: translateY(-1.25em); }
  50%, 70%  { transform: translateY(-2.5em); }
  75%, 95%  { transform: translateY(-3.75em); }
  100%      { transform: translateY(-5em); }
}
.lede { margin: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.5; text-wrap: pretty; }  /* short bio: uses the text column's full width */


/* ---------- projects ---------- */
.projects { padding: calc(var(--section-gap) / 2) 0; }
/* Each project card: logo, name and details on the left, description on the right. */
.project { display: grid; grid-template-columns: 260px 1fr; gap: 48px; }
.p-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.p-head h3 { margin: 0; }
.p-logo { width: 56px; height: 56px; border-radius: 14px; overflow: hidden; flex: none; display: grid; place-items: center; border: 1px solid var(--line-strong); }
.p-logo img { display: block; }
.logo-qwizz { background: #000; }
.logo-protag, .logo-flooper { border-color: var(--line-strong); }
.meta { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 4px; font: 500 .8rem/1.4 var(--font-mono); color: var(--faint); }
.meta li { display: flex; align-items: center; gap: 7px; }
.meta li[hidden] { display: none; }
.meta a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.meta a:hover { color: var(--ink); }
.p-text p { color: var(--muted); max-width: 62ch; }
.p-text > :first-child { margin-top: 0; }
.p-text .why { font-size: .95rem; color: var(--faint); }
/* tech stack: brand-coloured icons, name on hover */
.stack { list-style: none; padding: 0; margin: 20px 0 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.stack li { cursor: default; }
.stack img { display: block; }
.link { font-weight: 600; color: var(--ink); text-decoration: none; margin-right: 18px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link .arr { display: inline-block; transition: transform .15s ease-out; }
.link:hover .arr, .link:focus-visible .arr { transform: translateX(4px); }
.link:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

/* ---------- contact ---------- */
.contact { padding: calc(var(--section-gap) / 2) 0 48px; }
.say { font-size: clamp(3rem, 10vw, 6rem); margin-bottom: 32px; }
.cursor { color: var(--ink); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 14px; }
.links a { display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--raised); text-decoration: none; font-weight: 600; }  /* one shade up from the card */
.links a:hover { background: var(--line-strong); }
.links img { display: block; flex: none; }
.fine { font-size: .85rem; color: var(--faint); margin: 24px 0 0; }

/* ---------- intro cover ----------
   Covers the page until the intro has taken its pixelated snapshot, so the
   unpixelated page never flashes first. main.js removes it; if the script
   never runs, it fades out by itself after 3s so the page can't stay hidden. */
#intro-cover { position: fixed; inset: 0; z-index: 2147483200; background: var(--page);
               animation: intro-failsafe .3s ease-out 3s forwards; }
@keyframes intro-failsafe { to { opacity: 0; visibility: hidden; } }

/* ---------- freeze button ----------
   A black squircle with a 3x3 "pixel" icon (drawn by freeze-icon.js).
   The border is a spinning pastel rainbow, roughened by an SVG filter so it
   looks hand-drawn and "boils" like an animated avatar frame.
   The button sits outside #app, so html2canvas never has to draw any of this. */
@property --fz-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
#freeze {
  --fz-size: 56px; --fz-radius: 16px; --fz-ring: 3px;
  /* The page margin: from the cards' right edge to the screen edge. The content
     column is 1040px max with a 24px gutter (16px on phones). The % is used
     inside `right`, where it means the page width without the scrollbar. */
  --gutter: 24px;
  --margin: max(var(--gutter), (100% - 1040px) / 2 + var(--gutter));
  /* Narrow screens have no room in the margin: line the button's right edge
     up with the cards' right edge instead (see the wide-screen rule below). */
  position: fixed; right: var(--margin); top: calc(65px + var(--intro-gap)); z-index: 2147483001;  /* top lines up with the intro card's top (header is 64px + 1px border) */
  width: var(--fz-size); height: var(--fz-size); padding: 0; border: 0; border-radius: var(--fz-radius);
  background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform .12s cubic-bezier(.3, 1.6, .5, 1);
}
/* Wide screens: the button sits just outside the content column, a gutter's
   width (24px) to the right of the cards. From 1200px wide there's room for
   that with ~20px or more to spare before the screen edge. */
@media (min-width: 1200px) {
  #freeze { right: calc(var(--margin) - var(--gutter) - var(--fz-size)); }
}
/* Big screens: a bigger button (icon, border and effects all scale with it).
   From 1440px wide the margin has plenty of room for it. */
@media (min-width: 1440px) {
  #freeze { --fz-size: 68px; --fz-radius: 19px; }
}
/* Snaps in instantly on press; the release still springs back (the transition above). */
#freeze:not(.busy):active { transform: scale(.94); transition: none; }
/* Mid-ripple (or during the intro) the button ignores clicks; see main.js. */
#freeze.busy { cursor: default; }
#freeze:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }
.fz-ring, .fz-glow {
  position: absolute; inset: calc(var(--fz-ring) * -1); border-radius: calc(var(--fz-radius) + var(--fz-ring));
  background: conic-gradient(from var(--fz-angle), #2ee6ff, #6c8cff, #b388ff, #ff5d8f, #ffa45c, #ffd166, #4dd4ac, #2ee6ff);
  animation: fz-spin 5s linear infinite;
}
.fz-ring { filter: url(#fz-wobble); }
.fz-glow { inset: -2px; filter: blur(10px); opacity: .5; }
.fz-face { position: absolute; inset: 0; border-radius: var(--fz-radius); background: #000; display: grid; place-items: center; }
.fz-grid { display: block; overflow: visible; width: calc(var(--fz-size) * 34 / 56); height: auto; }  /* 34px on the 56px button */
/* Press / landing effects (button-fx.js): a layer centred on the button and
   behind it, so pulse rings appear to come out from under the button. */
.fz-fx { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: -1; pointer-events: none; }
.fz-pulse { position: absolute; width: var(--fz-size); height: var(--fz-size); left: calc(var(--fz-size) / -2); top: calc(var(--fz-size) / -2);
            border-radius: var(--fz-radius); border: 2px solid rgba(236, 236, 241, .9); box-sizing: border-box; }
.fz-dust { position: absolute; left: -2px; top: -2px; }
/* Hover glint: the lit copies of the icon's pixels (freeze-icon.js) light up one diagonal
   at a time (bottom-left to top-right) while hovered, and go dark again the
   same way on leave. Transitions, so leaving halfway just turns it around.
   Only on devices that really hover, so a tap doesn't leave it stuck lit. */
.fz-glint { opacity: 0; transition: opacity .22s ease-out calc(var(--d) * 45ms); }
@media (hover: hover) { #freeze:hover .fz-glint { opacity: 1; } }
#freeze:focus-visible .fz-glint { opacity: 1; }
@keyframes fz-spin { to { --fz-angle: 360deg; } }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  #freeze { --gutter: 16px; }
  .nav ul { gap: 16px; }
  :root { --section-gap: 96px; --intro-gap: 48px; }
  .project { grid-template-columns: 1fr; gap: 6px; }
}

/* The intro stacks (avatar above the text) a little earlier than the rest:
   below ~900px the bio beside the avatar would outgrow it. */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; grid-template-areas: "avatar" "kicker" "text"; gap: 0; }
  .hero-grid .kicker { margin: 24px 0 8px; }
  .hero-text { min-height: 0; }
  .hero-text .rotator { margin: 18px 0 28px; }
  .hero-grid .avatar { width: 112px; height: 112px; min-height: 0; align-self: start; border-radius: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; }
  .words-track { animation: none; }
}
