/* Muhammad Fahad — portfolio
   Layout: one reading column; the hero pairs the thesis with a live integration map. */
:root {
  --bg: #f4f6f7;
  --surface: #ffffff;
  --fg: #142027;
  --muted: #55646d;
  --line: #d6dde1;
  --accent: #0b6b68;
  --accent-soft: #dcefed;
  --signal: #b86e00;
  --signal-soft: #fbefd9;
  --ok: #1d7a3a;
  --err: #b42318;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 10px;
  --wrap: 1080px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1418; --surface: #131d22; --fg: #e4ebee; --muted: #9aa9b1; --line: #26343b;
    --accent: #43c2b6; --accent-soft: #123432; --signal: #f0b04a; --signal-soft: #3a2a10;
    --ok: #5cc47f; --err: #ff8a80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1418; --surface: #131d22; --fg: #e4ebee; --muted: #9aa9b1; --line: #26343b;
  --accent: #43c2b6; --accent-soft: #123432; --signal: #f0b04a; --signal-soft: #3a2a10;
  --ok: #5cc47f; --err: #ff8a80;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg); color: var(--fg);
  font-family: var(--body); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.wrap {
  max-width: var(--wrap); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; text-wrap: balance; }
p { margin: 0; }
.eyebrow {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.skip {
  position: absolute; left: -999px; top: 8px; z-index: 50;
  background: var(--fg); color: var(--bg); padding: 8px 12px; border-radius: 6px;
}
.skip:focus { left: 16px; }

/* Top bar */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.05rem; color: var(--fg); text-decoration: none; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; font-weight: 600; }
.nav a:hover { color: var(--fg); }
.nav .cv { color: var(--accent); border: 1px solid var(--accent); border-radius: 6px; padding: 3px 10px; }
@media (max-width: 680px) { .nav a:not(.keep) { display: none; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer;
  font: 600 0.98rem var(--body); padding: 11px 18px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--bg);
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: 0.6; cursor: default; }

/* Hero */
.hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; padding-block: 64px 40px; }
.hero-text { min-width: 0; display: grid; gap: 20px; }
.hero h1 { font-size: clamp(2.4rem, 5.4vw, 4rem); font-weight: 800; letter-spacing: -0.02em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.role-line { font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: var(--fg); }
.role-line span { color: var(--muted); font-weight: 500; }
.status {
  display: inline-flex; align-items: center; gap: 10px; width: fit-content; max-width: 100%;
  font-family: var(--mono); font-size: 0.82rem; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
}
.status i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ctas { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 880px) { .hero .wrap { grid-template-columns: 1fr; gap: 32px; padding-block: 40px 24px; } }

/* Integration map */
.map { min-width: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 12px; }
.map-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.map svg { width: 100%; height: auto; display: block; }
.map .wire { stroke: var(--muted); stroke-opacity: 0.45; stroke-width: 1.5; fill: none; }
.map .pulse { stroke: var(--accent); stroke-width: 2; fill: none; stroke-dasharray: 6 140; animation: flow 3.2s linear infinite; }
.map .pulse.s { stroke: var(--signal); }
@keyframes flow { to { stroke-dashoffset: -146; } }
@media (prefers-reduced-motion: reduce) { .map .pulse { stroke-dasharray: none; opacity: 0.35; } }
.map .node rect { fill: var(--bg); stroke: var(--line); }
.map .node text { fill: var(--fg); font-family: var(--mono); font-size: 13px; font-weight: 500; }
.map .node .sub { fill: var(--muted); font-size: 10.5px; font-weight: 400; }
.map .core rect { fill: var(--accent-soft); stroke: var(--accent); }
.map .core text { fill: var(--fg); font-family: var(--display); font-size: 15px; font-weight: 700; }
.map .core .sub { fill: var(--accent); font-family: var(--mono); font-size: 10.5px; font-weight: 500; }
.map-cap { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
@media (max-width: 560px) {
  .map .node text { font-size: 17px; }
  .map .node .sub { display: none; }
  .map .core text { font-size: 18px; }
}

/* Figures */
.figures .wrap { padding-block: 8px 24px; }
.figs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.fig { padding: 20px 16px; display: grid; gap: 4px; align-content: start; }
.fig + .fig { border-left: 1px solid var(--line); }
.fig b { font-family: var(--display); font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.fig span { font-size: 0.9rem; color: var(--muted); line-height: 1.35; }
@media (max-width: 860px) {
  .figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fig + .fig { border-left: 0; }
  .fig { border-top: 1px solid var(--line); }
  .fig:nth-child(-n+2) { border-top: 0; }
  .fig:nth-child(even) { border-left: 1px solid var(--line); }
  .fig:last-child { grid-column: 1 / -1; border-left: 0; }
}

/* Sections */
section.block .wrap { padding-block: 56px; display: grid; gap: 28px; }
.sec-head { display: grid; gap: 8px; max-width: 46em; }
.sec-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 700; letter-spacing: -0.01em; }
.sec-head p { color: var(--muted); }

/* Work cards */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters button {
  font: 600 0.9rem var(--body); color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
.filters button[aria-pressed="true"] { color: var(--bg); background: var(--fg); border-color: var(--fg); }
.work { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .work { grid-template-columns: 1fr; } }
.card {
  min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; display: grid; gap: 12px; align-content: start;
}
.card .meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tag { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.when { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.card h3 { font-size: 1.3rem; font-weight: 700; }
.card h3 a { color: var(--fg); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card .org { color: var(--muted); font-size: 0.95rem; margin-top: -6px; }
.card ul { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; }
.card li::marker { color: var(--accent); }
.impact { font-size: 0.95rem; background: var(--signal-soft); color: var(--fg); border-radius: 6px; padding: 8px 12px; }
.impact b { color: var(--signal); font-family: var(--mono); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--mono); font-size: 0.75rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; background: var(--bg);
}
.more { font-weight: 600; text-decoration: none; }
.more:hover { text-decoration: underline; }

/* Experience timeline */
.timeline { display: grid; border-left: 2px solid var(--line); margin-left: 6px; }
.job { position: relative; padding: 0 0 28px 26px; display: grid; gap: 6px; min-width: 0; }
.job:last-child { padding-bottom: 0; }
.job::before {
  content: ""; position: absolute; left: -8px; top: 6px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.job.now::before { background: var(--accent); }
.job-top { display: flex; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; align-items: baseline; }
.job h3 { font-size: 1.2rem; font-weight: 700; }
.job h3 span { color: var(--muted); font-weight: 500; }
.job p { color: var(--muted); max-width: 46em; }
.job ul { margin: 4px 0 0; padding-left: 1.1em; color: var(--muted); display: grid; gap: 2px; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 32px; }
@media (max-width: 860px) { .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .skills { grid-template-columns: 1fr; } }
.skill { display: grid; gap: 8px; align-content: start; min-width: 0; }
.skill h3 { font-family: var(--mono); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.skill .chip { font-size: 0.8rem; color: var(--fg); background: var(--surface); }

/* Two-up cards (education, integrations) */
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .two { grid-template-columns: 1fr; } }
.two .card { gap: 6px; }

/* Integrations table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 600; white-space: nowrap; }

/* Contact */
.contact { background: var(--fg); color: var(--bg); }
.contact .wrap { padding-block: 64px; display: grid; gap: 28px; grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 820px) { .contact .wrap { grid-template-columns: 1fr; } }
.contact-info { display: grid; gap: 18px; min-width: 0; }
.contact h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); font-weight: 800; color: var(--bg); }
.contact p { color: color-mix(in srgb, var(--bg) 78%, var(--fg)); max-width: 40em; }
.contact .eyebrow { color: color-mix(in srgb, var(--bg) 70%, var(--fg)); }
.contact-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.mail {
  font-family: var(--mono); font-size: 1rem; color: var(--bg); user-select: all;
  border: 1px solid color-mix(in srgb, var(--bg) 35%, var(--fg)); border-radius: 8px; padding: 10px 14px;
  overflow-wrap: anywhere; text-decoration: none;
}
.contact .btn { background: var(--bg); color: var(--fg); border-color: var(--bg); }
.contact .btn.ghost { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 45%, var(--fg)); }
.note { font-family: var(--mono); font-size: 0.85rem; color: var(--bg); min-height: 1.3em; }
.form { min-width: 0; display: grid; gap: 14px; background: color-mix(in srgb, var(--bg) 6%, var(--fg)); border: 1px solid color-mix(in srgb, var(--bg) 18%, var(--fg)); border-radius: 12px; padding: 22px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.95rem; color: var(--bg); }
.form input, .form textarea {
  font: 400 1rem var(--body); color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%;
}
.form textarea { min-height: 130px; resize: vertical; }
.form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { font-size: 0.95rem; min-height: 1.4em; }
.form-status.ok { color: #9be3b0; }
.form-status.err { color: #ffb4ab; }

/* Footer */
footer .wrap { padding-block: 20px; font-size: 0.85rem; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
footer a { color: var(--muted); }

/* Case study pages */
.crumbs { font-size: 0.9rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.case-hero .wrap { padding-block: 40px 24px; display: grid; gap: 16px; }
.case-hero h1 { font-size: clamp(2rem, 4.6vw, 3.2rem); font-weight: 800; letter-spacing: -0.02em; }
.case-hero .lede { font-size: 1.15rem; color: var(--muted); max-width: 44em; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-block: 1px solid var(--line); margin-top: 8px; }
.facts div { padding: 14px 16px; display: grid; gap: 2px; min-width: 0; }
.facts div + div { border-left: 1px solid var(--line); }
.facts dt { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts div + div { border-left: 0; }
  .facts div:nth-child(even) { border-left: 1px solid var(--line); }
  .facts div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
.case-body .wrap { padding-block: 24px 64px; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 48px; align-items: start; }
@media (max-width: 900px) { .case-body .wrap { grid-template-columns: 1fr; gap: 32px; } }
.prose { display: grid; gap: 34px; min-width: 0; }
.prose section { display: grid; gap: 12px; }
.prose h2 { font-size: 1.5rem; font-weight: 700; }
.prose p { max-width: 42em; }
.prose ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; max-width: 42em; }
.prose li::marker { color: var(--accent); }
.results { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.result { background: var(--signal-soft); border-radius: 8px; padding: 14px 16px; display: grid; gap: 4px; }
.result b { font-family: var(--display); font-size: 1.5rem; color: var(--signal); line-height: 1.1; }
.result span { font-size: 0.92rem; }
.aside { position: sticky; top: 76px; display: grid; gap: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.aside h2 { font-family: var(--mono); font-size: 0.78rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.aside .group { display: grid; gap: 8px; }
@media (max-width: 900px) { .aside { position: static; } }
.pager { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 20px; }
.pager a { display: grid; gap: 2px; text-decoration: none; max-width: 48%; }
.pager a span { font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.pager a b { color: var(--fg); }
.pager a:last-child { text-align: right; margin-left: auto; }

/* 404 */
.notfound .wrap { padding-block: 96px; display: grid; gap: 18px; justify-items: start; }
.notfound h1 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 800; }
