/* Design tokens (from the "Haitham Resume" Figma file) */
:root {
  --bg-page: #fcfcfc;
  --bg-card: #fbfbfd;
  --bg-tint: rgba(85, 85, 85, 0.04);
  --ink: #232323;
  --ink-muted: #7d7d7d;
  --border-strong: #434343;
  --border-frame: #6a6c71;
  --border-soft: rgba(106, 108, 113, 0.12);

  --font: "Rethink Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius-frame: 16px;
  --radius-card: 12px;
  --radius-icon: 10px;
  --radius-pill: 1000px;

  --section-px: 32px;
  --section-py: 40px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.28;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4,
p,
ul,
ol {
  margin: 0;
}

a {
  color: inherit;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg-card);
  border-radius: 8px;
  z-index: 10;
}

.skip-link:focus {
  top: 16px;
}

/* Typography scale */
.h1 {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.01em;
}

.h2 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.01em;
}

.h3 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.01em;
}

.label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.muted {
  color: var(--ink-muted);
}

/* Page frame */
.page {
  display: flex;
  justify-content: center;
  padding: 25px 12px;
}

.frame {
  width: 100%;
  max-width: 1200px;
  background: var(--bg-card);
  border: 1px solid var(--border-frame);
  border-radius: var(--radius-frame);
  /* clip, not hidden: keeps the sticky nav working inside the frame */
  overflow: clip;
}

.section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  padding: var(--section-py) var(--section-px);
  border-bottom: 1px solid var(--border-soft);
}

.section--tinted {
  background: var(--bg-tint);
  gap: 28px;
}

.section__body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 6px;
  padding: 0;
  list-style: none;
}

/* Sticky section nav */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px var(--section-px);
  background: rgba(251, 251, 253, 0.88);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.topbar__mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg-card);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.topbar__links {
  display: flex;
  gap: 4px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.topbar__links a {
  display: block;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.topbar__links a:hover,
.topbar__links a.is-active {
  color: var(--ink);
  border-color: var(--ink);
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  background: var(--ink);
  color: var(--bg-card);
  border: 1px solid var(--ink);
  border-radius: var(--radius-card);
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.button:hover {
  opacity: 0.85;
}

.button img {
  width: 14px;
  height: 14px;
}

.button--ghost {
  background: transparent;
  color: var(--ink);
}

.button--ghost:hover {
  opacity: 1;
  background: var(--bg-tint);
}

.button--small {
  padding: 9px 14px;
  border-radius: var(--radius-icon);
}

/* Header / about */
.hero {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 40px 32px 32px;
  border-bottom: 1px solid var(--border-soft);
}

.hero__main {
  display: flex;
  align-items: flex-start;
  gap: 32px;
}

.hero__lead {
  max-width: 620px;
  font-size: 16px;
  line-height: 1.4;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 6px;
}

/* Key numbers */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--bg-tint);
  overflow: hidden;
}

.stat {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 6px;
  padding: 20px;
  border-left: 1px solid var(--border-soft);
}

.stat:first-child {
  border-left: 0;
}

.stat__value {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.01em;
}

.hero__avatar {
  flex-shrink: 0;
  width: 112px;
  height: 112px;
  border: 3px solid #5a5a5a;
  border-radius: 50%;
  background: #858585;
  object-fit: cover;
}

.hero__info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero__name {
  font-size: 40px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

/* Summary */
.summary__text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.summary__title {
  max-width: 560px;
}

.meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.meta img {
  width: 14px;
  height: 14px;
}

/* Competencies */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  padding: 0;
  list-style: none;
}

.skill {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 19px;
  background: var(--bg-tint);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
}

.skill__icon {
  display: flex;
  flex-shrink: 0;
  padding: 11px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-icon);
}

.skill__icon img {
  width: 18px;
  height: 18px;
}

.skill__text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skill__desc {
  color: var(--ink-muted);
  font-size: 13px;
}

/* Signature platforms */
.platforms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  padding: 0;
  list-style: none;
}

.platform {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 23px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
}

.platform .h3 {
  font-size: 22px;
}

.platform--wide {
  grid-column: 1 / -1;
}

.platform .chips {
  margin-top: 6px;
}

/* Contact call to action */
.cta {
  gap: 20px;
}

.cta__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 640px;
}

/* Experience & education cards */
.cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 0;
  list-style: none;
}

.card {
  background: var(--bg-tint);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.card__head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  background: var(--bg-tint);
  border-bottom: 1px solid var(--border-soft);
}

.card__title-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.card__title-row .h3 {
  flex: 1 1 0;
  min-width: 0;
}

.card__period {
  flex-shrink: 0;
  white-space: nowrap;
}

.card__sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink-muted);
}

.card__body {
  display: flex;
}

.card__col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 20px 32px;
}

.card__col--main {
  flex: 1 1 0;
  min-width: 0;
  border-right: 1px solid var(--border-soft);
}

.card__col--side {
  flex: 0 0 272px;
}

.card__col--full {
  flex: 1 1 auto;
}

.bullets {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  list-style: none;
}

.bullets li {
  position: relative;
  padding-left: 11px;
}

.bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink);
}

/* Footer */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px var(--section-px);
  background: var(--bg-tint);
}

.footer__social {
  display: flex;
  border-radius: 4px;
  transition: opacity 0.15s ease;
}

.footer__social:hover {
  opacity: 0.7;
}

.footer__social img {
  width: 20px;
  height: 20px;
}

/* 404 */
.page--full {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 12px;
}

.frame--404 {
  display: flex;
  flex-direction: column;
  border-color: var(--ink-muted);
  border-radius: 24px;
}

.notfound__head {
  display: flex;
  justify-content: center;
  padding: var(--section-py) var(--section-px);
  background: rgba(67, 67, 67, 0.03);
  border-bottom: 1px solid var(--ink-muted);
}

.notfound__head a {
  text-decoration: none;
}

.notfound__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--ink-muted);
  text-align: center;
}

/* Tablet */
@media (max-width: 900px) {
  .topbar__links {
    display: none;
  }

  .topbar .button--small {
    margin-left: auto;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat:nth-child(3) {
    border-left: 0;
  }

  .stat:nth-child(n + 3) {
    border-top: 1px solid var(--border-soft);
  }

  .card__body {
    flex-direction: column;
  }

  .card__col--main {
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }

  .card__col--side {
    flex-basis: auto;
  }
}

/* Mobile (Figma "Home - Mobile", 360px) */
@media (max-width: 640px) {
  :root {
    --section-px: 20px;
    --section-py: 32px;
  }

  .page {
    padding: 12px;
  }

  .topbar {
    padding: 10px 16px;
  }

  .hero {
    gap: 24px;
    padding: 28px 20px 24px;
  }

  .hero__main {
    flex-direction: column;
    gap: 20px;
  }

  .hero__avatar {
    width: 88px;
    height: 88px;
  }

  .hero__name {
    font-size: 30px;
  }

  .hero__lead {
    font-size: 14px;
  }

  .hero__actions .button {
    flex: 1 1 100%;
  }

  .stat {
    padding: 16px;
  }

  .stat__value {
    font-size: 26px;
  }

  .section {
    gap: 20px;
  }

  .section--tinted {
    gap: 24px;
  }

  .h1 {
    font-size: 22px;
  }

  .summary__text p:not(.h1) {
    font-size: 13px;
    font-weight: 500;
  }

  .h2 {
    font-size: 22px;
  }

  .skills-grid,
  .platforms {
    grid-template-columns: 1fr;
  }

  .card__title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .card__head {
    gap: 16px;
  }

  .cta .button {
    width: 100%;
  }

  .notfound__body .h1 {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Print / "Download CV": a clean, compact resume */
@media print {
  @page {
    margin: 12mm;
  }

  body {
    background: #fff;
    font-size: 12px;
  }

  .page {
    padding: 0;
  }

  .frame {
    border: 0;
    border-radius: 0;
  }

  .skip-link,
  .topbar,
  .hero__actions .button,
  .cta,
  .footer__social {
    display: none;
  }

  .section,
  .hero {
    padding: 18px 0;
  }

  .section--tinted {
    background: none;
  }

  .skill,
  .platform,
  .stats,
  .card__head,
  .bullets li {
    break-inside: avoid;
  }

  .h2,
  .chip {
    break-after: avoid;
  }

  .card__col {
    padding: 14px 20px 18px;
  }
}
