/* ==========================================================================
   Yasir Hassan · Portfolio
   Dark-first design system. Light theme via [data-theme="light"].
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #0b1120;
  --bg-elev: #111a2e;
  --bg-hover: #18233b;
  --border: rgba(148, 163, 184, .13);
  --border-strong: rgba(148, 163, 184, .24);
  --text: #e8edf5;
  --text-2: #a3afc2;
  --text-3: #8391a9;
  --accent: #5b9cff;
  --accent-2: #2dd4bf;
  --grid: rgba(148, 163, 184, .07);
  --ok: #34d399;
  --btn-bg: #2563eb;
  --btn-text: #ffffff;
  --shadow: 0 1px 2px rgba(2, 6, 23, .5), 0 16px 40px -16px rgba(2, 6, 23, .8);
  --radius: 14px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f8fafc;
  --bg-elev: #ffffff;
  --bg-hover: #f1f5f9;
  --border: rgba(15, 23, 42, .09);
  --border-strong: rgba(15, 23, 42, .16);
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --accent: #2563eb;
  --accent-2: #0d9488;
  --grid: rgba(15, 23, 42, .06);
  --ok: #059669;
  --btn-bg: #1d4ed8;
  --btn-text: #ffffff;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 12px 32px -16px rgba(15, 23, 42, .15);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { list-style: none; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--text-2); }
.skip {
  position: fixed; top: -48px; left: 16px; z-index: 300; padding: 8px 14px; border-radius: 8px;
  background: var(--btn-bg); color: var(--btn-text); font-size: 14px; font-weight: 500; transition: top .2s;
}
.skip:focus { top: 12px; }
kbd {
  font-family: var(--mono); font-size: 11px; line-height: 1; padding: 4px 6px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-2); white-space: nowrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 10px; font-size: 14.5px; font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn-sm { height: 34px; padding: 0 14px; font-size: 13.5px; border-radius: 8px; }
.btn-light { background: var(--btn-bg); color: var(--btn-text); }
.btn-light:hover { opacity: 1; filter: brightness(1.08); }
.btn-light { box-shadow: 0 1px 2px rgba(2, 6, 23, .3), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-outline { border: 1px solid var(--border-strong); background: var(--bg); }
.btn-outline:hover { background: var(--bg-hover); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.i-moon { display: none; }
:root[data-theme="light"] .i-sun { display: none; }
:root[data-theme="light"] .i-moon { display: block; }
.text-link { font-size: 14px; color: var(--text-2); transition: color .15s; }
.text-link:hover { color: var(--text); }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 100; border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  transition: border-color .2s;
}
.header.scrolled { border-bottom-color: var(--border); }
.nav { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand img { border-radius: 6px; }
.nav-links { display: flex; gap: 4px; margin-left: 8px; }
.nav-links a {
  padding: 6px 12px; border-radius: 8px; font-size: 14px; color: var(--text-2); transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-hover); }
.nav-links a.active { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.kbd-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 10px; border-radius: 8px;
  border: 1px solid var(--border); color: var(--text-3); transition: border-color .15s, color .15s;
}
.kbd-btn:hover { border-color: var(--border-strong); color: var(--text); }
.kbd-btn kbd { border: 0; background: var(--bg-hover); }
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { padding: 120px 24px 104px; position: relative; }
.hero::before {
  content: ""; position: absolute; inset: -64px 0 auto; height: 520px; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 50% at 50% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%);
}
.pill {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px 6px 10px; margin-bottom: 28px;
  border: 1px solid var(--border); border-radius: 99px; font-size: 13.5px; color: var(--text-2);
  background: var(--bg-elev); transition: border-color .15s, color .15s;
}
.pill:hover { border-color: var(--border-strong); color: var(--text); }
.pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.pulse::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1px solid var(--ok);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.8); opacity: 0; } }
.hero h1 {
  font-size: clamp(38px, 6vw, 58px); line-height: 1.05; letter-spacing: -.045em; font-weight: 600; max-width: 820px;
}
.hero::after {
  content: ""; position: absolute; inset: -64px 0 0; z-index: -2; pointer-events: none;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px; background-position: center top;
  -webkit-mask-image: radial-gradient(75% 65% at 50% 15%, #000 25%, transparent 75%);
  mask-image: radial-gradient(75% 65% at 50% 15%, #000 25%, transparent 75%);
}
.hero h1 .dim {
  color: var(--text-3);
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.highlights {
  display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 72px; border: 1px solid var(--border);
  border-radius: var(--radius); background: color-mix(in srgb, var(--bg-elev) 80%, transparent);
}
.highlights li { padding: 20px 22px; border-left: 1px solid var(--border); font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.highlights li:first-child { border-left: 0; }
.highlights b { display: block; margin-bottom: 4px; font-size: 26px; font-weight: 600; letter-spacing: -.03em; color: var(--text); }
.hero-sub { margin-top: 24px; max-width: 560px; font-size: 17.5px; color: var(--text-2); line-height: 1.65; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 36px; }
.socials { display: flex; gap: 4px; margin-top: 40px; margin-left: -8px; }
.socials a {
  width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; color: var(--text-3);
  transition: color .15s, background .15s;
}
.socials a:hover { color: var(--text); background: var(--bg-hover); }

/* ---------- Sections ---------- */
.section { padding: 88px 24px; border-top: 1px solid var(--border); }
section[id] { scroll-margin-top: 64px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 40px; }
.section-head h2 { font-size: 32px; font-weight: 600; letter-spacing: -.03em; }
/* Numbered section labels: "// 01" */
main { counter-reset: section; }
main > .section { counter-increment: section; }
main > .section .section-head h2::before, main > .section .contact-intro h2::before {
  content: "// " counter(section, decimal-leading-zero);
  content: "// " counter(section, decimal-leading-zero) / "";
  display: block; margin-bottom: 10px; font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: .06em; color: var(--accent);
}

/* ---------- Work ---------- */
.work-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card {
  display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-elev); overflow: hidden; transition: border-color .2s, transform .2s, box-shadow .2s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); transform: translateY(-2px); box-shadow: var(--shadow); }
.card-feature { grid-column: 1 / -1; display: grid; grid-template-columns: 1.05fr 1fr; }
.card-wide { grid-column: 1 / -1; }
.card-split { display: grid; grid-template-columns: 1fr 1fr; }
.card-split .card-body { padding: 32px; }

/* Sample NetGuard scan (decorative, same look in both themes) */
.scan {
  margin: 20px 20px 20px 0; border: 1px solid rgba(148, 163, 184, .2); border-radius: 12px; overflow: hidden;
  background: #060a13; color: #d1d9e6; font-family: var(--mono); font-size: 12.5px; align-self: center;
}
.scan-bar { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid rgba(148, 163, 184, .13); background: #0b1120; color: #8391a9; font-size: 11.5px; }
.scan-body { padding: 16px 18px 14px; }
.scan-score { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; color: #8391a9; font-size: 11.5px; line-height: 1.35; }
.scan-score b {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: #e8edf5; font-size: 18px;
  background: radial-gradient(closest-side, #060a13 78%, transparent 80% 100%), conic-gradient(#34d399 71%, rgba(148, 163, 184, .18) 0);
}
.scan-list { display: grid; gap: 7px; }
.scan-list li { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; }
.scan-list code { color: #8391a9; font-family: inherit; }
.sev { padding: 1px 0; border-radius: 4px; text-align: center; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.sev-high { color: #fca5a5; background: rgba(248, 113, 113, .14); }
.sev-med { color: #fcd34d; background: rgba(251, 191, 36, .12); }
.sev-low { color: #93c5fd; background: rgba(91, 156, 255, .14); }
.sev-ok { color: #6ee7b7; background: rgba(52, 211, 153, .12); }
.scan-foot { margin-top: 14px; padding-top: 10px; border-top: 1px dashed rgba(148, 163, 184, .18); color: #64748b; font-size: 11px; }
.card-media {
  display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; border-bottom: 1px solid var(--border);
}
.card-feature .card-media { aspect-ratio: auto; min-height: 340px; border-bottom: 0; border-right: 1px solid var(--border); }
.card-media img { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.card:hover .card-media img { transform: scale(1.03); }
.media-navy { background: radial-gradient(120% 90% at 50% 40%, #0f2547, #0a1a33); }
.media-navy img { width: 78%; }
.media-milkiyat { background: #0b2545; }
.media-milkiyat img { width: 82%; }
.media-shot { background: #111; align-items: start; }
.media-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.card-body { display: flex; flex-direction: column; gap: 12px; padding: 24px; flex: 1; }
.card-feature .card-body { padding: 32px; justify-content: center; }
.card-meta { display: flex; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.card h3 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.card-feature h3 { font-size: 26px; }
.card h3 a { display: inline-flex; align-items: center; gap: 6px; }
.card h3 .arrow { font-size: .8em; color: var(--text-3); transition: transform .2s, color .2s; }
.card h3 a:hover .arrow { transform: translate(2px, -2px); color: var(--text); }
.card p { color: var(--text-2); font-size: 15px; }
.card .tags { margin-top: auto; padding-top: 8px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: 10px; margin: 6px 0 4px; }
.facts li { padding: 12px 14px; font-size: 12.5px; color: var(--text-2); line-height: 1.4; border-left: 1px solid var(--border); }
.facts li:first-child { border-left: 0; }
.facts b { display: block; font-size: 17px; color: var(--text); font-weight: 600; letter-spacing: -.02em; margin-bottom: 2px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  font-size: 12.5px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--border);
  color: var(--text-2); background: var(--bg);
}

/* ---------- Experience timeline ---------- */
.timeline { position: relative; display: grid; gap: 20px; }
.timeline::before {
  content: ""; position: absolute; left: 170px; top: 12px; bottom: 12px; width: 1px;
  background: linear-gradient(var(--ok), var(--accent) 35%, var(--border));
}
.tl-item { position: relative; display: grid; grid-template-columns: 150px 1fr; gap: 40px; }
.tl-dot {
  position: absolute; left: 164px; top: 34px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.tl-now .tl-dot { border-color: var(--ok); background: var(--ok); box-shadow: 0 0 0 5px color-mix(in srgb, var(--ok) 18%, transparent); }
.tl-when { padding-top: 30px; text-align: right; font-family: var(--mono); font-size: 13px; color: var(--text-3); }
.tl-now .tl-when { color: var(--ok); }
.tl-card { padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); transition: border-color .2s; }
.tl-card:hover { border-color: var(--border-strong); }
.tl-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.tl-badge {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px;
  font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.tl-now .tl-badge { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.tl-head h3 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.tl-head p { font-size: 14px; color: var(--text-2); }
.tl-card > .muted { font-size: 15px; }
.plain { display: grid; gap: 6px; color: var(--text-2); font-size: 15px; }
.plain li { position: relative; padding-left: 18px; }
.plain li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 5px; height: 1px; background: var(--text-3); }

/* ---------- Skills ---------- */
.skill-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skill-card {
  display: flex; flex-direction: column; gap: 14px; padding: 22px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg-elev); transition: border-color .2s;
}
.skill-card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); }
.skill-head { display: flex; align-items: center; gap: 12px; }
.skill-head h3 { font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.skill-icon {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.skill-top { display: grid; gap: 7px; font-size: 14px; font-weight: 500; color: var(--text); }
.skill-top li { display: flex; align-items: center; gap: 10px; }
.skill-top li::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); }
.skill-card .tags li { font-size: 12px; padding: 2px 9px; }
.skill-card .used { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-3); }
.skill-card .used a { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.skill-card .used a:hover { color: var(--text); text-decoration-color: var(--text-3); }

/* ---------- Project diagrams (HRMS, Enterprise Network) ---------- */
.media-diagram {
  aspect-ratio: 16 / 7; background: radial-gradient(80% 100% at 50% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), var(--bg);
}
.media-diagram svg { width: 86%; height: auto; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.card:hover .media-diagram svg { transform: scale(1.03); }
.dg-line { fill: none; stroke: var(--border-strong); stroke-width: 1.5; }
.dg-dash { stroke-dasharray: 3 4; opacity: .7; }
.dg-node { fill: var(--bg-elev); stroke: var(--border-strong); stroke-width: 1.2; }
.dg-core { stroke: var(--accent); }
.dg-text { fill: var(--text-3); font-family: var(--mono); font-size: 8.5px; font-weight: 600; letter-spacing: .06em; }
.dg-bar, .dg-dot { fill: var(--border-strong); }
.dg-pill { fill: none; stroke: var(--border-strong); }
.dg-a { fill: var(--accent); }
.dg-b { fill: var(--accent-2); }
.dg-c { fill: #f59e0b; }

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: 1fr 1.1fr; gap: 56px; align-items: start; }
.contact-intro h2 { font-size: clamp(32px, 5vw, 44px); font-weight: 600; letter-spacing: -.04em; }
.contact-intro p { margin: 14px 0 28px; max-width: 420px; color: var(--text-2); }
.email-chip {
  display: inline-flex; align-items: center; height: 42px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--bg); overflow: hidden; max-width: 100%;
}
.email-chip a { padding: 0 14px 0 16px; font-family: var(--mono); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.email-chip a:hover { text-decoration: underline; text-underline-offset: 3px; }
.copy { height: 100%; width: 42px; flex: none; display: grid; place-items: center; border-left: 1px solid var(--border); color: var(--text-2); transition: background .15s, color .15s; }
.copy:hover { background: var(--bg-hover); color: var(--text); }
.contact-links { display: flex; gap: 20px; margin-top: 24px; font-size: 14.5px; }
.contact-links a { color: var(--text-2); transition: color .15s; }
.contact-links a span { color: var(--text-3); }
.contact-links a:hover { color: var(--text); }

.form { display: grid; gap: 16px; padding: 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg);
  color: var(--text); font: inherit; font-size: 14.5px; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 120px; }
.field select { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--text-3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 8%, transparent);
}
.field input:user-invalid, .field textarea:user-invalid { border-color: #e5484d; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.form-status { min-height: 1.4em; font-size: 14px; color: var(--text-2); }
.form-status.ok { color: var(--ok); }
.form-status.err { color: #e5484d; }

/* ---------- Footer ---------- */
.footer { margin-top: 24px; border-top: 1px solid var(--border); background: var(--bg-elev); font-size: 14px; color: var(--text-2); }
.footer-top { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.3fr; gap: 40px; padding-top: 56px; padding-bottom: 48px; }
.footer-about p { margin: 16px 0 18px; max-width: 320px; line-height: 1.65; }
.footer-status {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px; border: 1px solid var(--border);
  border-radius: 99px; font-size: 13px; color: var(--text); background: var(--bg);
}
.footer-col { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.footer-col h2 {
  margin-bottom: 6px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text);
}
.footer-col a { transition: color .15s; }
.footer-col a:hover { color: var(--text); }
.footer-social { display: flex; gap: 8px; margin-top: 8px; }
.footer-social a {
  width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px;
  color: var(--text-2); transition: color .15s, border-color .15s, background .15s;
}
.footer-social a:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-hover); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-top: 20px; padding-bottom: 24px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3);
}
.footer-bottom nav { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-bottom a { transition: color .15s; }
.footer-bottom a:hover { color: var(--text); }

/* ---------- Command palette ---------- */
.palette {
  position: fixed; inset: 0; z-index: 200; display: flex; justify-content: center; align-items: flex-start;
  padding: 14vh 16px 16px; background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); animation: fade .12s ease;
}
.palette[hidden] { display: none; }
.palette-box {
  width: 100%; max-width: 540px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--bg-elev);
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, .7); overflow: hidden; animation: pop .14s ease;
}
.palette-search { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.palette-search input { flex: 1; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 15px; }
.palette-search input::placeholder { color: var(--text-3); }
.palette-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.p-group { padding: 10px 10px 6px; font-size: 12px; color: var(--text-3); }
.p-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.p-item.active { background: var(--bg-hover); color: var(--text); }
.p-item kbd { border: 0; background: none; color: var(--text-3); }
.p-empty { padding: 28px; text-align: center; font-size: 14px; color: var(--text-3); }
/* ---------- Terminal (same look in both themes) ---------- */
.term {
  position: fixed; inset: 0; z-index: 200; display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 16px 16px; background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); animation: fade .12s ease;
}
.term[hidden] { display: none; }
.term-box {
  width: 100%; max-width: 700px; border: 1px solid rgba(148, 163, 184, .24); border-radius: 12px; background: #060a13;
  color: #d1d9e6; font-family: var(--mono); font-size: 13.5px; line-height: 1.55;
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, .8); overflow: hidden; animation: pop .14s ease;
}
.term-bar { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid rgba(148, 163, 184, .13); background: #0b1120; color: #8391a9; font-size: 12px; }
.term-dots { display: flex; gap: 6px; }
.term-dots i { width: 10px; height: 10px; border-radius: 50%; background: #f87171; opacity: .8; }
.term-dots i:nth-child(2) { background: #fbbf24; }
.term-dots i:nth-child(3) { background: #34d399; }
.term-title { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-close { padding: 2px 7px; border: 1px solid rgba(148, 163, 184, .24); border-radius: 5px; color: #8391a9; font-family: var(--mono); font-size: 11px; }
.term-close:hover { color: #e8edf5; }
.term-body { height: min(440px, 62vh); overflow-y: auto; padding: 14px 16px; cursor: text; }
.t-line { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.55em; }
.t-cmd { color: #e8edf5; margin-top: 6px; }
.t-dim { color: #8391a9; }
.t-ok { color: #34d399; }
.t-err { color: #f87171; }
.t-acc { color: #5b9cff; }
.t-line a { color: #5b9cff; text-decoration: underline; text-underline-offset: 3px; }
.term-line { display: flex; gap: 8px; margin-top: 6px; }
.term-prompt { color: #34d399; white-space: nowrap; }
.term-line input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: #e8edf5; font: inherit; caret-color: #34d399; }
.footer-bottom button { display: inline-flex; align-items: center; gap: 6px; font-size: inherit; color: inherit; transition: color .15s; }
.footer-bottom button:hover { color: var(--text); }
@media (max-width: 640px) {
  .term { padding: 8vh 10px 10px; }
  .term-box { font-size: 12.5px; }
  .term-prompt { display: none; }
  .term-line::before { content: "$"; color: #34d399; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.98); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 250; padding: 10px 16px; border-radius: 10px;
  background: var(--btn-bg); color: var(--btn-text); font-size: 14px; font-weight: 500; box-shadow: var(--shadow);
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .footer-top { grid-template-columns: 1fr 1fr 1fr; }
  .footer-about { grid-column: 1 / -1; }
  .card-feature { grid-template-columns: 1fr; }
  .card-feature .card-media { min-height: 0; aspect-ratio: 16 / 8; border-right: 0; border-bottom: 1px solid var(--border); }
  .card-feature .card-body { padding: 24px; }
}
@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .hero { padding: 80px 16px 72px; }
  .section { padding: 64px 16px; }
  .nav { gap: 12px; }
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0; margin: 0; padding: 8px 12px 12px;
    flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; font-size: 15px; }
  .menu-btn { display: grid; }
  .kbd-btn { display: none; }
  .hide-sm { display: none; }
  .work-grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .facts li { border-left: 0; border-top: 1px solid var(--border); }
  .facts li:first-child { border-top: 0; }
  .footer-top { grid-template-columns: 1fr 1fr; gap: 32px 24px; padding-top: 44px; padding-bottom: 36px; }
  .footer-about { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 12px; }
  .contact { grid-template-columns: 1fr; gap: 36px; }
  .form { padding: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .email-chip a { font-size: 13px; padding: 0 10px 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pulse::after, .palette, .palette-box, .term, .term-box { animation: none; }
  .card-media img { transition: none; }
  .card:hover { transform: none; }
  .media-diagram svg { transition: none; }
  .card:hover .media-diagram svg { transform: none; }
}
@media (max-width: 860px) {
  .skill-grid { grid-template-columns: 1fr 1fr; }
  .card-split { grid-template-columns: 1fr; }
  .card-split .card-body { padding: 24px; }
  .scan { margin: 0 20px 20px; }
}
@media (max-width: 720px) {
  .highlights { grid-template-columns: 1fr 1fr; margin-top: 48px; }
  .highlights li:nth-child(3) { border-left: 0; }
  .highlights li:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .highlights b { font-size: 22px; }
  .section-head h2 { font-size: 28px; }
  .skill-grid { grid-template-columns: 1fr; }
  .timeline::before { left: 6px; }
  .tl-item { grid-template-columns: 1fr; gap: 10px; padding-left: 30px; }
  .tl-dot { left: 0; top: 3px; }
  .tl-when { padding-top: 0; text-align: left; }
  .tl-card { padding: 18px; }
}

/* ---------- Hero portrait ---------- */
.hero-grid { display: grid; grid-template-columns: 1fr 300px; gap: 56px; align-items: center; }
.portrait {
  position: relative; border: 1px solid var(--border); border-radius: 20px; padding: 8px;
  background: var(--bg-elev); box-shadow: var(--shadow);
}
.portrait img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; }
.portrait figcaption {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 8px 6px; font-size: 13px; color: var(--text-2);
}
.portrait figcaption b { display: block; color: var(--text); font-weight: 600; font-size: 14px; }
.portrait .open { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--border); font-size: 12px; white-space: nowrap; }
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 0; }
  .portrait { order: -1; width: 112px; padding: 4px; border-radius: 50%; margin-bottom: 28px; }
  .portrait img { border-radius: 50%; }
  .portrait figcaption { display: none; }
}
.brand span { white-space: nowrap; }

/* ---------- Skills: provenance + section intro ---------- */
.section-head--stack { flex-direction: column; align-items: flex-start; gap: 8px; }
.section-head--stack p { color: var(--text-2); font-size: 15px; }

/* ---------- Contact lines ---------- */
.contact-lines { display: grid; gap: 10px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); font-size: 14.5px; max-width: 360px; }
.contact-lines li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; color: var(--text); }
.contact-lines li > span:first-child { color: var(--text-3); font-size: 13.5px; }
.contact-lines a:hover { text-decoration: underline; text-underline-offset: 3px; }
.contact-lines .dim-arrow { color: var(--text-3); }

/* ---------- Card links ---------- */
.card .tags { margin-top: auto; }
.card-links { display: flex; gap: 18px; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 14px; font-weight: 500; }
.card-links a { color: var(--accent); transition: opacity .15s; }
.card-links a:hover { opacity: .8; text-decoration: underline; text-underline-offset: 3px; }
.card-links a + a { color: var(--text-2); font-weight: 400; }

/* ---------- Now line ---------- */
.now { display: flex; align-items: center; gap: 10px; margin-top: 28px; font-size: 13.5px; color: var(--text-2); }
.now-tag {
  flex: none; padding: 2px 8px; border-radius: 6px; font-family: var(--mono); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .06em; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* ---------- How I work ---------- */
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; counter-reset: none; }
.step { display: flex; flex-direction: column; gap: 10px; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); position: relative; }
.step-num { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.step h3 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.step p { font-size: 14px; color: var(--text-2); line-height: 1.6; flex: 1; }
.steps-note { margin-top: 24px; font-size: 14.5px; color: var(--text-2); max-width: 720px; }
.steps-note a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
.steps-note a:hover { text-decoration-color: var(--text-3); }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .steps { grid-template-columns: 1fr; } .now { align-items: flex-start; } }

/* ---------- Interaction feedback: every button and box reacts to hover and press ---------- */
.btn, .icon-btn, .kbd-btn, .pill, .socials a, .copy, .footer-social a, .term-close, .footer-bottom button {
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s, filter .15s, transform .12s;
}
.btn-light:hover { box-shadow: 0 6px 20px -6px color-mix(in srgb, var(--btn-bg) 70%, transparent); transform: translateY(-1px); }
.btn-outline:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); transform: translateY(-1px); }
.pill:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
.icon-btn:hover, .socials a:hover { color: var(--accent); }
.btn:active, .icon-btn:active, .kbd-btn:active, .pill:active, .socials a:active, .copy:active,
.footer-social a:active, .term-close:active, .footer-bottom button:active { transform: scale(.95); filter: brightness(.95); }

.step, .highlights li, .tl-card, .skill-card, .portrait, .contact-lines li {
  transition: border-color .2s, transform .2s, box-shadow .2s, background .2s;
}
.step:hover, .tl-card:hover, .skill-card:hover, .portrait:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); transform: translateY(-2px); box-shadow: var(--shadow);
}
.highlights li:hover { background: var(--bg-hover); }
.highlights li:first-child:hover { border-radius: var(--radius) 0 0 var(--radius); }
.highlights li:last-child:hover { border-radius: 0 var(--radius) var(--radius) 0; }
.highlights li:hover b { color: var(--accent); }
.step:hover .step-num, .skill-card:hover .skill-icon { color: var(--accent-2); }
.card:active, .step:active, .tl-card:active, .skill-card:active { transform: translateY(0) scale(.99); }
.tags li { transition: border-color .15s, color .15s; }
.tags li:hover { border-color: var(--border-strong); color: var(--text); }
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--text-3); }
@media (max-width: 720px) {
  .highlights li:hover { border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .btn:hover, .btn:active, .icon-btn:active, .kbd-btn:active, .pill:active, .socials a:active, .copy:active,
  .footer-social a:active, .term-close:active, .footer-bottom button:active,
  .step:hover, .tl-card:hover, .skill-card:hover, .portrait:hover,
  .card:active, .step:active, .tl-card:active, .skill-card:active { transform: none; }
}

/* ---------- Utilities ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
