/* ============================================================
   Zain Abedeen — portfolio (homepage)
   Corporate, restrained: deep navy + ivory, brass hairlines.
   Newsreader (headlines) · Inter (body)
   Subtle WebGL shaders in hero, portrait and contact only.
   (samples/ pages keep using styles.css)
   ============================================================ */

:root {
  --navy: #0a1a2f;
  --navy-2: #10243f;
  --navy-line: rgba(232, 228, 218, 0.14);
  --ivory: #f7f5f0;
  --paper: #ffffff;
  --tint: #efece4;
  --ink: #14202e;
  --ink-2: #3b4757;
  --muted: #667180;
  --line: #ddd8cc;
  --brass: #a8834a;
  --brass-soft: #c9ad7f;
  --on-navy: #eef0f2;
  --on-navy-muted: #a9b4c2;
  --ok: #2f7a4f; --warn: #a06b12; --bad: #a83a32;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  background: var(--ivory); color: var(--ink);
  font-family: var(--sans); font-size: 1rem; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
ul, ol { list-style: none; }
::selection { background: var(--navy); color: var(--ivory); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 300; background: var(--paper); color: var(--ink); padding: 10px 16px; }
.skip-link:focus { top: 16px; }

.label, .kicker {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
}
.label { color: var(--brass); display: flex; align-items: center; gap: 12px; }
.label::before { content: ""; width: 28px; height: 1px; background: var(--brass); }
.kicker { color: var(--brass-soft); }

.h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2rem, 3.6vw, 2.9rem); line-height: 1.12; letter-spacing: -0.015em;
  margin: 18px 0 16px; color: var(--ink);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 26px; font-size: 0.95rem; font-weight: 500; text-decoration: none;
  border: 1px solid transparent; border-radius: 2px;
  transition: background .25s, color .25s, border-color .25s;
}
.btn-light { background: var(--ivory); color: var(--navy); }
.btn-light:hover { background: #fff; }
.btn-outline { border-color: rgba(238, 240, 242, 0.4); color: var(--on-navy); }
.btn-outline:hover { border-color: var(--on-navy); background: rgba(238, 240, 242, 0.06); }

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  color: var(--on-navy);
  transition: background .3s, color .3s, box-shadow .3s;
}
.nav-inner { display: flex; align-items: center; gap: 24px; height: 76px; }
.nav.scrolled { background: rgba(247, 245, 240, 0.94); color: var(--ink); box-shadow: 0 1px 0 var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.wordmark { display: flex; flex-direction: column; text-decoration: none; line-height: 1.2; }
.wm-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 500; letter-spacing: -0.005em; }
.wm-role { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.nav nav { margin-left: auto; }
.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-link { position: relative; font-size: 0.92rem; text-decoration: none; opacity: 0.85; transition: opacity .2s; }
.nav-link::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 1px; background: var(--brass); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
.nav-link:hover, .nav-link.active { opacity: 1; }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }
.nav-btn { font-size: 0.9rem; font-weight: 500; text-decoration: none; padding: 9px 18px; border: 1px solid currentColor; border-radius: 2px; transition: background .25s, color .25s; }
.nav-btn:hover { background: var(--on-navy); color: var(--navy); }
.nav.scrolled .nav-btn:hover { background: var(--navy); color: var(--ivory); border-color: var(--navy); }
.menu-toggle { display: none; }

.mobile-menu {
  position: fixed; inset: 76px 0 0; z-index: 99; background: var(--ivory);
  padding: 24px var(--gutter); opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s;
}
.mobile-menu.open { opacity: 1; visibility: visible; }
.mobile-menu a { display: block; padding: 18px 0; border-bottom: 1px solid var(--line); font-family: var(--serif); font-size: 1.6rem; text-decoration: none; color: var(--ink); }

@media (max-width: 820px) {
  .nav nav { display: none; }
  .wm-role { display: none; }
  .menu-toggle {
    display: grid; place-content: center; gap: 6px; margin-left: auto;
    width: 44px; height: 44px; background: none; border: 1px solid currentColor; border-radius: 2px; color: inherit; cursor: pointer;
  }
  .menu-toggle span { display: block; width: 18px; height: 1.5px; background: currentColor; transition: transform .3s var(--ease); }
  .menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }
  .nav.menu-open { background: var(--ivory); color: var(--ink); box-shadow: 0 1px 0 var(--line); }
}

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  background: radial-gradient(90% 80% at 80% 20%, #15304f 0%, var(--navy) 60%);
  color: var(--on-navy);
  padding: 150px 0 0;
}
#hero-shader, #contact-shader { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.hero > .wrap, .contact > .wrap { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(40px, 6vw, 96px); align-items: center; padding-bottom: 80px; }
.hero-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.5rem, 5.2vw, 4.4rem); line-height: 1.06; letter-spacing: -0.02em;
  margin: 22px 0 24px; max-width: 15em;
}
.hero-lead { font-size: 1.1rem; color: var(--on-navy-muted); max-width: 36em; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

.portrait { justify-self: end; width: 100%; max-width: 400px; }
.portrait-frame {
  position: relative; aspect-ratio: 4 / 5; overflow: hidden;
  background: linear-gradient(160deg, #1a3557, #0c1d33);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5);
}
.portrait-frame::after { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(201, 173, 127, 0.35); pointer-events: none; }
#portrait-gl, #portrait-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#portrait-img { filter: grayscale(0.2); }
.portrait.gl-on #portrait-img { opacity: 0; }
.portrait-monogram {
  position: absolute; inset: 0; display: none; place-items: center;
  font-family: var(--serif); font-size: clamp(4.5rem, 9vw, 7rem); color: rgba(238, 240, 242, 0.85); letter-spacing: 0.02em;
}
.portrait.no-photo .portrait-monogram { display: grid; }
.portrait.no-photo #portrait-img { display: none; }
.portrait figcaption { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; padding-left: 14px; border-left: 1px solid var(--brass); }
.pc-name { font-family: var(--serif); font-size: 1.15rem; }
.pc-cred { font-size: 0.82rem; color: var(--on-navy-muted); }

.cred-bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 28px;
  padding: 26px 0; border-top: 1px solid var(--navy-line);
  font-size: 0.8rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--on-navy-muted);
}
@media (max-width: 900px) {
  .hero { padding-top: 116px; }
  .hero-grid { grid-template-columns: 1fr; padding-bottom: 56px; }
  .portrait { justify-self: start; max-width: min(320px, 70vw); order: -1; }
  .cred-bar { justify-content: flex-start; }
}

/* ---------- impact ---------- */
.impact { background: var(--paper); border-bottom: 1px solid var(--line); }
.impact-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 44px 28px 44px 0; }
.stat + .stat { padding-left: 28px; border-left: 1px solid var(--line); }
.stat dt { font-family: var(--serif); font-size: clamp(2.2rem, 3.6vw, 3rem); line-height: 1; color: var(--navy); font-variant-numeric: lining-nums tabular-nums; }
.stat dd { margin-top: 12px; font-size: 0.9rem; color: var(--muted); max-width: 24ch; }
@media (max-width: 860px) {
  .impact-grid { grid-template-columns: 1fr 1fr; }
  .stat, .stat + .stat { padding: 28px 16px 28px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .stat:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
  .stat:nth-last-child(-n+2) { border-bottom: 0; }
}

/* ---------- sections ---------- */
.section { padding: clamp(80px, 10vw, 128px) 0; }
.section-tint { background: var(--tint); }
.section-head { max-width: 760px; margin-bottom: 48px; }
.split { display: grid; grid-template-columns: 1fr 1.25fr; gap: clamp(40px, 7vw, 110px); align-items: start; }
.split-head { position: sticky; top: 110px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } .split-head { position: static; } }

.services { border-top: 1px solid var(--ink); }
.service { display: grid; grid-template-columns: 56px 1fr; gap: 16px; padding: 32px 0; border-bottom: 1px solid var(--line); }
.svc-no { font-family: var(--serif); font-size: 1.1rem; color: var(--brass); padding-top: 3px; }
.service h3 { font-family: var(--serif); font-weight: 500; font-size: 1.55rem; line-height: 1.2; margin-bottom: 8px; }
.service p { color: var(--ink-2); }

/* ---------- approach loop ---------- */
.loop { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--ink); counter-reset: s; }
.loop-step { position: relative; padding: 28px 28px 8px 0; }
.loop-step + .loop-step { padding-left: 28px; border-left: 1px solid var(--line); }
.loop-step::after { content: "→"; position: absolute; right: -9px; top: 26px; z-index: 1; background: var(--ivory); color: var(--brass); font-size: 0.9rem; padding: 0 2px; }
.loop-step:last-child::after { content: none; }
.loop-no { font-family: var(--serif); color: var(--brass); font-size: 1.1rem; }
.loop-step h3 { font-family: var(--serif); font-weight: 500; font-size: 1.4rem; margin: 10px 0 8px; }
.loop-step p { color: var(--ink-2); font-size: 0.95rem; }
@media (max-width: 900px) {
  .loop { grid-template-columns: 1fr 1fr; }
  .loop-step, .loop-step + .loop-step { padding: 24px 16px 24px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .loop-step:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
  .loop-step::after { content: none; }
}
@media (max-width: 560px) {
  .loop { grid-template-columns: 1fr; }
  .loop-step:nth-child(even) { padding-left: 0; border-left: 0; }
}
.svc-tag { display: inline-block; vertical-align: middle; margin-left: 8px; padding: 2px 8px; font-family: var(--sans); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brass); border: 1px solid var(--brass-soft); }
#approach { padding-bottom: 0; }

/* ---------- work ---------- */
.work-list { display: grid; gap: 24px; }
.case { display: grid; grid-template-columns: 1.15fr 1fr; background: var(--paper); border: 1px solid var(--line); transition: box-shadow .35s var(--ease), border-color .35s; }
.case:hover { border-color: #cfc8b8; box-shadow: 0 24px 50px -28px rgba(10, 26, 47, 0.35); }
.case-body { padding: clamp(28px, 4vw, 48px); }
.case-meta { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brass); }
.case-title { font-family: var(--serif); font-weight: 400; font-size: clamp(1.6rem, 2.6vw, 2.1rem); line-height: 1.15; margin: 12px 0 22px; }
.case-block { padding: 14px 0; border-top: 1px solid var(--line); }
.case-block h4 { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); margin-bottom: 4px; }
.case-block p { color: var(--ink-2); font-size: 0.95rem; }
.case-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 24px; }
.case-tags li { font-size: 0.75rem; padding: 4px 10px; background: var(--tint); color: var(--ink-2); }
.case-link { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; text-decoration: none; color: var(--navy); border-bottom: 1px solid var(--brass); padding-bottom: 3px; }
.case-link span { transition: transform .3s var(--ease); }
.case-link:hover span { transform: translateX(4px); }

.case-media { background: var(--navy); color: var(--on-navy); padding: clamp(28px, 4vw, 44px); display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.rep-head { display: flex; justify-content: space-between; gap: 12px; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--on-navy-muted); padding-bottom: 12px; border-bottom: 1px solid var(--navy-line); }
.rep-title { font-family: var(--serif); font-size: 1.35rem; line-height: 1.2; }
.rep-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.rep-table th { text-align: left; font-weight: 500; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-navy-muted); padding: 8px 0; border-bottom: 1px solid var(--navy-line); }
.rep-table td { padding: 12px 0; border-bottom: 1px solid var(--navy-line); }
.rep-table td:first-child { color: var(--on-navy-muted); width: 30%; }
.rep-table th:last-child, .rep-table td:last-child { text-align: right; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: #7fc79b; } .pill.warn { color: #e0b864; } .pill.bad { color: #e48a80; }
.rep-foot { font-size: 0.75rem; color: var(--on-navy-muted); }
.case-flip { grid-template-columns: 1fr 1.15fr; }
.case-flip .case-media { order: -1; }
@media (max-width: 900px) {
  .case, .case-flip { grid-template-columns: 1fr; }
  .case-flip .case-media { order: 0; }
}

/* ---------- experience ---------- */
.roles { border-top: 1px solid var(--ink); }
.role { display: grid; grid-template-columns: 150px 1fr; gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.r-year { font-size: 0.88rem; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 4px; }
.role h3 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; line-height: 1.25; }
.role p { color: var(--muted); font-size: 0.92rem; }
.sub-label { margin: 48px 0 16px; }
@media (max-width: 560px) { .role { grid-template-columns: 1fr; gap: 4px; } }

.capabilities { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; margin-top: 80px; padding-top: 40px; border-top: 1px solid var(--line); }
.capabilities h4 { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brass); margin-bottom: 10px; }
.capabilities p { color: var(--ink-2); font-size: 0.95rem; }
@media (max-width: 760px) { .capabilities { grid-template-columns: 1fr; gap: 24px; margin-top: 56px; } }

/* ---------- contact ---------- */
.contact { position: relative; overflow: hidden; isolation: isolate; background: var(--navy); color: var(--on-navy); padding: clamp(80px, 10vw, 128px) 0; }
.contact-inner { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(40px, 7vw, 110px); align-items: end; }
.contact-title { font-family: var(--serif); font-weight: 400; font-size: clamp(2.2rem, 4.4vw, 3.6rem); line-height: 1.1; letter-spacing: -0.015em; margin: 18px 0 18px; }
.contact-lead { color: var(--on-navy-muted); max-width: 34em; }
.contact-list li { display: grid; grid-template-columns: 100px 1fr; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--navy-line); }
.contact-list li:first-child { border-top: 1px solid var(--navy-line); }
.contact-list span { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brass-soft); padding-top: 3px; }
.contact-list a { text-decoration: none; overflow-wrap: anywhere; background: linear-gradient(var(--brass-soft), var(--brass-soft)) 0 100% / 0 1px no-repeat; transition: background-size .35s var(--ease); }
.contact-list a:hover { background-size: 100% 1px; }
@media (max-width: 860px) { .contact-inner { grid-template-columns: 1fr; } }

.footer { background: var(--navy); color: var(--on-navy-muted); font-size: 0.82rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 22px; padding-bottom: 26px; border-top: 1px solid var(--navy-line); }

/* ---------- motion ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}
