/* ============================================================
   Yassine Daouji — personal website
   Landing-page design. Light & dark themes via data-theme.
   ============================================================ */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-2: #06b6d4;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --shadow-sm: 0 1px 3px rgb(15 23 42 / 0.06);
  --shadow-md: 0 10px 30px -12px rgb(15 23 42 / 0.18);
  --grad: linear-gradient(120deg, var(--accent), var(--accent-2));
  --header-h: 68px;
}

html[data-theme="dark"] {
  --bg: #0b1121;
  --surface: #111a30;
  --surface-2: #0e1526;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #22304d;
  --accent: #60a5fa;
  --accent-2: #22d3ee;
  --accent-soft: rgba(96, 165, 250, 0.12);
  --shadow-sm: 0 1px 3px rgb(0 0 0 / 0.4);
  --shadow-md: 0 14px 34px -12px rgb(0 0 0 / 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }
a { color: inherit; }

::selection { background: var(--accent); color: #fff; }

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

.container {
  width: min(1080px, 100% - 2.5rem);
  margin-inline: auto;
}

.icon { width: 1.2em; height: 1.2em; flex-shrink: 0; }
.icon-sm { width: 1em; height: 1em; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--border);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-dot { color: var(--accent); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-link:hover { color: var(--text); background: var(--surface-2); }

.nav-link.active { color: var(--accent); background: var(--accent-soft); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.lang-btn.active {
  color: #fff;
  background: var(--grad);
}

html[data-theme="dark"] .lang-btn.active { color: #0b1121; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

#nav-toggle { display: none; }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 12px;
  padding: 11px 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
              background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  color: #fff;
  background: var(--grad);
  border: none;
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent);
}

html[data-theme="dark"] .btn-primary { color: #0b1121; }

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px -8px color-mix(in srgb, var(--accent) 75%, transparent);
}

.btn-ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn-lg { font-size: 1rem; padding: 13px 24px; }

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

.hero-section {
  position: relative;
  overflow: hidden;
  padding: clamp(3rem, 7vw, 5.5rem) 0 3rem;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 320px at 85% 0%, var(--accent-soft), transparent 70%),
    radial-gradient(500px 300px at 0% 30%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 70%);
}

.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--muted) 26%, transparent) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 65%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 65%);
  opacity: 0.5;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  align-items: center;
}

@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.15fr 0.85fr; }
}

@media (max-width: 899px) {
  .hero-visual { order: -1; }
  .hero-copy { text-align: center; }
  .hero-tagline { margin-inline: auto; }
  .hero-actions { justify-content: center; }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  padding: 6px 14px;
}

.chip .icon { width: 0.95em; height: 0.95em; }

.chip-muted {
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 10%, transparent);
  border-color: color-mix(in srgb, var(--muted) 28%, transparent);
}

.hero-greeting {
  margin-top: 24px;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--muted);
}

.hero-title {
  font-size: clamp(2.4rem, 6.5vw, 3.9rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-role {
  margin-top: 10px;
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  font-weight: 600;
}

.hero-tagline {
  margin-top: 16px;
  max-width: 54ch;
  font-size: 1.02rem;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

/* hero photo */

.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
}

.photo-ring {
  padding: 6px;
  border-radius: 28px;
  background: var(--grad);
  box-shadow: var(--shadow-md);
}

.photo-ring img {
  width: min(300px, 72vw);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 22px;
  background: var(--surface);
}

.float-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: var(--shadow-md);
}

.float-chip .icon { width: 1em; height: 1em; color: var(--accent); }

.float-chip-1 { top: 8%; right: 4%; animation: floaty 5s ease-in-out infinite; }
.float-chip-2 { bottom: 10%; left: 2%; animation: floaty 5s ease-in-out 1.2s infinite; }

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@media (prefers-reduced-motion: reduce) {
  .float-chip { animation: none; }
  html { scroll-behavior: auto; }
}

/* stats */

.stats {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-block: 1px solid var(--border);
}

@media (min-width: 700px) {
  .stats { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 699px) {
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

.stat {
  padding: 22px 12px;
  text-align: center;
}

.stat + .stat { border-left: 1px solid var(--border); }

.stat-value {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label { color: var(--muted); font-size: 0.88rem; }

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

section[id] {
  padding: clamp(3.5rem, 8vw, 5.5rem) 0;
}

#about, #skills { background: var(--surface-2); }

.section-head { margin-bottom: 40px; }

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 8px;
}

.section-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

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

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: start;
}

@media (min-width: 860px) {
  .about-grid { grid-template-columns: 1.5fr 1fr; }
}

@media (max-width: 859px) {
  .about-text { text-align: center; }
  .facts-card li { justify-content: center; }
  .facts-card li > div { text-align: center; }
}

.about-text p { color: var(--muted); }
.about-text p + p { margin-top: 16px; }

.facts-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  padding: 8px 20px;
}

.facts-card li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
}

.facts-card li + li { border-top: 1px solid var(--border); }

.facts-card .icon { color: var(--accent); width: 1.35em; height: 1.35em; }

.fact-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.fact-value { font-weight: 500; font-size: 0.95rem; word-break: break-all; }

/* ---------- experience ---------- */

.timeline { position: relative; }

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

.timeline-item + .timeline-item { margin-top: 28px; }

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-marker {
  position: absolute;
  left: 0;
  top: 26px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 0 4px var(--bg);
}

#experience .timeline-marker { box-shadow: 0 0 0 4px var(--bg); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.job-card { padding: 24px; }

.job-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.company-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  background: var(--grad);
}

html[data-theme="dark"] .company-logo { color: #0b1121; }

.job-head > div { flex: 1; min-width: 180px; }

.job-role { font-size: 1.08rem; font-weight: 700; line-height: 1.3; }

.job-company { font-size: 0.9rem; color: var(--muted); }

.job-sector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 12px;
}

.job-sector .icon { width: 0.95em; height: 0.95em; }

.job-period {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}

.job-summary { margin-top: 14px; font-weight: 500; }

.job-bullets {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.job-bullets li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.job-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.tag:hover { border-color: var(--accent); color: var(--accent); }

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

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.skill-card { padding: 24px; }

.skill-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.skill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  margin-bottom: 14px;
}

.skill-icon .icon { width: 1.4em; height: 1.4em; }

.skill-cat { font-size: 1.02rem; font-weight: 700; margin-bottom: 4px; }

/* ---------- projects ---------- */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 20px;
}

.project-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.project-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.project-title { font-size: 1.05rem; font-weight: 700; line-height: 1.3; }

.project-link {
  display: inline-flex;
  color: var(--muted);
  transition: color 0.15s ease, transform 0.15s ease;
}

.project-link:hover { color: var(--accent); transform: translateX(3px); }

.project-desc {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  flex: 1;
}

/* ---------- education ---------- */

.edu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 860px) {
  .edu-grid { grid-template-columns: 1.4fr 1fr; }
}

.edu-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  padding: 8px 24px;
}

.edu-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 16px 0;
}

.edu-heading .icon { color: var(--accent); }

.edu-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
}

.edu-item + .edu-item { border-top: 1px solid var(--border); }

.edu-year {
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  padding-top: 2px;
}

.edu-degree { font-weight: 600; line-height: 1.4; }

.edu-school { font-size: 0.88rem; color: var(--muted); }

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

.contact-panel {
  text-align: center;
  background:
    radial-gradient(420px 200px at 50% 0%, var(--accent-soft), transparent 75%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 5vw, 3rem);
}

.contact-title {
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.contact-sub {
  max-width: 46ch;
  margin: 12px auto 28px;
  color: var(--muted);
}

.contact-channels {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 28px;
  margin-top: 32px;
}

.contact-channels a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.contact-channels a:hover { color: var(--accent); }

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

.site-footer {
  border-top: 1px solid var(--border);
  padding: 36px 0;
  text-align: center;
}

.footer-brand {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.footer-brand::after { content: "."; color: var(--accent); }

.footer-made { margin-top: 6px; font-size: 0.88rem; color: var(--muted); }

.footer-copy { margin-top: 4px; font-size: 0.82rem; color: var(--muted); }

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

@media (max-width: 820px) {
  #nav-toggle { display: inline-flex; }

  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px 16px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(-130%);
    transition: transform 0.25s ease;
    z-index: 40;
  }

  body.nav-open .site-nav { transform: translateY(0); }

  .nav-link { padding: 12px 16px; border-radius: 12px; font-size: 1rem; }

  .float-chip-1 { right: 0; }
  .float-chip-2 { left: 0; }
}

/* ---------- mobile centering ---------- */

@media (max-width: 820px) {
  .section-head { text-align: center; }

  .skill-card { text-align: center; }

  .project-top { justify-content: center; }
  .project-desc { text-align: center; }

  .skill-card .tag-row,
  .project-card .tag-row { justify-content: center; }
}

/* ---------- reveal animation ---------- */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}
