/* ==========================================================
   Muhib Ullah — Portfolio design system
   ========================================================== */
:root {
  --bg: #F7F8F5;
  --paper: #FFFFFF;
  --ink: #20251F;
  --muted: #626960;
  --accent: #315E45;
  --accent-hover: #244A35;
  --accent-soft: #EAF0E9;
  --accent-light: #8FBF9F;
  --line: #E1E5DE;
  --dark: #20251F;
  --on-dark: #F2F4EF;
  --on-dark-muted: #A9B1A6;
  --line-dark: #3A4237;

  --f-head: "Manrope", system-ui, sans-serif;
  --f-body: "Inter", system-ui, sans-serif;
  --f-serif: "Instrument Serif", Georgia, serif;

  --t-display: clamp(2.6rem, 1.6rem + 4.4vw, 5.25rem);
  --t-h2: clamp(1.9rem, 1.3rem + 2.2vw, 3.1rem);
  --t-h3: clamp(1.35rem, 1.1rem + .9vw, 1.85rem);
  --t-lead: clamp(1.06rem, 1rem + .3vw, 1.25rem);
  --t-body: 1rem;
  --t-small: .875rem;
  --t-meta: .78rem;

  --s-1: .5rem; --s-2: 1rem; --s-3: 1.5rem; --s-4: 2rem; --s-5: 3rem; --s-6: 4.5rem;
  --section: clamp(4.5rem, 3rem + 6vw, 9rem);
  --gutter: clamp(1.25rem, .5rem + 3vw, 3rem);
  --max: 1240px;
  --ease: cubic-bezier(.2,.7,.2,1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--t-body)/1.65 var(--f-body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, h4 { font-family: var(--f-head); margin: 0; line-height: 1.12; letter-spacing: -.02em; font-weight: 700; }
p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
svg { display: block; width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -3rem; background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 100; }
.skip:focus { top: 1rem; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.small { font-size: var(--t-small); color: var(--muted); }

/* ---------- Type primitives ---------- */
.eyebrow, .label, .role__n, .case__n, .edu__head { font: 600 var(--t-meta)/1.4 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.label { display: flex; align-items: center; gap: .5rem; margin-bottom: var(--s-4); }
.label span { color: var(--accent); }
.label::after { content: ""; flex: 1; height: 1px; background: var(--line); max-width: 120px; }
.label--light { color: var(--on-dark-muted); }
.label--light span { color: var(--accent-light); }
.label--light::after { background: var(--line-dark); }
.display { font-size: var(--t-display); font-weight: 800; letter-spacing: -.035em; line-height: 1.02; }
.display em, .pull { font-family: var(--f-serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; }
.display em { color: var(--accent); }
.h2 { font-size: var(--t-h2); max-width: 16ch; }
.h2--wide { max-width: 22ch; margin-bottom: var(--s-6); }
.h3 { font-size: var(--t-h3); }
.lead { font-size: var(--t-lead); line-height: 1.55; color: var(--muted); max-width: 52ch; }
.lead--light { color: var(--on-dark-muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; min-height: 48px; padding: 0 1.4rem; background: var(--accent); color: var(--paper); font: 600 .94rem/1 var(--f-body); text-decoration: none; border: 1px solid var(--accent); border-radius: 2px; transition: background .2s, border-color .2s, color .2s; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--small { min-height: 40px; padding: 0 1rem; font-size: .86rem; }
.link-arrow { font-weight: 600; text-decoration: none; color: var(--accent); border-bottom: 1px solid currentColor; padding-bottom: 2px; }
.link-arrow::after { content: " →"; }
.link-arrow:hover { color: var(--accent-hover); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }

/* ---------- Header ---------- */
.header { position: sticky; top: 0; z-index: 50; background: transparent; border-bottom: 1px solid transparent; transition: background .25s, border-color .25s; }
.header.is-scrolled { background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-color: var(--line); }
.header__inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { text-decoration: none; display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font: 800 1rem/1.1 var(--f-head); letter-spacing: .06em; }
.brand__role { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; align-items: center; gap: var(--s-4); }
.nav ul { display: flex; gap: var(--s-3); }
.nav ul a { text-decoration: none; font-size: .92rem; font-weight: 500; color: var(--muted); padding: .4rem 0; position: relative; }
.nav ul a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px; background: var(--accent); transition: right .25s var(--ease); }
.nav ul a:hover, .nav ul a.is-active { color: var(--ink); }
.nav ul a.is-active::after, .nav ul a:hover::after { right: 0; }
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.25fr .9fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; padding-block: clamp(3rem, 2rem + 5vw, 7rem) clamp(3rem, 2rem + 4vw, 6rem); }
.hero__text > * + * { margin-top: var(--s-3); }
.hero .display { max-width: 13ch; }
.meta-line { display: flex; align-items: center; gap: .6rem; font-size: var(--t-small); color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); flex: none; }
.hero .actions { margin-top: var(--s-5); }
.hero__art { background: var(--paper); border: 1px solid var(--line); padding: clamp(.75rem, 2vw, 1.5rem); }
.hero__art figcaption { font-size: var(--t-meta); color: var(--muted); margin-top: .75rem; font-style: italic; }
.flow .spine { stroke-dasharray: 1400; stroke-dashoffset: 0; }
.js .flow .spine { stroke-dashoffset: 1400; animation: draw 2.2s var(--ease) .3s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.workflow-current { stroke-dasharray: 5 9; }
.workflow-feedback { stroke-dasharray: 3 5; opacity: .6; }
.workflow-row { fill: var(--paper); stroke: var(--line); transition: fill .2s, stroke .2s; }
.workflow-stage:hover .workflow-row { fill: var(--accent-soft); stroke: var(--accent); }
.workflow-number { font-size: 10px; font-weight: 500; fill: var(--accent); }
.workflow-detail { font-size: 10px; font-weight: 400; fill: var(--muted); }
.workflow-halo { fill: var(--accent-soft); stroke: var(--accent); stroke-width: .7; opacity: .35; transform-box: fill-box; transform-origin: center; }
.workflow-stage:nth-child(2) { --stage-delay: 1.4s; }
.workflow-stage:nth-child(3) { --stage-delay: 2.8s; }
.workflow-stage:nth-child(4) { --stage-delay: 4.2s; }
.workflow-stage:nth-child(5) { --stage-delay: 5.6s; }
@media (prefers-reduced-motion: no-preference) {
  .workflow-current { animation: workflow-stream 2s linear infinite; }
  .workflow-feedback { animation: workflow-feedback 2s linear infinite; }
  .workflow-halo { animation: workflow-stage 7s ease-in-out var(--stage-delay, 0s) infinite; }
}
@keyframes workflow-stream { to { stroke-dashoffset: -28; } }
@keyframes workflow-feedback { to { stroke-dashoffset: -16; } }
@keyframes workflow-stage { 0%, 24%, 100% { opacity: .35; transform: scale(1); } 10% { opacity: .85; transform: scale(1.15); } }

/* ---------- Highlights ---------- */
.highlights { border-block: 1px solid var(--line); background: var(--paper); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); }
.stats > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: .4rem; padding: var(--s-4) var(--s-3); border-left: 1px solid var(--line); }
.stats > div:first-child { border-left: 0; padding-left: 0; }
.stats dd { font: 700 clamp(2.4rem, 1.8rem + 2vw, 3.6rem)/1 var(--f-head); letter-spacing: -.04em; }
.stats dt { font-size: var(--t-small); color: var(--muted); max-width: 20ch; }
.highlights__note { border-top: 1px solid var(--line); padding-block: var(--s-2); font-size: var(--t-small); color: var(--muted); }

/* ---------- Sections ---------- */
.section { padding-block: var(--section); }
.section--rule { border-top: 1px solid var(--line); }
.section--tint { background: var(--accent-soft); }
.split { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(2rem, 5vw, 6rem); align-items: start; }
.prose > * + * { margin-top: 1.1em; }
.prose { color: var(--muted); max-width: 60ch; }
.pull { font-size: clamp(1.35rem, 1.1rem + .8vw, 1.7rem); line-height: 1.35; color: var(--ink); border-left: 2px solid var(--accent); padding-left: var(--s-3); }

/* Timeline */
.timeline { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: var(--s-6); position: relative; }
.timeline::before { content: ""; position: absolute; top: 15px; left: 0; right: 0; height: 1px; background: linear-gradient(to right, var(--line), var(--accent)); }
.timeline li { position: relative; padding-top: 52px; padding-right: var(--s-3); }
.timeline__n { position: absolute; top: 0; left: 0; width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid var(--ink); background: var(--bg); font: 600 .74rem var(--f-body); }
.timeline li.is-current .timeline__n { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.timeline h3 { font-size: 1.15rem; }
.timeline p { font-size: var(--t-small); color: var(--muted); margin-top: .25rem; }
.timeline__tag { display: inline-block; margin-top: .75rem; font-family: var(--f-serif); font-style: italic; font-size: 1.1rem; color: var(--accent); }

/* Roles */
.role { display: grid; grid-template-columns: 220px 1fr; gap: clamp(1.5rem, 4vw, 4rem); padding-block: var(--s-5); border-top: 1px solid var(--line); }
.role__meta { font-size: var(--t-small); color: var(--muted); display: flex; flex-direction: column; gap: .5rem; }
.role__dates { font: 600 1rem var(--f-head); color: var(--ink); }
.role__overview { font-size: var(--t-lead); margin-top: .75rem; max-width: 56ch; line-height: 1.55; }
.role--current { border-top: 2px solid var(--ink); }
.role--current .role__n { color: var(--accent); }
.role--current .h3 { font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.4rem); }
.role__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s-4); margin-top: var(--s-4); }
.ticks { margin-top: var(--s-3); }
.role__cols .ticks { margin-top: 0; }
.ticks li { position: relative; padding: .6rem 0 .6rem 1.4rem; border-bottom: 1px solid var(--line); font-size: .95rem; color: var(--muted); }
.ticks li::before { content: ""; position: absolute; left: 0; top: 1.15rem; width: 8px; height: 1px; background: var(--accent); }
.ticks--2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s-4); }
.callout { margin-top: var(--s-4); background: var(--accent-soft); padding: var(--s-3); border-left: 2px solid var(--accent); max-width: 70ch; }
.callout span { display: block; font: 600 var(--t-meta) var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: .4rem; }

/* Work (dark) */
.work { background: var(--dark); color: var(--on-dark); }
.work .h2 { color: var(--on-dark); }
.case { display: grid; gap: clamp(2rem, 5vw, 5rem); align-items: center; margin-top: var(--s-6); padding-top: var(--s-6); border-top: 1px solid var(--line-dark); }
.case--a { grid-template-columns: 1.15fr 1fr; }
.case--b { grid-template-columns: 1fr 1fr; }
.case__art { border: 1px solid var(--line-dark); padding: clamp(.75rem, 2vw, 1.5rem); }
.case__art--grid { background-image: linear-gradient(var(--line-dark) 1px, transparent 1px), linear-gradient(90deg, var(--line-dark) 1px, transparent 1px); background-size: 28px 28px; background-color: var(--dark); }
.case__art--enterprise { padding: 1rem; background: var(--dark); }
.dashboard-type { font-family: var(--f-head); letter-spacing: 0; }
.dashboard-sync { stroke-dasharray: 4 5; }
@media (prefers-reduced-motion: no-preference) {
  .dashboard-sync { animation: flow 3s linear infinite; }
  .dashboard-trend { stroke-dasharray: 100; animation: dashboard-trace 7s var(--ease) infinite; }
  .dashboard-live { animation: dashboard-pulse 3s ease-in-out infinite; }
  .dashboard-progress { animation: dashboard-progress 5s ease-in-out infinite; }
}
@keyframes dashboard-trace { 0% { stroke-dashoffset: 100; } 35%, 100% { stroke-dashoffset: 0; } }
@keyframes dashboard-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes dashboard-progress { 0%, 100% { opacity: .7; } 50% { opacity: 1; } }
.case__note { font-size: var(--t-meta); color: var(--on-dark-muted); font-style: italic; margin-top: .75rem; }
.case__n { color: var(--accent-light); }
.case .h3 { color: var(--on-dark); margin: .5rem 0 var(--s-3); font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.3rem); }
.case__dl > div { display: grid; grid-template-columns: 130px 1fr; gap: var(--s-2); padding-block: .85rem; border-top: 1px solid var(--line-dark); }
.case__dl dt { font-size: var(--t-meta); text-transform: uppercase; letter-spacing: .1em; color: var(--on-dark-muted); padding-top: .2rem; }
.case__dl dd { font-size: .95rem; color: var(--on-dark); }
.feed-lines path { stroke-dasharray: 4 5; }
@media (prefers-reduced-motion: no-preference) { .feed-lines path { animation: flow 3s linear infinite; } }
@keyframes flow { to { stroke-dashoffset: -36; } }

/* Approach */
.steps { display: grid; grid-template-columns: repeat(5, 1fr); position: relative; }
.steps::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 1px; background: var(--ink); }
.steps li { position: relative; padding: var(--s-5) var(--s-3) 0 0; }
.steps li::before { content: ""; position: absolute; top: 0; left: 0; width: 13px; height: 13px; border: 1px solid var(--ink); background: var(--bg); border-radius: 50%; }
.steps li:last-child::before { background: var(--accent); border-color: var(--accent); border-radius: 0; }
.steps__n { font: 400 2.4rem/1 var(--f-serif); font-style: italic; color: var(--accent); }
.steps h3 { font-size: 1.1rem; margin: .8rem 0 .6rem; }
.steps p { font-size: .93rem; color: var(--muted); }

/* Skills */
.skills { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: var(--s-5); margin-top: var(--s-6); border-top: 1px solid var(--ink); padding-top: var(--s-4); }
.skills h3 { font-size: 1rem; margin-bottom: var(--s-2); }
.skills li { padding: .5rem 0; border-bottom: 1px solid color-mix(in srgb, var(--accent) 18%, transparent); font-size: .95rem; color: var(--muted); }
.skills__group--main h3 { color: var(--accent); }
.skills__group--main ul { columns: 2; column-gap: var(--s-4); }
.skills__group--main li { break-inside: avoid; color: var(--ink); }

/* Education */
.edu { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(2rem, 5vw, 6rem); }
.edu__head { margin-bottom: var(--s-2); }
.edu__item { display: grid; grid-template-columns: 110px 1fr; gap: var(--s-2); padding-block: var(--s-3); border-top: 1px solid var(--line); }
.edu__date { font: 600 .9rem var(--f-head); }
.edu h4 { font-size: 1.15rem; margin-bottom: .3rem; }
.edu__item p { color: var(--muted); font-size: .95rem; }
.edu__item .small { margin-top: .6rem; }
.certs li { padding: var(--s-2) 0; border-top: 1px solid var(--line); font-family: var(--f-head); font-weight: 600; }

/* Contact */
.contact { padding-block: var(--section); border-top: 1px solid var(--line); background: var(--paper); }
.contact__inner > * + * { margin-top: var(--s-3); }
.display--contact { max-width: 16ch; font-size: clamp(2.4rem, 1.5rem + 4vw, 4.75rem); }
.contact__links { margin-top: var(--s-5) !important; padding-top: var(--s-4); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-4); }
.contact__mail { font: 600 clamp(1.15rem, .9rem + 1.2vw, 1.8rem) var(--f-head); text-decoration: none; color: var(--accent); word-break: break-all; }
.contact__mail:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 6px; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding-block: var(--s-4); }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--s-3); }
.footer__links { display: flex; gap: var(--s-3); }
.footer__links a { font-size: var(--t-small); text-decoration: none; color: var(--muted); }
.footer__links a:hover { color: var(--accent); }

/* Reveal */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .nav ul { gap: var(--s-2); }
  .steps { grid-template-columns: repeat(3, 1fr); row-gap: var(--s-5); }
  .steps::before { display: none; }
  .skills { grid-template-columns: 1fr 1fr; }
  .skills__group--main { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .menu-btn { display: inline-flex; flex-direction: column; justify-content: center; gap: 6px; width: 44px; height: 44px; background: none; border: 1px solid var(--line); cursor: pointer; padding: 0 11px; }
  .menu-btn span { height: 1.5px; background: var(--ink); transition: transform .25s; }
  .menu-btn[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }
  .js .nav { position: fixed; inset: 72px 0 auto 0; background: var(--bg); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: var(--s-2) var(--gutter) var(--s-4); gap: var(--s-3); display: none; }
  .js .nav.is-open { display: flex; }
  .js .nav ul { flex-direction: column; gap: 0; }
  .js .nav ul a { display: block; padding: .9rem 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; color: var(--ink); }
  .js .nav ul a::after { display: none; }
  .js .nav .btn { justify-content: center; }
  html:not(.js) .menu-btn { display: none; }
  html:not(.js) .header__inner { height: auto; flex-wrap: wrap; padding-block: 1rem; gap: 1rem; }
  html:not(.js) .nav { flex-wrap: wrap; }

  .hero { grid-template-columns: 1fr; }
  .hero__art { max-width: 520px; }
  .split, .edu { grid-template-columns: 1fr; }
  .role { grid-template-columns: 1fr; gap: var(--s-2); }
  .role__meta { flex-direction: row; flex-wrap: wrap; gap: .25rem 1.25rem; align-items: center; }
  .role__meta br { display: none; }
  .case--a, .case--b { grid-template-columns: 1fr; }
  .case--b .case__art { order: -1; }
}

@media (max-width: 700px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats > div { padding: var(--s-3) var(--s-2); border-left: 0; border-top: 1px solid var(--line); }
  .stats > div:nth-child(-n+2) { border-top: 0; }
  .stats > div:nth-child(even) { border-left: 1px solid var(--line); padding-left: var(--s-3); }
  .stats > div:first-child { padding-left: var(--s-2); }
  .stats > div:nth-child(odd) { padding-left: 0; }
  .timeline { grid-template-columns: 1fr; gap: var(--s-4); }
  .timeline::before { top: 0; bottom: 0; left: 15px; right: auto; width: 1px; height: auto; background: linear-gradient(var(--line), var(--accent)); }
  .timeline li { padding: 4px 0 0 52px; }
  .role__cols, .ticks--2 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; row-gap: 0; }
  .steps::before { display: block; top: 0; bottom: 0; left: 6px; right: auto; width: 1px; height: auto; }
  .steps li { padding: 0 0 var(--s-4) var(--s-4); }
  .steps__n { font-size: 1.8rem; }
  .steps h3 { margin-top: .3rem; }
  .skills { grid-template-columns: 1fr; }
  .skills__group--main ul { columns: 1; }
  .case__dl > div { grid-template-columns: 1fr; gap: .25rem; }
  .edu__item { grid-template-columns: 1fr; gap: .4rem; }
  .actions .btn { flex: 1 1 100%; justify-content: center; }
  .contact__links { flex-direction: column; align-items: flex-start; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  .js .flow .spine { stroke-dashoffset: 0; }
}
