/* Personal site: Mohamed Hda
   Black background, white text, muted grey secondary text. No dependencies. */

:root {
  --bg: #000000;
  --fg: #ffffff;
  --muted: #8a8a8a;
  --faint: #5c5c5c;
  --line: #1f1f1f;
  --measure: 38rem;
}

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

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem) 1.5rem 3rem;
}

/* ---------- Links ---------- */
a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  transition: opacity 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  opacity: 0.65;
  text-decoration-color: var(--fg);
}

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--fg);
  color: var(--bg);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}

.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* ---------- Navigation ---------- */
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 0.875rem;
  margin-bottom: clamp(3rem, 9vw, 5.5rem);
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--fg);
  opacity: 1;
}

.nav a:hover {
  text-decoration: underline;
  text-decoration-color: var(--fg);
}

/* ---------- Headings and text ---------- */
h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 1.4rem + 2.6vw, 2.75rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 1.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

p {
  margin: 0 0 1rem;
}

.lede {
  color: var(--muted);
  margin-bottom: 1.25rem;
}

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

.small {
  font-size: 0.875rem;
}

.contact-lines {
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

.contact-lines li {
  margin: 0.15rem 0;
}

.contact-lines .label {
  display: inline-block;
  min-width: 5.5rem;
  color: var(--muted);
}

/* ---------- Sections ---------- */
section {
  border-top: 1px solid var(--line);
  padding-top: 2rem;
  margin-top: 3rem;
  scroll-margin-top: 1.5rem;
}

.intro {
  margin-top: 2.25rem;
}

/* ---------- Entries (projects / experience) ---------- */
.entry {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.25rem 1.5rem;
  margin-bottom: 1.75rem;
}

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

.entry .when {
  color: var(--muted);
  font-size: 0.875rem;
  padding-top: 0.15rem;
}

.entry .role {
  color: var(--muted);
  font-size: 0.9375rem;
  margin: 0.1rem 0 0.5rem;
}

.entry p {
  margin: 0 0 0.5rem;
}

.meta {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.875rem;
}

.meta li {
  display: inline;
}

.meta li + li::before {
  content: "\00b7";
  margin: 0 0.5rem;
  color: var(--faint);
}

.bullets {
  margin: 0.5rem 0 0 1.1rem;
  padding: 0;
}

.bullets li {
  margin: 0 0 0.4rem;
}

.group-label {
  margin: 2rem 0 1rem;
  font-size: 0.8125rem;
  color: var(--faint);
}

.group-label:first-of-type {
  margin-top: 0;
}

/* ---------- Contact line ---------- */
.links-line {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}

.links-line li + li::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 0.9em;
  background: var(--faint);
  margin: 0 1rem;
  vertical-align: -0.1em;
}

/* ---------- CV page ---------- */
.cv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

.cv-note {
  margin-top: 1.5rem;
  padding: 0.75rem 0 0.75rem 1rem;
  border-left: 1px solid var(--faint);
  color: var(--muted);
  font-size: 0.875rem;
}

.placeholder {
  color: var(--faint);
  font-style: italic;
}

.cv-viewer {
  display: none;
  margin-top: 2rem;
}

.cv-viewer:target {
  display: block;
}

.cv-viewer iframe {
  width: 100%;
  height: 80vh;
  border: 1px solid var(--line);
  background: #111;
}

/* ---------- Footer ---------- */
footer {
  max-width: calc(var(--measure) - 3rem);
  width: calc(100% - 3rem);
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

footer a {
  color: var(--muted);
}

footer .foot-links a + a {
  margin-left: 1rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 34rem) {
  .entry {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .entry .when {
    order: -1;
    padding-top: 0;
  }

  .contact-lines .label {
    display: block;
    min-width: 0;
    font-size: 0.8125rem;
  }

  .contact-lines li {
    margin: 0.5rem 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

@media print {
  html,
  body {
    background: #fff;
    color: #000;
  }
  a {
    color: #000;
  }
  .nav,
  footer {
    display: none;
  }
}
