/* ayoub.dev — dark, minimal, system fonts only. */

:root {
  color-scheme: dark;

  --bg: #09090a;
  --bg-raised: #0f1012;
  --line: #1d1f22;
  --line-strong: #2b2e32;
  --line-bright: #44484e;
  --text: #ededee;
  --text-bright: #ffffff;
  --muted: #a1a4aa; /* 7.6:1 on --bg */
  --dim: #8a8e95; /* 5.8:1 on --bg, labels only */
  --button-hover: #c6c8cc; /* filled buttons dim on hover; --bg text keeps 11:1 */
  --hover-fill: rgb(255 255 255 / 0.07); /* outlined buttons fill faintly on hover */

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --gap: clamp(1rem, 2vw, 2rem);
  --section: clamp(5rem, 11vw, 10rem);
  --header-h: 3.5rem;
  --header-bg: rgb(9 9 10 / 0.86);
  --max: 90rem;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

/* Light theme: opt-in through the header toggle (theme.js / script.js). Dark stays the default. */
:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f7f7f5;
  --bg-raised: #efefec;
  --line: #e2e2de;
  --line-strong: #cfcfca;
  --line-bright: #8c8d88;
  --text: #1b1b1d;
  --text-bright: #000000;
  --muted: #4f5257; /* 7.3:1 on --bg */
  --dim: #65686e; /* 5.2:1 on --bg, labels only */
  --button-hover: #3b3d41; /* --bg text keeps 10:1 */
  --hover-fill: rgb(0 0 0 / 0.05);
  --header-bg: rgb(247 247 245 / 0.86);
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

@media (min-width: 64rem) {
  body {
    font-size: 1.0625rem;
  }
}

h1,
h2,
h3,
p,
dl,
dd,
ol,
ul {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 500;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

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

main:focus {
  outline: none;
}

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

.label {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  min-height: 2.75rem;
  padding: 0.625rem 1.125rem;
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
  border-radius: 0;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease);
}

.button--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line-bright);
}

/* Hover only where a pointer can hover, so a tapped button doesn't stay "hovered" on touch screens.
   Filled buttons dim; outlined ones fill faintly and brighten; arrows nudge the way they point. */
@media (hover: hover) {
  .button:hover {
    background: var(--button-hover);
    border-color: var(--button-hover);
  }

  .button--ghost:hover {
    background: var(--hover-fill);
    border-color: var(--text);
    color: var(--text-bright);
  }
}

.button > [aria-hidden="true"] {
  transition: transform 180ms var(--ease);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .button:hover > [aria-hidden="true"] {
    transform: translateX(3px);
  }

  .button:hover > [data-arrow="out"] {
    transform: translate(2px, -2px);
  }
}

.button--small {
  min-height: 2.25rem;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
}

/* Label voice (mono, uppercase) for buttons that lead to another site, such as ayoub.cv. */
.button--mono {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Skip link */

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--text);
  color: var(--bg);
  font-weight: 500;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

@supports (backdrop-filter: blur(1px)) {
  .site-header {
    background: var(--header-bg);
    backdrop-filter: saturate(140%) blur(12px);
  }
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--text-bright);
}

.wordmark__mark {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2.25rem);
}

.site-nav a:not(.button) {
  display: inline-block;
  padding-block: 0.5rem;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--muted);
  transition: color 180ms var(--ease);
}

.site-nav a:not(.button):hover,
.site-nav a[aria-current="true"]:not(.button) {
  color: var(--text-bright);
}

/* Breakpoints leave room for both header buttons (Resume and Contact) and the menu button without overflow.
   Every link the header hides is in the side navigation. */
@media (max-width: 49.99rem) {
  .site-nav__item--wide {
    display: none;
  }
}

@media (max-width: 33.99rem) {
  .site-nav__item--mid {
    display: none;
  }
}

/* "Request Resume" in the header shortens to "Resume" when space runs out. */
@media (max-width: 63.99rem) {
  .site-nav__long {
    display: none;
  }
}

/* The ayoub.cv button (about 115px) only shows where it leaves spare room; below that, the menu has it. */
@media (max-width: 69.99rem) {
  .site-nav__item--xl {
    display: none;
  }
}

@media (max-width: 23.99rem) {
  .site-nav ul {
    gap: 0.5rem;
  }

  .site-nav .button--small {
    padding-inline: 0.625rem;
  }
}

/* Theme toggle: needs JavaScript, so only shown once theme.js has run. Wide headers keep it at the far
   right, after a hairline that sets it apart from the actions; narrower ones move it into the menu. */
.site-nav__theme {
  display: none;
}

@media (min-width: 70rem) {
  .js .site-nav__theme {
    display: flex;
    align-items: center;
    padding-left: clamp(1rem, 2.5vw, 2.25rem);
    border-left: 1px solid var(--line-strong);
  }
}

/* Menu button: shown with the ayoub.cv button hidden, and opens the side navigation (needs JavaScript). */
.site-nav__menu {
  display: none;
}

@media (max-width: 69.99rem) {
  .js .site-nav__menu {
    display: block;
  }
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line-bright);
  border-radius: 0;
  cursor: pointer;
  transition: color 180ms var(--ease), border-color 180ms var(--ease), background-color 180ms var(--ease);
}

/* Settings rather than actions: no frame until hovered. */
.icon-button--bare {
  border-color: transparent;
}

@media (hover: hover) {
  .icon-button:hover {
    background: var(--hover-fill);
    color: var(--text-bright);
    border-color: var(--text);
  }

  .icon-button--bare:hover {
    border-color: transparent;
  }
}

.icon-button svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.theme-toggle__sun,
[data-theme="light"] .theme-toggle__moon {
  display: none;
}

[data-theme="light"] .theme-toggle__sun {
  display: block;
}

/* On phones the header shows only the mark; the name is the first thing in the hero. */
@media (max-width: 29.99rem) {
  .wordmark__text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* Side navigation: a modal drawer from the right, opened by the header menu button (script.js). */
.side-nav {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(22rem, 100% - 3rem);
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0 var(--gutter) 2rem;
  background: var(--bg);
  color: var(--text);
  border: 0;
  border-left: 1px solid var(--line-strong);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.side-nav[open] {
  display: flex;
  flex-direction: column;
}

.side-nav::backdrop {
  background: rgb(0 0 0 / 0.55);
}

html:has(.side-nav[open]) {
  overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .side-nav[open] {
    animation: side-nav-in 260ms var(--ease);
  }

  .side-nav[open]::backdrop {
    animation: fade-in 260ms var(--ease);
  }
}

@keyframes side-nav-in {
  from { transform: translateX(100%); }
}

@keyframes fade-in {
  from { opacity: 0; }
}

.side-nav__head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  border-bottom: 1px solid var(--line);
}

.side-nav__tools {
  display: flex;
  gap: 0.5rem;
}

.side-nav nav {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.side-nav__links {
  padding-block: 1rem;
}

.side-nav__links a {
  display: block;
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  color: var(--muted);
  transition: color 180ms var(--ease);
}

.side-nav__links a:hover,
.side-nav__links a[aria-current="true"] {
  color: var(--text-bright);
}

.side-nav__actions {
  display: grid;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1.5rem;
}

.side-nav__actions .button {
  width: 100%;
}

/* Back-to-top button: fixed bottom right, shown by script.js between the hero and the footer
   (the footer has its own "Back to top" link). A solid background keeps it legible over content. */
.to-top {
  position: fixed;
  right: var(--gutter);
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line-bright);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease), visibility 200ms, color 180ms var(--ease), border-color 180ms var(--ease);
}

.js .to-top {
  display: inline-flex;
}

.to-top:not([data-visible]) {
  visibility: hidden;
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .to-top:not([data-visible]) {
    transform: translateY(0.5rem);
  }
}

@media (hover: hover) {
  .to-top:hover {
    background: linear-gradient(var(--hover-fill), var(--hover-fill)), var(--bg);
    color: var(--text-bright);
    border-color: var(--text);
  }
}

.to-top svg {
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* Hero */

.hero {
  padding-block: clamp(2.5rem, 6vw, 5rem) clamp(4rem, 8vw, 7rem);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--line-strong);
}

.hero__status {
  color: var(--text);
}

/* Square "status light", same marker as the active project status. */
.hero__status::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.5rem;
  background: currentColor;
  vertical-align: 0.05em;
}

@media (prefers-reduced-motion: no-preference) {
  .hero__status::before {
    animation: status-pulse 2.4s var(--ease) infinite;
  }
}

@keyframes status-pulse {
  50% { opacity: 0.25; }
}

.hero__uptime {
  white-space: nowrap;
}

@media (max-width: 23.99rem) {
  .hero__uptime {
    white-space: normal;
  }
}

.hero__uptime-value {
  margin-left: 0.75em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Hero layout follows reading order: who (name, role) -> what (statement) -> why trust (support)
   -> next step (actions) -> proof (credential). Spacing groups related items: tight within a group,
   wider between groups. On wide screens the portrait fills the right column. */
.hero__grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "photo title"
    "statement statement"
    "support support"
    "actions actions"
    "credential credential";
  align-items: center;
  column-gap: 1rem;
  margin-top: clamp(2.5rem, 6vw, 5rem);
}

.hero__photo {
  grid-area: photo;
  display: block;
  width: 3.75rem;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg-raised);
  /* Grayscale fits the monochrome palette and removes the source's colour cast; contrast keeps the dark tones from going flat. */
  filter: grayscale(1) contrast(1.08);
}

/* Colour on hover, only where a real pointer can hover (touch screens would get stuck in colour after a tap). */
@media (hover: hover) and (pointer: fine) {
  .hero__photo:hover {
    filter: grayscale(0) contrast(1);
  }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .hero__photo {
    transition: filter 600ms var(--ease);
  }
}

.hero__title {
  grid-area: title;
  display: grid;
  gap: 0.25rem;
  font-weight: 500;
}

.hero__name {
  font-size: clamp(1.375rem, 2.2vw, 1.875rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-bright);
}

.hero__role {
  font-family: var(--sans);
  font-size: clamp(0.9375rem, 1.2vw, 1.0625rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0;
  color: var(--muted);
}

/* The statement is the headline: two tones, the lead phrase brightest. */
.hero__statement {
  grid-area: statement;
  max-width: 20ch;
  margin-top: clamp(2.25rem, 5vw, 4rem);
  margin-left: -0.04em;
  font-family: var(--display);
  font-size: clamp(2rem, 4.6vw, 4.25rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.04em;
  color: var(--muted);
  text-wrap: balance;
}

.hero__statement-lead {
  color: var(--text-bright);
}

.hero__support {
  grid-area: support;
  max-width: 34rem;
  margin-top: clamp(1.25rem, 2vw, 1.75rem);
  font-size: clamp(1rem, 1.25vw, 1.125rem);
  line-height: 1.6;
  color: var(--muted);
}

.hero__actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: clamp(1.75rem, 3vw, 2.25rem);
}

/* Proof line under the actions: secondary weight, so it supports the call to action instead of competing.
   The featured credential comes first, then the other certifications as small logo tiles (as on the resume). */
.hero__proof {
  grid-area: credential;
  justify-self: start;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 1.75rem;
  max-width: 100%;
  margin-top: clamp(2rem, 3.5vw, 2.75rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.hero__credential {
  display: inline-flex;
  align-items: center;
  gap: 0.875rem;
  max-width: 100%;
  color: var(--text);
  text-decoration: none;
}

.hero__certs {
  display: grid;
  gap: 0.5rem;
}

.hero__certs ul {
  display: flex;
  gap: 0.5rem;
}

.hero__certs a {
  display: block;
}

.hero__certs-logo {
  display: block;
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  transition: border-color 180ms var(--ease);
}

.hero__certs a:hover .hero__certs-logo,
.hero__certs a:focus-visible .hero__certs-logo {
  border-color: var(--text-bright);
}

@media (min-width: 44rem) {
  .hero__certs {
    padding-left: 1.75rem;
    border-left: 1px solid var(--line);
  }
}

.hero__credential-logo {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
}

.hero__credential-text {
  display: grid;
  gap: 0.2rem;
  font-size: 0.9375rem;
  line-height: 1.3;
}

.hero__credential-issuer {
  font-size: 0.875rem;
  color: var(--muted);
}

.hero__credential-arrow {
  font-family: var(--mono);
  color: var(--dim);
  transition: color 180ms var(--ease), transform 180ms var(--ease);
}

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

.hero__credential:hover .hero__credential-arrow {
  color: var(--text-bright);
}

@media (prefers-reduced-motion: no-preference) {
  .hero__credential:hover .hero__credential-arrow {
    transform: translateX(3px);
  }
}

@media (min-width: 64rem) {
  .hero__grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-areas:
      "title title title title title title title title . photo photo photo"
      "statement statement statement statement statement statement statement statement . photo photo photo"
      "support support support support support support support support . photo photo photo"
      "actions actions actions actions actions actions actions actions . photo photo photo"
      "credential credential credential credential credential credential credential credential . photo photo photo";
    grid-template-rows: auto auto auto auto 1fr;
    align-items: start;
  }

  .hero__photo {
    width: 100%;
    max-width: 17rem;
    justify-self: end;
    align-self: center;
  }

  .hero__statement {
    margin-top: clamp(2rem, 3.5vw, 3rem);
  }
}

/* Readout: the at-a-glance strip under the hero */

.readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: clamp(4rem, 8vw, 7rem);
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line);
}

.readout > div {
  display: grid;
  gap: 0.625rem;
  align-content: start;
  padding: 1.125rem 1.25rem 1.375rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.readout dt {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.readout dd {
  font-size: 0.9375rem;
  line-height: 1.45;
}

@media (min-width: 64rem) {
  .readout {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .readout dd {
    font-size: 1rem;
  }
}

@media (max-width: 21.99rem) {
  .readout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Teams strip */

.teams {
  display: grid;
  gap: 1rem var(--gap);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

.teams ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem clamp(1.5rem, 3vw, 3rem);
}

.teams a {
  font-family: var(--display);
  font-size: clamp(1rem, 1.4vw, 1.1875rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--muted);
  text-decoration: none;
  transition: color 180ms var(--ease);
}

.teams a:hover {
  color: var(--text-bright);
}

@media (min-width: 64rem) {
  .teams {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: baseline;
  }

  .teams__label {
    grid-column: 1 / span 3;
  }

  .teams ul {
    grid-column: 4 / -1;
    justify-content: space-between;
  }
}

/* Sections (shared) */

.section {
  padding-block: clamp(4rem, 8vw, 7rem) var(--section);
}

/* Section header: a meta bar like the hero's (index and name left, a short factual summary right),
   then a modest title with the note beside it on wide screens. */
.section-head {
  display: grid;
  gap: 1.25rem var(--gap);
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-head__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 2rem;
  margin-bottom: clamp(0.75rem, 2vw, 1.5rem);
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--line-strong);
}

.section-head__index {
  display: flex;
  gap: 0.75rem;
}

.section-head__index span {
  color: var(--text-bright);
}

.section-head__index span::after {
  content: "/" / "";
  margin-left: 0.75rem;
  color: var(--line-bright);
}

.section-head__meta {
  white-space: nowrap;
}

.section-head__title {
  max-width: 24ch;
  font-size: clamp(1.75rem, 3.1vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
  color: var(--text-bright);
}

.section-head__note {
  max-width: 34rem;
  color: var(--muted);
}

@media (min-width: 64rem) {
  .section-head {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
  }

  .section-head__bar {
    grid-column: 1 / -1;
  }

  .section-head__title {
    grid-column: 1 / span 7;
  }

  .section-head__note {
    grid-column: 8 / -1;
    padding-bottom: 0.2rem;
  }
}

/* Selected work */

.projects {
  border-top: 1px solid var(--line-strong);
}

.project {
  display: grid;
  gap: 1.5rem var(--gap);
  padding-block: clamp(2.25rem, 4.5vw, 4rem);
  border-bottom: 1px solid var(--line);
}

.project__heading {
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.project__index {
  color: var(--text);
}

.project__logo,
.ledger__logo,
.certs__logo,
.hero__credential-logo {
  display: block;
  flex: none;
  object-fit: contain;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
}

.project__logo {
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 0.5rem;
}

.project__title {
  font-size: clamp(1.875rem, 3.6vw, 3rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text-bright);
}

.project__lede {
  max-width: 38rem;
  font-family: var(--display);
  font-size: clamp(1.125rem, 1.5vw, 1.375rem);
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.facts {
  margin-top: 1.75rem;
  border-top: 1px solid var(--line);
}

.facts > div {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 1rem;
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.facts dt,
.spec dt {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  padding-top: 0.2em;
}

.facts dd,
.spec dd {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--muted);
}

@media (min-width: 64rem) {
  .project {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .project__heading {
    grid-column: 1 / span 5;
    grid-template-columns: 3rem 1fr;
    column-gap: 0;
  }

  .project__index {
    grid-row: 1 / span 3;
    padding-top: 0.75rem;
  }

  .project__body {
    grid-column: 7 / -1;
    padding-top: 0.35rem;
  }
}

/* Experience ledger */

.ledger {
  border-top: 1px solid var(--line-strong);
}

.ledger__head {
  display: none;
}

.ledger__row {
  display: grid;
  gap: 0.5rem var(--gap);
  padding-block: clamp(1.5rem, 3vw, 2.25rem);
  border-bottom: 1px solid var(--line);
}

.ledger__entity {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.ledger__logo {
  width: 2.75rem;
  height: 2.75rem;
}

.ledger__org {
  font-size: clamp(1.25rem, 1.9vw, 1.5rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-bright);
}

.ledger__org span {
  display: block;
  margin-top: 0.375rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--dim);
}

.ledger__role {
  font-size: 0.9375rem;
  color: var(--text);
}

.ledger__text {
  max-width: 40rem;
  color: var(--muted);
}

@media (min-width: 64rem) {
  .ledger__head,
  .ledger__row {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gap);
  }

  .ledger__head {
    padding-block: 0.875rem;
    border-bottom: 1px solid var(--line);
  }

  .ledger__head span:nth-child(1),
  .ledger__entity {
    grid-column: 1 / span 3;
  }

  .ledger__head span:nth-child(2),
  .ledger__role {
    grid-column: 4 / span 3;
  }

  .ledger__head span:nth-child(3),
  .ledger__text {
    grid-column: 7 / -1;
  }

  .ledger__role {
    padding-top: 0.2rem;
  }
}

/* Certifications */

.certs {
  border-top: 1px solid var(--line-strong);
}

.certs__head {
  display: none;
}

.certs__row {
  display: grid;
  gap: 0.375rem var(--gap);
  padding-block: clamp(1.25rem, 2.5vw, 1.75rem);
  border-bottom: 1px solid var(--line);
}

.certs__entity {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.certs__logo {
  width: 2.75rem;
  height: 2.75rem;
}

.certs__name {
  padding-top: 0.6rem;
  font-size: clamp(1.125rem, 1.6vw, 1.3125rem);
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text-bright);
}

.certs__name > span {
  display: block;
  margin-top: 0.375rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--dim);
}

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

.certs__name a:hover {
  color: var(--text-bright);
}

.certs__issuer {
  font-size: 0.9375rem;
  color: var(--muted);
}

.certs__year {
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  color: var(--dim);
}

@media (min-width: 64rem) {
  .certs__head,
  .certs__row {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gap);
  }

  .certs__head {
    padding-block: 0.875rem;
    border-bottom: 1px solid var(--line);
  }

  .certs__head span:nth-child(1),
  .certs__entity {
    grid-column: 1 / span 6;
  }

  .certs__head span:nth-child(2),
  .certs__issuer {
    grid-column: 7 / span 4;
  }

  .certs__head span:nth-child(3),
  .certs__year {
    grid-column: 11 / -1;
    text-align: right;
  }

  .certs__issuer,
  .certs__year {
    padding-top: 0.8rem;
  }
}

/* Personal projects: one row per project. When a project has a live URL, the whole row opens it. */

.builds {
  display: grid;
  gap: clamp(3rem, 6vw, 4.5rem);
}

.builds__group {
  display: grid;
  gap: 1.25rem var(--gap);
}

.builds__list {
  border-top: 1px solid var(--line-strong);
}

.build {
  position: relative;
  display: grid;
  gap: 0.75rem var(--gap);
  padding-block: clamp(1.25rem, 2vw, 1.625rem);
  border-bottom: 1px solid var(--line);
}

.build__head {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding-right: 2rem;
}

.build__logo {
  display: block;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  object-fit: contain;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
}

.build__title {
  font-size: clamp(1.125rem, 1.5vw, 1.3125rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-bright);
}

.build__url {
  display: inline-block;
  margin-top: 0.125rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 180ms var(--ease);
}

/* Stretch the URL link over the whole row. */
a.build__url::after {
  content: "";
  position: absolute;
  inset: 0;
}

.build:has(a.build__url)::after {
  content: "↗" / "";
  position: absolute;
  top: clamp(1.25rem, 2vw, 1.625rem);
  right: 0;
  font-family: var(--mono);
  color: var(--dim);
  transition: color 180ms var(--ease), transform 180ms var(--ease);
}

.build:has(a.build__url:hover) .build__title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.build:has(a.build__url:hover) .build__url,
.build:has(a.build__url:hover)::after {
  color: var(--text-bright);
}

@media (prefers-reduced-motion: no-preference) {
  .build:has(a.build__url:hover)::after {
    transform: translate(2px, -2px);
  }
}

@supports selector(:has(*)) {
  a.build__url:focus-visible {
    outline: none;
  }

  .build:has(a.build__url:focus-visible) {
    outline: 2px solid var(--text-bright);
    outline-offset: 4px;
  }
}

.build__text {
  max-width: 40rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

.build__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--dim);
}

.build__meta dt {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.build__status::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.5rem;
  border: 1px solid currentColor;
  vertical-align: 0.05em;
}

.build__status[data-status="active"] {
  color: var(--text);
}

.build__status[data-status="active"]::before {
  background: currentColor;
}

.build__status[data-status="discontinued"]::before {
  border-color: var(--line-bright);
}

.build__demo {
  position: relative;
  z-index: 1;
  justify-self: start;
}

@media (min-width: 48rem) {
  .build {
    grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
    align-items: start;
    row-gap: 0;
  }

  .build__head {
    grid-row: 1 / span 3;
    padding-right: 0;
  }

  .build__text,
  .build__meta,
  .build__demo {
    grid-column: 2;
  }

  .build__text,
  .build__meta {
    padding-right: 2rem;
  }

  .build__meta,
  .build__demo {
    margin-top: 0.75rem;
  }
}

@media (min-width: 64rem) {
  .builds__group {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .builds__label {
    grid-column: 1 / span 3;
    padding-top: 1.25rem;
  }

  .builds__list {
    grid-column: 4 / -1;
  }

  .build {
    grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 13rem;
  }

  .build__text {
    padding-right: 0;
  }

  .build__meta {
    grid-column: 3;
    grid-row: 1 / span 2;
    flex-direction: column;
    margin-top: 0;
    padding-top: 0.2rem;
  }
}

/* About */

.about {
  display: grid;
  gap: 3rem var(--gap);
}

.about__text {
  display: grid;
  gap: 1.25rem;
  max-width: 40rem;
  align-content: start;
}

.about__text p:not(.about__lede) {
  color: var(--muted);
}

.about__text a,
.project__lede a,
.ledger__text a,
.resume-note a {
  color: var(--text);
}

.about__text a:hover,
.project__lede a:hover,
.ledger__text a:hover,
.resume-note a:hover {
  color: var(--text-bright);
}

/* Per-entry pointer to the resume request form (Selected work and Experience). */
.resume-note {
  max-width: 40rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}

.project__body .resume-note {
  margin-top: 1rem;
}

@media (min-width: 64rem) {
  .ledger__row .resume-note {
    grid-column: 7 / -1;
  }
}

.about__lede {
  font-family: var(--display);
  font-size: clamp(1.25rem, 2vw, 1.625rem);
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--text-bright);
}

.about__cta {
  display: grid;
  gap: 1rem;
  justify-items: start;
  margin-top: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.about__text .about__cta-text {
  font-size: 0.9375rem;
}

.spec {
  border-top: 1px solid var(--line-strong);
}

.spec > div {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1rem;
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 64rem) {
  .about {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .about__text {
    grid-column: 4 / span 4;
  }

  .spec {
    grid-column: 8 / -1;
    margin-left: var(--gap);
  }
}

@media (min-width: 64rem) and (max-width: 79.99rem) {
  .about__text {
    grid-column: 1 / span 6;
  }

  .spec {
    margin-left: 0;
  }
}

/* Contact */

.contact__email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 2rem;
}

.contact__email {
  display: inline-block;
  font-family: var(--display);
  font-size: clamp(1.875rem, 8.5vw, 6.5rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--text-bright);
  text-decoration: none;
  margin-left: -0.04em;
  padding-bottom: 0.1em;
  background-image: linear-gradient(var(--line-bright), var(--line-bright));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 180ms var(--ease);
}

.contact__email:hover {
  background-image: linear-gradient(var(--text-bright), var(--text-bright));
  background-size: 100% 2px;
}

.contact__links {
  max-width: 48rem;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  border-top: 1px solid var(--line-strong);
}

@media (min-width: 64rem) {
  /* Align with the content rail (column 4 of 12). */
  .contact__email-row,
  .contact__links,
  .contact__form {
    margin-left: calc((100% - 11 * var(--gap)) / 12 * 3 + 3 * var(--gap));
  }
}

.contact__form {
  max-width: 48rem;
  margin-top: clamp(3.5rem, 7vw, 5rem);
}

.contact__form-title {
  margin: 0 0 1.25rem;
}

.contact__notice {
  display: none;
  margin: 0 0 1.5rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--line-bright);
  border-left: 2px solid var(--text);
  background: var(--bg-raised);
  color: var(--text);
}

.contact__notice:target:not([hidden]) {
  display: block;
}

.contact__fields {
  display: grid;
  gap: 1.25rem var(--gap);
}

@media (min-width: 36rem) {
  .contact__fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field--wide {
    grid-column: 1 / -1;
  }
}

.field {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  margin: 0;
}

.field__input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.625rem 0.75rem;
  background: var(--bg-raised);
  color: var(--text-bright);
  border: 1px solid var(--line-bright);
  border-radius: 0;
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color 180ms var(--ease);
}

textarea.field__input {
  min-height: 9rem;
  resize: vertical;
}

.field__input:hover {
  border-color: var(--muted);
}

.field__input:focus {
  border-color: var(--text-bright);
}

.field__input[aria-invalid="true"] {
  border-color: var(--text-bright);
  border-style: dashed;
}

.field__error {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text);
}

.field__error::before {
  content: "↳ " / "";
  font-family: var(--mono);
  color: var(--dim);
}

/* Honeypot for bots: off-screen and out of the accessibility tree. */
.field--trap {
  position: absolute;
  left: -100vw;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* reCAPTCHA "I'm not a robot" checkbox (304×78, or 164×144 compact on narrow screens). The height is
   reserved while it loads so the send button doesn't jump; .js is set by theme.js. */
.captcha {
  margin-top: 1.5rem;
}

.js .captcha {
  min-height: 78px;
}

.contact__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 1.75rem;
}

.contact__status {
  margin: 0;
  color: var(--muted);
}

.contact__status:empty {
  display: none;
}

.contact__privacy {
  max-width: 40rem;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.resume-form__intro {
  max-width: 40rem;
  margin: 0 0 1.75rem;
  color: var(--muted);
}

.field__optional {
  text-transform: none;
  letter-spacing: 0;
  color: var(--dim);
}

textarea.field__input--short {
  min-height: 4.5rem;
}

.field__input::placeholder {
  color: var(--dim);
  opacity: 1;
}

/* Resume call to action under the experience ledger */

.resume-cta {
  display: grid;
  gap: 1rem var(--gap);
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--text);
  background: var(--bg-raised);
}

.resume-cta__label {
  margin: 0;
}

.resume-cta__title {
  font-size: clamp(1.375rem, 2.4vw, 1.875rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text-bright);
}

.resume-cta__text {
  max-width: 40rem;
  margin: 0;
  color: var(--muted);
}

.resume-cta__button {
  justify-self: start;
}

/* Top of the resume's first page (same image and fade as ayoub.cv), kept small so it doesn't fill the screen. */
.resume-cta__preview {
  width: 100%;
  max-width: 24rem;
  margin: 0.5rem 0 0;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
  mask-image: linear-gradient(to bottom, #000 55%, transparent);
}

.resume-cta__preview img {
  display: block;
  width: 100%;
  height: auto;
}

@media (min-width: 64rem) {
  .resume-cta {
    grid-template-columns: minmax(0, 1fr) minmax(0, 22rem);
    column-gap: clamp(2rem, 4vw, 3.5rem);
  }

  .resume-cta__label,
  .resume-cta__title,
  .resume-cta__text,
  .resume-cta__button {
    grid-column: 1;
  }

  .resume-cta__preview {
    grid-column: 2;
    grid-row: 1 / span 4;
    align-self: center;
    margin: 0;
  }
}

.contact__form .button[aria-disabled="true"] {
  cursor: progress;
  opacity: 0.6;
}

.contact__links a {
  display: grid;
  grid-template-columns: minmax(6.5rem, 9rem) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.contact__links a::after {
  content: "↗" / "";
  font-family: var(--mono);
  color: var(--dim);
  transition: color 180ms var(--ease), transform 180ms var(--ease);
}

.contact__service {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.contact__handle {
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--text);
  transition: color 180ms var(--ease);
}

.contact__links a:hover .contact__handle,
.contact__links a:hover::after {
  color: var(--text-bright);
}

@media (prefers-reduced-motion: no-preference) {
  .contact__links a:hover::after {
    transform: translate(2px, -2px);
  }
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
  color: var(--muted);
}

.site-footer__grid {
  display: grid;
  gap: 2.5rem var(--gap);
  padding-block: clamp(3rem, 6vw, 5rem);
}

.site-footer__name {
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-bright);
}

.site-footer .label {
  margin-bottom: 1rem;
}

.site-footer ul {
  display: grid;
  gap: 0.5rem;
}

.site-footer a {
  text-decoration: none;
  transition: color 180ms var(--ease);
}

.site-footer a:hover {
  color: var(--text-bright);
}

.site-footer .site-footer__cta {
  margin-top: 1.25rem;
  color: var(--text);
}

@media (min-width: 40rem) {
  .site-footer__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 64rem) {
  .site-footer__grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .site-footer__id {
    grid-column: 1 / span 6;
  }

  .site-footer__grid > :nth-child(2) {
    grid-column: 7 / span 3;
  }

  .site-footer__grid > :nth-child(3) {
    grid-column: 10 / span 3;
  }
}

.site-footer__base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1.25rem;
  border-top: 1px solid var(--line);
}

.site-footer__base p {
  margin: 0;
}

/* 404 */

.not-found {
  display: flex;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
  padding-block: clamp(2.5rem, 6vw, 5rem);
}

.not-found h1 {
  margin-top: clamp(4rem, 12vw, 10rem);
  font-size: clamp(2.75rem, 8vw, 7rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  color: var(--text-bright);
}

.not-found p:not(.label) {
  margin-top: 1.5rem;
  max-width: 32rem;
  color: var(--muted);
}

.not-found .button {
  margin-top: 2.5rem;
}

/* Print */

@media print {
  :root {
    --bg: #fff;
    --bg-raised: #fff;
    --text: #000;
    --text-bright: #000;
    --muted: #333;
    --dim: #555;
    --line: #ccc;
    --line-strong: #999;
    --line-bright: #999;
  }

  .site-header,
  .skip-link,
  .to-top,
  .hero__actions,
  .teams,
  .contact__copy,
  .contact__form,
  .resume-cta__button,
  .resume-cta__preview,
  .resume-note,
  .about__cta .button,
  .site-footer__cta,
  .site-footer__grid nav,
  .site-footer__base p:last-child {
    display: none;
  }

  .section {
    padding-block: 2rem;
    break-inside: avoid-page;
  }

  .contact__links a::after {
    content: " (" attr(href) ")";
  }

  .build:has(a.build__url)::after {
    content: none;
  }

  .build {
    break-inside: avoid;
  }

  .build__demo {
    min-height: 0;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .build__demo::after {
    content: " (" attr(href) ")";
  }
}
