/* ============================================================
   Omar Abdalla — Portfolio Styles
   Design: dark, restrained, Swiss-grid-influenced
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;700&display=swap');

/* --- Design Tokens --- */
:root {
  --color-bg:          #0c0e14;
  --color-bg-elevated: #14161e;
  --color-bg-subtle:   #1c1f2a;
  --color-text:        #d4d4d8;
  --color-text-muted:  #71717a;
  --color-accent:      #60a5fa;
  --color-accent-dim:  #2563eb;
  --color-border:      #27272a;

  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  1rem;
  --space-4:  1.5rem;
  --space-5:  2rem;
  --space-6:  3rem;
  --space-8:  4rem;
  --space-10: 5rem;

  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --text-xs:  0.75rem;
  --text-sm:  0.875rem;
  --text-base: 1rem;
  --text-lg:  1.125rem;
  --text-xl:  clamp(1.25rem, 2vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 3vw, 2rem);
  --text-3xl: clamp(1.75rem, 4vw, 2.5rem);
  --text-4xl: clamp(2.25rem, 5vw, 3.25rem);
  --leading-tight:  1.25;
  --leading-normal: 1.6;

  --ease-out:        cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast:   150ms;
  --duration-normal: 300ms;
  --duration-slow:   500ms;

  --max-width: 960px;
  --nav-height: 3.5rem;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ul, ol { margin: 0; }
img { max-width: 100%; display: block; }
ul { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* --- Base --- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + var(--space-5));
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* --- Utilities --- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.section-label {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.section-title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--color-text);
  margin-bottom: var(--space-5);
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(12, 14, 20, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav__logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
}

.nav__logo svg {
  width: 2.4rem;
  height: auto;
}

.nav__logo-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.nav__link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color var(--duration-fast) var(--ease-out);
  position: relative;
  padding-bottom: 2px;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0;
  height: 1.5px;
  background: var(--color-accent);
  transition: width var(--duration-normal) var(--ease-out);
}

.nav__link:hover { color: var(--color-text); }

.nav__link.is-active {
  color: var(--color-text);
}

.nav__link.is-active::after {
  width: 100%;
}

/* Mobile nav */
.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-2);
}

.nav__toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--color-text);
  transition: transform var(--duration-normal) var(--ease-out), opacity var(--duration-fast);
}

@media (max-width: 639px) {
  .nav__toggle { display: flex; }

  .nav__links {
    position: absolute;
    top: var(--nav-height);
    left: 0; right: 0;
    flex-direction: column;
    background: rgba(12, 14, 20, 0.97);
    backdrop-filter: blur(12px);
    padding: var(--space-4);
    gap: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--duration-normal) var(--ease-out),
                opacity var(--duration-normal) var(--ease-out);
  }

  .nav.is-open .nav__links {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav.is-open .nav__toggle span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
  }
  .nav.is-open .nav__toggle span:nth-child(2) {
    opacity: 0;
  }
  .nav.is-open .nav__toggle span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
  }
}

/* --- Hero --- */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--nav-height) + var(--space-8)) var(--space-4) var(--space-10);
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
}

.hero__logo-mark {
  width: clamp(64px, 12vw, 100px);
  height: auto;
  margin-bottom: var(--space-5);
  color: var(--color-text);
}

.hero__intro {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.hero__name {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-3);
  color: var(--color-text);
}

.hero__tagline {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 42ch;
  margin-bottom: var(--space-6);
  line-height: var(--leading-normal);
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.6rem var(--space-4);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 500;
  font-size: var(--text-sm);
  border-radius: 6px;
  transition: border-color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}

.hero__cta:hover {
  border-color: var(--color-accent);
  background: rgba(96, 165, 250, 0.06);
}

.hero__scroll {
  position: absolute;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-text-muted);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  animation: float 2.5s ease-in-out infinite;
}

.hero__scroll-line {
  width: 1px;
  height: 24px;
  background: linear-gradient(to bottom, var(--color-text-muted), transparent);
}

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(5px); }
}

/* --- About --- */
.about {
  padding: var(--space-10) 0;
}

.about__text {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 56ch;
  line-height: 1.7;
}

.about__text strong {
  color: var(--color-text);
  font-weight: 500;
}

/* --- Timeline --- */
.timeline-section {
  padding: var(--space-8) 0 var(--space-10);
}

.timeline {
  position: relative;
  padding-left: 28px;
}

/* Vertical rule */
.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--color-border);
}

.timeline__item {
  position: relative;
  padding-bottom: var(--space-5);
}

.timeline__item:last-child {
  padding-bottom: 0;
}

/* Timeline node dot */
.timeline__node {
  position: absolute;
  left: -28px;
  top: 8px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-bg);
  z-index: 1;
}

.timeline__item[data-type="education"] .timeline__node {
  border-color: var(--color-text-muted);
}
.timeline__item[data-type="work"] .timeline__node {
  border-color: var(--color-accent-dim);
}
.timeline__item[data-type="project"] .timeline__node {
  border-color: var(--color-accent);
  background: var(--color-accent);
}

/* Card */
.timeline__card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: var(--space-4);
  cursor: pointer;
  transition: border-color var(--duration-normal) var(--ease-out);
}

.timeline__card:hover {
  border-color: var(--color-bg-subtle);
}

.timeline__card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.timeline__date {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.timeline__type-badge {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
}

.timeline__title {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--color-text);
}

.timeline__org {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.timeline__highlight {
  display: inline-block;
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-accent);
  background: rgba(96, 165, 250, 0.08);
  padding: 2px 8px;
  border-radius: 3px;
}

/* Expandable details */
.timeline__details {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-slow) var(--ease-out),
              margin-top var(--duration-normal) var(--ease-out);
  margin-top: 0;
}

.timeline__card[aria-expanded="true"] .timeline__details {
  max-height: 500px;
  margin-top: var(--space-3);
}

.timeline__bullets {
  padding-left: var(--space-4);
  list-style: disc;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.75;
}

.timeline__bullets li::marker {
  color: var(--color-border);
}

.timeline__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-3);
}

.timeline__tag {
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
}

.timeline__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-accent);
  transition: gap var(--duration-fast) var(--ease-out);
}

.timeline__link:hover {
  gap: var(--space-2);
}

.timeline__expand-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  opacity: 0.6;
  transition: opacity var(--duration-fast);
}

.timeline__card[aria-expanded="true"] .timeline__expand-hint {
  opacity: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}

/* --- Skills --- */
.skills-section {
  padding: var(--space-8) 0 var(--space-10);
}

.skills__group {
  margin-bottom: var(--space-5);
}

.skills__group:last-child {
  margin-bottom: 0;
}

.skills__group-title {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.skills__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.skills__chip {
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  border-radius: 6px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  transition: border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.skills__chip:hover {
  border-color: var(--color-bg-subtle);
  color: var(--color-text);
}

/* --- Footer --- */
.footer {
  padding: var(--space-6) 0 var(--space-4);
  border-top: 1px solid var(--color-border);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
}

.footer__heading {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.footer__sub {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: color var(--duration-fast) var(--ease-out);
}

.footer__link:hover {
  color: var(--color-text);
}

.footer__link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
}

.footer__copy {
  width: 100%;
  text-align: center;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* --- Scroll Animations --- */
.fade-in-up {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.fade-in-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Responsive --- */
@media (min-width: 640px) {
  .footer__inner {
    flex-wrap: nowrap;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-5);
  }

  .timeline {
    padding-left: 36px;
  }

  .timeline__node {
    left: -36px;
  }
}

/* --- Accessibility --- */
@media (prefers-reduced-motion: reduce) {
  .fade-in-up {
    transition: none;
    opacity: 1;
    transform: none;
  }
  .hero__scroll {
    animation: none;
  }
}
