/* ==========================================================================
   Theme tokens
   ========================================================================== */
:root {
  --bg: #ffffff;
  --ink: #0f1b2d;
  --ink-2: #334155;
  --muted: #6b7280;
  --line: rgba(15, 27, 45, 0.1);
  --card: rgba(255, 255, 255, 0.92);
  --card-solid: #fbfbfa;
  --card-hover: rgba(255, 255, 255, 0.92);
  --chip: rgba(15, 27, 45, 0.045);
  --accent: #1d4ed8;
  --accent-soft: rgba(29, 78, 216, 0.1);
  --blue: #2563eb;
  --blue-soft: rgba(37, 99, 235, 0.1);
  --green: #16a34a;
  --shadow: 0 1px 2px rgba(15, 27, 45, 0.04), 0 8px 28px rgba(15, 27, 45, 0.06);
  --shadow-lift: 0 2px 4px rgba(15, 27, 45, 0.06), 0 18px 40px rgba(15, 27, 45, 0.1);

  /* background canvas colours (read by background.js) */
  --bg-grid: rgba(37, 99, 235, 0.06);
  --bg-grid-major: rgba(37, 99, 235, 0.11);
  --bg-member: rgba(15, 27, 45, 0.10);
  --bg-tension: 29, 78, 216;
  --bg-compression: 100, 116, 139;
  --bg-node: rgba(15, 27, 45, 0.28);
  --bg-label: rgba(37, 99, 235, 0.35);

  --radius: 22px;
  --radius-sm: 14px;
  --sidebar-w: 268px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}

/* Dark mode only when the visitor turns it on (the site defaults to white) */
:root[data-theme="dark"] {
  --bg: #0a1120;
  --ink: #e8edf5;
  --ink-2: #c3ccd9;
  --muted: #8b97a8;
  --line: rgba(232, 237, 245, 0.08);
  --card: rgba(17, 26, 43, 0.9);
  --card-solid: #111a2b;
  --card-hover: rgba(22, 33, 54, 0.9);
  --chip: rgba(232, 237, 245, 0.06);
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.12);
  --green: #22c55e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 28px rgba(0, 0, 0, 0.25);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 18px 40px rgba(0, 0, 0, 0.4);
  --bg-grid: rgba(96, 165, 250, 0.05);
  --bg-grid-major: rgba(96, 165, 250, 0.1);
  --bg-member: rgba(148, 178, 220, 0.10);
  --bg-tension: 96, 165, 250;
  --bg-compression: 148, 163, 184;
  --bg-node: rgba(190, 210, 240, 0.3);
  --bg-label: rgba(96, 165, 250, 0.4);
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
/* Keyboard users: "Skip to content" appears on the first Tab press */
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; transition: top 0.2s; }
.skip-link:focus { top: 12px; }
#main:focus { outline: none; }
/* Text for search engines and no-JS visitors; replaced by the dashboard when JavaScript runs */
.static-fallback { padding: 8px 4px; overflow: auto; }
.static-fallback h2 { font-size: 20px; margin: 18px 0 8px; }
.static-fallback p, .static-fallback li { color: var(--muted); font-size: 15px; line-height: 1.6; max-width: 70ch; }
.static-fallback ul { padding-left: 18px; }

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.icon { width: 18px; height: 18px; flex: none; }
.mono { font-family: var(--mono); }

/* ==========================================================================
   Sidebar
   ========================================================================== */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  padding: 32px 20px 20px;
  display: flex;
  flex-direction: column;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.profile { text-align: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.avatar {
  width: 136px; height: 136px;
  margin: 0 auto 14px;
  border-radius: 50%;
  overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--ink) 0%, #1e3a5f 100%);
  color: #fff;
  font-size: 36px; font-weight: 800; letter-spacing: -0.03em;
  box-shadow: 0 0 0 5px var(--card-solid), 0 0 0 6px var(--line), var(--shadow);
  position: relative;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .initials { position: relative; z-index: 1; }
.avatar svg.avatar-grid { position: absolute; inset: 0; opacity: 0.35; }
/* Long names with titles wrap neatly; the badge stays on the last line */
/* One line: app.js shrinks the font until the full name fits */
.profile-name { font-size: 17px; font-weight: 800; line-height: 1.25; white-space: nowrap; }
.profile-name .verified { color: var(--blue); width: 1em; height: 1em; display: inline-block; vertical-align: -0.12em; margin-left: 0.3em; }
.profile-handle { color: var(--muted); font-size: 13px; margin-top: 2px; }
.socials { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.socials a, .icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card-solid);
  border: 1px solid var(--line);
  transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.socials a:hover, .icon-btn:hover { transform: translateY(-2px); color: var(--accent); border-color: var(--accent); }
.socials .icon, .icon-btn .icon { width: 16px; height: 16px; }

.nav { display: flex; flex-direction: column; gap: 4px; padding: 18px 0; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 14.5px;
  transition: background 0.2s ease, color 0.2s ease;
}
.nav a:hover { background: var(--chip); color: var(--ink); }
.nav a.active {
  background: var(--card-solid);
  color: var(--ink);
  font-weight: 700;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.nav a.active .icon { color: var(--accent); }

.sidebar-foot { padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.availability { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--ink-2); font-weight: 500; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); position: relative; }
.pulse::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--green); opacity: 0;
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(0.5); opacity: 0.8; } 100% { transform: scale(1.4); opacity: 0; } }

.topbar, .scrim { display: none; }

/* ==========================================================================
   Main: one fixed screen. Hero + tools stay put; only the board changes.
   ========================================================================== */
html, body { height: 100%; }
body { overflow: hidden; }

.main {
  position: relative;
  z-index: 1;
  margin-left: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  padding: clamp(16px, 3vh, 30px) clamp(20px, 2.6vw, 40px);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vh, 16px);
  max-width: calc(1280px + var(--sidebar-w));
  outline: none;
}

.hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex: none; }
.hero h1 {
  font-size: clamp(28px, min(4.2vw, 6.4vh), 58px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.035em;
}
.hero h1 .accent { color: var(--accent); }
.hero p { color: var(--muted); font-size: clamp(13.5px, 1.9vh, 16px); margin-top: clamp(4px, 1vh, 10px); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  font-size: 13.5px;
  border: 0;
  white-space: nowrap;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.btn .icon { width: 15px; height: 15px; color: var(--accent); }
.btn.ghost { background: var(--card-solid); color: var(--ink); border: 1px solid var(--line); padding: 8px 14px; font-size: 12.5px; }

/* ---------- Card ---------- */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(14px, 2vh, 20px);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 0;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); background: var(--card-hover); }
.card-head { display: flex; align-items: center; gap: 11px; }
.card-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  flex: none;
  box-shadow: 0 4px 12px var(--accent-soft);
}
.card-icon .icon { width: 17px; height: 17px; }
.card-title { font-size: 14.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.card-desc { color: var(--muted); font-size: 13px; margin-top: 6px; }
.bento .card-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.card .arrow {
  position: absolute; top: 16px; right: 16px;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--card-solid);
  opacity: 0; transform: translate(-4px, 4px);
  transition: all 0.25s ease;
  z-index: 3;
}
.card .arrow .icon { width: 14px; height: 14px; }
a.card:hover .arrow { opacity: 1; transform: none; color: var(--accent); border-color: var(--accent); }

/* ---------- Tools marquee ---------- */
.tools { display: flex; align-items: center; gap: 18px; padding: 12px 18px; border-radius: 18px; flex: none; }
.tools-label { flex: none; padding-right: 18px; border-right: 1px solid var(--line); }
.eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 500; }
.tools-label strong { display: block; font-size: 15px; font-weight: 800; }
.marquee { overflow: hidden; flex: 1; min-width: 0; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.marquee-track { display: flex; gap: 10px; width: max-content; animation: marquee 38s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--card-solid);
  border: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
  white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); transform: rotate(45deg); }
.chip.sm { padding: 3px 9px; font-size: 11.5px; font-weight: 600; background: var(--chip); border-color: transparent; color: var(--ink-2); }

/* ==========================================================================
   Board: the one dashboard panel whose content changes with the menu
   ========================================================================== */
.board {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.6vh, 16px);
  padding: clamp(10px, 1.6vh, 16px);
  border-radius: 28px;
  border: 1px solid var(--line);
  /* No backdrop blur anywhere over the animated canvas: it forces a full repaint every frame */
  background: color-mix(in srgb, var(--blue) 3%, color-mix(in srgb, var(--bg) 70%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--card-solid) 60%, transparent), var(--shadow);
  /* Never shows a scrollbar; on very short screens the wheel still reaches the rest */
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.board::-webkit-scrollbar { display: none; }
.board.enter > * { animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.board.enter > *:nth-child(2) { animation-delay: 0.06s; }
.board.enter > *:nth-child(3) { animation-delay: 0.12s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.board-head { display: flex; align-items: center; gap: 14px; flex: none; padding: 2px 4px 0; }
.board-head h2 { font-size: clamp(20px, 3vh, 26px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.board-head p { color: var(--muted); font-size: 13.5px; }
.board-head .btn { margin-left: auto; }
.board-body { flex: 1; min-height: 0; display: grid; gap: clamp(10px, 1.6vh, 16px); }

/* ---------- Home bento ---------- */
.bento {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: clamp(10px, 1.6vh, 16px);
}
.bento .card { display: flex; flex-direction: column; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }

/* Projects card */
.projects-card { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; }
.projects-card .card-body { display: flex; flex-direction: column; min-height: 0; }
.slideshow { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--card-solid); min-height: 120px; }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity 0.8s ease; display: flex; flex-direction: column; }
.slide.on { opacity: 1; }
.slide .thumb { flex: 1; min-height: 0; }
.slide-cap { padding: 7px 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; font-size: 12px; background: var(--card-solid); min-width: 0; }
.slide-cap b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-cap span { color: var(--muted); font-family: var(--mono); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dots { position: absolute; top: 10px; left: 12px; display: flex; gap: 5px; z-index: 2; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: all 0.3s; }
.dots i.on { background: var(--accent); width: 16px; border-radius: 3px; }
.mini-list { margin-top: auto; padding-top: 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
.mini-list div { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-2); border-top: 1px dashed var(--line); padding-top: 5px; }
.mini-list span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list span + span { flex: none; }
.mini-list span + span { font-family: var(--mono); color: var(--muted); font-size: 11.5px; }

.thumb { width: 100%; height: 100%; background: color-mix(in srgb, var(--blue) 5%, var(--card-solid)); }
.thumb svg { width: 100%; height: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* About card art scales to whatever height is left */
.about-art { flex: 1; min-height: 70px; position: relative; margin-top: 6px; }
.about-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Software card */
.app-marquee { margin-top: auto; display: grid; gap: 8px; padding-top: 10px; }
.app-marquee .marquee-track { animation-duration: 26s; }
.app-marquee .reverse .marquee-track { animation-direction: reverse; }
.chip .live { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.chip .dev { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* Credentials badge */
.badge-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding-top: 6px; }
.badge { position: relative; width: clamp(70px, 13vh, 132px); aspect-ratio: 1; }
.badge svg { width: 100%; height: 100%; }
.badge .ring { animation: spin 40s linear infinite; transform-origin: 50% 50%; }
@keyframes spin { to { transform: rotate(360deg); } }
.badge-chip { background: var(--ink); color: var(--bg); border: 0; font-size: 12px; }
.badge-chip .icon { width: 13px; height: 13px; color: var(--accent); }

/* Services list */
.svc-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
.svc-list li {
  display: flex; align-items: center; gap: 10px;
  padding: clamp(3px, 0.6vh, 6px) 10px;
  border-radius: 10px;
  background: var(--card-solid);
  border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.svc-list li:hover { transform: translateX(3px); border-color: var(--accent); }
.svc-list .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-list .n { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.svc-list .ic { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.svc-list .ic .icon { width: 12px; height: 12px; }

/* Design Portfolio tile: the cover as a small open book */
.pf-cover { margin-top: 10px; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.pf-cover img { width: 50%; max-height: 100%; aspect-ratio: 1600 / 1131; object-fit: cover; box-shadow: 0 6px 18px rgba(15, 27, 45, 0.14); }
.pf-cover img:first-child { border-radius: 6px 0 0 6px; }
.pf-cover img:last-child { border-radius: 0 6px 6px 0; border-left: 1px solid rgba(15, 27, 45, 0.12); }

/* ==========================================================================
   Inner pages (all inside the board)
   ========================================================================== */
.grid-2 { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; }
.split { grid-template-columns: 1.5fr 1fr; }

/* Projects: picture left, text right, 2 × 2 */
.project { padding: 0; display: grid; grid-template-columns: 0.9fr 1fr; }
.project .thumb { border-right: 1px solid var(--line); min-height: 110px; }
.project .body { padding: clamp(12px, 1.8vh, 18px); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.project .meta { display: flex; gap: 8px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.project .meta span:first-child { color: var(--accent); }
.project h3 { font-size: 17px; font-weight: 800; line-height: 1.2; }
.project p { color: var(--muted); font-size: 13px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }

.item { display: flex; flex-direction: column; }
.item h3 { font-size: 17px; font-weight: 800; margin-top: 12px; }
.item p { color: var(--muted); font-size: 13.5px; margin-top: 6px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; }
@media (min-width: 901px) and (max-height: 760px) { .item p { -webkit-line-clamp: 3; } }
.item .num { position: absolute; top: 18px; right: 20px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.status { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.status.live { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.status.internal { background: var(--blue-soft); color: var(--blue); }
.item .tags { margin-top: auto; padding-top: 12px; }
.item .link-row { margin-top: 10px; }
/* Software cards: screenshot on top */
.app .app-shot { margin: calc(-1 * clamp(14px, 2vh, 20px)) calc(-1 * clamp(14px, 2vh, 20px)) 12px; height: clamp(110px, 24vh, 220px); flex: none; border-bottom: 1px solid var(--line); border-radius: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; overflow: hidden; background: color-mix(in srgb, var(--blue) 5%, var(--card-solid)); }
.app .app-shot a { display: block; height: 100%; cursor: zoom-in; }
.app .app-shot img { width: 100%; height: 100%; object-fit: cover; object-position: left top; transition: transform 0.4s; }
.app .app-shot a:hover img { transform: scale(1.03); }
.app-shot-ph { height: 100%; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--blue); font-family: var(--mono); font-size: 12px; }
.app-shot-ph .icon { width: 34px; height: 34px; }
.app h3 { margin-top: 10px; }
.app-soon { align-items: center; justify-content: center; text-align: center; background: transparent; border: 1.5px dashed color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: none; }
.app-soon .soon-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.app-soon .soon-ic .icon { width: 24px; height: 24px; }
.app-soon h3 { margin-top: 6px; }
.app-soon p { max-width: 260px; display: block; -webkit-line-clamp: unset; overflow: visible; }
@media (min-width: 901px) and (max-height: 760px) { .app .app-shot { height: 20vh; } .app p { -webkit-line-clamp: 5; } }
.item .link-row a { font-weight: 700; font-size: 13px; color: var(--accent); display: inline-flex; align-items: center; gap: 6px; }

.timeline { display: grid; height: 100%; align-content: space-evenly; }
.tl { display: grid; grid-template-columns: 120px 1fr auto; gap: 18px; align-items: center; padding: 10px 0; border-top: 1px dashed var(--line); }
.tl:first-child { border-top: 0; }
.tl .kind { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); }
.tl h3 { font-size: 16px; font-weight: 800; }
.tl p { color: var(--muted); font-size: 13.5px; }
.tl .yr { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.tl { cursor: pointer; padding-left: 12px; padding-right: 12px; border-radius: 12px; transition: background 0.2s ease, box-shadow 0.2s ease; }
.tl:hover, .tl.active { background: var(--accent-soft); border-top-color: transparent; }
.tl.active { box-shadow: inset 3px 0 0 var(--accent); }
.tl.active + .tl { border-top-color: transparent; }

/* Projects: list left, photo + details right */
.proj-split { grid-template-columns: 1fr 1.15fr; }
.proj-split .tl { grid-template-columns: 34px 1fr auto; gap: 14px; }
.project-detail { padding: 0; display: flex; flex-direction: column; }
.project-detail .thumb { flex: 1; min-height: 120px; height: auto; border-bottom: 1px solid var(--line); }
.project-detail .body { padding: clamp(12px, 1.8vh, 18px); display: flex; flex-direction: column; gap: 6px; }
.project-detail .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.project-detail .meta span:first-child { color: var(--accent); }
.project-detail h3 { font-size: clamp(17px, 2.6vh, 21px); font-weight: 800; line-height: 1.2; }
.project-detail p { color: var(--muted); font-size: 13.5px; }
.project-detail .tags { margin-top: 4px; }
.project-detail.swap > * { animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

/* Credentials detail: badge at the top, details below; swaps with the hovered row */
.badge-card { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: clamp(6px, 1.2vh, 10px); text-align: center; }
.badge-card .badge { width: clamp(80px, 15vh, 140px); }
.badge-card.swap > * { animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.cred-info p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.rating { width: 100%; max-width: 320px; margin-top: clamp(2px, 1vh, 8px); text-align: left; }
.rating-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--muted); }
.rating-head b { font-size: clamp(22px, 3.6vh, 30px); font-weight: 800; color: var(--ink); letter-spacing: -0.03em; }
.rating-bar { position: relative; height: 8px; border-radius: 99px; background: var(--chip); margin-top: 6px; }
.rating-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent), var(--accent)); animation: grow 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.rating-bar em { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: 0.5; }
@keyframes grow { from { width: 0; } }
.rating-foot { position: relative; display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.rating-foot span:nth-child(2) { position: absolute; left: 70%; transform: translateX(-50%); white-space: nowrap; }
.btn.verify { margin-top: auto; background: var(--accent); color: #fff; }
.btn.verify .icon { color: #fff; }
.btn.verify + .btn.verify { margin-top: 0; }
/* Membership / education (no rating): keep the button under the text and center the group */
.badge-card:not(.has-gallery):not(:has(.rating)) { justify-content: center; }
.badge-card:not(:has(.rating)) .btn.verify { margin-top: clamp(6px, 1.4vh, 12px); }

/* Certificate slideshow (Trainings & Certifications row) */
.badge-card.has-gallery { padding: clamp(10px, 1.6vh, 14px); }
.cert-gallery { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.cert-stage { position: relative; flex: 1; min-height: 140px; overflow: hidden; border-radius: 14px; background: var(--chip); border: 1px solid var(--line); }
.cert-track { display: flex; height: 100%; transition: transform 0.7s cubic-bezier(0.65, 0, 0.35, 1); cursor: zoom-in; }
.cert-slide { flex: 0 0 100%; height: 100%; margin: 0; padding: 10px; display: grid; place-items: center; }
.cert-slide img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 6px 18px rgba(15, 27, 45, 0.16); background: #fff; }
.cert-nav { position: absolute; top: 50%; width: 32px; height: 32px; margin-top: -16px; border-radius: 50%; border: 1px solid var(--line); background: var(--card-solid); display: grid; place-items: center; opacity: 0; transition: opacity 0.2s; }
.cert-nav .icon { width: 15px; height: 15px; }
.cert-nav.prev { left: 8px; } .cert-nav.prev .icon { transform: rotate(-135deg); }
.cert-nav.next { right: 8px; } .cert-nav.next .icon { transform: rotate(45deg); }
.cert-stage:hover .cert-nav { opacity: 1; }
.cert-cap { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; text-align: left; }
.cert-cap b { font-size: 14px; font-weight: 800; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cert-cap .meta { grid-column: 1; font-size: 12px; color: var(--muted); }
.cert-cap .count { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.cert-progress { height: 3px; border-radius: 3px; background: var(--chip); overflow: hidden; }
.cert-progress i { display: block; height: 100%; background: var(--accent); transition: width 0.7s ease; }

/* Design Portfolio: flip book (CSS 3D page turn; sizes come from --pw / --ph set in app.js) */
.fb-wrap { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.fb-stage { flex: 1; min-height: 0; display: grid; place-items: center; perspective: 2600px; overflow: hidden; }
.book { position: relative; display: grid; grid-template-columns: var(--pw) var(--pw); height: var(--ph); transition: transform 0.6s cubic-bezier(.4, 0, .2, 1); }
.book.single { grid-template-columns: var(--pw); }
.book.single .pg-l { display: none; }
.pg { position: relative; width: var(--pw); height: var(--ph); background: #f4f2ee; overflow: hidden; cursor: pointer; }
.pg.empty { background: transparent; cursor: default; }
.pg img, .leaf img { width: 100%; height: 100%; display: block; user-select: none; }
.pg-l:not(.empty) { border-radius: 6px 0 0 6px; box-shadow: -6px 10px 26px rgba(15, 27, 45, 0.16); }
.pg-r:not(.empty) { border-radius: 0 6px 6px 0; box-shadow: 6px 10px 26px rgba(15, 27, 45, 0.16); }
.book:not(.single) .pg-l:not(.empty)::after { content: ""; position: absolute; inset: 0 0 0 auto; width: 40px; background: linear-gradient(to left, rgba(0, 0, 0, 0.14), transparent); pointer-events: none; }
.book:not(.single) .pg-r:not(.empty)::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40px; background: linear-gradient(to right, rgba(0, 0, 0, 0.12), transparent); pointer-events: none; }
.book.single .pg-r:not(.empty) { border-radius: 6px; }
.leaf { display: none; position: absolute; top: 0; width: var(--pw); height: var(--ph); transform-style: preserve-3d; transition: transform 0.7s cubic-bezier(.45, .05, .3, 1); z-index: 3; pointer-events: none; }
.leaf.on { display: block; }
.leaf .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: #f4f2ee; overflow: hidden; }
.leaf .back { transform: rotateY(180deg); }
.leaf .face::after { content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.7s; pointer-events: none; }
/* Forward: the right page turns over the spine to the left */
.leaf.fwd { left: var(--pw); transform-origin: left center; transform: rotateY(0deg); }
.leaf.fwd.go { transform: rotateY(-180deg); }
.leaf.fwd .front::after { background: linear-gradient(to left, rgba(0, 0, 0, 0.3), transparent 60%); }
/* Back: the left page turns over the spine to the right */
.leaf.rev { left: 0; transform-origin: right center; transform: rotateY(180deg); }
.leaf.rev .front { transform: rotateY(180deg); }
.leaf.rev .back { transform: rotateY(0deg); }
.leaf.rev.go { transform: rotateY(0deg); }
.leaf.rev .front::after { background: linear-gradient(to right, rgba(0, 0, 0, 0.3), transparent 60%); }
.leaf.go .face::after { opacity: 1; }
/* Single page (phones): the page lifts away to the left */
.book.single .leaf { left: 0; transform-origin: left center; }
.book.single .leaf.fwd { transform: rotateY(0deg); }
.book.single .leaf.fwd.go { transform: rotateY(-100deg); opacity: 0; transition: transform 0.7s, opacity 0.7s ease-in; }
.book.single .leaf.rev { transform: rotateY(-100deg); opacity: 0; }
.book.single .leaf.rev .front { transform: none; }
.book.single .leaf.rev.go { transform: rotateY(0deg); opacity: 1; transition: transform 0.7s, opacity 0.3s; }
.fb-bar { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.fb-bar .icon-btn:disabled { opacity: 0.35; cursor: default; }
.fb-label { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 132px; text-align: center; }
.fb-progress { flex: 1; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.fb-progress span { display: block; height: 100%; background: var(--accent); transition: width 0.4s; }
.fb-wrap:fullscreen { background: var(--bg); padding: 24px; }
@media (max-width: 900px) { .fb-stage { flex: none; } }

/* About: text left, numbers right, optional process strip along the bottom */
.about-layout { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-auto-rows: auto; }
.about-text { display: flex; flex-direction: column; justify-content: center; }
.about-text .lead { font-size: clamp(14.5px, 2.1vh, 18px); font-weight: 600; line-height: 1.5; }
.about-label { margin-bottom: clamp(6px, 1.2vh, 10px); }
.about-text > p:not(.lead) { margin-top: clamp(8px, 1.6vh, 14px); color: var(--ink-2); font-size: clamp(12.5px, 1.95vh, 14px); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.stat { padding: clamp(8px, 1.4vh, 14px); border-radius: 14px; background: var(--card-solid); border: 1px solid var(--line); }
.stat .num { font-size: clamp(22px, 3.6vh, 32px); font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.stat .num small { color: var(--accent); font-size: 0.7em; }
.stat .lbl { color: var(--muted); font-size: 12px; margin-top: 4px; }
.codes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.process { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(10px, 1.6vh, 16px); }
.process .card { padding: clamp(10px, 1.6vh, 16px); }
.process .n { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.process h3 { font-size: 15px; font-weight: 800; margin-top: 4px; }
.process p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* Contact */
.contact-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
.contact-info { display: flex; flex-direction: column; gap: clamp(6px, 1.2vh, 12px); }
.contact-title { font-size: clamp(22px, 3.6vh, 32px); font-weight: 800; line-height: 1.12; letter-spacing: -0.02em; }
.contact-text { color: var(--ink-2); font-size: clamp(13px, 1.9vh, 14.5px); line-height: 1.55; }
.contact-items { margin-top: auto; display: grid; gap: clamp(10px, 1.8vh, 18px); padding-top: clamp(8px, 1.6vh, 16px); border-top: 1px solid var(--line); }
.contact-item { display: flex; flex-direction: column; gap: 3px; font-size: 14.5px; line-height: 1.5; }
.contact-item small { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); }
.contact-item a { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); text-decoration: none; width: fit-content; }
.contact-item a:hover { color: var(--accent); }
.contact-item .icon { width: 15px; height: 15px; color: var(--accent); }

/* Inquiry form in the dark card (its text colour is --bg, so it flips with the theme) */
.inquiry { gap: clamp(6px, 1.1vh, 10px); }
.inquiry .hp { position: absolute; left: -9999px; }
.inquiry label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: color-mix(in srgb, var(--bg) 70%, transparent); min-width: 0; }
.inquiry input, .inquiry select, .inquiry textarea {
  font: inherit; font-size: 13.5px; font-weight: 500; color: var(--bg);
  background: color-mix(in srgb, var(--bg) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--bg) 18%, transparent);
  border-radius: 10px; padding: clamp(6px, 1.1vh, 9px) 11px; width: 100%; outline: none; transition: border-color 0.2s;
}
.inquiry input::placeholder, .inquiry textarea::placeholder { color: color-mix(in srgb, var(--bg) 40%, transparent); }
.inquiry input:focus, .inquiry select:focus, .inquiry textarea:focus { border-color: var(--accent); }
.inquiry select option { color: #0f1b2d; }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.f-brief { flex: 1; min-height: 0; }
.f-brief textarea { flex: 1; min-height: 80px; resize: none; line-height: 1.5; }
.f-foot { display: flex; align-items: center; gap: 12px; }
.f-status { flex: 1; font-size: 12px; line-height: 1.4; color: color-mix(in srgb, var(--bg) 70%, transparent); }
.f-status.ok { color: #4ade80; }
.f-status.err { color: #f87171; }
.inquiry .btn { margin-top: 0; flex: none; }
.inquiry .btn:disabled { opacity: 0.6; cursor: wait; }
.cta-card { background: var(--ink) !important; color: var(--bg); border: 0 !important; display: flex; flex-direction: column; }
.cta-card .card-desc { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.cta-card h3 { font-size: clamp(20px, 3vh, 26px); font-weight: 800; line-height: 1.15; margin-top: 12px; }
.cta-card .btn { background: var(--accent); color: #fff; margin-top: auto; align-self: flex-start; }
.cta-card .btn .icon { color: #fff; }
.cta-card .blueprint { position: absolute; right: -30px; bottom: -30px; width: 200px; opacity: 0.14; color: var(--bg); }

/* ==========================================================================
   Background switcher (sidebar footer)
   ========================================================================== */
.bg-switch {
  display: flex; gap: 2px;
  padding: 3px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--line);
  font-size: 12px;
}
.bg-switch button { flex: 1; border: 0; background: transparent; padding: 5px 8px; border-radius: 999px; font-weight: 600; color: var(--ink-2); }
.bg-switch button.on { background: var(--ink); color: var(--bg); }

/* ==========================================================================
   Responsive
   ========================================================================== */
/* Short desktop screens: trim descriptions so every card still fits */
@media (min-width: 901px) and (max-height: 760px) {
  .sidebar { padding-top: 18px; }
  .avatar { width: 92px; height: 92px; font-size: 28px; margin-bottom: 8px; }
  .profile { padding-bottom: 12px; }
  .socials { margin-top: 8px; }
  .nav { padding: 10px 0; gap: 1px; }
  .nav a { padding: 7px 14px; }
  .bento .card-desc { -webkit-line-clamp: 2; }
  .hero p { display: none; }
  .process p { display: none; }
}
@media (min-width: 901px) and (max-height: 640px) {
  .bento .card-desc { display: none; }
}
@media (min-width: 901px) and (max-width: 1180px) {
  .projects-card { grid-template-columns: 1fr; }
  .projects-card .mini-list { display: none; }
  .project { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .project .thumb { border-right: 0; border-bottom: 1px solid var(--line); }
  .project p { display: none; }
}

/* Phones and small tablets: a normal scrolling page (no fixed screen) */
@media (max-width: 900px) {
  body { overflow: auto; }
  .socials a, .socials .icon-btn, .topbar .icon-btn { width: 44px; height: 44px; }
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; box-shadow: var(--shadow-lift); background: var(--bg); }
  body.menu-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 19; background: rgba(0, 0, 0, 0.35); opacity: 0; pointer-events: none; transition: opacity 0.3s; }
  body.menu-open .scrim { opacity: 1; pointer-events: auto; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 10;
    padding: 10px 16px;
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .topbar-name { font-weight: 800; }
  .main { margin-left: 0; height: auto; padding: 20px 16px 32px; }
  .board { overflow: visible; flex: none; }
  .bento { grid-template-rows: none; }
  .bento .card { min-height: 230px; }
  .span-3, .span-4 { grid-column: span 6; }
  .span-6 { grid-column: span 12; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .split, .about-layout, .proj-split, .contact-split, .f-row { grid-template-columns: 1fr; }
  .project-detail .thumb { min-height: 220px; }
  .process { grid-template-columns: repeat(2, 1fr); }
  .badge-card { min-height: 260px; }
}
@media (max-width: 680px) {
  .hero { flex-direction: column; }
  .hero .btn { display: none; }
  .span-3, .span-4, .span-6 { grid-column: span 12; }
  .projects-card { grid-template-columns: 1fr; }
  .slideshow { min-height: 190px; }
  .tools { flex-direction: column; align-items: stretch; gap: 10px; }
  .tools-label { border-right: 0; padding-right: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .project .thumb { min-height: 180px; }
  .project { grid-template-columns: 1fr; }
  .project .thumb { border-right: 0; border-bottom: 1px solid var(--line); }
  .board-head { flex-wrap: wrap; }
  .board-head .btn { display: none; }
  .tl { grid-template-columns: 1fr; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
