/* ==========================================================================
   Portfolio — main stylesheet
   All colors, fonts and spacing live in the variables below.
   --accent is injected from SiteSettings.accent_color in base.html.
   ========================================================================== */

:root {
  /* Fonts */
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  /* Spacing */
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --section-space: clamp(5rem, 12vw, 10rem);
  --container: 1240px;
  --radius: 18px;
  --radius-sm: 10px;

  /* Accent (overridden inline from the dashboard) */
  --accent: #6D44F2;    /* overridden from the dashboard, with --on-accent / --accent-ink */
  --on-accent: #ffffff;

  /* Dark theme (default) */
  --bg: #0a0a0b;
  --bg-elev: #131316;
  --bg-elev-2: #1b1b20;
  --text: #f2f1ec;
  --text-muted: #a1a1a8;
  --line: rgba(255, 255, 255, 0.1);
  --accent-ink: #9273f5;                    /* accent used as text (lightened for contrast) */
  --grain-opacity: 0.06;
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="light"] {
  --bg: #f6f5f1;
  --bg-elev: #ffffff;
  --bg-elev-2: #eceae4;
  --text: #111113;
  --text-muted: #55555c;
  --line: rgba(0, 0, 0, 0.1);
  /* Bright accents are hard to read on white, so darken them for text. */
  --accent-ink: #6d44f2;                    /* accent used as text on light backgrounds */
  --grain-opacity: 0.035;
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.25);
}

/* --- Reset & base --------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* With JS, Lenis handles smooth scrolling. CSS smooth scrolling must be off then: ScrollTrigger jumps to the top
   to re-measure on refresh, and a *smooth* jump makes it measure mid-scroll (pinned sections end up misplaced). */
html.js { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.05; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent-ink); }
button { font: inherit; color: inherit; }

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

::selection { background: var(--accent); color: var(--on-accent); }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--text-muted); }
.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -0.2em; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: 0.75rem; left: 0.75rem; z-index: 1000;
  padding: 0.6rem 1rem; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-weight: 600;
  transform: translateY(-200%); transition: transform 0.2s;
}
.skip-link:focus { transform: none; }

/* Film-grain overlay */
.grain {
  position: fixed; inset: 0; z-index: 900; pointer-events: none; opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Buttons, badges, chips ---------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  min-height: 3.25rem; padding: 0.85rem 1.6rem; border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { color: var(--on-accent); background: color-mix(in srgb, var(--accent) 85%, #fff); }
.btn--ghost { border-color: var(--line); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent-ink); color: var(--accent-ink); }
.btn[disabled] { opacity: 0.6; cursor: progress; }

.badge {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.4rem 0.9rem; border-radius: 999px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-elev) 70%, transparent);
  font-size: 0.875rem; color: var(--text-muted);
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); }
.badge--pulse .badge-dot { animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  padding: 0.45rem 0.9rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-elev); font-size: 0.9rem;
  transition: border-color 0.3s, color 0.3s;
}
.chip:hover { border-color: var(--accent-ink); color: var(--accent-ink); }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags li {
  font-size: 0.78rem; padding: 0.25rem 0.65rem; border-radius: 999px;
  background: var(--bg-elev-2); color: var(--text-muted);
}

/* --- Preloader ------------------------------------------------------------ */

.preloader { display: none; }
html.js:not(.no-preload) .preloader {
  display: flex; align-items: center; justify-content: center;
  position: fixed; inset: 0; z-index: 1000; background: var(--bg-elev);
  /* CSS failsafe: disappears on its own if JS never removes it */
  animation: preloader-failsafe 0.5s 3s forwards;
}
.anim-failed .preloader { display: none !important; }
@keyframes preloader-failsafe { to { opacity: 0; visibility: hidden; } }
.preloader-name {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2rem, 7vw, 5rem); letter-spacing: -0.03em; overflow: hidden;
}
.preloader-char { display: inline-block; }

/* --- Custom cursor (desktop only, enabled by JS) -------------------------- */

.cursor { display: none; }
html.has-cursor .cursor {
  display: block; position: fixed; top: 0; left: 0; z-index: 950; pointer-events: none;
  width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--accent); opacity: 0.85; box-shadow: 0 0 0 2px color-mix(in srgb, var(--on-accent) 35%, transparent);
  transition: width 0.3s var(--ease), height 0.3s var(--ease), margin 0.3s var(--ease), opacity 0.3s,
              background-color 0.3s var(--ease), border-color 0.3s var(--ease);
  border: 1.5px solid transparent;
}
/* Over links/buttons the dot grows into an outline ring, so it never covers the text underneath */
html.has-cursor .cursor.is-hover {
  width: 48px; height: 48px; margin: -24px 0 0 -24px; opacity: 1;
  background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: var(--accent-ink); box-shadow: none;
}
html.has-cursor .cursor.is-off { opacity: 0 !important; } /* beats the inline opacity GSAP sets on mousemove */
/* Disabled buttons get no mouse events in Chrome, so let the pointer fall through to the board
   (which carries data-native-cursor) — otherwise the custom cursor would reappear over them. */
[data-native-cursor] button:disabled { pointer-events: none; }

/* --- Navbar --------------------------------------------------------------- */

.nav {
  position: fixed; inset: 0 0 auto; z-index: 800;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: transform 0.45s var(--ease), background-color 0.4s;
}
.nav.is-hidden { transform: translateY(-100%); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.25rem; }
.nav-logo { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; text-decoration: none; white-space: nowrap; }
.nav-links ul { display: flex; gap: clamp(1rem, 2vw, 2rem); }
.nav-links a {
  position: relative; display: inline-block; padding-block: 0.35rem;
  text-decoration: none; font-size: 0.92rem; color: var(--text-muted); transition: color 0.2s;
}
/* Underline that slides in on hover / keyboard focus (the custom cursor hides over the menu) */
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px;
  background: var(--accent-ink); transform: scaleX(0); transform-origin: right;
  transition: transform 0.35s var(--ease);
}
.nav-links a:hover, .nav-links a:focus-visible { color: var(--text); }
.nav-links a:hover::after, .nav-links a:focus-visible::after { transform: scaleX(1); transform-origin: left; }
.nav-actions { display: flex; align-items: center; gap: 0.5rem; }

.theme-toggle, .menu-toggle {
  display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem;
  border-radius: 50%; border: 1px solid var(--line); background: transparent; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent-ink); color: var(--accent-ink); }
.theme-icon { grid-area: 1 / 1; display: grid; }
[data-theme="dark"] .theme-icon--moon, [data-theme="light"] .theme-icon--sun { display: none; }

.menu-toggle { display: none; gap: 5px; align-content: center; }
.menu-toggle-bar { display: block; width: 18px; height: 2px; background: currentColor; transition: transform 0.35s var(--ease); }
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:first-child { transform: translateY(3.5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(2) { transform: translateY(-3.5px) rotate(-45deg); }

.mobile-menu {
  position: fixed; inset: 0; z-index: 790; padding: 6.5rem var(--gutter) 2rem;
  background: var(--bg); overflow-y: auto;
}
.mobile-menu[hidden] { display: none; }
.mobile-menu li { overflow: hidden; border-bottom: 1px solid var(--line); }
.mobile-menu a {
  display: flex; align-items: baseline; gap: 1rem; padding: 0.9rem 0;
  font-family: var(--font-display); font-size: clamp(1.8rem, 8vw, 2.6rem); font-weight: 600; text-decoration: none;
}
.mobile-menu-num { font-size: 0.85rem; color: var(--accent-ink); font-family: var(--font-body); }

@media (max-width: 960px) {
  .nav-links { display: none; }
  html.js .menu-toggle { display: inline-grid; }
}
/* Without JS the mobile menu cannot open, so keep the links visible and scrollable. */
@media (max-width: 960px) {
  html.no-js .nav-links { display: block; overflow-x: auto; }
  html.no-js .nav-inner { flex-wrap: wrap; padding-bottom: 0.5rem; }
}

/* --- Sections (shared) ---------------------------------------------------- */

.section { padding-block: var(--section-space) 0; scroll-margin-top: 4rem; }
.section-head { margin-bottom: clamp(2.5rem, 6vw, 4.5rem); max-width: 60rem; }
.section-label {
  display: inline-flex; gap: 0.4rem; font-size: 0.85rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 1.25rem;
}
.section-num { color: var(--accent-ink); font-weight: 600; }
.section-title { font-size: clamp(2.3rem, 6.5vw, 5rem); font-weight: 600; }
.section-subtitle { margin-top: 1.25rem; color: var(--text-muted); font-size: 1.15rem; max-width: 42rem; }

.rich-text > * + * { margin-top: 1.1em; }
.rich-text ul { list-style: disc; padding-left: 1.2em; }
.rich-text ol { list-style: decimal; padding-left: 1.2em; }
.rich-text a { color: var(--accent-ink); }

.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.card {
  position: relative; padding: clamp(1.5rem, 3vw, 2rem); border-radius: var(--radius);
  background: var(--bg-elev); border: 1px solid var(--line); margin: 0;
  transition: border-color 0.35s var(--ease); /* no transform transition: GSAP animates transform */
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card-icon {
  display: inline-grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: 2.5rem;
  border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-ink);
}
.card-title { font-size: 1.35rem; font-weight: 600; margin-bottom: 0.65rem; }
.card-text { color: var(--text-muted); }
.card-image { border-radius: var(--radius-sm); margin-bottom: 1.25rem; aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.card-link { display: inline-flex; gap: 0.35rem; align-items: center; margin-top: 1.25rem; color: var(--accent-ink); font-weight: 500; }

/* --- Hero ----------------------------------------------------------------- */

.hero {
  position: relative; min-height: 100svh; display: flex; align-items: center;
  padding-block: 8rem 4rem; overflow: hidden; isolation: isolate;
}
.hero-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hero-grid {
  position: absolute; inset: -10%;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 75%);
}
.hero-blob {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.35;
  animation: blob 18s ease-in-out infinite alternate;
}
.hero-blob--1 { width: 46vmax; height: 46vmax; top: -18vmax; right: -12vmax; background: var(--accent); }
.hero-blob--2 {
  width: 34vmax; height: 34vmax; bottom: -16vmax; left: -10vmax;
  background: color-mix(in srgb, var(--accent) 35%, #6b5cff); animation-delay: -6s;
}
[data-theme="light"] .hero-blob { opacity: 0.22; }
@keyframes blob {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-6vmax, 4vmax) scale(1.15); }
}

.hero-inner { display: flex; flex-direction: column; align-items: flex-start; gap: 1.6rem; }
.hero-name {
  font-size: clamp(2.6rem, 11vw, 9rem); font-weight: 700; letter-spacing: -0.045em; line-height: 0.95;
}
.hero-headline {
  font-family: var(--font-display); font-size: clamp(1.25rem, 3vw, 2rem); font-weight: 500;
  color: var(--text-muted); max-width: 32ch; line-height: 1.25;
}
.hero-rotator { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; font-size: clamp(1.1rem, 2.2vw, 1.4rem); }
.hero-rotator-label { color: var(--text-muted); }
.rotator { display: inline-grid; font-family: var(--font-display); font-weight: 600; color: var(--accent-ink); overflow: hidden; }
.rotator-word { grid-area: 1 / 1; opacity: 0; white-space: nowrap; }
.rotator-word.is-active { opacity: 1; }
.hero-intro { max-width: 46ch; font-size: clamp(1.05rem, 1.6vw, 1.2rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.5rem; }

/* Hero items start hidden only when JS is running (failsafe restores them). */
html.js:not(.anim-failed) [data-hero-item],
html.js:not(.anim-failed) [data-hero-split] { visibility: hidden; }

/* --- Stats ---------------------------------------------------------------- */

.stats { border-block: 1px solid var(--line); }
.stats-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.stat { padding: clamp(1.75rem, 4vw, 3rem) 1rem; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat-value {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(2.8rem, 6vw, 4.5rem);
  line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums;
}
.stat-suffix { color: var(--accent-ink); }
.stat-label { margin-top: 0.6rem; color: var(--text-muted); font-size: 0.95rem; max-width: 22ch; }
@media (max-width: 860px) {
  .stats-list { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

/* --- About ---------------------------------------------------------------- */

.about-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2rem, 6vw, 6rem); align-items: start; }
.about-grid--single { grid-template-columns: minmax(0, 52rem); }
.about-photo { margin: 0; border-radius: var(--radius); overflow: hidden; background: var(--bg-elev); }
.about-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.about-body { font-size: clamp(1.15rem, 2vw, 1.45rem); line-height: 1.55; }
.about-location { display: flex; align-items: center; gap: 0.5rem; font-size: 1rem; color: var(--text-muted); }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; } .about-photo { max-width: 420px; } }

/* --- Skills --------------------------------------------------------------- */

.skills-grid { display: grid; gap: 2.5rem 3rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.skill-group-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }

.marquee { margin-top: clamp(4rem, 8vw, 6rem); overflow: hidden; border-block: 1px solid var(--line); padding-block: 1.25rem; }
.marquee-track { display: flex; width: max-content; animation: marquee 50s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-list { display: flex; flex-shrink: 0; }
.marquee-list li {
  font-family: var(--font-display); font-size: clamp(1.5rem, 3.5vw, 2.6rem); font-weight: 600;
  padding-inline: 1.5rem; white-space: nowrap; color: var(--text-muted);
}
.marquee-list li::after { content: "✦"; margin-left: 3rem; color: var(--accent-ink); font-size: 0.6em; vertical-align: middle; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* --- Experience timeline -------------------------------------------------- */

.timeline { position: relative; padding-left: clamp(1.75rem, 5vw, 3.5rem); }
.timeline-line { position: absolute; left: 6px; top: 0.5rem; bottom: 0; width: 2px; background: var(--line); }
.timeline-progress {
  position: absolute; inset: 0; border-radius: 2px; transform-origin: top;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--accent) 45%, transparent), var(--accent) 35%);
  /* soft glow around the drawn line (only scaled vertically, so the sideways glow stays even) */
  box-shadow:
    0 0 6px 0 color-mix(in srgb, var(--accent) 80%, transparent),
    0 0 16px 2px color-mix(in srgb, var(--accent) 40%, transparent);
}
/* Bright glowing tip that rides the end of the line as you scroll (JS moves it; hidden without JS) */
.timeline-head {
  position: absolute; left: 50%; top: 0; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 35%, #fff); opacity: 0; visibility: hidden;
  box-shadow:
    0 0 6px 2px color-mix(in srgb, var(--accent) 90%, transparent),
    0 0 18px 6px color-mix(in srgb, var(--accent) 55%, transparent),
    0 0 36px 12px color-mix(in srgb, var(--accent) 25%, transparent);
  animation: timeline-pulse 1.8s ease-in-out infinite;
}
@keyframes timeline-pulse { 50% { transform: scale(1.35); } }
[data-theme="light"] .timeline-progress { box-shadow: 0 0 6px 0 color-mix(in srgb, var(--accent) 55%, transparent); }
.timeline-list { display: grid; gap: clamp(3rem, 7vw, 5rem); }
.timeline-item { position: relative; max-width: 50rem; }
.timeline-dot {
  position: absolute; left: calc(-1 * clamp(1.75rem, 5vw, 3.5rem) + 1px); top: 0.45rem;
  width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
.timeline-dot { transition: background-color 0.4s var(--ease), box-shadow 0.4s var(--ease), transform 0.4s var(--ease); }
/* Lit once the glowing line reaches it (JS toggles .is-lit; all lit with reduced motion) */
.timeline-dot.is-lit {
  background: var(--accent); transform: scale(1.15);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent), 0 0 16px 3px color-mix(in srgb, var(--accent) 60%, transparent);
}
.timeline-dates { font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 0.6rem; }
.timeline-role { font-size: clamp(1.5rem, 3.5vw, 2.25rem); font-weight: 600; }
.timeline-company { margin-top: 0.4rem; color: var(--text-muted); }
.timeline-summary { margin-top: 1rem; }
.timeline-points { margin-top: 1.25rem; display: grid; gap: 0.7rem; }
.timeline-points li { position: relative; padding-left: 1.4rem; }
.timeline-points li::before {
  content: ""; position: absolute; left: 0; top: 0.7em; width: 0.6rem; height: 2px; background: var(--accent);
}

/* --- Projects ------------------------------------------------------------- */
/* Default: a vertical grid. JS adds .is-horizontal on desktop for the pinned scroll. */

.projects-viewport { padding-inline: var(--gutter); max-width: var(--container); margin-inline: auto; }
.projects-track { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }

.projects.is-horizontal {
  min-height: 100vh; padding-block: 5.5rem 2.5rem;
  display: flex; flex-direction: column; justify-content: center;
}
.projects.is-horizontal .section-head { margin-bottom: 2rem; }
.projects.is-horizontal .section-title { font-size: clamp(2.3rem, 5vw, 4rem); }
.projects.is-horizontal .project-media { aspect-ratio: auto; height: min(30vh, 280px); }
.projects.is-horizontal .projects-viewport { max-width: none; width: 100%; min-width: 0; padding: 0; overflow: hidden; }
.projects.is-horizontal .projects-track {
  display: flex; gap: 1.5rem; width: max-content;
  padding-inline: max(var(--gutter), calc((100vw - var(--container)) / 2 + var(--gutter)));
}
/* All cards share one width; featured cards stand out by title size only. */
.projects.is-horizontal .project-card { width: min(32rem, 40vw); flex-shrink: 0; }

.project-card {
  display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-elev); border: 1px solid var(--line);
  transform-style: preserve-3d; will-change: transform;
  transition: border-color 0.35s var(--ease);
}
.project-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.project-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-elev-2); }
.project-media img { width: 100%; height: 100%; object-fit: cover; }
.project-gradient {
  position: absolute; inset: 0; display: grid; place-items: center;
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--accent) 75%, transparent), transparent 55%),
    radial-gradient(circle at 80% 70%, hsl(calc(var(--hue, 0) + 250) 80% 60% / 0.75), transparent 55%),
    var(--bg-elev-2);
}
.project-gradient span {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(5rem, 12vw, 9rem);
  color: rgba(255, 255, 255, 0.85); mix-blend-mode: overlay; line-height: 1;
}
.status {
  position: absolute; top: 1rem; left: 1rem; padding: 0.3rem 0.75rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.status--live { background: color-mix(in srgb, var(--accent) 90%, transparent); color: var(--on-accent); }
.status--in_progress { background: rgba(255, 196, 77, 0.92); color: #1d1500; }
.project-body { display: flex; flex-direction: column; gap: 0.85rem; padding: clamp(1.25rem, 3vw, 1.75rem); flex: 1; }
.project-title { font-size: clamp(1.35rem, 2.5vw, 1.75rem); font-weight: 600; }
.project-card--featured .project-title { font-size: clamp(1.6rem, 3vw, 2.25rem); }
.project-tagline { color: var(--text); font-weight: 500; }
.project-desc { color: var(--text-muted); font-size: 0.95rem; }
.project-links { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: auto; padding-top: 0.5rem; }
.project-links a { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--accent-ink); font-weight: 500; }

/* --- Custom sections ------------------------------------------------------ */

.custom-text { font-size: 1.15rem; max-width: 50rem; }
.custom-list { border-top: 1px solid var(--line); }
.custom-list-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1rem 2rem; padding-block: 1.5rem; border-bottom: 1px solid var(--line); }
.custom-list-title { font-size: 1.25rem; font-weight: 600; }
.custom-list-title a { text-decoration: none; }
.custom-list-item p { color: var(--text-muted); }
@media (max-width: 700px) { .custom-list-item { grid-template-columns: 1fr; } }

/* --- Education & certifications ------------------------------------------ */

.edu-grid { display: grid; gap: 3rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.edu-heading { font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); font-family: var(--font-body); font-weight: 500; margin-bottom: 1rem; }
.edu-list { border-top: 1px solid var(--line); }
.edu-item { padding-block: 1.4rem; border-bottom: 1px solid var(--line); }
.edu-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
.edu-meta { margin-top: 0.35rem; color: var(--text-muted); }

/* --- Testimonials --------------------------------------------------------- */

.testimonial-quote { margin: 0 0 1.5rem; font-size: 1.15rem; }
.testimonial-person { display: flex; align-items: center; gap: 0.85rem; }
.testimonial-person img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }

/* --- Contact -------------------------------------------------------------- */

.contact { padding-bottom: var(--section-space); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 6rem); align-items: start; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-info { display: flex; flex-direction: column; align-items: flex-start; gap: 1.25rem; }
.contact-heading { font-size: clamp(2.6rem, 7.5vw, 6rem); font-weight: 700; letter-spacing: -0.04em; }
.contact-email {
  display: inline-block; font-family: var(--font-display); font-size: clamp(1.15rem, 2.6vw, 1.75rem);
  font-weight: 600; color: var(--accent-ink); word-break: break-all;
}
.contact-line { display: flex; align-items: center; gap: 0.6rem; color: var(--text-muted); }

.socials { display: flex; gap: 0.6rem; }
.socials a {
  display: inline-grid; place-items: center; width: 2.9rem; height: 2.9rem; border-radius: 50%;
  border: 1px solid var(--line); transition: border-color 0.3s, color 0.3s;
}
.socials a:hover { border-color: var(--accent-ink); }

.contact-form {
  position: relative; display: grid; gap: 1.25rem; padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--line);
}
.field { display: grid; gap: 0.45rem; }
.field label { font-size: 0.9rem; font-weight: 500; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
@media (max-width: 600px) { .field-row { grid-template-columns: minmax(0, 1fr); } }
.field input, .field textarea, .field select {
  width: 100%; padding: 0.85rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font: inherit; transition: border-color 0.2s;
}
.field textarea { resize: vertical; min-height: 8rem; }
.field select {
  appearance: none; cursor: pointer; padding-right: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1a8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.9rem center; background-size: 1.1rem;
}
.field select:invalid, .field select:has(option[value=""]:checked) { color: color-mix(in srgb, var(--text-muted) 70%, transparent); }
.field select option { color: var(--text); background: var(--bg-elev); }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent-ink); }
.field input::placeholder, .field textarea::placeholder { color: color-mix(in srgb, var(--text-muted) 70%, transparent); }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: #ff6b6b; }
.field-error { color: #ff6b6b; font-size: 0.85rem; min-height: 0; }
.field-error:empty { display: none; }
.contact-form .btn { justify-self: start; }

.form-status { display: none; padding: 0.85rem 1rem; border-radius: var(--radius-sm); font-weight: 500; }
.form-status.is-visible { display: block; }
.form-status--success { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-ink); }
.form-status--error { background: rgba(255, 107, 107, 0.14); color: #ff8080; }
[data-theme="light"] .form-status--error, [data-theme="light"] .field-error { color: #c0392b; }

/* Honeypot */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- Footer --------------------------------------------------------------- */

.footer { border-top: 1px solid var(--line); padding-block: 2rem; color: var(--text-muted); font-size: 0.92rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.back-to-top {
  display: inline-grid; place-items: center; width: 2.9rem; height: 2.9rem; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
}
.back-to-top:hover { color: var(--on-accent); }

/* --- Small screens -------------------------------------------------------- */

@media (max-width: 480px) {
  .hero { padding-top: 7rem; }
  .hero-actions .btn { flex: 1 1 100%; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* --- Reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .marquee-track { animation: none; }
  .hero-blob { animation: none; }
}

/* --- Floating WhatsApp button --------------------------------------------- */
/* Pure CSS timing so it also works without JS: button after 3s, bubble after ~5.5s. */

.wa {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 780; /* below the mobile menu */
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.75rem;
  pointer-events: none;
}
.wa > * { pointer-events: auto; }

.wa-button {
  display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%;
  background: #25d366; color: #fff; text-decoration: none;
  box-shadow: 0 10px 30px -8px rgba(37, 211, 102, 0.6), 0 4px 12px rgba(0, 0, 0, 0.25);
  visibility: hidden; opacity: 0; transform: translateY(16px) scale(0.6);
  animation: wa-in 0.55s var(--ease) 3s forwards;
  transition: box-shadow 0.3s var(--ease);
}
.wa-button:hover { color: #fff; box-shadow: 0 14px 36px -8px rgba(37, 211, 102, 0.8), 0 4px 12px rgba(0, 0, 0, 0.25); }

.wa-bubble {
  position: relative; display: flex; align-items: center; margin-right: 6px;
  border-radius: 16px 16px 4px 16px; background: var(--bg-elev); border: 1px solid var(--line);
  box-shadow: var(--shadow);
  visibility: hidden; opacity: 0; transform: translateY(10px) scale(0.85); transform-origin: bottom right;
  animation: wa-in 0.5s var(--ease) 5.5s forwards;
}
.wa-bubble::after { /* little tail pointing at the button */
  content: ""; position: absolute; right: 14px; bottom: -6px; width: 12px; height: 12px;
  background: var(--bg-elev); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}
.wa-bubble-link {
  padding: 0.6rem 0.9rem; font-family: var(--font-display); font-weight: 600; font-size: 0.95rem;
  text-decoration: none; white-space: nowrap;
}
.wa-bubble-close { display: none; }
html.js .wa-bubble-link { padding-right: 0.25rem; }
html.js .wa-bubble-close {
  display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 0.35rem;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer;
}
.wa-bubble-close:hover { background: var(--bg-elev-2); color: var(--text); }
.wa-bubble.is-dismissed { display: none; }

@keyframes wa-in { to { visibility: visible; opacity: 1; transform: none; } }

/* --- Floating chat widget (core/partials/chat.html, initChat in main.js) --- */
/* Same entrance timing as the WhatsApp button: button after 3s, bubble after ~5.5s. */

.chat {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 780; /* below the mobile menu */
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.75rem;
  pointer-events: none;
}
.chat > * { pointer-events: auto; }

.chat-button {
  position: relative; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); text-decoration: none;
  box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--accent) 70%, transparent), 0 4px 12px rgba(0, 0, 0, 0.25);
  visibility: hidden; opacity: 0; transform: translateY(16px) scale(0.6);
  animation: wa-in 0.55s var(--ease) 3s forwards;
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}
.chat-button:hover { color: var(--on-accent); transform: translateY(-2px); }
.chat-button svg { grid-area: 1 / 1; transition: opacity 0.25s var(--ease), transform 0.35s var(--ease); }
.chat-icon-close { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.chat.is-open .chat-icon-open { opacity: 0; transform: rotate(90deg) scale(0.6); }
.chat.is-open .chat-icon-close { opacity: 1; transform: none; }

/* Teaser bubble */
.chat-bubble {
  position: relative; display: flex; align-items: center; margin-right: 6px;
  border-radius: 16px 16px 4px 16px; background: var(--bg-elev); border: 1px solid var(--line);
  box-shadow: var(--shadow);
  visibility: hidden; opacity: 0; transform: translateY(10px) scale(0.85); transform-origin: bottom right;
  animation: wa-in 0.5s var(--ease) 5.5s forwards;
}
.chat-bubble::after {
  content: ""; position: absolute; right: 14px; bottom: -6px; width: 12px; height: 12px;
  background: var(--bg-elev); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}
.chat-bubble-link {
  padding: 0.6rem 0.25rem 0.6rem 0.9rem; font-family: var(--font-display); font-weight: 600; font-size: 0.95rem;
  text-decoration: none; white-space: nowrap; color: var(--text);
}
.chat-bubble-close {
  display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 0.35rem;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer;
}
.chat-bubble-close:hover { background: var(--bg-elev-2); color: var(--text); }
html:not(.js) .chat-bubble-close { display: none; }
.chat-bubble.is-dismissed, .chat.is-open .chat-bubble { display: none; }

/* Panel */
.chat-panel {
  display: flex; flex-direction: column;
  width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100dvh - 120px));
  border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--line);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.2);
  overflow: hidden; transform-origin: bottom right;
  animation: chat-pop 0.35s var(--ease);
}
.chat-panel[hidden] { display: none; }
@keyframes chat-pop { from { opacity: 0; transform: translateY(12px) scale(0.96); } }

.chat-head {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.9rem 0.9rem 0.9rem 1rem; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-elev));
}
.chat-avatar {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  background: var(--accent); color: var(--on-accent); font-family: var(--font-display); font-weight: 700;
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-head-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.chat-head-text strong { font-family: var(--font-display); font-weight: 600; }
.chat-head-text small { display: flex; align-items: center; gap: 0.4rem; color: var(--text-muted); font-size: 0.78rem; }
.chat-online { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.chat-close {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
}
.chat-close:hover { background: var(--bg-elev-2); color: var(--text); }

.chat-log {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 0.5rem; padding: 1rem;
}
.chat-msg {
  max-width: 85%; padding: 0.6rem 0.85rem; border-radius: 16px;
  font-size: 0.92rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
  animation: chat-msg-in 0.3s var(--ease);
}
.chat-msg.is-bot { align-self: flex-start; background: var(--bg-elev-2); border-bottom-left-radius: 4px; }
.chat-msg.is-user {
  align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; font-weight: 500;
}
@keyframes chat-msg-in { from { opacity: 0; transform: translateY(6px); } }

.chat-msg.is-typing { display: inline-flex; gap: 4px; padding: 0.75rem 0.9rem; }
.chat-msg.is-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted);
  animation: chat-typing 1s infinite ease-in-out;
}
.chat-msg.is-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-msg.is-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-typing { 0%, 60%, 100% { opacity: 0.3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-input { border-top: 1px solid var(--line); padding: 0.75rem; display: grid; gap: 0.6rem; }
.chat-input:has(.chat-choices:empty):has(.chat-compose[hidden]):has(.chat-error:empty) { display: none; }
.chat-choices { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem; }
.chat-choices:empty { display: none; }
.chat-choice {
  padding: 0.45rem 0.85rem; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent-ink) 45%, transparent); background: transparent;
  color: var(--accent-ink); font: inherit; font-size: 0.875rem; font-weight: 500;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.chat-choice:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chat-choice:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

.chat-compose { display: flex; gap: 0.5rem; }
.chat-compose[hidden] { display: none; }
.chat-compose input {
  flex: 1; min-width: 0; padding: 0.7rem 1rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 0.92rem;
}
.chat-compose input:focus { outline: none; border-color: var(--accent-ink); }
.chat-send {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: var(--accent); color: var(--on-accent); cursor: pointer;
}
.chat-error { margin: 0; color: #ff8080; font-size: 0.82rem; }
.chat-error:empty { display: none; }
[data-theme="light"] .chat-error { color: #c0392b; }

@media (max-width: 480px) {
  /* Near full-screen sheet under the site header; the header's close button replaces the launcher. */
  .chat.is-open { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); }
  .chat.is-open .chat-panel { width: 100%; height: calc(100dvh - 96px); }
  .chat.is-open .chat-button { display: none; }
}

/* --- Games ("Play" section) ----------------------------------------------- */

.games-box {
  border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--line);
  padding: clamp(1rem, 3vw, 2rem);
}
.games-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.games-tab {
  padding: 0.6rem 1.15rem; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  font-family: var(--font-display); font-weight: 600; cursor: pointer; color: var(--text-muted);
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}
.games-tab:hover { color: var(--text); border-color: var(--accent-ink); }
.games-tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.games-desc { color: var(--text-muted); margin-bottom: 1.25rem; }
.games-nojs { color: var(--text-muted); }

/* Stable height so switching games doesn't shift the page */
.game-stage { min-height: 460px; display: flex; flex-direction: column; align-items: center; gap: 1.25rem; }

.game-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.6rem 1.5rem;
  font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 0.95rem;
}
.game-bar strong { color: var(--text); font-family: var(--font-display); font-size: 1.1rem; }
.game-status { min-height: 1.6em; font-family: var(--font-display); font-weight: 600; text-align: center; color: var(--accent-ink); }
.game-btn {
  padding: 0.6rem 1.2rem; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-elev-2);
  color: var(--text); font-weight: 600; cursor: pointer;
}
.game-btn:hover { border-color: var(--accent-ink); color: var(--accent-ink); }
.game-btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.game-btn--primary:hover { color: var(--on-accent); }

/* Memory Match */
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; width: min(100%, 420px); }
.memory-card {
  aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--line); cursor: pointer; padding: 0;
  background: var(--bg-elev-2); perspective: 600px; position: relative; font-size: clamp(1.5rem, 6vw, 2.1rem);
}
.memory-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 0.45s var(--ease); }
.memory-card.is-flipped .memory-inner, .memory-card.is-matched .memory-inner { transform: rotateY(180deg); }
.memory-face {
  position: absolute; inset: 0; display: grid; place-items: center; border-radius: 13px; backface-visibility: hidden;
}
.memory-back {
  background:
    radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 60%),
    var(--bg-elev-2);
  color: color-mix(in srgb, var(--accent-ink) 60%, transparent); font-family: var(--font-display); font-weight: 700;
}
.memory-front { transform: rotateY(180deg); background: var(--bg); }
.memory-card.is-matched { border-color: var(--accent); cursor: default; }
.memory-card.is-matched .memory-front { background: color-mix(in srgb, var(--accent) 16%, var(--bg)); }

/* Tic-Tac-Toe */
.ttt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; width: min(100%, 330px); }
.ttt-cell {
  aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-elev-2);
  font-family: var(--font-display); font-weight: 700; font-size: clamp(2.2rem, 10vw, 3.2rem); cursor: pointer; color: var(--text);
}
.ttt-cell:disabled { cursor: default; }
.ttt-cell[data-mark="X"] { color: var(--accent-ink); }
.ttt-cell[data-mark="O"] { color: #ff8a65; }
.ttt-cell.is-win { background: color-mix(in srgb, var(--accent) 20%, var(--bg-elev-2)); border-color: var(--accent); }

/* Bug Smash */
.bug-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; width: min(100%, 360px); }
.bug-hole {
  aspect-ratio: 1; border-radius: 50%; border: 1px dashed var(--line); background: var(--bg);
  display: grid; place-items: center; font-size: clamp(2rem, 9vw, 2.8rem); cursor: pointer; padding: 0;
  transition: transform 0.12s;
}
.bug-hole:disabled { cursor: default; }
/* Small aiming crosshair (white with a dark outline, so it shows on both themes) */
.bug-grid, .bug-grid .bug-hole:not(:disabled) {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke-linecap='round'%3E%3Cg stroke='%23000' stroke-width='3.5' opacity='.55'%3E%3Ccircle cx='12' cy='12' r='6.5'/%3E%3Cpath d='M12 1.5v5M12 17.5v5M1.5 12h5M17.5 12h5'/%3E%3C/g%3E%3Cg stroke='%23fff' stroke-width='1.6'%3E%3Ccircle cx='12' cy='12' r='6.5'/%3E%3Cpath d='M12 1.5v5M12 17.5v5M1.5 12h5M17.5 12h5'/%3E%3C/g%3E%3Ccircle cx='12' cy='12' r='1.3' fill='%23ff4d4d'/%3E%3C/g%3E%3C/svg%3E") 12 12, crosshair;
}
.bug-hole.has-bug { background: var(--bg-elev-2); border-style: solid; }
.bug-hole.has-bug:active { transform: scale(0.92); }
.bug-hole.is-hit { background: color-mix(in srgb, var(--accent) 22%, var(--bg)); }

/* --- Project cost calculator ---------------------------------------------- */

.est-box {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(1rem, 3vw, 2rem); align-items: start;
}
@media (max-width: 960px) { .est-box { grid-template-columns: 1fr; } }
.est-main { display: grid; gap: 2rem; }
.est-step { border: 0; padding: 0; margin: 0; min-width: 0; }
.est-legend { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; margin-bottom: 1rem; padding: 0; }
.est-step-num {
  display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-ink); font-size: 0.9rem;
}
.est-optional { color: var(--text-muted); font-weight: 400; font-size: 0.9em; font-family: var(--font-body); }

.est-services { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.est-service {
  position: relative; display: flex; flex-direction: column; gap: 0.35rem; padding: 1.1rem 1.2rem; cursor: pointer;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg-elev);
  transition: border-color 0.25s, background-color 0.25s;
}
.est-service:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.est-service:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--bg-elev)); }
.est-service input, .est-feature input { position: absolute; opacity: 0; pointer-events: none; }
.est-service:has(input:focus-visible), .est-feature:has(input:focus-visible) { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.est-service-name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; padding-right: 1.6rem; }
.est-service::after { /* radio dot */
  content: ""; position: absolute; top: 1.15rem; right: 1.1rem; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); transition: border-color 0.2s, box-shadow 0.2s;
}
.est-service:has(input:checked)::after { border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--bg-elev), inset 0 0 0 8px var(--accent); }
.est-service-desc { color: var(--text-muted); font-size: 0.9rem; line-height: 1.45; }
.est-service-from { margin-top: auto; padding-top: 0.35rem; font-size: 0.85rem; color: var(--text-muted); }
.est-service-from span { color: var(--accent-ink); font-weight: 600; }

.est-features { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.est-features[hidden] { display: none; }
.est-feature {
  position: relative; display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; cursor: pointer;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg-elev); transition: border-color 0.25s, background-color 0.25s;
}
.est-feature::before { /* checkbox */
  content: ""; flex-shrink: 0; width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--line);
  transition: background-color 0.2s, border-color 0.2s;
}
.est-feature:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--bg-elev)); }
.est-feature:has(input:checked)::before {
  border-color: var(--accent);
  background: var(--accent);
  /* tick drawn in the readable text color for the current accent */
  content: "✓"; display: grid; place-items: center; color: var(--on-accent); font-size: 12px; font-weight: 700; line-height: 1;
}
.est-feature-name { flex: 1; }
.est-feature-price { color: var(--text-muted); font-size: 0.9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.est-none { color: var(--text-muted); }

.est-result {
  position: sticky; top: 5.5rem; display: flex; flex-direction: column; gap: 0.5rem;
  padding: clamp(1.25rem, 3vw, 1.75rem); border-radius: var(--radius); background: var(--bg-elev);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: 0 30px 60px -40px color-mix(in srgb, var(--accent) 60%, transparent);
}
@media (max-width: 960px) { .est-result { position: static; } }
.est-currency { display: inline-flex; align-self: flex-start; padding: 3px; border-radius: 999px; border: 1px solid var(--line); margin-bottom: 0.75rem; }
.est-currency button {
  padding: 0.4rem 0.9rem; border-radius: 999px; border: 0; background: transparent; color: var(--text-muted);
  font-weight: 600; font-size: 0.9rem; cursor: pointer;
}
.est-currency button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.est-label { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.est-price {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.1;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.est-weeks { color: var(--accent-ink); font-weight: 500; }
.est-note { color: var(--text-muted); font-size: 0.85rem; }
.est-quote-btn { margin-top: 0.75rem; }
.est-quote-btn[hidden] { display: none; } /* .btn sets display, which would override [hidden] */
.est-form { display: grid; gap: 0.9rem; margin-top: 0.75rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.est-form[hidden], .est-form [hidden] { display: none; }
.est-form-intro, .est-hint { color: var(--text-muted); font-size: 0.9rem; }
.est-hint { margin-top: -0.5rem; }
.est-form select, .demo-box select {
  width: 100%; padding: 0.85rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit;
}
.est-form .btn { justify-self: start; }

/* "Want to explore more?" banner (home + demos page) */
.explore {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem 2rem;
  margin-top: clamp(2rem, 5vw, 3.5rem); padding: clamp(1.5rem, 4vw, 2.5rem); border-radius: var(--radius);
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
    var(--bg-elev);
  border: 1px solid var(--line);
}
.explore-title { font-size: clamp(1.5rem, 3.5vw, 2.2rem); font-weight: 600; }
.explore-text { margin-top: 0.4rem; color: var(--text-muted); }

/* --- Demos page ----------------------------------------------------------- */

.page-head { padding-top: clamp(7rem, 14vw, 10rem); }
.page-title { font-size: clamp(2.8rem, 9vw, 6rem); font-weight: 700; letter-spacing: -0.04em; }
.page-back { color: var(--text-muted); text-decoration: none; text-transform: none; letter-spacing: 0; font-size: 0.95rem; }
.page-back:hover { color: var(--accent-ink); }
.demo-title { font-size: clamp(2rem, 5vw, 3.5rem); }
.demos-end { padding-bottom: var(--section-space); }

.demo-box { border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--line); padding: clamp(1.25rem, 3vw, 2rem); }
.demo-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(1.25rem, 4vw, 3rem); align-items: start; }
@media (max-width: 860px) { .demo-grid { grid-template-columns: 1fr; } }
.demo-col { display: grid; gap: 1rem; min-width: 0; }
.demo-col--qr { justify-items: center; }
.demo-hint { color: var(--text-muted); font-size: 0.85rem; }
.demo-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.demo-actions a.game-btn { text-decoration: none; display: inline-flex; align-items: center; }
.demo-actions a[aria-disabled] { opacity: 0.5; pointer-events: none; }
.game-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.demo-box .field input[readonly] { color: var(--accent-ink); }
.wl-qr { display: grid; place-items: center; width: 252px; height: 252px; padding: 16px; border-radius: var(--radius-sm); background: #fff; }
.wl-qr img, .wl-qr canvas { width: 220px !important; height: 220px !important; }
.wl-qr .demo-hint { color: #555; text-align: center; }

.sv-results { padding: clamp(1rem, 3vw, 1.5rem); border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line); gap: 0.35rem; }
.sv-big { font-family: var(--font-display); font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.1; margin-bottom: 0.6rem; font-variant-numeric: tabular-nums; }
.sv-results .sv-big:first-of-type { color: var(--accent-ink); }
.sv-cta { margin-top: 0.75rem; justify-self: start; }
.demo-box input[type="range"] { width: 100%; accent-color: var(--accent); }
.sv-share-out { font-family: var(--font-display); font-weight: 600; color: var(--accent-ink); }
.nav-links a[aria-current="page"] { color: var(--accent-ink); }
.nav-links a[aria-current="page"]::after { transform: scaleX(1); }
.sv-results .est-currency { justify-self: start; }

/* Bulk phone number cleaner demo */
.demo-box textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; }
.nc-check { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; font-size: 0.95rem; }
.nc-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.nc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
@media (max-width: 480px) { .nc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.nc-stat { display: grid; padding: 0.7rem 0.8rem; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line); }
.nc-stat strong { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.nc-stat span { color: var(--text-muted); font-size: 0.78rem; }
.nc-stat:nth-child(2) strong { color: var(--accent-ink); }
.nc-issues { display: grid; gap: 0.35rem; font-size: 0.85rem; color: var(--text-muted); }
.nc-issues:empty { display: none; }
.nc-issues code { color: var(--text); background: var(--bg); padding: 0.1rem 0.4rem; border-radius: 4px; }

/* --- Viewing note (footer) + one-time tip --------------------------------- */

.footer-text { display: grid; gap: 0.35rem; }
.footer-note { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.82rem; color: var(--text-muted); opacity: 0.85; }
.footer-note .icon { width: 1em; height: 1em; }

.view-tip {
  position: fixed; z-index: 820; left: 50%; top: 5rem; width: min(calc(100% - 32px), 520px);
  display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.6rem 0.7rem 0.9rem;
  border-radius: 14px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  transform: translate(-50%, -12px); opacity: 0; transition: transform 0.4s var(--ease), opacity 0.4s var(--ease);
}
.view-tip[hidden] { display: none; }
.view-tip.is-visible { transform: translate(-50%, 0); opacity: 1; }
.view-tip-icon {
  flex-shrink: 0; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-ink);
}
.view-tip-text { flex: 1; font-size: 0.88rem; line-height: 1.4; }
.view-tip-dark {
  flex-shrink: 0; padding: 0.4rem 0.8rem; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 0.82rem;
}
.view-tip-dark[hidden] { display: none; }
.view-tip-close {
  flex-shrink: 0; display: grid; place-items: center; width: 2rem; height: 2rem; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-muted); cursor: pointer;
}
.view-tip-close:hover { background: var(--bg-elev-2); color: var(--text); }
@media (max-width: 480px) { .view-tip { top: 4.75rem; } .view-tip-text { font-size: 0.82rem; } }
