/* Mohammed Ali Samk — portfolio
   Static, no build step. Light/dark via data-theme. */

:root,
[data-theme="light"] {
  --bg: #f4f1ea;
  --bg-alt: #ebe6db;
  --surface: #fffdf8;
  --text: #1c2430;
  --text-muted: #4d5868;
  --accent: #1b3a5f;
  --accent-hover: #142b47;
  --accent-soft: #dfe7f1;
  --brass: #8a6a3d;
  --border: #d6cfc0;
  --shadow: 0 18px 40px rgba(28, 36, 48, 0.08);
  --header-bg: rgba(244, 241, 234, 0.88);
  --ring: #2c6aa0;
  --hero-frame: #1b3a5f;
  --photo-mat: #fffdf8;
  --photo-edge: rgba(27, 58, 95, 0.14);
  --photo-shadow: 0 18px 36px rgba(28, 36, 48, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121720;
    --bg-alt: #181e29;
    --surface: #1b2230;
    --text: #efe8dc;
    --text-muted: #b4bcc9;
    --accent: #9ec0e4;
    --accent-hover: #c2d7ef;
    --accent-soft: #243044;
    --brass: #c4a574;
    --border: #2d3646;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    --header-bg: rgba(18, 23, 32, 0.86);
    --ring: #9ec0e4;
    --hero-frame: #2a384c;
    --photo-mat: #1c2433;
    --photo-edge: rgba(158, 192, 228, 0.28);
    --photo-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
  }
}

[data-theme="dark"] {
  --bg: #121720;
  --bg-alt: #181e29;
  --surface: #1b2230;
  --text: #efe8dc;
  --text-muted: #b4bcc9;
  --accent: #9ec0e4;
  --accent-hover: #c2d7ef;
  --accent-soft: #243044;
  --brass: #c4a574;
  --border: #2d3646;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --header-bg: rgba(18, 23, 32, 0.86);
  --ring: #9ec0e4;
  --hero-frame: #2a384c;
  --photo-mat: #1c2433;
  --photo-edge: rgba(158, 192, 228, 0.28);
  --photo-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
}

:root {
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --space: clamp(1rem, 2vw, 1.5rem);
  --wide: 1100px;
  --header-h: 4.25rem;
  --radius: 1rem;
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

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

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

.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;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 200;
  padding: 0.6rem 0.9rem;
  background: var(--accent);
  color: var(--bg);
  border-radius: 0.4rem;
}

.skip-link:focus {
  top: 1rem;
  color: #fff;
}

.container {
  width: min(var(--wide), calc(100% - 2rem));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  width: min(var(--wide), calc(100% - 2rem));
  margin-inline: auto;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

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

.nav-list {
  display: flex;
  gap: 1.25rem;
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-btn {
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

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

.icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
}

#theme-toggle .icon-sun {
  display: none;
}

#theme-toggle .icon-moon {
  display: block;
}

[data-theme="dark"] #theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] #theme-toggle .icon-moon {
  display: none;
}

.nav-toggle .icon-close,
.nav-toggle[aria-expanded="true"] .icon-menu {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

.nav-backdrop {
  display: none;
}

/* Hero */
.hero {
  padding: clamp(2.5rem, 6vw, 5.5rem) 0 clamp(3rem, 7vw, 6rem);
}

.hero-grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

.eyebrow {
  color: var(--brass);
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.3rem, 6vw, 4.1rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 650;
}

.lede {
  margin-top: 1.1rem;
  max-width: 38rem;
  color: var(--text-muted);
  font-size: 1.08rem;
}

.hero-meta {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.hero-actions {
  margin-top: 1.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.85rem;
  padding: 0.55rem 1.15rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

[data-theme="dark"] .btn-primary:hover {
  color: #121720;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover,
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--text);
}

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

.hero-photo {
  display: flex;
  justify-content: center;
}

.photo-frame {
  width: min(100%, 20rem);
  padding: 0.38rem;
  border-radius: 1.35rem;
  background: var(--photo-mat);
  box-shadow: 0 0 0 1px var(--photo-edge), var(--photo-shadow);
}

.photo-frame picture,
.photo-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 0;
  border-radius: 1.05rem;
}

/* Sections */
.section {
  padding: clamp(3.5rem, 8vw, 6rem) 0;
  scroll-margin-top: calc(var(--header-h) + 0.5rem);
}

#contact {
  min-height: calc(100svh - var(--header-h));
}

.section-alt {
  background: var(--bg-alt);
}

.section-heading {
  margin-bottom: 1.75rem;
}

.section-kicker {
  color: var(--brass);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  margin-bottom: 0.4rem;
}

.section h2 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
}

.split {
  display: grid;
  gap: 1.5rem 3rem;
}

.prose {
  max-width: 42rem;
}

.prose p + p {
  margin-top: 1rem;
}

.prose p {
  color: var(--text-muted);
}

/* Experience */
.timeline {
  list-style: none;
  display: grid;
  gap: 1.25rem;
}

.timeline-item {
  display: grid;
  gap: 0.7rem;
  padding: 1.35rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.timeline-dates {
  font-weight: 650;
  font-size: 0.92rem;
}

.timeline-place,
.timeline-org,
.project-context {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.timeline-body h3,
.project-card h3 {
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.timeline-org {
  margin: 0.2rem 0 0.7rem;
}

.timeline-body p,
.project-card li {
  color: var(--text-muted);
}

.timeline-body a,
.project-card h3 a {
  color: inherit;
}

.project-card h3 a {
  text-decoration: none;
}

.project-card h3 a:hover {
  color: var(--accent);
}

/* Projects */
.project-grid {
  display: grid;
  gap: 1rem;
}

.project-card {
  padding: 1.35rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.project-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.85rem;
}

.badge {
  margin: 0;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 650;
}

.project-context {
  margin: 0.45rem 0 0.8rem;
}

.project-card ul {
  padding-left: 1.1rem;
}

.project-card li + li {
  margin-top: 0.35rem;
}

/* Skills */
.skill-groups {
  display: grid;
  gap: 1.25rem;
}

.skill-group {
  padding: 1.2rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.skill-group h3 {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 0.8rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}

.tags li {
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.92rem;
  font-weight: 550;
}

.contact-panel p {
  color: var(--text-muted);
  max-width: 38rem;
}

.contact-panel .hero-actions {
  margin-top: 1.3rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.1rem;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
}

/* Mobile navigation */
@media (max-width: 860px) {
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem 1.1rem;
    z-index: 51;
    transform: translateY(-120%);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s ease;
  }

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

  .nav-list {
    flex-direction: column;
    gap: 0.15rem;
  }

  .nav-link {
    display: block;
    padding: 0.7rem 0.4rem;
    font-size: 1.05rem;
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: rgba(18, 23, 32, 0.42);
    z-index: 40;
  }

  .nav-backdrop[hidden] {
    display: none;
  }

  body.nav-open {
    overflow: hidden;
  }
}

@media (min-width: 861px) {
  .nav-toggle {
    display: none;
  }

  .nav-list {
    align-items: center;
  }
}

@media (max-width: 899px) {
  .hero-photo {
    order: -1;
  }

  .photo-frame {
    width: min(100%, 16.5rem);
  }
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(16rem, 21rem);
    gap: 3.5rem;
  }

  .hero-photo {
    justify-content: flex-end;
  }

  .split {
    grid-template-columns: 12rem 1fr;
    align-items: start;
  }

  .timeline-item {
    grid-template-columns: 13rem 1fr;
    gap: 1.5rem;
  }

  .project-grid,
  .skill-groups {
    grid-template-columns: 1fr 1fr;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  .site-header,
  .hero-actions,
  .icon-btn,
  .nav-backdrop {
    display: none !important;
  }

  body {
    background: #fff;
    color: #111;
  }

  a {
    color: inherit;
  }
}
