/* imronmaulana.my.id — v2 single-screen "signal" theme
   Desktop: everything fits one viewport (no page scroll).
   Small screens: one panel at a time, switched by the bottom tab bar.
   CSP-safe: no inline styles; dynamic values are set through CSSOM only. */

@font-face { font-family: "Geist"; src: url("../fonts/geist-latin-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../fonts/geist-mono-latin-wght.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #060709;
  --panel: #0b0d11;
  --surface: rgba(12, 14, 18, .82);
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .13);
  --text: #eceef2;
  --muted: #9198a6;
  --dim: #5d6472;
  --accent: #6ef2d0;
  --accent-rgb: 110, 242, 208;
  --accent-ink: #04130f;
  --accent-soft: rgba(110, 242, 208, .12);
  --warn: #f2c86e;
  --danger: #f27a7a;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gx: max(16px, calc((100vw - 1480px) / 2));
  --gap: clamp(8px, 1.4vh, 14px);
  --pad: clamp(14px, 2.3vh, 24px);
  --radius: clamp(14px, 2vh, 20px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 320px; padding: 0 var(--gx); background: var(--bg); color: var(--text); font: 400 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent); color: var(--accent-ink); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
svg { display: block; }
kbd { display: inline-grid; place-items: center; min-width: 1.7em; height: 1.7em; padding: 0 .4em; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; color: var(--muted); font: 10px/1 var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.mono { font-family: var(--mono); }
.accent { color: var(--accent); }
.fit-hide { display: none !important; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.skip-link:focus { top: 12px; }

/* ---------- Background ---------- */
.field { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; }
.grid-bg { position: fixed; inset: 0; z-index: -2; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 64px 64px; -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 20%, #000, transparent 80%); mask-image: radial-gradient(ellipse 80% 70% at 30% 20%, #000, transparent 80%); opacity: .5; }
body::before { content: ""; position: fixed; z-index: -2; left: -10%; top: -30%; width: 70vw; height: 70vh; background: radial-gradient(closest-side, rgba(var(--accent-rgb), .08), transparent); pointer-events: none; }

/* ---------- Top bar ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: clamp(52px, 8vh, 72px); animation: fade-down .8s var(--ease-out) backwards; }
.mark { font-size: 20px; font-weight: 700; letter-spacing: -.04em; }
.mark span { color: var(--accent); }
.top-right { display: flex; align-items: center; gap: 8px; }
.cmd-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px 0 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .02); color: var(--muted); font-size: 13px; transition: color .25s, border-color .25s, background .25s; }
.cmd-btn:hover { color: var(--text); border-color: var(--line-2); background: rgba(255, 255, 255, .04); }
.cmd-btn svg, .pal-search svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.cmd-btn kbd { height: 24px; border-radius: 999px; padding: 0 9px; border-bottom-width: 1px; }
.clock { display: inline-flex; align-items: center; gap: 8px; margin: 0 8px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dot { position: relative; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--accent); animation: ping 2.4s var(--ease-out) infinite; }
@keyframes ping { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.8); opacity: 0; } }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); transition: color .25s, border-color .25s, transform .3s var(--ease-out); }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); transform: translateY(-2px); }
.icon-btn svg { width: 16px; height: 16px; }
.fill { fill: currentColor; }

/* ---------- Shared pieces ---------- */
.label { display: flex; align-items: center; gap: 12px; color: var(--accent); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.label-line { width: 32px; height: 1px; background: currentColor; transform-origin: left; animation: grow 1s var(--ease-out) .3s backwards; }
@keyframes grow { from { transform: scaleX(0); } }
.card { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), .9), transparent) no-repeat -100% 0 / 40% 1px, var(--surface); animation: cell-in .9s var(--ease-out) backwards, sweep 1.6s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 90ms + 150ms), calc(var(--i, 0) * 90ms + 500ms); }
@keyframes cell-in { from { opacity: 0; transform: translateY(16px) scale(.985); filter: blur(8px); } }
@keyframes sweep { from { background-position: -100% 0, 0 0, 0 0; } to { background-position: 200% 0, 0 0, 0 0; } }
@keyframes fade-down { from { opacity: 0; transform: translateY(-10px); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); filter: blur(6px); } }
@keyframes fade-in { from { opacity: 0; } }
.glow { isolation: isolate; }
.glow::before { content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit; padding: 1px; background: radial-gradient(260px circle at var(--mx, 50%) var(--my, -200%), rgba(var(--accent-rgb), .6), transparent 60%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); opacity: 0; transition: opacity .4s; pointer-events: none; }
.glow::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, -200%), rgba(var(--accent-rgb), .05), transparent 55%); opacity: 0; transition: opacity .4s; pointer-events: none; }
.glow:hover::before, .glow:hover::after { opacity: 1; }

/* ---------- Hero ---------- */
.cell-hero { display: flex; flex-direction: column; justify-content: center; gap: clamp(10px, 2.2vh, 28px); padding: var(--pad) var(--pad) var(--pad) 0; }
.cell-hero > .label { animation: fade-up .9s var(--ease-out) .1s backwards; }
.hero-title { font-size: clamp(36px, min(6vw, 7.4vh), 120px); font-weight: 560; line-height: .94; letter-spacing: -.055em; }
.hero-title .line { display: block; overflow: hidden; padding-bottom: .07em; margin-bottom: -.07em; }
.hero-title .line > span { display: inline-block; animation: rise 1.1s var(--ease-out) backwards; }
.hero-title .line:nth-child(1) > span { animation-delay: .18s; }
.hero-title .line:nth-child(2) > span { animation-delay: .28s; }
.hero-title .line:nth-child(3) > span { animation-delay: .38s; }
.hero-title .accent { font-weight: 300; letter-spacing: -.06em; }
@keyframes rise { from { transform: translateY(105%); } }
.lead { max-width: 460px; color: var(--muted); font-size: clamp(14px, 2vh, 17px); line-height: 1.6; animation: fade-up .9s var(--ease-out) .6s backwards; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; animation: fade-up .9s var(--ease-out) .7s backwards; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 0; color: var(--dim); font-size: 11px; animation: fade-up .9s var(--ease-out) .8s backwards; }
.hero-meta span + span::before { content: "·"; margin: 0 10px; }

.btn { --tx: 0px; --ty: 0px; display: inline-flex; align-items: center; gap: 9px; height: clamp(40px, 5.6vh, 46px); padding: 0 18px; border: 1px solid var(--line-2); border-radius: 999px; background: transparent; font-size: 14px; font-weight: 500; transform: translate(var(--tx), var(--ty)); transition: transform .35s var(--ease-out), background .25s, border-color .25s, color .25s, box-shadow .25s; }
.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease-out); }
.btn-primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { box-shadow: 0 0 0 6px var(--accent-soft), 0 10px 40px rgba(var(--accent-rgb), .25); }
.btn-primary:hover svg { transform: translateX(2px); }
.btn-ghost { color: var(--text); }
.btn-ghost:hover { border-color: rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .04); }

/* ---------- Live telemetry ---------- */
.cell-live { --i: 1; display: flex; flex-direction: column; gap: clamp(10px, 1.8vh, 18px); padding: var(--pad); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tm-title-wrap { min-width: 0; }
.card-head h2 { margin-top: 6px; font-size: clamp(17px, 2.4vh, 22px); font-weight: 520; letter-spacing: -.025em; line-height: 1.2; }
.seg { position: relative; flex: none; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--line-2); border-radius: 999px; background: rgba(255, 255, 255, .02); }
.seg-btn { position: relative; z-index: 1; height: 26px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 11px; transition: color .3s; }
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-selected="true"] { color: var(--accent-ink); }
.seg-ind { position: absolute; top: 3px; left: 3px; width: calc(50% - 3px); height: calc(100% - 6px); border-radius: 999px; background: var(--accent); transform: translateX(calc(var(--seg, 0) * 100%)); transition: transform .45s var(--ease-out); }
.tm-view { display: flex; flex: 1; min-height: 0; flex-direction: column; gap: clamp(10px, 1.8vh, 18px); }
.tm-view[hidden] { display: none; }
.tm-view.swap-in { animation: view-in .5s var(--ease-out) backwards; }
@keyframes view-in { from { opacity: 0; transform: translateX(10px); filter: blur(4px); } }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metric { min-width: 0; padding-left: 12px; border-left: 1px solid var(--line-2); }
.metric:first-child { padding-left: 0; border-left: 0; }
.metric dt { color: var(--dim); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric dd { margin-top: 2px; font-size: clamp(19px, 3.4vh, 30px); font-weight: 450; letter-spacing: -.04em; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart { display: flex; flex: 1; min-height: 0; flex-direction: column; }
.chart-frame, .heat-frame { position: relative; flex: 1; min-height: 60px; }
.chart-frame { background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 33.33%; border-bottom: 1px solid var(--line-2); }
.chart-frame svg, .heat-frame svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; color: var(--dim); font-size: 12px; text-align: center; }
.has-data > .chart-empty { display: none; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-live { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 3 5; stroke-linecap: round; opacity: .55; animation: fade-in .5s ease 1.5s backwards; }
.chart-line.draw { animation: draw 1.8s var(--ease-out) backwards; }
@keyframes draw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
.chart-area { opacity: 0; transition: opacity 1.2s var(--ease) .5s; }
.has-data .chart-area { opacity: 1; }
.chart-cursor { stroke: rgba(255, 255, 255, .25); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; transition: opacity .2s; }
.chart-end, .chart-hover { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), 0 0 16px var(--accent); pointer-events: none; }
.chart-end::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid var(--accent); animation: ping 2s var(--ease-out) infinite; }
.chart-hover { opacity: 0; transition: opacity .2s; background: var(--text); box-shadow: 0 0 0 4px rgba(255, 255, 255, .1); }
.chart-tip { position: absolute; z-index: 2; top: 0; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: rgba(11, 13, 17, .94); color: var(--text); font-size: 11px; white-space: nowrap; pointer-events: none; opacity: 0; transform: translate(-50%, -110%); transition: opacity .2s; }
.chart-tip small { display: block; color: var(--dim); font-size: 10px; }
.chart-tip em { display: block; color: var(--warn); font-size: 10px; font-style: normal; }
.hovering .chart-cursor, .hovering .chart-hover, .hovering > .chart-tip { opacity: 1; }
.chart-axis { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; color: var(--dim); font-size: 10px; white-space: nowrap; }
/* contribution heatmap */
.heat-cell { animation: fade-in .5s var(--ease) backwards; transition: stroke .15s; }
.heat-cell.l0 { fill: rgba(255, 255, 255, .05); }
.heat-cell.l1 { fill: rgba(var(--accent-rgb), .22); }
.heat-cell.l2 { fill: rgba(var(--accent-rgb), .42); }
.heat-cell.l3 { fill: rgba(var(--accent-rgb), .68); }
.heat-cell.l4 { fill: var(--accent); }
.heat-cell.is-hot { stroke: var(--text); stroke-width: 1.5; }
.heat-legend { display: inline-flex; align-items: center; gap: 3px; }
.heat-legend i { width: 8px; height: 8px; border-radius: 2px; }
.heat-legend i:first-child { margin-left: 4px; } .heat-legend i:last-child { margin-right: 4px; }
.heat-legend .l0 { background: rgba(255, 255, 255, .07); } .heat-legend .l1 { background: rgba(var(--accent-rgb), .22); } .heat-legend .l2 { background: rgba(var(--accent-rgb), .42); } .heat-legend .l3 { background: rgba(var(--accent-rgb), .68); } .heat-legend .l4 { background: var(--accent); }
.card-foot { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 11px; }
.updated { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-link { flex: none; color: var(--muted); transition: color .2s; }
.src-link:hover { color: var(--accent); }
.pill { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill[data-state="connected"] { border-color: rgba(var(--accent-rgb), .35); color: var(--accent); background: var(--accent-soft); }
.pill[data-state="connected"]::before { box-shadow: 0 0 10px var(--accent); }
.pill[data-state="checking"]::before { animation: blink 1s steps(2) infinite; }
.pill[data-state="stale"], .pill[data-state="checking"] { border-color: rgba(242, 200, 110, .3); color: var(--warn); }
@keyframes blink { 50% { opacity: .2; } }
.refresh { display: grid; flex: none; place-items: center; width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); transition: color .2s, border-color .2s; }
.refresh:hover { color: var(--text); border-color: var(--line-2); }
.refresh svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.refresh:disabled { cursor: wait; }
.refresh:disabled svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Capabilities ---------- */
.cell-skills { --i: 2; display: flex; flex-direction: column; gap: clamp(10px, 1.6vh, 16px); padding: var(--pad); }
.caps { display: grid; flex: 1; min-height: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.cap { position: relative; display: flex; min-height: 0; flex-direction: column; gap: clamp(6px, 1vh, 10px); padding: clamp(8px, 1.5vh, 16px) clamp(10px, 1.4vw, 18px); border-top: 1px solid var(--line); overflow: hidden; animation: fade-up .8s var(--ease-out) backwards; }
.cap:nth-child(1) { animation-delay: .45s; } .cap:nth-child(2) { animation-delay: .52s; } .cap:nth-child(3) { animation-delay: .59s; } .cap:nth-child(4) { animation-delay: .66s; }
.cap:nth-child(odd) { padding-left: 0; }
.cap:nth-child(even) { border-left: 1px solid var(--line); }
.cap::before { content: ""; position: absolute; left: 0; top: -1px; width: 100%; height: 1px; background: linear-gradient(90deg, var(--accent), transparent); transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease-out); }
.cap:hover::before { transform: scaleX(1); }
.cap-viz { display: flex; flex: 1 1 0; min-height: clamp(34px, 6.4vh, 64px); align-items: center; }
.cap-viz svg { width: 100%; height: 100%; max-height: 96px; overflow: visible; }
.cap-meta { display: flex; align-items: baseline; gap: 10px; }
.cap-num { color: var(--dim); font-size: 11px; transition: color .3s; }
.cap h3 { font-size: clamp(14px, 2vh, 17px); font-weight: 520; letter-spacing: -.02em; line-height: 1.3; transition: transform .5s var(--ease-out); }
.cap .tags { margin-top: 0; }
.cap:hover .cap-num { color: var(--accent); }
.cap:hover h3 { transform: translateX(4px); }
/* capability diagrams (SVG, from capabilities.html; classes prefixed cv- to avoid clashes) */
.cv-pill rect { fill: transparent; stroke: #2a2e35; stroke-width: 1; }
.cv-pill text { font: 11px var(--mono); fill: var(--muted); dominant-baseline: central; text-anchor: middle; }
.cv-pill.on rect { stroke: var(--accent); fill: rgba(var(--accent-rgb), .08); }
.cv-pill.on text { fill: var(--accent); }
.cv-wire { fill: none; stroke: #2a2e35; stroke-width: 1; }
.cv-wire.dash { stroke-dasharray: 3 3; }
.cv-dot { fill: var(--accent); }
.cv-glow { filter: drop-shadow(0 0 4px rgba(var(--accent-rgb), .8)); }
.cv-lbl { font: 9.5px var(--mono); fill: var(--dim); text-anchor: middle; dominant-baseline: central; }
.cv-lbl.start { text-anchor: start; font-size: 10px; }
.cv-lbl.on { fill: var(--accent); }
.cv-bar { fill: var(--accent); opacity: .28; animation: cv-scan 3.2s linear infinite; }
.cv-bar.warn { fill: var(--warn); }
@keyframes cv-scan { 0%, 100% { opacity: .28; } 8% { opacity: 1; } 20% { opacity: .28; } }
.cv-ecg { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-dasharray: 320; stroke-dashoffset: 320; animation: cv-draw 2.6s linear infinite; }
@keyframes cv-draw { to { stroke-dashoffset: 0; } }
.cv-pulse { animation: cv-pulse 1.6s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes cv-pulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(3); opacity: 0; } }
.cv-breath rect { animation: cv-breath 2.4s ease-in-out infinite; }
@keyframes cv-breath { 0%, 100% { fill: rgba(var(--accent-rgb), .08); } 50% { fill: rgba(var(--accent-rgb), .2); } }

/* ---------- Work ---------- */
.cell-work { display: flex; flex-direction: column; gap: clamp(8px, 1.4vh, 12px); min-height: 0; }
.work-label { justify-content: space-between; animation: fade-up .8s var(--ease-out) .4s backwards; }
.work-hint { color: var(--dim); letter-spacing: .04em; text-transform: none; }
.projects { display: grid; flex: 1; min-height: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.project { display: flex; min-height: 0; flex-direction: column; padding: var(--pad); overflow: hidden; transition: transform .5s var(--ease-out), border-color .3s; }
.project:nth-child(1) { --i: 3; } .project:nth-child(2) { --i: 4; } .project:nth-child(3) { --i: 5; }
.project:hover { transform: translateY(-3px); border-color: var(--line-2); }
.project.featured { background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), .9), transparent) no-repeat -100% 0 / 40% 1px, radial-gradient(120% 90% at 100% 0%, rgba(var(--accent-rgb), .08), transparent 60%), var(--surface); }
.dg-wrap { display: grid; grid-template-columns: minmax(0, 1fr); flex: 1 1 0; min-height: fit-content; place-items: center; padding: 0 0 12px; }
.project .kicker { color: var(--dim); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project h3 { margin: 6px 0 4px; font-size: clamp(15px, 2.3vh, 20px); font-weight: 520; letter-spacing: -.025em; line-height: 1.2; }
.project-open { padding: 0; border: 0; background: none; font: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; }
.project-open::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.project-open:focus-visible { outline: none; }
.project-open:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -2px; }
.project .desc { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tags li { padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; }
.project-cta { position: absolute; z-index: 2; top: var(--pad); right: var(--pad); display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); transition: color .25s, border-color .25s, background .25s; }
.project-cta svg, .btn svg.ar { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--ease-out); }
.project-cta:hover { color: var(--accent-ink); border-color: var(--accent); background: var(--accent); }
.project-cta:hover svg { transform: translate(1px, -1px); }

/* ---------- Conceptual diagrams (em-based so they scale) ---------- */
.dg { position: relative; display: flex; align-items: center; width: 100%; font-size: 10.5px; }
.dg .node { flex: none; padding: .5em .8em; border: 1px solid var(--line-2); border-radius: .7em; background: var(--bg); color: var(--muted); font: 1em/1.2 var(--mono); transition: color .4s; }
.dg .node-hot { border-color: rgba(var(--accent-rgb), .4); color: var(--accent); box-shadow: 0 0 2em rgba(var(--accent-rgb), .1); }
.project .dg { font-size: clamp(10px, 1.45vh, 13px); }
.project:hover .dg .node { color: var(--text); }
.project:hover .dg .node-hot { color: var(--accent); }
.wire { position: relative; flex: 1; min-width: 1.2em; height: 1px; overflow: hidden; background: var(--line-2); }
.wire::after, .lanes i::after { content: ""; position: absolute; top: 0; left: 0; width: 45%; height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: packet 2.2s var(--ease) infinite; }
.wire-2::after { animation-delay: 1.1s; }
@keyframes packet { from { transform: translateX(-100%); } to { transform: translateX(240%); } }
.sink { flex: none; width: .8em; height: .8em; border-radius: 50%; background: var(--accent); box-shadow: 0 0 1.2em var(--accent); animation: breathe 2.2s var(--ease) infinite; }
@keyframes breathe { 50% { transform: scale(.6); opacity: .6; } }
/* exorde-auto: restart loops back to worker */
.dg-auto { margin-bottom: 3.3em; }
.loop { position: absolute; top: 100%; left: calc(50% - .6em); right: 2.9em; height: 1.5em; border: 1px dashed rgba(var(--accent-rgb), .45); border-top: 0; border-radius: 0 0 .7em .7em; }
.loop::before { content: ""; position: absolute; left: -.32em; top: -.1em; border: .3em solid transparent; border-bottom-color: rgba(var(--accent-rgb), .8); border-top: 0; }
.loop::after { content: ""; position: absolute; bottom: -.2em; right: 0; width: .4em; height: .4em; border-radius: 50%; background: var(--accent); box-shadow: 0 0 .8em var(--accent); animation: loop-run 2.6s var(--ease) infinite; }
@keyframes loop-run { from { right: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } to { right: calc(100% - .4em); opacity: 0; } }
.loop-label { position: absolute; left: 50%; top: 100%; margin-top: .35em; transform: translateX(-50%); color: var(--dim); font-size: .85em; white-space: nowrap; }
/* twitter module: account pool with one flagged account */
.accts { display: flex; flex: none; flex-direction: column; gap: .35em; }
.acct { padding: .25em .55em; border: 1px solid var(--line-2); border-radius: .5em; background: var(--bg); color: var(--muted); font-size: .9em; line-height: 1.2; }
.acct-flag { animation: flag 5s var(--ease) infinite; }
@keyframes flag {
  0%, 30% { border-color: var(--line-2); color: var(--muted); opacity: 1; transform: none; }
  40%, 62% { border-color: rgba(242, 122, 122, .6); color: var(--danger); text-decoration: line-through; opacity: 1; transform: none; }
  72% { opacity: 0; transform: translateX(-.6em); }
  82%, 100% { border-color: var(--line-2); color: var(--muted); opacity: 1; transform: none; text-decoration: none; }
}
/* upipe: parallel translation lanes */
.lanes { display: flex; flex: 1; min-width: 3em; flex-direction: column; gap: .55em; margin: 0 .5em; }
.lanes i { position: relative; display: block; height: 1px; overflow: hidden; background: var(--line-2); }
.lanes i::after { animation-duration: 1.3s; }
.lanes i:nth-child(2)::after { animation-delay: .3s; }
.lanes i:nth-child(3)::after { animation-delay: .6s; }
.lanes i:nth-child(4)::after { animation-delay: .9s; }

/* ---------- Footer & tab bar ---------- */
.foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: clamp(34px, 5.5vh, 48px); color: var(--dim); font-size: 11px; animation: fade-up .8s var(--ease-out) .9s backwards; }
.foot kbd { min-width: 0; height: 18px; font-size: 9.5px; }
.tabbar { display: none; }

/* ---------- Project detail dialog ---------- */
dialog { max-width: none; max-height: none; padding: 0; border: 0; color: var(--text); }
dialog::backdrop { background: rgba(3, 4, 6, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog[open]::backdrop { animation: fade-in .35s ease; }
.detail { width: min(1080px, 100vw - 32px); height: min(600px, 100dvh - 32px); margin: auto; overflow: hidden; border: 1px solid var(--line-2); border-radius: 24px; background: var(--panel); box-shadow: 0 40px 120px rgba(0, 0, 0, .6); }
.detail[open] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.d-visual { position: relative; display: grid; place-items: center; padding: 40px 48px; overflow: hidden; border-right: 1px solid var(--line); background: radial-gradient(80% 70% at 50% 40%, rgba(var(--accent-rgb), .09), transparent 70%), linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 32px 32px, linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 32px 32px, var(--bg); }
.d-visual .dg { font-size: clamp(12px, 1.5vw, 16px); }
.d-body { display: flex; min-height: 0; flex-direction: column; gap: 16px; padding: clamp(24px, 4vh, 40px); overflow-y: auto; }
.d-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.d-top .kicker { color: var(--accent); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.d-nav { display: flex; gap: 6px; }
.round-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line-2); border-radius: 50%; background: transparent; color: var(--muted); transition: color .2s, border-color .2s, background .2s; }
.round-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .04); }
.round-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.detail h2 { font-size: clamp(26px, 4.4vh, 40px); font-weight: 540; letter-spacing: -.04em; line-height: 1.05; }
.detail .d-summary { color: var(--muted); font-size: 15px; line-height: 1.6; }
.d-steps { display: grid; gap: 14px; padding-left: 18px; border-left: 1px solid var(--line-2); }
.d-steps > div { position: relative; }
.d-steps > div::before { content: ""; position: absolute; left: -22.5px; top: 5px; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--accent); background: var(--panel); }
.d-steps > div:last-child::before { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.d-steps dt { color: var(--accent); font: 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.d-steps dd { margin-top: 3px; color: var(--text); font-size: 14px; line-height: 1.55; }
.detail .tags { margin-top: 0; }
.d-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 4px; }
.d-actions .btn svg { width: 13px; height: 13px; }
.d-hint { display: inline-flex; align-items: center; gap: 4px; color: var(--dim); font-size: 11px; }
.detail.anim .d-body > * { animation: fade-up .6s var(--ease-out) backwards; }
.detail.anim .d-body > :nth-child(2) { animation-delay: .06s; } .detail.anim .d-body > :nth-child(3) { animation-delay: .12s; } .detail.anim .d-body > :nth-child(4) { animation-delay: .18s; } .detail.anim .d-body > :nth-child(5) { animation-delay: .24s; } .detail.anim .d-body > :nth-child(6) { animation-delay: .3s; }
.detail.anim .d-visual .dg { animation: fade-up .7s var(--ease-out) .1s backwards; }

/* ---------- Command palette ---------- */
.palette { width: min(560px, 100vw - 32px); margin: 14vh auto auto; overflow: hidden; border: 1px solid var(--line-2); border-radius: 16px; background: rgba(11, 13, 17, .97); box-shadow: 0 30px 100px rgba(0, 0, 0, .6), 0 0 0 1px rgba(var(--accent-rgb), .04); }
.palette[open] { animation: pal-in .25s var(--ease-out); }
@keyframes pal-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
.pal-search { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--dim); }
.pal-search input { flex: 1; height: 52px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 15px; }
.pal-search input::placeholder { color: var(--dim); }
.pal-list { max-height: min(360px, 52vh); padding: 6px; overflow-y: auto; scrollbar-width: thin; }
.pal-group { padding: 10px 10px 4px; color: var(--dim); font: 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.pal-item { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-size: 14px; cursor: pointer; }
.pal-item small { color: var(--dim); font: 11px var(--mono); }
.pal-item[aria-selected="true"] { background: rgba(255, 255, 255, .06); color: var(--text); }
.pal-item[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--accent); }
.pal-item[aria-selected="true"] small { color: var(--accent); }
.pal-empty { padding: 24px 12px; color: var(--dim); font-size: 13px; text-align: center; }
.pal-foot { display: flex; gap: 16px; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--dim); font-size: 11px; }
.pal-foot span { display: inline-flex; align-items: center; gap: 4px; }

/* ==========================================================
   Desktop / laptop: single-screen bento, no page scroll
   ========================================================== */
@media (min-width: 900px) and (min-height: 600px) {
  html, body { height: 100%; overflow: hidden; }
  body { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100vh; height: 100dvh; }
  .bento { display: grid; min-height: 0; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: minmax(0, 1.08fr) minmax(0, 1fr); gap: var(--gap); }
  .cell-hero { grid-column: 1 / 8; grid-row: 1; }
  .cell-live { grid-column: 8 / 13; grid-row: 1; }
  .cell-skills { grid-column: 1 / 6; grid-row: 2; }
  .cell-work { grid-column: 6 / 13; grid-row: 2; }
}
@media (min-width: 900px) and (max-width: 1180px) {
  .clock, .cmd-text, .work-hint { display: none; }
  .dg-wrap { padding-top: 30px; }
  .cap h3 { font-size: 14px; }
  .cap-viz { min-height: 28px; }
}

/* ==========================================================
   Small screens: stacked by default (no-JS); one panel per tab with JS
   ========================================================== */
@media not all and (min-width: 900px) and (min-height: 600px) {
  .bento { display: grid; gap: 14px; padding-bottom: 24px; }
  .cell-hero { padding: 32px 0; }
  .projects { grid-template-columns: 1fr; }
  .cap:nth-child(n) { padding-left: 0; border-left: 0; }
  .caps { grid-template-columns: 1fr; grid-template-rows: none; }
  .js .cell-skills .caps { flex: none; }
  .cap-viz { flex: none; height: 68px; }
  .cmd-text, .clock { display: none; }
  .cmd-btn { padding: 0 12px; }
  .cmd-btn kbd { display: none; }
  .foot-note, .work-hint { display: none; }

  .js body { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100vh; height: 100dvh; overflow: hidden; }
  .js .bento { position: relative; min-height: 0; padding: 0; }
  .js .cell { grid-area: 1 / 1; display: none; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
  .js .cell::-webkit-scrollbar { display: none; }
  .js .cell.is-active { display: flex; animation: panel-in .5s var(--ease-out) backwards; }
  .js .cell.is-active.card { animation: panel-in .5s var(--ease-out) backwards, sweep 1.4s var(--ease) .2s backwards; }
  .js .cell-hero { padding: 8px 0; }
  .js .cell-hero .hero-title { font-size: clamp(44px, 13vw, 76px); }
  .js .cell-work .projects { flex: none; grid-template-rows: repeat(3, auto); align-content: start; }
  .js .project { overflow: visible; }
  .js .foot { display: none; }
  .js .cell-live .chart-frame, .js .cell-live .heat-frame { min-height: 140px; max-height: 46vh; }
  .js .tabbar { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 12px 0 calc(12px + env(safe-area-inset-bottom)); padding: 4px; border: 1px solid var(--line-2); border-radius: 16px; background: rgba(12, 14, 18, .9); animation: fade-up .8s var(--ease-out) .5s backwards; }
  .tab { position: relative; z-index: 1; height: 42px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; transition: color .25s; }
  .tab[aria-selected="true"] { color: var(--accent-ink); }
  .tab-ind { position: absolute; z-index: 0; top: 4px; left: 4px; width: calc((100% - 8px) / 4); height: calc(100% - 8px); border-radius: 12px; background: var(--accent); box-shadow: 0 0 24px rgba(var(--accent-rgb), .3); transform: translateX(calc(var(--tab, 0) * 100%)); transition: transform .45s var(--ease-out); }
  .dg-wrap { flex: none; min-height: 0; padding: 4px 0 26px; }
  .project .dg-wrap { padding-bottom: 12px; }
  .js .project { padding: 14px 16px; }
  .project .dg { font-size: 10.5px; }
  .js .cell-work .projects { gap: 10px; }
  .project .dg-auto + * { margin-top: 0; }

  .detail { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .detail[open] { grid-template-columns: 1fr; grid-template-rows: minmax(110px, 22%) minmax(0, 1fr); }
  .d-visual { padding: 16px 28px; border-right: 0; border-bottom: 1px solid var(--line); }
  .d-body { gap: 12px; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); }
  .detail h2 { font-size: 26px; }
  .detail .d-summary { font-size: 14px; }
  .d-steps { gap: 10px; }
  .d-steps dd { font-size: 13.5px; line-height: 1.5; }
  .d-actions .btn { width: 100%; justify-content: center; }
  .d-visual .dg { font-size: 12.5px; }
  .d-hint { display: none; }
  .palette { margin-top: 10vh; }
}
@media not all and (min-width: 900px) and (min-height: 600px) {
  @media (max-height: 700px) { .cap .tags, .project .tags { display: none; } .detail .d-summary { display: none; } .cap-viz { height: 64px; } }
  @media (max-height: 660px) { .project .desc { display: none; } }
}
@media (max-width: 480px) { .axis-mid, .heat-legend { display: none; } }
@media (max-width: 420px) {
  .metric dd { font-size: 20px; }
  .metric { padding-left: 8px; }
  .metric dt { font-size: 10px; }
  .card-head { flex-wrap: wrap; }
  .updated { display: none; }
}
@keyframes panel-in { from { opacity: 0; transform: translateY(10px); filter: blur(6px); } }

@media (prefers-reduced-motion: reduce) {
  .cv-ecg { stroke-dashoffset: 0; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}
