/* ============================================================
   Saadat Hussain — Portfolio
   Warm editorial: bone paper, serif display, hairline system.
   ============================================================ */

:root {
  --paper:      #f4f1ea;
  --paper-deep: #ece6db;
  --ink:        #1a1917;
  --ink-2:      #4f4a42;
  --faint:      #8a847890;
  --faint-solid:#8a8478;
  --rule:       #ded6c7;
  --rule-soft:  #e6dfd2;
  --accent:     #a24e2c;   /* warm sienna, used sparingly */
  --accent-2:   #7d3d22;
  --accent-tint: rgba(162, 78, 44, 0.10);

  --serif: 'Fraunces', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans:  'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --measure: 680px;
  --gutter: clamp(20px, 5vw, 40px);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: 'kern', 'liga', 'calt';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.01em; }
p { margin: 0; }

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

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.nowrap { white-space: nowrap; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  z-index: 200;
}
.skip-link:focus { left: 8px; top: 8px; border-radius: 4px; }

/* ---------- Masthead ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(120%) blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}
.masthead.scrolled { border-bottom-color: var(--rule); }

.masthead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.wordmark {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.masthead-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}
.masthead-nav a {
  font-size: 14.5px;
  color: var(--ink-2);
  position: relative;
  transition: color 0.18s ease;
}
.masthead-nav a:hover { color: var(--ink); }
.masthead-nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s ease;
}
.masthead-nav a:hover::after { transform: scaleX(1); }
.nav-cv { color: var(--ink) !important; }

/* ---------- Intro ---------- */
main { padding-bottom: clamp(70px, 12vw, 130px); }

.intro {
  padding-top: clamp(56px, 12vw, 120px);
  padding-bottom: clamp(48px, 9vw, 90px);
}
.kicker {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint-solid);
  margin-bottom: 26px;
}
.display {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 11vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin-bottom: 32px;
}
.lede {
  font-size: clamp(1.15rem, 2.6vw, 1.42rem);
  line-height: 1.5;
  color: var(--ink);
  max-width: 34ch;
  max-width: 40ch;
  margin-bottom: 28px;
}
.lede .nowrap { border-bottom: 1px solid var(--accent); }
.locator {
  font-size: 15px;
  color: var(--ink-2);
  margin-bottom: 26px;
}
.avail { color: var(--faint-solid); }

.inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.inline-links a {
  font-size: 15px;
  color: var(--ink);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.18s ease, color 0.18s ease;
}
.inline-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Blocks / section heads ---------- */
.block { padding: clamp(40px, 7vw, 68px) 0; }
.block-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 34px;
}
.block-head h2 {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3.4vw, 1.7rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  white-space: nowrap;
}
.block-head .rule {
  flex: 1;
  height: 1px;
  background: var(--rule);
  transform: translateY(-4px);
}

/* ---------- About prose ---------- */
.prose p {
  color: var(--ink-2);
  font-size: 1.06rem;
  line-height: 1.7;
  margin-bottom: 18px;
  max-width: 62ch;
}
.prose p:last-child { margin-bottom: 0; }

/* ---------- Experience ---------- */
.roles { list-style: none; margin: 0; padding: 0; }
.role {
  padding: 30px 0;
  border-top: 1px solid var(--rule-soft);
}
.role:first-child { border-top: 0; padding-top: 0; }

.role-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
}
.role-top h3 {
  font-size: 1.16rem;
  font-weight: 500;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 12px;
}
.role-title { color: var(--ink); }
.role-co {
  color: var(--accent);
  position: relative;
  padding-left: 15px;
}
.role-co::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 5px; height: 5px;
  margin-top: -2px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.55;
}
.role-years {
  font-size: 14px;
  color: var(--faint-solid);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.role-context {
  font-size: 14.5px;
  color: var(--faint-solid);
  margin: 8px 0 16px;
}
.notes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 11px;
}
.notes li {
  position: relative;
  padding-left: 22px;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.62;
  max-width: 64ch;
}
.notes li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 8px;
  height: 1px;
  background: var(--accent);
}

/* ---------- Skills ---------- */
.skills { margin: 0; }
.skill-row {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 8px 28px;
  padding: 16px 0;
  border-top: 1px solid var(--rule-soft);
}
.skill-row:first-child { border-top: 0; padding-top: 0; }
.skill-row dt {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint-solid);
  padding-top: 2px;
}
.skill-row dd {
  margin: 0;
  color: var(--ink);
  font-size: 1.04rem;
}

/* ---------- Projects ---------- */
.projects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--rule-soft);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  overflow: hidden;
}
.project {
  background: var(--paper);
  padding: 26px 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: background 0.25s ease;
}
.project:hover { background: var(--paper-deep); }
.project-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.project-head h3 {
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 500;
}
.project-year {
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint-solid);
}
.project p {
  color: var(--ink-2);
  font-size: 0.99rem;
  line-height: 1.6;
}
.project-tech {
  margin-top: auto;
  font-size: 14px;
  color: var(--faint-solid) !important;
}
.project-tech a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-tint);
  transition: border-color 0.2s ease;
}
.project-tech a:hover { border-bottom-color: var(--accent); }

/* ---------- Contact ---------- */
.contact-lead {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.015em;
  max-width: 22ch;
  margin-bottom: 28px;
}
.contact-email {
  display: inline-block;
  font-size: clamp(1.05rem, 2.4vw, 1.28rem);
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 3px;
  margin-bottom: 30px;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.contact-email:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--rule);
  padding: 26px 0;
}
.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13.5px;
  color: var(--faint-solid);
}
.footer-row a { transition: color 0.18s ease; }
.footer-row a:hover { color: var(--accent); }

/* ---------- Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s cubic-bezier(.2,.7,.2,1), transform 0.7s cubic-bezier(.2,.7,.2,1);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .projects { grid-template-columns: 1fr; }
  .skill-row { grid-template-columns: 1fr; gap: 4px; padding: 14px 0; }
  .skill-row dt { padding-top: 0; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .masthead-nav { gap: 18px; }
  .masthead-nav a[href="#work"],
  .masthead-nav a[href="#skills"],
  .masthead-nav a[href="#projects"] { display: none; }
  .role-top { gap: 4px; }
  .role-years { order: 2; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .masthead-nav a::after { transition: none; }
}
