/* Ahmad personal site
   Radius system: buttons and chips = pill, tiles = 14px. Nothing else.
   Accent lock: --accent, one color across the whole page in both themes. */

:root {
  --bg:        #FAF9F6;
  --surface:   #F2F1EC;
  --line:      #DDDCD5;
  --text:      #191C1A;
  --muted:     #565C58;
  --accent:    #1F5C4A;
  --accent-ink:#FAF9F6;
  --accent-soft:#E3EDE7;

  --wrap: 1200px;
  --radius-tile: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --bg:        #0E1211;
  --surface:   #161B19;
  --line:      #262D2A;
  --text:      #ECEAE3;
  --muted:     #A0A9A4;
  --accent:    #7FCBAC;
  --accent-ink:#0E1211;
  --accent-soft:#182521;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 24px;
}

.skip {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 18px;
  z-index: 60;
}
.skip:focus { inset-inline-start: 12px; top: 12px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav__inner {
  height: 68px;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav__brand {
  font-weight: 600;
  font-size: 18px;
  text-decoration: none;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
  direction: ltr;
}
.nav__brand-tail {
  font-weight: 400;
  font-size: 0.82em;
  color: var(--muted);
}
@media (max-width: 420px) {
  .nav__brand { font-size: 15px; gap: 5px; }
}

.nav__links {
  display: none;
  gap: 28px;
  margin-inline-start: auto;
  font-size: 15px;
}

.nav__links a {
  text-decoration: none;
  color: var(--muted);
  padding-block: 4px;
  position: relative;
  transition: color .2s var(--ease);
}
.nav__links a::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: inline-start;
  transition: transform .3s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a:hover::after { transform: scaleX(1); }

.nav__tools {
  display: flex;
  gap: 8px;
  margin-inline-start: auto;
}
.nav__links + .nav__tools { margin-inline-start: 0; }

.chip {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 15px;
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--text); }
.chip:active { transform: translateY(1px); }

@media (min-width: 860px) {
  .nav__links { display: flex; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  border-radius: 999px;
  padding: 14px 30px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .18s var(--ease), background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}
.btn--solid {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn--solid:hover { transform: translateY(-2px); }
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn--ghost:hover { border-color: var(--text); transform: translateY(-2px); }
.btn:active { transform: translateY(1px); }

/* ---------- hero ---------- */

.hero {
  min-height: min(76vh, 640px);
  display: flex;
  align-items: center;
  padding-block: 72px 56px;
}

.hero__title {
  font-size: clamp(2rem, 7vw, 4.4rem);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.025em;
  max-width: 16ch;
}
.hero__title .line { display: block; }

/* latin runs longer than the arabic line: hold the headline to 2 lines */
html[lang="en"] .hero__title {
  font-size: clamp(2.1rem, 5.4vw, 4.2rem);
  max-width: 30ch;
}
.hero__title .accent { color: var(--accent); }

.hero__sub {
  margin-top: 26px;
  max-width: 46ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
}

.hero__cta {
  margin-top: 38px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* entry choreography: hierarchy, top line first */
@media (prefers-reduced-motion: no-preference) {
  .hero__title .line, .hero__sub, .hero__cta {
    animation: rise .9s var(--ease) both;
  }
  .hero__title .line:nth-child(1) { animation-delay: .05s; }
  .hero__title .line:nth-child(2) { animation-delay: .17s; }
  .hero__sub  { animation-delay: .30s; }
  .hero__cta  { animation-delay: .40s; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .hero { min-height: auto; padding-block: 44px 40px; }
}

/* ---------- feature image ---------- */

.feature { padding-block: 4px 60px; }

.feature__img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-tile);
  border: 1px solid var(--line);
}

@media (max-width: 640px) {
  .feature { padding-block: 0 36px; }
}

/* ---------- skills band ---------- */

.band {
  background: var(--accent-soft);
  border-block: 1px solid var(--line);
  padding-block: 30px;
  overflow: hidden;
  transition: background-color .35s var(--ease);
}

.band__label {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 24px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.marquee {
  margin-top: 18px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.marquee__track {
  display: flex;
  align-items: center;
  gap: 44px;
  margin: 0;
  padding: 0;
  list-style: none;
  width: max-content;
  font-size: clamp(1.35rem, 3.4vw, 2.1rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--accent);
}
.marquee__track li { white-space: nowrap; }

@media (prefers-reduced-motion: no-preference) {
  .marquee__track { animation: slide 34s linear infinite; }
  .marquee:hover .marquee__track { animation-play-state: paused; }
}
@keyframes slide {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-50% - 22px)); }
}
@media (prefers-reduced-motion: reduce) {
  .marquee { overflow-x: auto; }
}

/* ---------- sections ---------- */

.section { padding-block: clamp(72px, 11vw, 132px); }

.section__title {
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  letter-spacing: -0.02em;
  margin-bottom: 42px;
}

/* ---------- services bento: 5 items, 5 cells ---------- */

.bento {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-tile);
  padding: 30px;
  transition: transform .35s var(--ease), border-color .35s var(--ease), background-color .35s var(--ease);
}
.tile:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.tile h3 { font-size: 1.15rem; margin-bottom: 12px; }
.tile p { color: var(--muted); font-size: 0.97rem; }

.tile--accent {
  background: var(--accent);
  border-color: var(--accent);
}
.tile--accent h3, .tile--accent p { color: var(--accent-ink); }

.tile--lead { background: transparent; }
.tile--lead h3 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
.tile--lead p { font-size: 1.05rem; max-width: 42ch; }

@media (min-width: 820px) {
  .bento { grid-template-columns: repeat(6, 1fr); }
  /* row 1: lead + accent, row 2: two thirds, row 3: full width */
  .tile         { grid-column: span 3; }
  .tile--lead   { grid-column: span 4; }
  .tile--accent { grid-column: span 2; }
  .tile--wide   { grid-column: span 6; display: grid; grid-template-columns: 1fr 1.4fr; gap: 28px; align-items: baseline; }
  .tile--wide h3 { margin-bottom: 0; }
}

/* ---------- selected work: project cards ---------- */

.section--work { border-top: 1px solid var(--line); }

.work {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.work__card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-tile);
  overflow: hidden;
  transition: transform .35s var(--ease), border-color .35s var(--ease), background-color .35s var(--ease);
}
.work__card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
/* .reveal.is-in resets transform later in this file at equal weight,
   so the lift needs the extra class to survive once a card has revealed */
.work__card:hover,
.work__card.is-in:hover { transform: translateY(-4px); }

.work__media {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.work__media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  transition: transform .55s var(--ease);
}
.work__card:hover .work__media img { transform: scale(1.035); }

.work__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 26px 30px 30px;
}

.work__type {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.work__name {
  font-size: 1.2rem;
  letter-spacing: -0.015em;
}

.work__desc { color: var(--muted); font-size: 0.97rem; }

.work__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}
.work__tags li {
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--muted);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 13px;
  transition: background-color .35s var(--ease);
}

/* pushed to the card foot so the buttons line up across a row */
.work__cta {
  margin-top: auto;
  align-self: start;
  font-size: 15px;
  padding: 12px 26px;
}

@media (min-width: 820px) {
  .work { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}

@media (max-width: 480px) {
  .work__body { padding: 22px 22px 26px; gap: 12px; }
}

/* ---------- my store: one featured commercial project ---------- */

.section--store {
  background: var(--accent-soft);
  border-block: 1px solid var(--line);
  transition: background-color .35s var(--ease);
}

.store {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-tile);
  overflow: hidden;
  transition: border-color .35s var(--ease), background-color .35s var(--ease);
}
.store:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.store__media {
  margin: 0;
  display: flex;
  overflow: hidden;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.store__media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  transition: transform .55s var(--ease);
}
.store:hover .store__media img { transform: scale(1.03); }

.store__body {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 30px;
}

.store__type {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
}

/* the one featured project: larger than a work card title */
.store__name {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  letter-spacing: -0.025em;
}

.store__desc {
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 52ch;
}

.store__features {
  display: grid;
  gap: 9px;
  margin: 3px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}
.store__features li {
  position: relative;
  padding-inline-start: 22px;
}
/* accent tick, drawn in CSS so it flips with the writing direction */
.store__features li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.62em;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.store__cta {
  margin-top: 9px;
  align-self: start;
}

@media (min-width: 900px) {
  .store { grid-template-columns: 1.15fr 1fr; }
  .store__media {
    border-bottom: 0;
    border-inline-end: 1px solid var(--line);
  }
  /* the storefront shot is much wider than this column: mat it on the surface
     tone and show it whole, so the logo and the hero both stay readable */
  .store__media {
    align-items: center;
    justify-content: center;
    padding: 26px;
  }
  .store__media img {
    aspect-ratio: auto;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
  }
  .store__body { justify-content: center; padding: 44px 46px; gap: 17px; }
}

@media (max-width: 480px) {
  .store__body { padding: 24px 22px 28px; }
}

/* ---------- about ---------- */

.section--about {
  background: var(--surface);
  border-block: 1px solid var(--line);
  transition: background-color .35s var(--ease);
}

.about__body {
  max-width: 62ch;
  margin-inline-start: auto;
  display: grid;
  gap: 22px;
}
.about__lead {
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  line-height: 1.45;
  letter-spacing: -0.015em;
}
.about__body p:not(.about__lead) { color: var(--muted); }

@media (min-width: 900px) {
  .about { display: grid; grid-template-columns: 1fr 2fr; gap: 48px; align-items: start; }
  .about .section__title { margin-bottom: 0; position: sticky; top: 108px; }
}

/* ---------- contact ---------- */

.contact {
  padding-block: clamp(88px, 14vw, 170px);
  text-align: center;
}
.contact__title {
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  letter-spacing: -0.025em;
}
.contact__sub {
  margin-top: 18px;
  color: var(--muted);
  max-width: 40ch;
  margin-inline: auto;
}
.contact__links {
  margin-top: 34px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}
.contact__mail {
  margin-top: 20px;
  font-size: 15px;
  color: var(--muted);
  direction: ltr;
}
.contact__mail a { color: var(--accent); }

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--line);
  padding-block: 28px;
  font-size: 14px;
  color: var(--muted);
}
.foot__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: baseline;
}
.foot__role { color: var(--muted); }

/* ---------- scroll reveal ---------- */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity .7s var(--ease), transform .7s var(--ease);
  }
  .reveal.is-in { opacity: 1; transform: none; }
}

.foot__name { font-weight: 600; direction: ltr; unicode-bidi: isolate; }
