:root {
  color-scheme: dark;

  --bg: #171614;
  --text: #e8e4db;
  --muted: #a29d92;
  --rule: #36332e;
  --accent: #e0935f;
  --code-bg: #22201d;
  --figure-bg: #f2f0ea;

  --serif: "Source Serif 4", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --wide: 1040px;
  --gutter: 24px;
  --prose: 680px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
}

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

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

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0;
}

p { margin: 0 0 1em; }

/* Language switching: only the active language is shown */
[data-lang="es"] [data-l]:not([data-l="es"]),
[data-lang="fr"] [data-l]:not([data-l="fr"]),
[data-lang="en"] [data-l]:not([data-l="en"]) { display: none !important; }

.wrap {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Header */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 28px;
  padding-bottom: 28px;
}

.site-name {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 15px;
}

.site-nav a { color: var(--text); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }

.lang-switch { display: flex; gap: 2px; }

.lang-switch button {
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 2px 5px;
  cursor: pointer;
  border-radius: 3px;
}

.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 0.25em; }

/* Home: intro */
.intro {
  padding: 48px 0 64px;
}

.intro p { max-width: 760px; }

.intro h1 {
  font-size: clamp(2.6rem, 8vw, 5rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin-bottom: 1.75rem;
}

.intro h1 .hello { font-weight: 400; }

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

.intro .intro-text {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 1.25rem;
}

/* Sections */
.section {
  border-top: 1px solid var(--rule);
  padding: 28px 0 72px;
}

.section-title {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 36px;
}

/* Home: projects */
.project {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 40px;
  align-items: start;
}

.project + .project { margin-top: 64px; }

.project-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 3px;
}

.project-media:hover img { opacity: 0.92; }

.meta {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.project h3 { font-size: 1.6rem; margin-bottom: 0.9rem; }
.project h3 a { color: var(--text); text-decoration: none; }
.project h3 a:hover { color: var(--accent); }

.stack {
  font-size: 14px;
  color: var(--muted);
}

.more {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 7px 14px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid currentColor;
  border-radius: 3px;
}

.more:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

/* Home: skills */
.skills {
  margin: 0;
  display: grid;
  grid-template-columns: 220px 1fr;
}

.skills dt,
.skills dd {
  margin: 0;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}

.skills dt { font-weight: 600; padding-right: 24px; }

.skills dt:first-of-type,
.skills dd:first-of-type { padding-top: 0; }

.skills ul { list-style: none; margin: 0; padding: 0; }
.skills li + li { margin-top: 0.35rem; }
.skills .note { color: var(--muted); }

/* Footer */
.site-footer {
  /* rule drawn inside the gutters so it lines up with the content */
  background: linear-gradient(var(--rule), var(--rule)) center top / calc(100% - 2 * var(--gutter)) 1px no-repeat;
  padding-top: 28px;
  padding-bottom: 48px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  font-size: 15px;
  color: var(--muted);
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

/* Project pages */
.back {
  display: inline-block;
  font-size: 15px;
  color: var(--muted);
  text-decoration: none;
  margin-top: 24px;
  margin-bottom: 20px;
}

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

.project-head { max-width: var(--prose); margin-bottom: 40px; }

.project-head h1 {
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  margin-bottom: 1.1rem;
}

.lede {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.55;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1.5rem;
  margin: 1.75rem 0 0;
  font-size: 15px;
}

.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.prose { max-width: var(--prose); }

.prose h2 {
  font-size: 1.55rem;
  margin: 64px 0 1rem;
}

.prose ul { padding-left: 1.2rem; }
.prose li + li { margin-top: 0.3rem; }

figure { margin: 40px 0; }

figcaption {
  font-size: 14px;
  color: var(--muted);
  margin-top: 0.6rem;
  max-width: var(--prose);
}

figure img, figure video { width: 100%; border-radius: 3px; }

figure.drawing img {
  background: var(--figure-bg);
  padding: 16px;
  border: 1px solid var(--rule);
}

.figure-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 40px 0;
}

.figure-row figure { margin: 0; }

.figure-row img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.figure-row.natural img { aspect-ratio: auto; }

.narrow { max-width: 760px; }

.side-by-side {
  display: grid;
  grid-template-columns: minmax(0, var(--prose)) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.side-by-side figure { margin: 0; }

table {
  border-collapse: collapse;
  margin: 1.25rem 0 1.5rem;
  font-size: 15px;
}

th, td {
  text-align: left;
  padding: 8px 32px 8px 0;
  border-bottom: 1px solid var(--rule);
}

th { font-weight: 600; }

code, pre { font-family: var(--mono); font-size: 14px; }

pre {
  background: var(--code-bg);
  padding: 14px 18px;
  border-radius: 3px;
  overflow-x: auto;
  margin: 1.25rem 0 1.5rem;
}

.next {
  border-top: 1px solid var(--rule);
  margin-top: 80px;
  padding: 28px 0 72px;
}

.next a {
  font-family: var(--serif);
  font-size: 1.4rem;
  text-decoration: none;
}

.next a:hover { text-decoration: underline; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  :root { --gutter: 16px; }
  .intro { padding: 24px 0 48px; }
  .project, .side-by-side, .figure-row { grid-template-columns: 1fr; }
  .project { gap: 20px; }
  .skills { grid-template-columns: 1fr; }
  .skills dt { border-bottom: 0; padding-bottom: 4px; }
  .skills dd { padding-top: 0; }
  .skills dt:first-of-type + dd { padding-top: 0; }
  .side-by-side { gap: 24px; }
  .prose h2 { margin-top: 48px; }
  th, td { padding-right: 20px; }
}
