/* Moustafa Haydar — portfolio. Warm minimal: off-white/charcoal, one deep-teal accent. */
:root {
  --bg: #faf7f2;
  --bg-alt: #f1ece3;
  --text: #262220;
  --text-dim: #5c554e;
  --accent: #0f6b66;
  --accent-ink: #ffffff;
  --border: #e3ddd2;
  --card-bg: #ffffff;
  --shadow: 0 8px 24px rgba(38, 34, 32, 0.06);
  --radius: 14px;
  --maxw: 880px;
  --font-display: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Keep this block and the @media block below it identical — one is the manual override,
   the other is the system-preference default. */
:root[data-theme='dark'] {
  --bg: #1b1a18;
  --bg-alt: #242220;
  --text: #efe9e0;
  --text-dim: #b8b0a4;
  --accent: #3fc9bd;
  --accent-ink: #10221f;
  --border: #37342f;
  --card-bg: #232120;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #1b1a18;
    --bg-alt: #242220;
    --text: #efe9e0;
    --text-dim: #b8b0a4;
    --accent: #3fc9bd;
    --accent-ink: #10221f;
    --border: #37342f;
    --card-bg: #232120;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 0.5em; color: var(--text); }
p { margin: 0 0 1em; color: var(--text-dim); }
a { color: var(--accent); }
img, svg { max-width: 100%; display: block; }

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.site-header {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.site-header__name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; text-decoration: none; color: var(--text); }
.site-header__right { display: flex; align-items: center; gap: 20px; }
.site-header__nav { display: flex; gap: 20px; }
.site-header__nav a { text-decoration: none; color: var(--text-dim); font-size: 0.95rem; }
.site-header__nav a:hover, .site-header__nav a:focus-visible { color: var(--accent); }

.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--card-bg);
  color: var(--text); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme='dark'] .theme-toggle .icon-moon { display: none; }
:root[data-theme='dark'] .theme-toggle .icon-sun { display: block; }

a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

section { padding: 72px 0; }
section + section { border-top: 1px solid var(--border); }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; font-weight: 600; margin: 0 0 12px; }

.hero { padding-top: 88px; padding-bottom: 88px; }
.hero__layout { display: flex; align-items: center; gap: 48px; }
.hero__mark { width: 128px; height: 128px; flex-shrink: 0; border-radius: 50%; overflow: hidden; box-shadow: var(--shadow); }
.hero__mark img { width: 100%; height: 100%; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.hero__lede { font-size: 1.15rem; max-width: 46ch; }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px; border-radius: 999px;
  font-weight: 600; text-decoration: none; font-size: 0.95rem; border: 1px solid transparent; cursor: pointer;
}
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { opacity: 0.92; }
.btn--secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn--secondary:hover { border-color: var(--accent); color: var(--accent); }

.about__body { max-width: 62ch; }

.services__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 32px; }
.service-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 24px; box-shadow: var(--shadow);
}
.service-card__icon { width: 40px; height: 40px; color: var(--accent); margin-bottom: 16px; }
.service-card h3 { font-size: 1.1rem; }
.service-card p { margin-bottom: 0; font-size: 0.95rem; }

.skills__grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 28px;
}
.skill-pill {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; text-align: center; font-size: 0.9rem; font-weight: 600; color: var(--text);
}

.contact { text-align: center; }
.contact h2 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); }
.contact__lede { max-width: 50ch; margin-left: auto; margin-right: auto; }
.contact__email { font-size: 1.15rem; font-weight: 600; color: var(--accent); word-break: break-word; }
.contact__cta { margin-top: 24px; }

.site-footer { padding: 32px 0; text-align: center; color: var(--text-dim); font-size: 0.85rem; }
.site-footer a { color: var(--text-dim); }

.notfound { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.notfound h1 { font-size: clamp(2.4rem, 8vw, 4rem); margin-bottom: 0.2em; }

@media (max-width: 640px) {
  .site-header .container { flex-wrap: wrap; height: auto; row-gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .site-header__right { flex-wrap: wrap; justify-content: flex-end; row-gap: 8px; }
  .site-header__nav { display: flex; width: 100%; order: 3; justify-content: center; gap: 16px; font-size: 0.85rem; }
  .theme-toggle { width: 44px; height: 44px; }
  section { padding: 48px 0; }
  .hero { padding-top: 40px; }
  .hero__layout { flex-direction: column; align-items: flex-start; gap: 24px; }
  .hero__mark { width: 96px; height: 96px; }
  .services__grid { grid-template-columns: 1fr; }
}
