/* Faizan Saleem — portfolio
   Concept: a career drawn as a request trace. Cool grey paper by day, deep navy by night.
   Type: Schibsted Grotesk (loaded in index.html), system fallbacks below. */

/* ---------- Tokens ---------- */
:root {
  --paper: #f2f4f5;
  --surface: #ffffff;
  --sunken: #e8ebee;
  --ink: #121826;
  --slate: #515b6b;
  --rule: #d4d9df;
  --signal: #2a4bd7;
  --signal-ink: #ffffff;
  --live: #0f8a5f;
  --span-past: #9aa9d9;

  --sans: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Perfect-fourth scale on a 16px base */
  --t-sm: .8125rem;   /* 13 */
  --t-base: 1rem;     /* 16 */
  --t-md: 1.3125rem;  /* 21 */
  --t-lg: 1.75rem;    /* 28 */
  --t-xl: 2.375rem;   /* 38 */
  --t-name: clamp(3.75rem, 11vw, 8.5rem);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  color-scheme: light;
  interpolate-size: allow-keywords;
}

html[data-theme=dark] {
  --paper: #0e1320;
  --surface: #151c2c;
  --sunken: #1b2336;
  --ink: #e8ecf3;
  --slate: #9ba5b7;
  --rule: #273148;
  --signal: #8fa5ff;
  --signal-ink: #0e1320;
  --live: #3dd68c;
  --span-past: #4a5a8c;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--t-base)/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--signal); color: var(--signal-ink); }

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
p { text-wrap: pretty; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .22em; }
button { font: inherit; color: inherit; cursor: pointer; }
a, button, summary { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 2px; }

.shell { width: min(1160px, 100% - 48px); margin-inline: auto; }
.section { padding-block: 96px; border-top: 1px solid var(--rule); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: fixed; top: -80px; left: 16px; z-index: 50;
  padding: 10px 16px;
  background: var(--ink); color: var(--paper);
  border-radius: var(--r-sm);
}
.skip:focus { top: 12px; }

.live-dot {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--live);
}

/* ---------- Buttons & links ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid var(--signal);
  border-radius: var(--r-sm);
  background: var(--signal);
  color: var(--signal-ink);
  font-size: 15px; font-weight: 600;
  text-decoration: none;
  transition: filter .2s var(--ease), transform .15s var(--ease);
}
.button:hover { filter: brightness(1.08); }
.button:active { transform: translateY(1px); }
.button-quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.button-quiet:hover { filter: none; border-color: var(--slate); background: var(--surface); }

.text-link { font-weight: 600; text-decoration: underline; text-decoration-color: var(--rule); transition: text-decoration-color .2s var(--ease); }
.text-link:hover { text-decoration-color: currentColor; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
@supports (backdrop-filter: blur(1px)) {
  .site-header {
    background: color-mix(in srgb, var(--paper) 84%, transparent);
    backdrop-filter: saturate(1.5) blur(14px);
    -webkit-backdrop-filter: saturate(1.5) blur(14px);
  }
}
.header-row { display: flex; align-items: center; gap: 32px; min-height: 68px; }
.wordmark { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; text-decoration: none; }

nav { display: flex; gap: 28px; margin-left: auto; font-size: 15px; }
nav a { padding-block: 8px; color: var(--slate); text-decoration: none; transition: color .2s var(--ease); }
nav a:hover, nav a.active { color: var(--ink); }
nav a.active { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 8px; text-decoration-color: var(--signal); }

.theme-toggle {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.theme-toggle:hover { border-color: var(--slate); background: var(--surface); }
.theme-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
/* Icon shows the theme you switch to. */
.icon-sun, html[data-theme=dark] .icon-moon { display: none; }
html[data-theme=dark] .icon-sun { display: block; }

/* ---------- Hero ---------- */
.hero { padding-block: 72px 88px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 340px); gap: 64px; align-items: end; }

.hero-role { font-size: var(--t-md); font-weight: 500; color: var(--slate); letter-spacing: -0.01em; }
h1 {
  margin: 12px 0 28px;
  font-size: var(--t-name);
  font-weight: 800;
  line-height: .9;
  letter-spacing: -0.055em;
  margin-left: -0.05em; /* optical alignment of the S and F with the text column */
}
.hero-lede { max-width: 36ch; font-size: var(--t-md); line-height: 1.5; letter-spacing: -0.01em; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 28px; margin-top: 32px; }
.hero-meta { display: flex; align-items: start; gap: 10px; margin-top: 36px; font-size: 14px; color: var(--slate); }
.hero-meta .live-dot { margin-top: .5em; }

.portrait { overflow: hidden; border-radius: var(--r-lg); background: var(--sunken); aspect-ratio: 900 / 1170; }
.portrait picture, .portrait img { display: block; width: 100%; height: 100%; }
.portrait img { object-fit: cover; object-position: center 20%; }

/* ---------- Career trace ---------- */
.trace {
  margin-top: 80px;
  padding: 28px 32px 32px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  --label: 300px;
}
.trace-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 20px; }
.trace-title { font-size: var(--t-base); font-weight: 700; letter-spacing: 0; }
.trace-total { font-size: 14px; color: var(--slate); font-variant-numeric: tabular-nums; }

.trace-axis {
  position: relative;
  height: 20px;
  margin-left: var(--label);
  font-size: 12px; color: var(--slate);
  font-variant-numeric: tabular-nums;
}
.trace-axis span { position: absolute; left: calc(var(--at) / 120 * 100%); transform: translateX(-50%); }
.trace-axis span:first-child { transform: none; }
.trace-axis span:last-child { transform: translateX(-100%); }

.trace-spans li { display: grid; grid-template-columns: var(--label) 1fr; align-items: center; border-top: 1px solid var(--rule); }
.trace-spans a { display: grid; padding: 12px 16px 12px 0; text-decoration: none; }
.trace-spans a strong { font-size: 15px; font-weight: 600; }
.trace-spans a span { font-size: 13px; color: var(--slate); }
.trace-spans a:hover strong { text-decoration: underline; }

/* Year gridlines: 10 years across the track */
.track {
  position: relative;
  align-self: stretch;
  background-image: linear-gradient(to right, var(--rule) 1px, transparent 1px);
  background-size: 20% 100%;
  border-right: 1px solid var(--rule);
}
.span {
  position: absolute; top: 50%;
  left: calc(var(--from) / 120 * 100%);
  width: calc((var(--to) - var(--from)) / 120 * 100%);
  height: 14px;
  margin-top: -7px;
  border-radius: 4px;
  background: var(--span-past);
  transform-origin: left;
}
.is-live .span { background: var(--signal); }
.is-live .span::after {
  content: "";
  position: absolute; top: 50%; right: -5px;
  width: 10px; height: 10px; margin-top: -5px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--live);
}

/* The page's one orchestrated moment: spans draw in like a trace rendering. */
@media (prefers-reduced-motion: no-preference) {
  .span { animation: draw .7s var(--ease) calc(.25s + var(--i) * .18s) both; }
  .is-live .span::after { animation: appear .3s var(--ease) 1.3s both; }
  .live-dot::after {
    content: ""; position: absolute; inset: 0;
    border-radius: 50%;
    background: var(--live);
    animation: ping 2.4s var(--ease) 1.6s 3;
  }
}
@keyframes draw { from { transform: scaleX(0); } }
@keyframes appear { from { opacity: 0; transform: scale(.4); } }
@keyframes ping { 70%, 100% { transform: scale(2.6); opacity: 0; } }

/* ---------- Section headings ---------- */
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 32px; margin-bottom: 48px; }
.section-head h2, .about h2, .contact h2 { font-size: var(--t-xl); letter-spacing: -0.03em; }
.section-head p { max-width: 40ch; color: var(--slate); }

/* ---------- Work ---------- */
.case {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 32px 56px;
  margin-bottom: 24px;
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
}
.case-context { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; color: var(--slate); }
.case-context strong { color: var(--ink); font-weight: 600; }
.case h3 { margin: 12px 0 16px; font-size: var(--t-lg); letter-spacing: -0.025em; }
.case-body > p:not(.case-context) { max-width: 52ch; color: var(--slate); }

.case-facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 12px 32px; margin-top: 28px; }
.case-facts dt { font-size: 13px; color: var(--slate); }
.case-facts dd { font-size: 15px; font-weight: 600; text-wrap: balance; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.tags li { padding: 3px 10px; border-radius: var(--r-sm); background: var(--sunken); font-size: 13px; color: var(--slate); }

/* Diagrams */
.diagram {
  align-self: center;
  padding: 28px 24px;
  background: var(--sunken);
  border-radius: var(--r-md);
  font-size: 13px;
  text-align: center;
}
.clients, .tenants { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.clients > div, .tenants > div {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 6px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
}
.tenants > div { gap: 0; font-weight: 600; }
.tenants small { font-size: 12px; font-weight: 400; color: var(--slate); }
.clients svg { width: 22px; height: 22px; fill: none; stroke: var(--signal); stroke-width: 1.6; }
.fan-in { width: 67%; height: 20px; margin-inline: auto; border: 1px solid var(--slate); border-top: 0; border-radius: 0 0 6px 6px; opacity: .5; }
.drop { width: 1px; height: 20px; margin-inline: auto; background: var(--slate); opacity: .5; }
.fan-in + .core, .fan-in + .tool { margin-top: 20px; position: relative; }
.fan-in + .core::before, .fan-in + .tool::before { content: ""; position: absolute; left: 50%; top: -20px; width: 1px; height: 20px; background: var(--slate); opacity: .5; }
.core { display: grid; gap: 2px; padding: 18px 12px; border-radius: var(--r-sm); background: var(--ink); color: var(--paper); }
.core strong { font-size: 16px; }
.core span { font-size: 13px; opacity: .75; }
.tool { display: inline-block; padding: 8px 16px; border: 1px solid var(--signal); border-radius: var(--r-sm); background: var(--surface); color: var(--signal); font-weight: 600; }
.infra { display: flex; justify-content: center; gap: 8px; }
.infra span { padding: 6px 10px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--surface); font-size: 12px; }

.highlights { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 32px; padding-top: 28px; border-top: 1px solid var(--rule); }
.highlights h4 { margin-bottom: 6px; font-size: 15px; letter-spacing: 0; }
.highlights p { font-size: 15px; color: var(--slate); }

/* Disclosure */
.more { grid-column: 1 / -1; border-top: 1px solid var(--rule); }
summary {
  display: flex; align-items: center; gap: 12px;
  width: fit-content;
  padding-block: 18px 0;
  font-size: 15px; font-weight: 600;
  list-style: none;
  cursor: pointer;
}
summary::-webkit-details-marker { display: none; }
summary:hover { color: var(--signal); }
.plus { position: relative; width: 12px; height: 12px; transition: transform .3s var(--ease); }
.plus::before, .plus::after { content: ""; position: absolute; top: 5px; left: 0; width: 12px; height: 2px; border-radius: 1px; background: currentColor; }
.plus::after { transform: rotate(90deg); transition: transform .3s var(--ease); }
details[open] .plus::after { transform: rotate(0deg); }
details::details-content {
  block-size: 0;
  overflow: hidden;
  transition: block-size .35s var(--ease), content-visibility .35s allow-discrete;
}
details[open]::details-content { block-size: auto; }

.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; padding-top: 20px; }
.more-grid h4 { margin-bottom: 6px; font-size: 15px; letter-spacing: 0; }
.more-grid p, .more > p { font-size: 15px; color: var(--slate); }
.more > p { padding-top: 12px; max-width: 64ch; }

.minor-cases { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 48px; }
.minor-cases article { padding-top: 28px; border-top: 2px solid var(--ink); }
.minor-cases h3 { margin: 10px 0 12px; font-size: var(--t-md); letter-spacing: -0.015em; }
.minor-cases p:not(.case-context) { max-width: 52ch; color: var(--slate); }
.minor-cases .tags { margin-top: 20px; }

.markets { margin-top: 64px; padding-top: 28px; border-top: 2px solid var(--ink); }
.markets-title { font-size: var(--t-md); letter-spacing: -0.015em; }
.markets ul { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 20px; }
.markets li { display: grid; gap: 6px; }
.markets li strong { font-size: 15px; font-weight: 600; }
.markets li span { color: var(--slate); }
.markets-note { margin-top: 20px; font-size: 14px; color: var(--slate); }

.also { max-width: 72ch; margin-top: 40px; color: var(--slate); }
.also strong { color: var(--ink); font-weight: 600; }

/* ---------- Experience ---------- */
.roles li, .education { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; padding-block: 32px; border-top: 1px solid var(--rule); }
.roles li:first-child { border-top: 2px solid var(--ink); }
.role-dates { font-size: 15px; color: var(--slate); font-variant-numeric: tabular-nums; }
.now-badge { display: flex; width: fit-content; margin-top: 6px; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--live); }
.role-body { max-width: 68ch; }
.role-body h3 { font-size: var(--t-md); letter-spacing: -0.015em; }
.role-org { margin: 2px 0 12px; font-weight: 600; color: var(--signal); }
.role-award { display: inline-block; margin-bottom: 12px; padding: 2px 10px; border-radius: var(--r-sm); background: var(--sunken); font-size: 13px; font-weight: 600; }
.role-body > p:not(.role-org, .role-award) { color: var(--slate); }
.role-body .more { margin-top: 16px; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 64px; }
.about-copy { max-width: 62ch; }
.about-copy p + p { margin-top: 18px; }
.about-copy p:not(.about-lead) { color: var(--slate); }
.about-lead { font-size: var(--t-md); line-height: 1.5; letter-spacing: -0.01em; }

.sub-head { margin: 80px 0 24px; font-size: var(--t-lg); letter-spacing: -0.025em; }
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.principles > div { padding-top: 20px; border-top: 2px solid var(--ink); }
.principles h4 { margin-bottom: 8px; font-size: 17px; letter-spacing: -0.01em; }
.principles p { color: var(--slate); }

.skills > div { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; padding-block: 16px; border-top: 1px solid var(--rule); }
.skills > div:first-child { border-top: 2px solid var(--ink); }
.skills dt { font-weight: 600; }
.skills dd { color: var(--slate); }

/* ---------- Contact ---------- */
.contact { padding-block: 112px; background: var(--ink); color: var(--paper); }
.contact ::selection { background: var(--paper); color: var(--ink); }
.contact :focus-visible { outline-color: var(--paper); }
.contact h2 { font-size: clamp(2.5rem, 7vw, 5rem); line-height: .95; letter-spacing: -0.045em; }
.contact-lede { max-width: 48ch; margin-top: 24px; font-size: var(--t-md); line-height: 1.5; opacity: .8; }
.contact-email {
  display: inline-block;
  margin-top: 48px;
  font-size: clamp(1.25rem, 3.6vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: .18em;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  transition: text-decoration-color .2s var(--ease);
}
.contact-email:hover { text-decoration-color: currentColor; }
.contact-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 32px; }
.contact .button-quiet { color: var(--paper); border-color: color-mix(in srgb, var(--paper) 30%, transparent); }
.contact .button-quiet:hover { border-color: var(--paper); background: color-mix(in srgb, var(--paper) 8%, transparent); }
.copy-status { font-size: 14px; opacity: .8; }

/* ---------- Footer ---------- */
.site-footer { display: flex; justify-content: space-between; gap: 16px; padding-block: 28px; font-size: 14px; color: var(--slate); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .highlights { grid-template-columns: 1fr 1fr; }
  .trace { --label: 240px; }
  .case { grid-template-columns: 1fr; padding: 32px; }
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 720px) {
  .shell { width: calc(100% - 32px); }
  .section { padding-block: 64px; }

  .header-row { flex-wrap: wrap; gap: 8px 16px; min-height: 0; padding-block: 12px; }
  .theme-toggle { margin-left: auto; }
  nav { order: 3; width: 100%; justify-content: space-between; gap: 12px; margin: 0; font-size: 14px; }
  nav a { padding-block: 4px; }

  .hero { padding-block: 40px 56px; }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .portrait { order: -1; width: min(220px, 60%); }
  .hero-role { font-size: 17px; }
  .hero-lede { font-size: 18px; }

    .trace-axis span:nth-child(even) { display: none; }
  .trace { margin-top: 56px; padding: 20px 16px 20px; }
  .trace-head { flex-direction: column; gap: 2px; }
  .trace-axis { margin-left: 0; }
  .trace-spans li { grid-template-columns: 1fr; }
  .trace-spans a { padding: 12px 0 8px; }
  .track { height: 28px; margin-bottom: 8px; }

  .section-head { display: block; margin-bottom: 32px; }
  .section-head p { margin-top: 12px; }
  .section-head h2, .about h2 { font-size: 30px; }
  .case { padding: 24px 20px; gap: 28px; }
  .case h3 { font-size: 24px; }
  .case-facts { grid-template-columns: 1fr 1fr; }
  .diagram { padding: 20px 12px; }
  .more-grid, .minor-cases, .principles, .markets ul, .highlights { grid-template-columns: 1fr; }
  .more-grid { gap: 20px; }

  .roles li, .education, .skills > div { grid-template-columns: 1fr; gap: 8px; }
  .roles li, .education { padding-block: 24px; }
  .sub-head { margin-top: 56px; font-size: 24px; }

  .contact { padding-block: 72px; }
  .site-footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  :root, html[data-theme=dark] { --paper: #fff; --surface: #fff; --sunken: #f3f3f3; --ink: #111; --slate: #444; --rule: #ccc; color-scheme: light; }
  body { font-size: 11pt; }
  .site-header, .skip, .hero-actions, .portrait, .contact-actions, .site-footer, .diagram, summary { display: none !important; }
  .hero { padding-block: 0 24px; }
  h1 { font-size: 40pt; }
  .section { padding-block: 24px; }
  .case, .trace { break-inside: avoid; padding: 16px; }
  details::details-content { block-size: auto; content-visibility: visible; }
  .contact { padding-block: 24px; background: #fff; color: #111; }
}
