/* ============================================================
   Abdullah Waseem — "Signal on Paper"
   Swiss/International-style single-page portfolio.
   Palette: regulatory paper + signal orange.
   ============================================================ */

:root {
  --paper: #F6F4EF;
  --ink: #14130F;
  --accent: #E8490F;        /* large text & graphics only */
  --accent-deep: #B93607;   /* small accent text on paper (WCAG AA) */
  --accent-bright: #FF6A33; /* small accent text on ink */
  --muted: #6E6A5E;
  --hairline: #DAD6CA;
  --hairline-ink: rgba(246, 244, 239, 0.22);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --font-display: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, "SF Mono", monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection { background: var(--accent); color: var(--paper); }

.mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.accent { color: var(--accent); }

.container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 24px;
}

.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: top 150ms var(--ease);
}
.skip-link:focus { top: 8px; }

/* ---------- Grid overlay easter egg (press "g") ---------- */
.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms var(--ease);
}
body.show-grid .grid-overlay { opacity: 1; }
.grid-overlay__inner {
  max-width: 1200px;
  height: 100%;
  margin-inline: auto;
  padding-inline: 24px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
}
.grid-overlay__inner span {
  background: rgba(232, 73, 15, 0.05);
  border-inline: 1px solid rgba(232, 73, 15, 0.18);
}

/* ---------- Left progress rail ---------- */
.rail {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 32px;
  width: 1px;
  background: var(--hairline);
  z-index: 80;
  display: none;
}
.rail__marker {
  position: absolute;
  left: -3.5px;
  top: 0;
  width: 8px;
  height: 8px;
  background: var(--accent);
  will-change: transform;
}
@media (min-width: 1360px) {
  .rail { display: block; }
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-inline: 24px;
  background: rgba(246, 244, 239, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.topbar__mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-stretch: 115%;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  flex-shrink: 0;
}
.topbar__dot { color: var(--accent); }
.topbar__nav {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.topbar__nav::-webkit-scrollbar { display: none; }
.nav-link {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  white-space: nowrap;
  padding-block: 4px;
  transition: color 150ms var(--ease);
}
.nav-link:hover { color: var(--ink); }
.nav-link .num { color: var(--ink); transition: color 150ms var(--ease); }
.nav-link.active { color: var(--ink); }
.nav-link.active .num { color: var(--accent-deep); }

/* ---------- Section skeleton ---------- */
.section { padding-block: 128px; }

.section-head {
  position: relative;
  margin-bottom: 64px;
}
.section-rule {
  display: block;
  height: 1px;
  background: var(--hairline);
}
html:not(.no-js) .section-rule {
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 500ms var(--ease);
}
.in-view .section-rule, .section-head.in-view .section-rule { transform: scaleX(1); }
.section-marker {
  position: absolute;
  top: -0.5em;
  left: 0;
  background: var(--paper);
  padding-right: 16px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}
.section--ink .section-rule { background: var(--hairline-ink); }
.section--ink .section-marker { background: var(--ink); color: var(--paper); opacity: 0.75; }

.section-sub {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.25rem;
  margin: -40px 0 48px;
  color: var(--muted);
}

/* Ink inversion panels */
.section--ink {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- Reveal system ---------- */
html:not(.no-js) .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 500ms var(--ease), transform 500ms var(--ease);
  transition-delay: calc(var(--d, 0) * 60ms);
}
html:not(.no-js) .in-view .reveal,
html:not(.no-js) .reveal.in-view {
  opacity: 1;
  transform: none;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 56px;
  overflow: hidden;
}
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero__grid { position: relative; width: 100%; }
.hero__kicker { color: var(--muted); margin-bottom: 40px; }
.hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-stretch: 118%;
  font-size: clamp(3.25rem, 10vw, 8.5rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-transform: none;
  margin-bottom: 32px;
}
.hero__title .line { display: block; overflow: hidden; }
.hero__title .line-inner { display: block; }
html:not(.no-js) .hero__title .line-inner {
  transform: translateY(110%);
  transition: transform 700ms var(--ease);
}
html:not(.no-js) .hero__title .line:nth-child(2) .line-inner { transition-delay: 120ms; }
html:not(.no-js) body.loaded .hero__title .line-inner,
body.loaded .hero__title .line-inner { transform: translateY(0); }

.hero__tagline {
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  line-height: 1.5;
  max-width: 34ch;
  margin-bottom: 48px;
}
.hero__foot {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--muted);
}
.hero__scroll { color: var(--muted); text-decoration: none; transition: color 150ms var(--ease); }
.hero__scroll:hover { color: var(--accent-deep); }
.hero__orgs { display: none; }
@media (min-width: 640px) { .hero__orgs { display: inline; } }

/* ---------- 01 About ---------- */
.about__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 56px;
}
@media (min-width: 900px) {
  .about__grid { grid-template-columns: 4fr 7fr; column-gap: 96px; }
}
.facts-label { color: var(--muted); margin-bottom: 16px; }
.facts { border-top: 1px solid var(--hairline); }
.facts__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 12px;
  border-bottom: 1px solid var(--hairline);
}
.facts__row dt { color: var(--muted); flex-shrink: 0; }
.facts__row dd { text-align: right; }
.about__lede {
  font-family: var(--font-display);
  font-weight: 500;
  font-stretch: 110%;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 32px;
}
.lede-square {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  margin-right: 16px;
  vertical-align: 0.35em;
}
.about__body p + p { margin-top: 20px; }
.about__body { max-width: 68ch; }
.pullquote {
  margin-top: 40px;
  padding-left: 24px;
  border-left: 3px solid var(--accent);
}
.pullquote p {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.375rem;
  line-height: 1.4;
  color: var(--ink);
}

/* ---------- 02 Experience ---------- */
.xp-list {
  list-style: none;
  position: relative;
  border-top: 1px solid var(--hairline);
}
.xp-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 28px 0 28px 40px;
  border-bottom: 1px solid var(--hairline);
  transition: padding-left 200ms var(--ease);
}
@media (min-width: 900px) {
  .xp-row {
    grid-template-columns: 150px 1.1fr 1fr;
    column-gap: 40px;
    padding-left: 48px;
  }
}
/* rail: base line + energizing segment + node */
.xp-list::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 5px;
  width: 2px;
  background: var(--hairline);
}
.xp-seg {
  position: absolute;
  top: 0;
  left: 5px;
  width: 2px;
  height: 100%;
  background: var(--accent);
}
html:not(.no-js) .xp-seg {
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 600ms var(--ease);
}
.xp-row.in-view .xp-seg { transform: scaleY(1); }
.xp-node {
  position: absolute;
  top: 36px;
  left: 1px;
  width: 10px;
  height: 10px;
  background: var(--paper);
  border: 1px solid var(--muted);
  transition: background 300ms var(--ease), border-color 300ms var(--ease);
}
.xp-row.in-view .xp-node { background: var(--accent); border-color: var(--accent); }
.xp-row--current.in-view .xp-node { animation: node-pulse 2.4s var(--ease) infinite; }
@keyframes node-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 73, 15, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(232, 73, 15, 0); }
}
.xp-row:hover { padding-left: 52px; }
@media (max-width: 899px) { .xp-row:hover { padding-left: 44px; } }

.xp-date { color: var(--muted); padding-top: 4px; }
.xp-role {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1875rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.xp-org { color: var(--muted); font-weight: 500; }
.xp-detail p { color: var(--ink); font-size: 0.9375rem; }
.xp-tags { color: var(--accent-deep); margin-top: 10px; }

/* ---------- 03 Projects ---------- */
.proj-grid {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--hairline);
  border-left: 1px solid var(--hairline);
}
@media (min-width: 640px) { .proj-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .proj-grid { grid-template-columns: repeat(3, 1fr); } }
.cell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 230px;
  padding: 28px;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  text-decoration: none;
  background: var(--paper);
  color: var(--ink);
  transition: background 150ms var(--ease), color 150ms var(--ease);
}
.cell__index { color: var(--muted); transition: color 150ms var(--ease); }
.cell__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.375rem;
  letter-spacing: -0.01em;
}
.cell__desc { font-size: 0.9375rem; color: var(--muted); transition: color 150ms var(--ease); flex-grow: 1; }
.cell__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  color: var(--muted);
  transition: color 150ms var(--ease);
}
.cell__go { color: var(--accent-deep); transition: color 150ms var(--ease); }
.cell:hover, .cell:focus-visible {
  background: var(--ink);
  color: var(--paper);
}
.cell:hover .cell__index, .cell:focus-visible .cell__index { color: var(--accent-bright); }
.cell:hover .cell__desc, .cell:hover .cell__meta,
.cell:focus-visible .cell__desc, .cell:focus-visible .cell__meta { color: rgba(246, 244, 239, 0.7); }
.cell:hover .cell__go, .cell:focus-visible .cell__go { color: var(--accent-bright); }

/* ---------- 04 Skills ---------- */
.skills__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
}
@media (min-width: 900px) { .skills__grid { grid-template-columns: repeat(3, 1fr); column-gap: 64px; } }
.skill-col__head {
  color: var(--muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 4px;
}
.skill-rows { list-style: none; }
.skill-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-block: 12px;
  border-bottom: 1px solid var(--hairline);
  position: relative;
}
.skill-row::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--hairline);
  flex-shrink: 0;
  align-self: center;
  transition: background 150ms var(--ease);
}
.skill-row:hover::before { background: var(--accent); }
.skill-name { font-size: 0.9375rem; font-weight: 500; }
.skill-row::after {
  content: "";
  flex-grow: 1;
  border-bottom: 1px dotted var(--hairline);
  transform: translateY(-4px);
  order: 2;
  min-width: 24px;
}
.skill-name { order: 1; }
.skill-note { order: 3; color: var(--muted); font-size: 0.6875rem; text-align: right; }

/* ---------- 06 Education ---------- */
.edu-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding-block: 28px;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
@media (min-width: 900px) {
  .edu-row { grid-template-columns: 150px 1.1fr 1fr; column-gap: 40px; align-items: baseline; }
}
.edu-row__where { color: var(--muted); }
.edu-row__what h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1875rem;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.edu-row__school { color: var(--muted); margin-top: 4px; }
.edu-row__note { font-size: 0.9375rem; color: var(--ink); }

/* ---------- 07 Contact / footer ---------- */
.footer { padding-bottom: 48px; }
.footer__headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-stretch: 118%;
  font-size: clamp(2.25rem, 6vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin-bottom: 56px;
  max-width: 16ch;
}
.footer__links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 96px;
  color: rgba(246, 244, 239, 0.55);
}
.footer__links a {
  color: var(--accent-bright);
  text-decoration: none;
  position: relative;
}
.footer__links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 2px;
  background: var(--accent-bright);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms var(--ease);
}
.footer__links a:hover::after { transform: scaleX(1); }

.footer__bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 40px;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--hairline-ink);
  color: rgba(246, 244, 239, 0.5);
  font-size: 0.6875rem;
}
.footer__clock { font-variant-numeric: tabular-nums; }
.footer__square {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--accent);
  margin-left: 10px;
}
.footer__top {
  display: inline-block;
  margin-top: 40px;
  color: rgba(246, 244, 239, 0.55);
  text-decoration: none;
  transition: color 150ms var(--ease);
}
.footer__top:hover { color: var(--accent-bright); }

/* ---------- Print ---------- */
@media print {
  .topbar, .rail, .grid-overlay, .hero__canvas, .hero__foot, .footer__top { display: none; }
  .section { padding-block: 32px; }
  .hero { min-height: auto; padding-block: 48px; }
  .section--ink { background: none; color: var(--ink); }
  .section--ink *, .footer__links, .footer__links a, .footer__bar { color: var(--ink) !important; }
  .section--ink .section-marker { background: #fff; opacity: 1; }
  body { background: #fff; }
  html:not(.no-js) .reveal,
  html:not(.no-js) .hero__title .line-inner {
    opacity: 1 !important;
    transform: none !important;
  }
  html:not(.no-js) .section-rule { transform: scaleX(1); }
  html:not(.no-js) .xp-seg { transform: scaleY(1); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html:not(.no-js) .reveal,
  html:not(.no-js) .hero__title .line-inner {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html:not(.no-js) .section-rule { transform: scaleX(1); transition: none; }
  html:not(.no-js) .xp-seg { transform: scaleY(1); transition: none; }
  .xp-row--current.in-view .xp-node { animation: none; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
