/* =========================================================================
   Usman Asim Saikhu — Personal Portfolio
   Plain HTML + CSS + vanilla JS. No build step.
   ========================================================================= */

/* ----------------------------- Design tokens ----------------------------- */
:root {
  --bg: #FBFAF7;
  --surface: #ffffff;
  --ink: #1a1a17;
  --ink2: #3c3b34;
  --muted: #7c7a70;
  --faint: #aaa79c;
  --line: #e9e6dd;
  --line2: #f2f0ea;
  --navbg: rgba(251, 250, 247, 0.8);
  --shadow: 0 18px 40px -22px rgba(26, 26, 23, 0.42);

  /* Accent (default: Slate). Swap to another preset to re-tint the site. */
  --accent: #54607a;
  /* Cobalt #3a559e · Forest #3f6b52 · Clay #a85a43 */

  --green: #3a9d6a;

  --font-sans: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --maxw: 1080px;
  --pad-inline: clamp(20px, 5vw, 40px);
  --sec-pad: clamp(38px, 5.5vw, 60px);
}

.theme-dark {
  --bg: #141412;
  --surface: #1c1c19;
  --ink: #f3f1ea;
  --ink2: #cac7bd;
  --muted: #928f85;
  --faint: #6c695f;
  --line: #2c2b26;
  --line2: #232320;
  --navbg: rgba(20, 20, 18, 0.82);
  --shadow: 0 22px 52px -24px rgba(0, 0, 0, 0.72);
}

/* ----------------------------- Reset / base ----------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--ink2);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background 0.5s, color 0.5s;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

/* Cross-fade for surfaces when theme changes */
.surf {
  transition: background 0.5s, border-color 0.5s, color 0.5s;
}

/* Container */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--pad-inline);
}

/* Sections */
main > section {
  padding-block: var(--sec-pad);
  scroll-margin-top: 90px;
}
#about {
  scroll-margin-top: 90px;
}

/* Reveal-on-scroll */
[data-reveal] {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.75s cubic-bezier(0.16, 0.84, 0.44, 1),
              transform 0.75s cubic-bezier(0.16, 0.84, 0.44, 1);
  will-change: opacity, transform;
}
[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* Keyboard focus — visible accent ring for all interactive elements */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) {
  outline: none;
}

/* Scroll-progress indicator (width driven by main.js via transform) */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: var(--accent);
  z-index: 60;
  pointer-events: none;
  will-change: transform;
}

/* =============================== NAV =============================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: 64px;
  background: var(--navbg);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
}
.brand-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.brand-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--faint);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: clamp(13px, 2.2vw, 26px);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  transition: color 0.25s;
}
.nav-link:hover,
.nav-link.is-active {
  color: var(--ink);
}
.nav-resume {
  color: var(--ink);
  font-weight: 500;
}
.nav-resume:hover {
  color: var(--accent);
}

.theme-toggle {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: border-color 0.4s, transform 0.4s, background 0.5s, color 0.5s;
}
.theme-toggle:hover {
  border-color: var(--ink);
  transform: rotate(35deg);
}

.contact-pill {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 7px 14px;
  border-radius: 100px;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.contact-pill:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* =============================== HERO =============================== */
.hero {
  padding-top: clamp(100px, 13vh, 140px);
  padding-bottom: clamp(32px, 4.5vw, 52px);
}

.hero-grid {
  display: flex;
  gap: clamp(32px, 6vw, 72px);
  flex-wrap: wrap-reverse;
  align-items: flex-end;
}
.hero-text {
  flex: 1 1 460px;
  min-width: 300px;
}
.hero-photo {
  flex: 0 0 auto;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 100px;
  padding: 6px 13px 6px 11px;
  margin-bottom: 30px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink2);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulseDot 2.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.82); }
}

.h1 {
  font-weight: 700;
  font-size: clamp(2.5rem, 6.4vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: 24px;
}

.tagline {
  font-size: clamp(1.08rem, 2vw, 1.32rem);
  line-height: 1.55;
  color: var(--ink2);
  max-width: 30em;
  text-wrap: pretty;
  margin-bottom: 28px;
}
.tagline strong {
  color: var(--ink);
  font-weight: 600;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
}
.meta-loc {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.meta-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
}
.meta-email {
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: color 0.25s, border-color 0.25s;
}
.meta-email:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 100px;
  transition: transform 0.25s, box-shadow 0.25s, background 0.25s, border-color 0.25s, color 0.25s;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.btn-secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.btn-secondary:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}
.mono-arrow {
  font-family: var(--font-mono);
}

/* Photo */
.photo-wrap {
  position: relative;
  width: clamp(160px, 21vw, 240px);
}
.photo-frame {
  position: absolute;
  inset: -10px -10px auto auto;
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  pointer-events: none;
}
.photo {
  width: 100%;
  aspect-ratio: 1260 / 1666;
  object-fit: cover;
  object-position: center top;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
}

/* Stats */
.stats {
  margin-top: clamp(32px, 5vw, 56px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.stat {
  padding: 26px 24px;
  border-right: 1px solid var(--line2);
}
.stat:first-child {
  padding-left: 0;
}
.stat:last-child {
  border-right: none;
  padding-right: 0;
}
/* 2×2 on small screens — even columns, balanced dividers */
@media (max-width: 560px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat {
    padding: 22px 18px;
    border-bottom: 1px solid var(--line2);
  }
  .stat:nth-child(odd) {
    padding-left: 0;
  }
  .stat:nth-child(even) {
    border-right: none;
    padding-right: 0;
  }
  .stat:nth-last-child(-n + 2) {
    border-bottom: none;
  }
}
.stat-val {
  font-size: clamp(1.7rem, 3.2vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.stat-label {
  margin-top: 11px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ====================== Section header (numbered) ====================== */
.sec-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: clamp(20px, 2.6vw, 32px);
}
.sec-num {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
}
.sec-title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
}

/* Supporting intro paragraph under a section header */
.sec-intro {
  font-size: clamp(1.02rem, 1.7vw, 1.18rem);
  line-height: 1.6;
  color: var(--ink2);
  max-width: 54em;
  text-wrap: pretty;
  margin: -10px 0 clamp(20px, 3vw, 30px);
}
.sec-intro strong {
  color: var(--ink);
  font-weight: 600;
}

/* =============================== 01 FOCUS =============================== */
.focus-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}
.focus-card {
  flex: 1 1 280px;
  min-width: 240px;
  background: var(--surface);
  padding: clamp(22px, 2.6vw, 30px);
  transition: background 0.3s;
}
.focus-card:hover {
  background: var(--line2);
}
.card-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--faint);
}
.focus-card h3 {
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--ink);
  margin: 14px 0 12px;
}
.focus-card p {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

/* =============================== 02 EXPERIENCE =============================== */
.exp-entry {
  display: flex;
  gap: clamp(20px, 4vw, 44px);
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding: clamp(22px, 2.6vw, 30px) 0;
}
.exp-close {
  border-top: 1px solid var(--line);
}
.exp-pt {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--faint);
  margin-left: 8px;
  vertical-align: middle;
}
.exp-body em {
  font-style: italic;
  color: var(--ink);
}
.exp-meta {
  width: clamp(120px, 16vw, 180px);
  flex: 0 0 auto;
}
.exp-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.exp-loc {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 6px;
}
.exp-main {
  flex: 1 1 420px;
  min-width: 280px;
}
.exp-role {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
}
.exp-org {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
  margin: 7px 0 16px;
}
.exp-body {
  font-size: 1rem;
  line-height: 1.62;
  color: var(--ink2);
  max-width: 46em;
}
.exp-body strong {
  color: var(--ink);
  font-weight: 600;
}
/* Metric-led bullets under an experience lead sentence */
.exp-bullets {
  list-style: none;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: 46em;
}
.exp-bullets li {
  position: relative;
  padding-left: 20px;
  font-size: 0.97rem;
  line-height: 1.55;
  color: var(--ink2);
  text-wrap: pretty;
}
.exp-bullets li::before {
  content: "—";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-family: var(--font-mono);
}
.exp-bullets strong {
  color: var(--ink);
  font-weight: 600;
}
.targets {
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
}
.targets-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--faint);
  margin-bottom: 14px;
}
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.targets .chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--ink2);
}

/* =============================== 04 TOOLKIT =============================== */
.toolkit {
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
}
.tk-col {
  flex: 1 1 210px;
  min-width: 180px;
  padding: clamp(18px, 2.2vw, 24px) 28px clamp(18px, 2.2vw, 24px) 0;
}
.tk-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--faint);
  margin-bottom: 16px;
}
.tk-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.tk-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tk-chips .chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink2);
  padding: 6px 12px;
  border-radius: 8px;
  transition: border-color 0.25s;
}
.tk-chips .chip:hover {
  border-color: var(--accent);
}
/* Open-source highlight row under the toolkit grid */
.tk-os {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: clamp(22px, 3vw, 30px);
  padding-top: clamp(22px, 3vw, 30px);
  border-top: 1px solid var(--line);
}
.tk-os-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--faint);
}
.tk-os-link {
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color 0.25s, color 0.25s;
}
.tk-os-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.tk-os-link .mono-arrow {
  font-family: var(--font-mono);
  color: var(--accent);
}

/* =============================== 05 PUBLICATIONS =============================== */
.pub-group {
  display: flex;
  gap: clamp(20px, 4vw, 44px);
  padding: clamp(20px, 2.4vw, 28px) 0;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.pub-close {
  border-top: 1px solid var(--line);
}
.pub-year {
  width: 64px;
  flex: 0 0 64px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.pub-items {
  flex: 1 1 420px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.pub-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.pub-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 9px;
}
.pub-selected {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
}
.pub-title {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.32;
  color: var(--ink);
  text-wrap: pretty;
}
.pub-authors {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
  margin-top: 8px;
}
.pub-me {
  color: var(--ink);
  font-weight: 600;
}
.pub-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  margin-top: 12px;
  transition: border-color 0.25s, color 0.25s;
}
.pub-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* =============================== 07 RECOGNITION =============================== */
.recognition {
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
}
.rec-col {
  flex: 1 1 280px;
  min-width: 240px;
  padding: clamp(18px, 2.2vw, 24px) 28px clamp(8px, 1.2vw, 12px) 0;
}
.rec-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--faint);
  margin-bottom: 8px;
}
.rec-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line2);
}
.rec-item:last-child {
  border-bottom: none;
}
.rec-item-title {
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
}
.rec-item-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

/* =============================== 08 CONTACT =============================== */
.contact {
  padding-top: clamp(44px, 6vw, 76px) !important;
  padding-bottom: clamp(36px, 4.5vw, 56px) !important;
}
.contact-statement {
  font-size: clamp(1.6rem, 4.4vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
  max-width: 16em;
  text-wrap: pretty;
  margin-bottom: clamp(32px, 5vw, 48px);
}
.email-big {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  font-weight: 600;
  color: var(--ink);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 6px;
  transition: gap 0.3s;
}
.email-big:hover {
  gap: 18px;
}
/* Email + résumé stacked, left-aligned, with breathing room */
.contact-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(22px, 3vw, 30px);
}
.resume-cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 100px;
  padding: 12px 20px;
  transition: border-color 0.25s, transform 0.25s;
}
.resume-cta:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}
.resume-cta-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.resume-cta-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
}
.resume-cta .mono-arrow {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 600;
}
/* Socials: clean single-line links, divider above */
.socials {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(20px, 4vw, 38px);
  margin-top: clamp(40px, 6vw, 58px);
  padding-top: clamp(26px, 4vw, 34px);
  border-top: 1px solid var(--line);
}
.social-link {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
}
.social-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  transition: color 0.25s;
}
.social-handle {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  transition: color 0.25s;
}
.social-arrow {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  transition: color 0.25s, transform 0.25s;
}
.social-link:hover .social-name,
.social-link:hover .social-handle {
  color: var(--accent);
}
.social-link:hover .social-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* =============================== FOOTER =============================== */
.footer {
  border-top: 1px solid var(--line);
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px var(--pad-inline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.footer-left {
  color: var(--muted);
}
.footer-center {
  color: var(--faint);
}
.footer-top {
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: color 0.25s;
}
.footer-top:hover {
  color: var(--ink);
}

/* =============================== RESPONSIVE NAV =============================== */
/* On narrow screens, drop the in-page section links so the nav stays uncrowded —
   Résumé, theme toggle, and Contact remain reachable. */
@media (max-width: 640px) {
  .nav-right {
    gap: 14px;
  }
  .nav-link[data-nav] {
    display: none;
  }
}
@media (max-width: 460px) {
  .brand-tag {
    display: none;
  }
}
