/* Ahmed Hussein | portfolio
   Palette follows the CV: navy, ink, muted slate, on a warm paper background. */

:root {
  --paper: #F6F4EF;
  --paper-2: #EFECE4;
  --surface: #FFFFFF;
  --ink: #1B1F24;
  --ink-2: #39414B;
  --muted: #5E6B78;
  --rule: #DCD6CA;
  --navy: #1D3A57;
  --navy-2: #2B5179;
  --deep: #0F1D2C;
  --deep-2: #162839;
  --deep-line: #2A3E53;
  --on-deep: #E8EDF2;
  --on-deep-2: #A9B8C7;
  --accent: #C98A2B;
  --accent-soft: #F3E4CB;

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --wrap: 1140px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 29, 44, .05), 0 8px 24px -12px rgba(15, 29, 44, .18);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.62 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent-soft); color: var(--ink); }

.wrap { width: min(var(--wrap), 100% - 48px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: 999px; border: 1px solid transparent;
  font: 500 15px/1 var(--sans); text-decoration: none; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn--solid { background: var(--navy); color: #fff; }
.btn--solid:hover { background: var(--deep); }
.btn--line { border-color: var(--rule); color: var(--ink); background: transparent; }
.btn--line:hover { border-color: var(--navy); color: var(--navy); }
.btn--line:hover svg { transform: translateX(3px); }
.btn--line svg { transition: transform .2s; }
.btn--small { padding: 9px 16px; font-size: 14px; }
.btn--ghost-light { background: transparent; color: var(--on-deep); border-color: var(--deep-line); }
.btn--ghost-light:hover { border-color: var(--on-deep-2); background: rgba(255,255,255,.04); }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(246, 244, 239, .82);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .25s;
}
.nav.is-scrolled { border-bottom-color: var(--rule); }
.nav__inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand__mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: var(--navy); color: var(--paper); font: 600 13px/1 var(--serif); letter-spacing: .04em;
}
.brand__name { font: 600 15px/1 var(--sans); letter-spacing: -.01em; }
.nav__links { display: flex; gap: 26px; margin-left: auto; }
.nav__links a { font-size: 14.5px; color: var(--ink-2); text-decoration: none; position: relative; padding: 4px 0; }
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1.5px; background: var(--navy);
  transform: scaleX(0); transform-origin: left; transition: transform .25s;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--ink); }
.nav__links a:hover::after, .nav__links a.is-active::after { transform: scaleX(1); }

/* ---------- hero ---------- */
.hero { padding: 72px 0 0; }
.hero__grid { display: grid; grid-template-columns: 1.25fr .85fr; gap: 72px; align-items: center; }
.eyebrow {
  font: 500 12.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 26px;
}
.eyebrow span { color: var(--accent); padding: 0 4px; }
.hero__title {
  font: 500 clamp(52px, 7.4vw, 92px)/.98 var(--serif); letter-spacing: -.025em; color: var(--navy);
  margin-bottom: 28px;
}
.hero__lede { font: 400 clamp(21px, 2.2vw, 25px)/1.42 var(--serif); color: var(--ink); max-width: 30ch; margin-bottom: 18px; }
.hero__body { color: var(--ink-2); max-width: 54ch; margin-bottom: 34px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 30px; }
.hero__links { display: flex; flex-wrap: wrap; gap: 8px 26px; font-size: 14.5px; color: var(--muted); }
.hero__links a { text-decoration: none; border-bottom: 1px solid var(--rule); padding-bottom: 2px; transition: border-color .2s, color .2s; }
.hero__links a:hover { color: var(--navy); border-color: var(--navy); }

.hero__photo { position: relative; margin: 0; }
.hero__photo img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 38%;
  border-radius: 20px; box-shadow: 0 30px 60px -30px rgba(15, 29, 44, .45);
  filter: saturate(.92);
}
.hero__photo::before {
  content: ""; position: absolute; inset: 18px -18px -18px 18px; border: 1px solid var(--rule); border-radius: 22px; z-index: -1;
}
.hero__badge {
  position: absolute; left: -26px; bottom: 34px; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow);
  font-size: 14px; color: var(--ink-2);
}
.hero__badge b { color: var(--ink); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3E9B6B; box-shadow: 0 0 0 4px rgba(62, 155, 107, .18); flex: none; }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 84px;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.stats li { padding: 28px 24px 28px 0; display: flex; flex-direction: column; gap: 8px; }
.stats li + li { padding-left: 24px; border-left: 1px solid var(--rule); }
.stats b { font: 500 40px/1 var(--serif); color: var(--navy); letter-spacing: -.02em; }
.stats span { font-size: 14px; color: var(--muted); line-height: 1.45; max-width: 24ch; }

/* ---------- section headings ---------- */
.section { padding: 112px 0; }
.section--tint { background: var(--paper-2); }
.sec-head { margin-bottom: 48px; }
.sec-num {
  font: 500 12.5px/1 var(--mono); color: var(--accent); letter-spacing: .08em; margin-bottom: 18px;
}
.sec-num span { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin-left: 10px; }
.sec-num--light span { color: var(--on-deep-2); }
.sec-head h2 { font: 500 clamp(34px, 4.4vw, 52px)/1.06 var(--serif); letter-spacing: -.02em; color: var(--ink); max-width: 22ch; }
.sec-sub { font: italic 400 clamp(20px, 2.2vw, 26px)/1.3 var(--serif); margin-top: 10px; }
.meta-line { margin-top: 18px; font: 500 13px/1.4 var(--mono); color: var(--on-deep-2); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.meta-line i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .55; }
.meta-line--dark { color: var(--muted); }

/* ---------- chips & ticks ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.chips li {
  font: 500 12.5px/1 var(--mono); padding: 8px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--rule); color: var(--ink-2);
}
.chips--dark li { background: transparent; border-color: var(--deep-line); color: var(--on-deep-2); }

.ticks { display: grid; gap: 10px; }
.ticks li { position: relative; padding-left: 20px; color: var(--ink-2); font-size: 15px; }
.ticks li::before {
  content: ""; position: absolute; left: 2px; top: .72em; width: 8px; height: 1.5px; background: var(--accent);
}
.ticks b { color: var(--ink); font-weight: 600; }

/* ---------- Dramatizer spotlight ---------- */
.spot {
  position: relative; overflow: hidden;
  background: var(--deep); color: var(--on-deep); padding: 120px 0 112px;
}
.spot::before {
  /* faint waveform texture */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background:
    radial-gradient(900px 420px at 88% -10%, rgba(43, 81, 121, .55), transparent 70%),
    radial-gradient(600px 300px at -5% 105%, rgba(201, 138, 43, .12), transparent 70%);
}
.spot .wrap { position: relative; }
.sec-head--light h2 { color: #fff; }
.sec-head--light .sec-sub { color: var(--on-deep-2); }

.spot__intro { display: grid; grid-template-columns: 1fr 1.25fr; gap: 56px; margin-bottom: 56px; align-items: start; }
.spot__lead { font: 400 clamp(24px, 2.6vw, 30px)/1.3 var(--serif); color: #fff; }
.spot__intro p:not(.spot__lead) { color: var(--on-deep-2); font-size: 16.5px; }

.spot__intro > div { display: grid; gap: 16px; }
.spot__note { font-size: 14.5px !important; color: var(--on-deep-2); padding-left: 14px; border-left: 2px solid var(--accent); }
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--deep-line); border-radius: var(--radius); background: rgba(255,255,255,.02); }
.pillars li { padding: 24px 24px 26px; display: flex; flex-direction: column; gap: 6px; }
.pillars li + li { border-left: 1px solid var(--deep-line); }
.pillars b { font: 500 24px/1.2 var(--serif); color: #fff; }
.pillars span { font-size: 14.5px; color: var(--on-deep-2); }
@media (max-width: 720px) {
  .pillars { grid-template-columns: 1fr; }
  .pillars li + li { border-left: 0; border-top: 1px solid var(--deep-line); }
}

.flow {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; margin-bottom: 64px;
  border: 1px solid var(--deep-line); border-radius: var(--radius); background: rgba(255,255,255,.02);
}
.flow li { position: relative; padding: 22px 18px 22px 20px; display: flex; flex-direction: column; gap: 4px; }
.flow li + li { border-left: 1px solid var(--deep-line); }
.flow li + li::before {
  content: ""; position: absolute; left: -6px; top: 50%; width: 10px; height: 10px; transform: translateY(-50%) rotate(45deg);
  background: var(--deep); border-top: 1px solid var(--deep-line); border-right: 1px solid var(--deep-line);
}
.flow__n { font: 500 12px/1 var(--mono); color: var(--accent); margin-bottom: 8px; }
.flow b { font: 600 16px/1.2 var(--sans); color: #fff; }
.flow small { font-size: 13px; color: var(--on-deep-2); line-height: 1.4; }
.flow__loop { background: rgba(201, 138, 43, .08); border-radius: 0 var(--radius) var(--radius) 0; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.card {
  background: var(--deep-2); border: 1px solid var(--deep-line); border-radius: var(--radius);
  padding: 24px 22px 26px; display: flex; flex-direction: column; gap: 12px;
  transition: border-color .25s, transform .25s;
}
.card:hover { border-color: #3D5874; transform: translateY(-2px); }
.card__k { font: 500 11.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.card__big { font: 500 32px/1 var(--serif); color: #fff; letter-spacing: -.015em; }
.card__big small { font: 400 13px/1 var(--sans); color: var(--on-deep-2); letter-spacing: 0; margin-left: 4px; }
.card p:last-child { color: var(--on-deep-2); font-size: 14.5px; line-height: 1.55; }

.origin {
  margin-top: 72px; padding-top: 48px; border-top: 1px solid var(--deep-line);
  display: grid; grid-template-columns: .9fr 1.4fr; gap: 56px;
}
.origin h3 { font: 500 30px/1.15 var(--serif); color: #fff; margin: 14px 0 10px; }
.origin h3 span { display: block; font: 400 14px/1.4 var(--sans); color: var(--on-deep-2); margin-top: 8px; }
.origin__stack { font: 500 12.5px/1.5 var(--mono); color: var(--on-deep-2); }
.origin .ticks li { color: var(--on-deep); font-size: 15.5px; }
.origin .ticks em { font-style: normal; color: #fff; border-bottom: 1px solid var(--accent); }

/* ---------- research ---------- */
.research { display: grid; grid-template-columns: 1fr 1.08fr; gap: 64px; align-items: start; }
.research__text p { color: var(--ink-2); margin-bottom: 18px; font-size: 16.5px; }
.research__text strong { color: var(--ink); font-weight: 600; }
.research__data { display: grid; gap: 22px; }
.table-wrap { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
caption { text-align: left; padding: 18px 20px 4px; font: 500 12px/1.4 var(--mono); color: var(--muted); letter-spacing: .04em; }
th, td { padding: 14px 20px; text-align: right; border-bottom: 1px solid var(--paper-2); }
thead th { font: 600 13px/1.3 var(--sans); color: var(--ink); vertical-align: bottom; }
thead th small { font: 400 12px/1 var(--mono); color: var(--muted); }
th[scope="row"], thead th:first-child { text-align: left; font-weight: 500; }
td { font-family: var(--mono); font-size: 14.5px; color: var(--ink-2); }
tbody tr:last-child > * { border-bottom: 0; }
.is-best td { color: var(--navy); font-weight: 500; }
.is-best th::after { content: "baseline"; margin-left: 10px; font: 500 10.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 4px 6px; border-radius: 4px; vertical-align: 2px; }
.figure { margin: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.figure img { border-radius: 6px; }
.figure figcaption { font-size: 13.5px; color: var(--muted); padding: 12px 4px 2px; }

/* ---------- projects ---------- */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.proj {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 30px 30px 28px; display: flex; flex-direction: column; gap: 14px;
  transition: box-shadow .25s, transform .25s, border-color .25s;
}
.proj:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #CFC8BA; }
.proj__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tag { font: 500 11.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--navy-2); }
.year { font: 500 12.5px/1 var(--mono); color: var(--muted); }
.proj h3 { font: 500 27px/1.15 var(--serif); letter-spacing: -.01em; color: var(--ink); }
.proj__kicker { color: var(--muted); font-size: 15px; margin-top: -6px; }
.proj .ticks { margin-top: 4px; }
.proj__stack { margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--rule); font: 500 12.5px/1.5 var(--mono); color: var(--muted); }

.proj--media { grid-column: 1 / -1; display: grid; grid-template-columns: 1.1fr 1fr; padding: 0; overflow: hidden; gap: 0; }
.proj--media img { width: 100%; height: 100%; object-fit: cover; min-height: 320px; }
.proj__body { padding: 32px 32px 28px; display: flex; flex-direction: column; gap: 14px; }

.workshop { margin-top: 88px; }
.workshop__head { display: flex; justify-content: space-between; align-items: end; gap: 32px; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.workshop__head h3 { font: 500 32px/1.1 var(--serif); color: var(--ink); }
.workshop__head p { color: var(--muted); max-width: 46ch; font-size: 15px; }
.mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.mini {
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.mini h4 { font: 500 21px/1.2 var(--serif); color: var(--ink); }
.mini p { font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.mini .proj__stack { font-size: 11.5px; padding-top: 12px; }
.mini__k { font: 500 11px/1 var(--mono) !important; letter-spacing: .1em; text-transform: uppercase; color: var(--navy-2) !important; }
.mini--art { grid-column: 1 / -1; display: grid; grid-template-columns: 180px 1fr; gap: 28px; align-items: center; background: var(--surface); }
.mini--art > div { display: flex; flex-direction: column; gap: 10px; }
.mini--art img { width: 180px; height: 180px; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(15,29,44,.18)); }
.mini--art p:not(.mini__k):not(.proj__stack) { font-size: 15px; max-width: 72ch; }

/* ---------- experience & skills ---------- */
.two-col { display: grid; grid-template-columns: 1.15fr 1fr; gap: 80px; }
.timeline { position: relative; display: grid; gap: 36px; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--rule); }
.timeline > li { position: relative; }
.timeline > li::before {
  content: ""; position: absolute; left: -26px; top: 4px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--navy);
}
.timeline__when { font: 500 12.5px/1 var(--mono); color: var(--accent); margin-bottom: 10px; }
.timeline h3 { font: 500 23px/1.2 var(--serif); color: var(--ink); }
.timeline__org { color: var(--muted); font-size: 15px; margin: 4px 0 14px; }

.skills { margin: 0; display: grid; }
.skills > div { display: grid; grid-template-columns: 130px 1fr; gap: 20px; padding: 18px 0; border-top: 1px solid var(--rule); }
.skills > div:last-child { border-bottom: 1px solid var(--rule); }
.skills dt { font: 600 14px/1.5 var(--sans); color: var(--navy); }
.skills dd { margin: 0; color: var(--ink-2); font-size: 15px; }

/* ---------- contact ---------- */
.contact { background: var(--deep); color: var(--on-deep); padding: 112px 0 0; position: relative; overflow: hidden; }
.contact::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(700px 360px at 100% 0%, rgba(43, 81, 121, .5), transparent 70%);
}
.contact .wrap { position: relative; }
.contact__inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 64px; align-items: end; padding-bottom: 96px; }
.contact h2 { font: 500 clamp(34px, 4.2vw, 50px)/1.08 var(--serif); color: #fff; letter-spacing: -.02em; margin-bottom: 18px; }
.contact p { color: var(--on-deep-2); max-width: 46ch; }
.contact__actions { display: grid; gap: 22px; justify-items: start; }
.contact__mail {
  font: 400 clamp(26px, 3.2vw, 40px)/1.1 var(--serif); color: #fff; text-decoration: none;
  border-bottom: 1px solid var(--accent); padding-bottom: 6px; word-break: break-all;
  transition: color .2s;
}
.contact__mail:hover { color: var(--accent-soft); }
.contact__row { display: flex; flex-wrap: wrap; gap: 10px; }
.footer {
  position: relative; display: flex; justify-content: space-between; gap: 16px;
  border-top: 1px solid var(--deep-line); padding: 26px 0 34px; font-size: 13.5px; color: var(--on-deep-2);
}
.footer a { text-decoration: none; }
.footer a:hover { color: #fff; }

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

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .mini-grid { grid-template-columns: repeat(2, 1fr); }
  .flow { grid-template-columns: repeat(3, 1fr); }
  .flow li:nth-child(4) { border-left: 0; }
  .flow li:nth-child(n+4) { border-top: 1px solid var(--deep-line); }
  .flow li:nth-child(4)::before { display: none; }
  .flow__loop { border-radius: 0 0 var(--radius) 0; }
  .research, .two-col { grid-template-columns: 1fr; gap: 56px; }
}
@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav .btn { margin-left: auto; }
  .hero { padding-top: 40px; }
  .hero__grid { grid-template-columns: 1fr; gap: 48px; }
  .hero__photo { max-width: 420px; }
  .hero__photo::before { display: none; }
  .hero__badge { left: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); margin-top: 64px; }
  .stats li:nth-child(3) { padding-left: 0; border-left: 0; }
  .stats li:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .spot__intro, .origin, .contact__inner { grid-template-columns: 1fr; gap: 28px; }
  .projects { grid-template-columns: 1fr; }
  .proj--media { grid-template-columns: 1fr; }
  .proj--media img { min-height: 0; aspect-ratio: 16 / 10; }
  .workshop__head { flex-direction: column; align-items: start; gap: 10px; }
  .section { padding: 84px 0; }
  .spot { padding: 88px 0; }
}
@media (max-width: 560px) {
  .wrap { width: min(var(--wrap), 100% - 36px); }
  .brand__name { display: none; }
  .cards, .mini-grid { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr 1fr; }
  .flow li { border-left: 0 !important; border-top: 1px solid var(--deep-line); }
  .flow li:nth-child(-n+2) { border-top: 0; }
  .flow li:nth-child(even) { border-left: 1px solid var(--deep-line) !important; }
  .flow li::before { display: none; }
  .flow__loop { border-radius: 0 0 var(--radius) 0; }
  .mini--art { grid-template-columns: 1fr; }
  .mini--art img { width: 140px; height: 140px; }
  .proj { padding: 24px 22px; }
  .proj__body { padding: 24px 22px; }
  .skills > div { grid-template-columns: 1fr; gap: 4px; }
  .stats b { font-size: 32px; }
  .stats li, .stats li + li { padding: 22px 14px 22px 0; }
  .stats li:nth-child(even) { padding-left: 14px; }
  .hero__cta .btn { width: 100%; justify-content: center; }
}
