/* ============================================================
   Omar M. Hammouda - Portfolio
   Hand-tuned static site. No framework, no build step.
   Theme: auto light/dark via CSS variables.
   ============================================================ */

/* ---------- Fonts (self-hosted) ---------- */
@font-face {
  font-family: "Satoshi";
  src: url("assets/fonts/satoshi-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Satoshi";
  src: url("assets/fonts/satoshi-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Satoshi";
  src: url("assets/fonts/satoshi-900.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --ink: #191a1c;
  --muted: #5f6266;
  --line: rgba(25, 26, 28, 0.14);
  --line-soft: rgba(25, 26, 28, 0.08);
  --accent: #1f6b4c;
  --accent-contrast: #ffffff;
  --radius: 14px;
  --nav-h: 68px;
  --pad: clamp(20px, 4vw, 48px);
  --max: 1280px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214;
    --surface: #17191c;
    --ink: #edece8;
    --muted: #9a9da3;
    --line: rgba(237, 236, 232, 0.17);
    --line-soft: rgba(237, 236, 232, 0.09);
    --accent: #6fc29a;
    --accent-contrast: #0d1f17;
  }
}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Satoshi", "Helvetica Neue", Arial, sans-serif;
  font-weight: 500;
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
  text-decoration: none;
}
::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.nav.scrolled {
  border-bottom-color: var(--line-soft);
}
.nav-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav-name {
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 32px);
  list-style: none;
}
.nav-links a {
  font-size: 0.95rem;
  color: var(--muted);
  transition: color 0.2s var(--ease);
}
.nav-links a:hover {
  color: var(--ink);
}
.nav-links a.nav-cta {
  color: var(--ink);
  font-weight: 700;
}

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(56px, 10vh, 96px) clamp(48px, 8vh, 88px);
}
.hero-grid {
  display: grid;
  grid-template-columns: 7fr 4fr;
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.5rem, 5.6vw, 4.4rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.02;
  max-width: 14ch;
}
.hero h1 em {
  font-style: italic;
  line-height: 1.1;
  padding-bottom: 0.05em;
  color: var(--accent);
}
.hero-sub {
  margin-top: 24px;
  color: var(--muted);
  max-width: 44ch;
}
.hero-actions {
  margin-top: 36px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease),
    color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-ghost {
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--ink);
}
.btn .arrow {
  transition: transform 0.25s var(--ease);
}
.btn:hover .arrow {
  transform: translateX(4px);
}

/* Palette index: interactive index of the 12 projects */
.palette {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
}
.palette li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  border-radius: 8px;
  padding-inline: 14px;
  background: var(--chip);
  color: var(--chip-ink);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.25s var(--ease), height 0.25s var(--ease);
}
.palette li a .p-cat {
  font-weight: 500;
  opacity: 0;
  font-size: 0.78rem;
  transition: opacity 0.2s var(--ease);
}
.palette li a:hover,
.palette li a:focus-visible {
  transform: scaleX(1.04);
}
.palette li a:hover .p-cat,
.palette li a:focus-visible .p-cat {
  opacity: 0.85;
}

/* ---------- Section scaffolding ---------- */
.section {
  padding-block: clamp(64px, 10vh, 128px);
}
.section-head {
  margin-bottom: clamp(32px, 5vh, 56px);
}
.section-head h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.section-head p {
  margin-top: 12px;
  color: var(--muted);
  max-width: 52ch;
}

/* ---------- Work grid ---------- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(16px, 2.5vw, 28px);
}
.work-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  grid-column: span 12;
}
.work-card.span-7 {
  grid-column: span 7;
}
.work-card.span-5 {
  grid-column: span 5;
}
.cover {
  /* Typographic cover. Replace each cover's inner content with a real
     export from the Figma board when ready:
     <img src="assets/work/<slug>.png" alt="..."> at the same aspect ratio. */
  position: relative;
  display: flex;
  align-items: flex-end;
  background: var(--c-bg);
  color: var(--c-ink);
  aspect-ratio: 21 / 9;
  padding: clamp(20px, 3vw, 36px);
  overflow: hidden;
  transition: transform 0.5s var(--ease);
}
.work-card.wide-tall .cover {
  aspect-ratio: 2 / 1;
}
@media (min-width: 861px) {
  /* Split rows: covers stretch so both cards in a row share one height. */
  .work-card.span-7 .cover,
  .work-card.span-5 .cover {
    aspect-ratio: auto;
    flex: 1;
    min-height: 420px;
  }
  .work-card.span-5 .cover .cover-title {
    font-size: clamp(1.4rem, 2.2vw, 2rem);
  }
}
.cover .ghost {
  position: absolute;
  right: -0.08em;
  top: -0.18em;
  font-size: clamp(5rem, 13vw, 11rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  opacity: 0.14;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}
.cover .cover-title {
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.05;
  max-width: 16ch;
}
.work-card:hover .cover {
  transform: scale(1.015);
}
.work-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px 0;
}
.work-meta .w-name {
  font-weight: 700;
}
.work-meta .w-cat {
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

/* ---------- Index of remaining work ---------- */
.index-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 clamp(32px, 6vw, 88px);
}
.index-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.index-item:nth-child(-n + 2) {
  border-top: 1px solid var(--line-soft);
}
.index-swatch {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex: none;
  background: var(--chip);
}
.index-body {
  flex: 1;
  min-width: 0;
}
.index-body .i-name {
  font-weight: 700;
}
.index-body .i-cat {
  color: var(--muted);
  font-size: 0.9rem;
}
.index-item .i-go {
  color: var(--muted);
  transition: transform 0.25s var(--ease), color 0.2s var(--ease);
}
a.index-item:hover .i-go {
  transform: translateX(4px);
  color: var(--ink);
}
.index-item .i-status {
  font-size: 0.82rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
}
.about-grid h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.15;
  position: sticky;
  top: calc(var(--nav-h) + 24px);
}
.about-body p + p {
  margin-top: 1em;
}
.about-body .lede {
  font-size: 1.25rem;
  line-height: 1.5;
  font-weight: 500;
}
.chips {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
}
.chips li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.92rem;
  color: var(--muted);
}

/* ---------- Contact ---------- */
.contact {
  border-top: 1px solid var(--line-soft);
}
.contact .big-mail {
  display: inline-block;
  margin-top: 8px;
  font-size: clamp(1.6rem, 4.6vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  word-break: break-all;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.4s var(--ease), color 0.2s var(--ease);
}
.contact .big-mail:hover {
  color: var(--accent);
  background-size: 100% 2px;
}
.contact-links {
  margin-top: 36px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  color: var(--muted);
}
.contact-links a {
  transition: color 0.2s var(--ease);
}
.contact-links a:hover {
  color: var(--ink);
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line-soft);
  padding-block: 28px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}
.footer a:hover {
  color: var(--ink);
}

/* ---------- Case study pages ---------- */
.case-hero {
  background: var(--c-bg);
  color: var(--c-ink);
  padding-block: clamp(64px, 12vh, 128px);
}
.case-hero .case-cat {
  font-size: 1rem;
  opacity: 0.75;
  font-weight: 700;
}
.case-hero h1 {
  margin-top: 10px;
  font-size: clamp(2.6rem, 6.5vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.02;
}
.case-hero .case-lede {
  margin-top: 20px;
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  max-width: 46ch;
  opacity: 0.9;
}
.case-meta {
  padding-block: 28px;
  border-bottom: 1px solid var(--line-soft);
}
.case-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 24px;
}
.case-meta-grid .m-label {
  font-size: 0.82rem;
  color: var(--muted);
}
.case-meta-grid .m-value {
  font-weight: 700;
  margin-top: 2px;
}
.case-body {
  padding-block: clamp(48px, 8vh, 88px);
  display: grid;
  gap: clamp(48px, 8vh, 80px);
}
.case-section h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.case-section p {
  max-width: 68ch;
  color: var(--ink);
}
.case-section p + p {
  margin-top: 1em;
}
.case-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 32px;
  max-width: 820px;
}
.case-list li {
  padding: 14px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.98rem;
}
.figure-slot {
  border-radius: var(--radius);
  background: var(--c-bg);
  color: var(--c-ink);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.figure-slot span {
  opacity: 0.7;
  font-size: 0.95rem;
  max-width: 44ch;
}
.case-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}
.case-next {
  border-top: 1px solid var(--line-soft);
  padding-block: clamp(40px, 7vh, 72px);
}
.case-next a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
}
.case-next .n-label {
  color: var(--muted);
  font-size: 0.95rem;
}
.case-next .n-name {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  transition: color 0.2s var(--ease);
}
.case-next a:hover .n-name {
  color: var(--accent);
}

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .cover,
  .btn,
  .palette li a {
    transition: none;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .palette {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
  }
  .palette li {
    flex: none;
    scroll-snap-align: start;
  }
  .palette li a {
    height: 44px;
    min-width: 132px;
  }
  .palette li a .p-cat {
    display: none;
  }
  .work-card.span-7,
  .work-card.span-5 {
    grid-column: span 12;
  }
  .work-card .cover,
  .work-card.wide-tall .cover {
    aspect-ratio: 4 / 3;
  }
  .index-grid {
    grid-template-columns: 1fr;
  }
  .index-item:nth-child(-n + 2) {
    border-top: none;
  }
  .index-item:first-child {
    border-top: 1px solid var(--line-soft);
  }
  .about-grid {
    grid-template-columns: 1fr;
  }
  .about-grid h2 {
    position: static;
  }
  .case-meta-grid {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  .case-list {
    grid-template-columns: 1fr;
  }
  .nav-links li.hide-sm {
    display: none;
  }
}
