/* ==========================================================================
   Ghareeb Thiab — CV
   Modern-minimal redesign. "Less, but better."
   Spacing scale (px): 4 8 12 16 24 32 48 64 96
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  --bg: #FAFAF7;
  --ink: #111111;
  --text: #3C3C3E;
  --muted: #6B6B6F;
  --line: #E6E4DF;
  --accent: #EA5A0C;        /* marks only: dots, focus, rules */
  --accent-text: #B8470A;   /* AA-safe for text and solid button */
  --accent-hover: #9E3C08;
  --on-accent: #FFFFFF;

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;  --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; 

  --radius-sm: 8px;
  --maxw: 1120px;
  --gutter: 20px;
  --nav-h: 64px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F0F10;
  --ink: #F2F2EF;
  --text: #C8C8C6;
  --muted: #8E8E93;
  --line: #2A2A2D;
  --accent: #FF7A33;
  --accent-text: #FF8E52;
  --accent-hover: #FFA274;
  --on-accent: #0F0F10;
}

/* No-JS fallback: follow the OS when no explicit theme is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0F0F10; --ink: #F2F2EF; --text: #C8C8C6;
    --muted: #8E8E93; --line: #2A2A2D; --accent: #FF7A33; --accent-text: #FF8E52;
    --accent-hover: #FFA274; --on-accent: #0F0F10;
  }
}

@media (min-width: 720px) { :root { --gutter: 40px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--s5));
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 26px;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
h1, h2, h3, h4 { color: var(--ink); font-weight: 600; margin: 0; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-text); }

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

.skip-link {
  position: absolute; left: var(--s4); top: -64px; z-index: 200;
  background: var(--ink); color: var(--bg);
  padding: var(--s2) var(--s4); border-radius: var(--radius-sm);
  text-decoration: none; transition: top .2s var(--ease);
}
.skip-link:focus { top: var(--s4); color: var(--bg); }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gutter); }

svg.ico { width: 16px; height: 16px; flex: none; }

/* ---------- Type helpers ---------- */
.label {
  font-size: 12px; line-height: 16px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s5);
  font: inherit; font-size: 15px; font-weight: 500; line-height: 1;
  border-radius: 999px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
}
.btn-primary { background: var(--accent-text); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-quiet { color: var(--ink); border-color: var(--line); background: transparent; }
.btn-quiet:hover { border-color: var(--ink); color: var(--ink); }
.btn-sm { min-height: 36px; padding: 0 var(--s4); font-size: 14px; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  height: var(--nav-h);
}
.brand {
  font-weight: 600; font-size: 15px; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.nav-right { display: flex; align-items: center; gap: var(--s2); }
.nav-links { display: flex; gap: var(--s1); }
.nav-links a {
  font-size: 14px; color: var(--muted); text-decoration: none;
  padding: var(--s2) var(--s3); border-radius: 999px;
  transition: color .2s var(--ease);
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-width: 36px; height: 36px; padding: 0 var(--s2);
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 14px;
  transition: border-color .2s var(--ease);
}
.icon-btn:hover { border-color: var(--ink); }
.theme-toggle .theme-off { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-on { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-off { display: inline; }
.nav-toggle { display: none; padding: 0 var(--s3); }

@media (max-width: 1039px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; left: 0; right: 0; top: var(--nav-h);
    flex-direction: column; gap: 0;
    padding: var(--s2) var(--gutter) var(--s5);
    background: var(--bg); border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { font-size: 17px; padding: var(--s3) 0; border-radius: 0; color: var(--ink); border-bottom: 1px solid var(--line); }
  .nav-links a:last-child { border-bottom: 0; }
}
@media (max-width: 479px) {
  .nav-cv .txt { display: none; }
  .nav-cv { padding: 0 var(--s3); }
}

/* ---------- Hero ---------- */
.hero { padding-block: var(--s8) var(--s7); }
.hero-grid { display: grid; gap: var(--s6); }
.hero-photo img {
  width: 96px; height: 96px; border-radius: 24px; object-fit: cover;
  background: var(--line);
}
.hero h1 {
  font-size: 40px; line-height: 44px; letter-spacing: -.025em; font-weight: 600;
  margin-bottom: var(--s3);
}
.hero .title { font-size: 18px; line-height: 28px; color: var(--ink); font-weight: 500; margin-bottom: var(--s5); }
.hero .headline { font-size: 18px; line-height: 30px; color: var(--text); max-width: 60ch; margin-bottom: var(--s4); }
.hero .intro { color: var(--muted); max-width: 64ch; margin-bottom: var(--s6); }

.hero-facts { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin-bottom: var(--s6); }
.hero-facts li { font-size: 14px; line-height: 22px; color: var(--ink); display: inline-flex; align-items: center; gap: var(--s2); }
.hero-facts li::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }

.hero-meta { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); margin-bottom: var(--s6); font-size: 14px; color: var(--muted); }
.hero-meta .mi { display: inline-flex; align-items: center; gap: var(--s2); text-decoration: none; }
.hero-meta a.mi { color: var(--ink); }
.hero-meta a.mi:hover { color: var(--accent-text); }

.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }

.cred-strip {
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5);
  margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid var(--line);
}
.cred-strip li { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

@media (min-width: 720px) {
  .hero { padding-block: var(--s9) var(--s8); }
  .hero h1 { font-size: 56px; line-height: 60px; }
  .hero .title { font-size: 20px; line-height: 30px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s8); align-items: start; }
  .hero-photo { order: 2; }
  .hero-photo img { width: 168px; height: 168px; border-radius: 32px; }
}

/* ---------- Stats ---------- */
.stats { padding-bottom: var(--s8); }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s6) var(--s5); }
.stat { border-top: 1px solid var(--line); padding-top: var(--s4); }
.stat-num {
  display: block; font-size: 40px; line-height: 44px; font-weight: 500; letter-spacing: -.03em;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.stat-label { display: block; margin-top: var(--s2); font-size: 14px; line-height: 22px; color: var(--muted); max-width: 26ch; }
@media (min-width: 720px) { .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Sections: Swiss two-column ---------- */
.sec { padding-block: var(--s8); border-top: 1px solid var(--line); }
.sec-grid { display: grid; gap: var(--s5); }
.sec-label { padding-top: 6px; }
.sec-head h2 { font-size: 24px; line-height: 32px; letter-spacing: -.015em; }
.sec-head .lead { margin-top: var(--s3); color: var(--muted); max-width: 64ch; }
.sec-head { margin-bottom: var(--s6); }
.sec-body > .sec-head:only-child { margin-bottom: 0; }

@media (min-width: 960px) {
  .sec { padding-block: var(--s9); }
  .sec-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--s5); }
  .sec-label { grid-column: 1 / span 3; position: sticky; top: calc(var(--nav-h) + var(--s6)); align-self: start; }
  .sec-body { grid-column: 4 / span 9; min-width: 0; }
  .sec-head h2 { font-size: 28px; line-height: 36px; }
}

/* ---------- Summary ---------- */
.summary-text { font-size: 18px; line-height: 30px; color: var(--text); max-width: 66ch; }
.summary-text + .summary-text { margin-top: var(--s4); }

/* ---------- Roles (experience / teaching) ---------- */
.roles > .role { padding-block: var(--s6); border-top: 1px solid var(--line); }
.roles > .role:first-child { padding-top: 0; border-top: 0; }
.roles > .role:last-child { padding-bottom: 0; }
.role-head { display: grid; gap: var(--s1) var(--s5); }
.role-head h3 { font-size: 18px; line-height: 28px; letter-spacing: -.01em; }
.role-org { font-weight: 400; color: var(--muted); }
.role-dates { font-size: 14px; line-height: 22px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.role-loc { font-size: 14px; line-height: 22px; color: var(--muted); margin-top: var(--s1); }
.role-loc a { color: var(--muted); }
.role-loc a:hover { color: var(--accent-text); }
@media (min-width: 720px) {
  .role-head { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; }
}

.tag {
  display: inline-flex; align-items: center; gap: 6px; vertical-align: 2px; margin-left: var(--s2);
  font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .04em; color: var(--muted);
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.tag-live::before { background: var(--accent); }

.subroles { margin-top: var(--s4); border-left: 1px solid var(--line); padding-left: var(--s4); display: grid; gap: var(--s2); }
.subrole-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 var(--s4); font-size: 15px; }
.subrole-row .t { color: var(--ink); font-weight: 500; }

.bullets { margin-top: var(--s4); display: grid; gap: var(--s2); max-width: 70ch; }
.bullets li { position: relative; padding-left: var(--s5); }
.bullets li::before {
  content: ""; position: absolute; left: 2px; top: 12px;
  width: 8px; height: 1px; background: var(--muted);
}

/* ---------- Courses ---------- */
.courses-title { font-size: 18px; line-height: 28px; margin: var(--s8) 0 var(--s5); }
.courses { display: grid; gap: 0 var(--s6); grid-template-columns: minmax(0, 1fr); }
.course { padding-block: var(--s5); border-top: 1px solid var(--line); }
.course h4 { font-size: 16px; line-height: 24px; font-weight: 600; }
.course .meta { font-size: 14px; line-height: 22px; color: var(--muted); margin: var(--s1) 0 var(--s3); }
.course ul { display: grid; gap: var(--s1); }
.course li { font-size: 15px; line-height: 24px; position: relative; padding-left: var(--s4); }
.course li::before { content: ""; position: absolute; left: 0; top: 11px; width: 6px; height: 1px; background: var(--muted); }
@media (min-width: 720px) { .courses { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Certifications ---------- */
.cert-group + .cert-group { margin-top: var(--s7); }
.cert-group > h3 { margin-bottom: var(--s3); }
.cert-list > li {
  display: grid; gap: var(--s1) var(--s5); padding-block: var(--s4);
  border-top: 1px solid var(--line);
}
.cert-list > li:last-child { border-bottom: 1px solid var(--line); }
.cert .name { color: var(--ink); font-weight: 500; }
.cert .issuer { font-size: 14px; line-height: 22px; color: var(--muted); }
.cert .date { font-size: 14px; line-height: 22px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (min-width: 720px) {
  .cert-list > li { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; }
  .cert .date { grid-column: 2; grid-row: 1; text-align: right; }
}

/* ---------- Education ---------- */
.edu-row { display: grid; gap: var(--s1) var(--s5); }
.edu-row .degree { font-size: 18px; line-height: 28px; }
.edu-row .school { color: var(--text); margin-top: var(--s1); }
.edu-row .ach { font-size: 14px; line-height: 22px; color: var(--muted); margin-top: var(--s1); }
@media (min-width: 720px) { .edu-row { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; } }

/* ---------- Skills ---------- */
.skills-grid { display: grid; gap: var(--s6) var(--s6); }
.skill-cat h3 { margin-bottom: var(--s3); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chips li {
  font-size: 14px; line-height: 20px; color: var(--ink);
  padding: 6px var(--s3); border: 1px solid var(--line); border-radius: 999px;
}
@media (min-width: 720px) { .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Highlights ---------- */
.highlights { display: grid; gap: var(--s6) var(--s6); }
.highlight { border-top: 1px solid var(--line); padding-top: var(--s4); }
.highlight h3 { font-size: 16px; line-height: 24px; margin-bottom: var(--s2); }
.highlight p { color: var(--muted); font-size: 15px; line-height: 24px; }
@media (min-width: 720px) { .highlights { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- FAQ ---------- */
.faq-list { border-top: 1px solid var(--line); max-width: 760px; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s4);
  padding-block: var(--s4); cursor: pointer; list-style: none;
  color: var(--ink); font-weight: 500;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: ""; flex: none; width: 10px; height: 10px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: translateY(-3px) rotate(45deg); transition: transform .3s var(--ease);
}
.faq-item[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.faq-item p { padding-bottom: var(--s5); color: var(--muted); max-width: 66ch; }

/* ---------- Contact ---------- */
.contact-box { display: grid; gap: var(--s6); }
.contact-list { display: grid; gap: var(--s3); }
.contact-list .ci { display: inline-flex; align-items: center; gap: var(--s3); color: var(--ink); text-decoration: none; font-size: 17px; }
.contact-list a.ci:hover { color: var(--accent-text); }
.contact-list span.ci { color: var(--muted); }
.contact-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); padding-block: var(--s6) var(--s7); font-size: 14px; line-height: 22px; color: var(--muted); }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2) var(--s5); }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent-text); }

/* ---------- Motion: slow, gentle reveal ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
  html.js .reveal.in { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

/* ---------- Print ---------- */
@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --ink: #000; --text: #111; --muted: #444; --line: #ccc;
  }
  body { font-size: 10.5pt; line-height: 1.45; background: #fff; }
  .nav, .skip-link, .hero-actions, .contact-actions, .hero-photo { display: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .hero, .sec, .stats { padding-block: 12pt; }
  .sec-label { position: static; }
  .role, .cert-list > li, .course, .highlight, .faq-item { break-inside: avoid; }
  .faq-item p { display: block; }
  a { text-decoration: none; }
  .hero-meta a[href^="http"]::after, .contact-list a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; }
}
