/* ============================================================
   Abdulhadi portfolio. Field-manual system.
   Tokens drive everything. Light is default; dark swaps tokens
   via prefers-color-scheme unless data-theme is set explicitly.
   UI shape lock: sharp corners everywhere. Logo mark is the only
   circle (brand mark, not a UI component).
   ============================================================ */

:root {
  --bg: #e9e8e0;
  --bg-2: #e0dfd5;
  --text: #14160f;
  --text-2: #565a4e;
  --acid: #d4f34a;
  --acid-text: #14160f;
  --acid-deep: #5c7010;
  --line: rgba(20, 22, 15, .16);
  --line-2: rgba(20, 22, 15, .38);
  --plate: #171a13;
  --plate-2: #1f231a;
  --on-plate: #e9e8e0;
  --on-plate-2: #a3a896;
  --plate-line: rgba(233, 232, 224, .16);
  --shadow: #14160f;
  --dot: rgba(20, 22, 15, .13);
  --grain: .05;
  --maxw: 1160px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #12140e;
    --bg-2: #191c13;
    --text: #e9e8e0;
    --text-2: #a0a592;
    --acid-deep: #c3e13a;
    --line: rgba(233, 232, 224, .14);
    --line-2: rgba(233, 232, 224, .32);
    --plate: #1b1f15;
    --plate-2: #232820;
    --shadow: #050603;
    --dot: rgba(233, 232, 224, .11);
    --grain: .035;
    color-scheme: dark;
  }
}

html[data-theme="dark"] {
  --bg: #12140e;
  --bg-2: #191c13;
  --text: #e9e8e0;
  --text-2: #a0a592;
  --acid-deep: #c3e13a;
  --line: rgba(233, 232, 224, .14);
  --line-2: rgba(233, 232, 224, .32);
  --plate: #1b1f15;
  --plate-2: #232820;
  --shadow: #050603;
  --dot: rgba(233, 232, 224, .11);
  --grain: .035;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0 }
html { scroll-behavior: smooth }
body {
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--text);
  font-family: 'Archivo', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
section { scroll-margin-top: 86px }
a { color: inherit; text-decoration: none }
::selection { background: var(--acid); color: var(--acid-text) }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px }
img { display: block; max-width: 100%; height: auto }
.wrap { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; padding: 0 28px }

.grain {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- type helpers ---------- */
.mono, .eyebrow, .signal-top, .wf-role, .proof-strip, .dossier dt, .tag, .chip, .skill-ico, .edu-dates, .theme-toggle, .foot-in { font-family: 'DM Mono', monospace }

/* ---------- nav ---------- */
nav {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.nav-in { max-width: var(--maxw); margin: auto; padding: 14px 28px; display: flex; align-items: center; gap: 28px }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em }
.logo-mark { display: grid; place-items: center; width: 28px; height: 28px; background: var(--text); color: var(--acid); font-size: 14px; border-radius: 50%; font-weight: 700 }
.nav-links { display: flex; gap: 26px; margin-left: auto; font-size: 14px; color: var(--text-2) }
.nav-links a { position: relative; padding: 4px 0 }
.nav-links a:after { content: ''; position: absolute; left: 0; right: 100%; bottom: -2px; height: 2px; background: var(--acid-deep); transition: right .2s }
.nav-links a:hover, .nav-links a.active { color: var(--text) }
.nav-links a.active:after, .nav-links a:hover:after { right: 0 }
.nav-tools { display: flex; align-items: center; gap: 18px }
.nav-cta { font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--text); padding-bottom: 3px; white-space: nowrap }
.nav-cta span, .text-link span, .btn span, .signal-link span, .proof-strip a, .p-link span { color: var(--acid-deep) }
.theme-toggle {
  background: transparent; border: 1px solid var(--line-2); color: var(--text-2);
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  padding: 6px 9px; cursor: pointer; transition: color .2s, border-color .2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text) }
.menu-toggle, .mobile-menu { display: none }

/* ---------- buttons and links ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 14px 20px; font-size: 13px; font-weight: 700; letter-spacing: .01em;
  border: 1px solid transparent; white-space: nowrap;
  transition: transform .18s, box-shadow .18s, background .18s;
}
.btn-primary { background: var(--acid); color: var(--acid-text); box-shadow: 4px 4px 0 var(--shadow) }
.btn-primary:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--shadow) }
.btn-primary:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--shadow) }
.btn-ghost { border-color: var(--plate-line); color: var(--on-plate) }
.btn-ghost:hover { border-color: var(--on-plate) }
.text-link { font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--text); padding-bottom: 3px }
.text-link:hover { color: var(--acid-deep) }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(270px, .55fr);
  align-items: end; gap: 48px;
  padding: 92px 0 72px;
}
.hero-copy { max-width: 760px }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text-2); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  margin-bottom: 26px;
}
.eyebrow:before { content: ''; width: 26px; height: 1px; background: var(--acid-deep) }
.hero-title {
  font-size: clamp(2.6rem, 5vw, 4.15rem);
  font-weight: 700; font-stretch: 118%;
  line-height: 1.02; letter-spacing: -.028em;
  text-wrap: balance;
}
.hero-title .cond { font-stretch: 68%; font-weight: 800; letter-spacing: -.01em }
.lede { max-width: 34em; color: var(--text-2); font-size: 18px; line-height: 1.55; margin: 30px 0 34px }
.hero-cta { display: flex; align-items: center; gap: 26px; flex-wrap: wrap }

.hero-aside { align-self: end; padding-bottom: 6px }
.signal-card {
  background: var(--plate); color: var(--on-plate);
  padding: 26px 26px 24px;
  box-shadow: 10px 10px 0 rgba(20, 22, 15, .14);
  transform: rotate(1.4deg);
  transition: transform .3s cubic-bezier(.16, 1, .3, 1);
}
html[data-theme="dark"] .signal-card { box-shadow: 10px 10px 0 rgba(0, 0, 0, .35) }
.signal-card:hover { transform: rotate(0deg) translateY(-3px) }
.signal-top {
  display: flex; align-items: center; gap: 9px;
  color: var(--acid); font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  margin-bottom: 38px;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--acid); animation: pulse 2.2s infinite }
@keyframes pulse { 50% { opacity: .3; transform: scale(.7) } }
.signal-card h2 { font-size: 28px; font-weight: 700; font-stretch: 112%; letter-spacing: -.02em; margin-bottom: 8px }
.signal-card p { color: var(--on-plate-2); font-size: 13.5px; line-height: 1.5; max-width: 24em }
.signal-link { display: inline-block; margin-top: 34px; font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--plate-line); padding-bottom: 3px }
.signal-link:hover { border-color: var(--acid) }

/* ---------- proof strip ---------- */
.proof-strip {
  display: flex; align-items: center; gap: 16px;
  border-top: 1px solid var(--text); border-bottom: 1px solid var(--text);
  padding: 20px 0;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  flex-wrap: wrap;
}
.proof-k { color: var(--text-2); margin-right: auto }
.proof-item { display: flex; align-items: baseline; gap: 8px }
.proof-strip strong { font-family: 'Archivo', sans-serif; font-size: 26px; font-weight: 700; font-stretch: 115%; letter-spacing: -.03em }
.proof-strip small { color: var(--text-2); font-size: 9px }
.proof-strip a { margin-left: 8px; border-bottom: 1px solid var(--line-2); padding-bottom: 2px }
.proof-strip a:hover { border-color: var(--text) }

/* ---------- sections ---------- */
section { padding: 110px 0 }
.sec-head { margin-bottom: 52px }
h2 {
  font-size: clamp(2.1rem, 4.6vw, 3.9rem);
  font-weight: 700; font-stretch: 118%;
  line-height: 1.02; letter-spacing: -.028em;
}
h2 span { color: var(--text-2) }
.sec-sub { color: var(--text-2); font-size: 16px; max-width: 30em; margin-top: 18px }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 72px; align-items: start }
.about-text { max-width: 38em }
.about-text p { font-size: 17px; color: var(--text-2); line-height: 1.65; margin-bottom: 20px }
.about-text strong { color: var(--text); font-weight: 600 }
.about-side { display: grid; gap: 28px }
.portrait { border: 1px solid var(--line-2); padding: 10px; background: var(--bg-2) }
.portrait img { width: 100%; filter: grayscale(1) contrast(1.05); transition: filter .35s }
.portrait:hover img { filter: grayscale(.15) contrast(1.02) }
.dossier { border-top: 1px solid var(--line-2) }
.dossier-row { display: grid; grid-template-columns: 108px 1fr; gap: 14px; border-bottom: 1px solid var(--line); padding: 13px 0 }
.dossier dt { color: var(--text-2); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; padding-top: 3px }
.dossier dd { font-size: 14px; font-weight: 600 }
.dossier dd a { border-bottom: 1px solid var(--line-2) }
.dossier dd a:hover { color: var(--acid-deep); border-color: var(--acid-deep) }

/* ---------- work ---------- */
.work-featured {
  background: var(--plate); color: var(--on-plate);
  padding: 42px 42px 38px;
  margin-bottom: 0;
}
.wf-grid { display: grid; grid-template-columns: 1fr 400px; gap: 40px }
.wf-role { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--acid); margin-bottom: 16px }
.work-item .wf-role, .work-list .wf-role { color: var(--acid-deep) }
.work-featured h3, .work-item h3 { font-size: 30px; font-weight: 700; font-stretch: 112%; letter-spacing: -.025em; line-height: 1.05; margin-bottom: 10px }
.wf-desc { color: var(--on-plate-2); font-size: 14.5px; max-width: 34em }
.work-item .wf-desc { color: var(--text-2) }
.wf-list, .wi-list { list-style: none; margin-top: 24px; display: flex; flex-direction: column; gap: 11px }
.wf-list li, .wi-list li { display: flex; gap: 12px; font-size: 13.5px; line-height: 1.55; color: var(--on-plate-2) }
.wi-list li { color: var(--text-2) }
.wf-list li:before, .wi-list li:before { content: '→'; color: var(--acid); font-size: 13px; line-height: 1.6; flex-shrink: 0 }
.wi-list li:before { color: var(--acid-deep) }
.wf-side { display: flex; flex-direction: column; align-items: flex-start; gap: 26px }
.work-shot { border: 1px solid var(--plate-line); background: var(--plate-2); overflow: hidden; width: 100% }
.work-item .work-shot { border-color: var(--line-2); background: var(--bg-2) }
.work-shot img { display: block; width: 100%; height: auto }
.wi-head .work-shot { margin-top: 22px; max-width: 420px }
.project-metric { display: flex; gap: 14px; align-items: center; border-left: 1px solid var(--plate-line); padding-left: 22px }
.project-metric strong { font-size: 58px; line-height: 1; color: var(--acid); font-weight: 500; letter-spacing: -.05em }
.project-metric span { font-family: 'DM Mono', monospace; text-transform: uppercase; color: var(--on-plate-2); font-size: 10px; line-height: 1.4; letter-spacing: .08em }
.p-link { font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid currentColor; padding-bottom: 3px }
.work-featured .p-link:hover { color: var(--acid) }
.work-item .p-link:hover { color: var(--acid-deep) }
.p-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 24px }
.tag { font-size: 10px; padding: 5px 9px; border: 1px solid var(--plate-line); color: var(--on-plate-2); letter-spacing: .04em }
.work-item .tag { border-color: var(--line-2); color: var(--text-2) }

.work-list { border-top: 1px solid var(--line-2) }
.work-item {
  position: relative;
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 12px 48px;
  border-bottom: 1px solid var(--line);
  padding: 40px 28px 38px 32px;
  transition: background .25s;
}
.work-item:before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--acid); transform: scaleY(0); transform-origin: top;
  transition: transform .3s cubic-bezier(.16, 1, .3, 1);
}
.work-item:hover, .work-item:focus-within { background: var(--bg-2) }
.work-item:hover:before, .work-item:focus-within:before { transform: scaleY(1) }
.wi-head { grid-column: 1; display: flex; justify-content: space-between; align-items: flex-start; gap: 18px }
.wi-list { grid-column: 2; margin-top: 0 }
.work-item .p-tags { grid-column: 1 / -1; margin-top: 10px }

/* ---------- skills ---------- */
.skills-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line-2); border-left: 1px solid var(--line-2);
}
.skill-card {
  padding: 26px 24px; min-height: 170px;
  border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
  transition: background .2s;
}
.skill-card:hover { background: var(--bg-2) }
.skill-card-accent { background: color-mix(in srgb, var(--acid) 16%, transparent) }
.skill-card-accent:hover { background: color-mix(in srgb, var(--acid) 26%, transparent) }
.skill-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px }
.skill-ico {
  font-size: 10px; display: grid; place-items: center; width: 30px; height: 30px;
  border: 1px solid var(--text); color: var(--acid-deep); letter-spacing: 0;
}
.skill-card h3 { font-size: 14px; font-weight: 600; letter-spacing: -.01em }
.skill-items { display: flex; flex-wrap: wrap; gap: 6px }
.chip { font-size: 10px; padding: 5px 8px; border: 1px solid var(--line); color: var(--text-2); letter-spacing: .03em }

/* ---------- education ---------- */
#education { padding-top: 0 }
.edu {
  display: grid; grid-template-columns: 5px 1fr auto; gap: 28px; align-items: start;
  border-top: 1px solid var(--text); padding-top: 28px;
  max-width: 820px;
}
.edu-bar { background: var(--acid); height: 100%; min-height: 74px }
.edu-title { font-size: clamp(1.5rem, 2.6vw, 2rem); margin-bottom: 14px }
.edu-main h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px }
.edu-main p { color: var(--text-2); font-size: 14px; max-width: 40em }
.edu-dates { color: var(--acid-deep); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; padding-top: 8px; white-space: nowrap }

/* ---------- contact ---------- */
#contact { padding-bottom: 120px }
.contact-box {
  position: relative; overflow: hidden;
  background: var(--plate); color: var(--on-plate);
  padding: 92px 30px 84px; text-align: center;
}
.contact-box:before {
  content: 'LET\'S\A BUILD'; white-space: pre;
  position: absolute; right: -12px; bottom: -58px;
  font-size: 150px; line-height: .78; font-weight: 800; font-stretch: 125%;
  letter-spacing: -.04em; color: rgba(233, 232, 224, .045);
  pointer-events: none;
}
.contact-box > * { position: relative; z-index: 1 }
.contact-box h2 { margin-bottom: 18px }
.contact-box h2 em { font-style: italic; color: var(--acid) }
.contact-box > p { color: var(--on-plate-2); max-width: 30em; margin: 0 auto 30px; font-size: 15.5px }
.contact-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line); padding: 26px 0 40px }
.foot-in { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; color: var(--text-2); font-size: 10px; letter-spacing: .08em; text-transform: uppercase }
.foot-copy span { display: inline-block; margin-left: 14px; color: var(--text-2); opacity: .75 }
.foot-links { display: flex; gap: 22px }
.foot-links a:hover { color: var(--acid-deep) }

/* ---------- reveal (progressive enhancement contract) ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s cubic-bezier(.16, 1, .3, 1), transform .7s cubic-bezier(.16, 1, .3, 1) }
.js .reveal.on { opacity: 1; transform: none }
.js .hero-copy > * { animation: hero-in .8s cubic-bezier(.16, 1, .3, 1) both }
.js .hero-copy > :nth-child(2) { animation-delay: .07s }
.js .hero-copy > :nth-child(3) { animation-delay: .14s }
.js .hero-copy > :nth-child(4) { animation-delay: .21s }
@keyframes hero-in { from { opacity: 0; transform: translateY(22px) } to { opacity: 1; transform: none } }
.js .work-list > .reveal:nth-child(2) { transition-delay: 60ms }
.js .work-list > .reveal:nth-child(3) { transition-delay: 120ms }
.js .work-list > .reveal:nth-child(4) { transition-delay: 180ms }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 72px 0 60px; align-items: start }
  .hero-aside { max-width: 400px; padding-bottom: 0 }
  .about-grid { grid-template-columns: 1fr; gap: 48px }
  .about-side { max-width: 440px }
  .wf-grid { grid-template-columns: 1fr; gap: 28px }
  .wf-side { width: 100%; max-width: 480px }
  .work-item { grid-template-columns: 1fr; gap: 18px }
  .wi-head, .wi-list, .work-item .p-tags { grid-column: 1 }
  .skills-grid { grid-template-columns: repeat(2, 1fr) }
  section { padding: 88px 0 }
}

@media (max-width: 768px) {
  .nav-links { display: none }
  .nav-cta { display: none }
  .nav-tools { margin-left: auto }
  .menu-toggle {
    display: flex; width: 36px; height: 36px; border: 1px solid var(--line-2);
    background: transparent; align-items: center; justify-content: center;
    flex-direction: column; gap: 5px; cursor: pointer;
  }
  .menu-toggle span { display: block; width: 14px; height: 1.5px; background: var(--text); transition: transform .2s }
  .menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.25px) rotate(45deg) }
  .menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.25px) rotate(-45deg) }
  .mobile-menu {
    display: grid; max-height: 0; overflow: hidden;
    border-top: 0 solid var(--line);
    transition: max-height .3s ease, padding .3s ease;
  }
  .mobile-menu.open { max-height: 240px; padding: 10px 28px 18px; border-top-width: 1px }
  .mobile-menu a { display: flex; justify-content: space-between; font-size: 16px; font-weight: 600; padding: 11px 0; border-bottom: 1px solid var(--line) }
  .mobile-menu a:last-child { border-bottom: 0 }
  html:not(.js) .menu-toggle { display: none }
  html:not(.js) .mobile-menu { max-height: none; padding: 10px 28px 18px; border-top-width: 1px }
  .edu { grid-template-columns: 5px 1fr; gap: 20px }
  .edu-dates { grid-column: 2; padding-top: 0 }
}

@media (max-width: 520px) {
  .wrap, .nav-in { padding-left: 18px; padding-right: 18px }
  .hero-title { font-size: 2.6rem }
  .hero { padding-top: 52px; min-height: auto; padding-bottom: 52px }
  .lede { font-size: 16px }
  .hero-cta { gap: 18px }
  .signal-card { transform: none; box-shadow: 6px 6px 0 rgba(20, 22, 15, .14) }
  .proof-strip { gap: 12px 18px }
  .proof-k { width: 100%; margin-bottom: 2px }
  .proof-strip a { margin-left: 0 }
  section { padding: 72px 0 }
  .work-featured { padding: 30px 24px 28px }
  .work-item { padding: 32px 8px 30px 18px }
  .project-metric strong { font-size: 46px }
  .skills-grid { grid-template-columns: 1fr }
  .contact-box { padding: 72px 20px 66px }
  .contact-box h2 { font-size: 2.1rem }
  .contact-box:before { font-size: 92px; bottom: -34px }
  .foot-links { gap: 14px; flex-wrap: wrap }
  .foot-copy span { display: block; margin-left: 0; margin-top: 4px }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto }
  .js .reveal { opacity: 1; transform: none; transition: none }
  .js .hero-copy > * { animation: none }
  .live-dot { animation: none }
  .signal-card, .btn, .work-item, .work-item:before, .portrait img, .nav-links a:after { transition: none }
}
