/* Nicolas Ruth, portfolio */

/* ---------- Fonts ---------- */

/* Roboto, SIL Open Font License (assets/fonts/OFL.txt) */
@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/roboto-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Roboto";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("../assets/fonts/roboto-latin-italic.woff2") format("woff2");
}

/* ---------- Tokens ---------- */

:root {
  --font-sans: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas,
    "Liberation Mono", Menlo, monospace;

  --step--1: 0.9rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.1rem;

  --space-xs: 0.5rem;
  --space-s: 0.875rem;
  --space-m: 1.5rem;
  --space-l: 2.25rem;
  --space-xl: 3.5rem;

  --radius: 3px;
  --measure: 70ch;
  --wrap: 1000px;

  --bg: #121416;
  --bg-sunken: #1b1e21;
  --text: #e6e6e3;
  --text-soft: #b9bbb8;
  --text-faint: #8d908c;
  --border: #2c3034;
  --border-strong: #4a4f55;
  --link: #8ab4f8;
  --link-visited: #b69cf2;

  color-scheme: dark;
}

/* ---------- Reset ---------- */

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

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

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

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.2;
  font-weight: 600;
}

h1 {
  font-size: var(--step-3);
}
h2 {
  font-size: var(--step-2);
  margin-bottom: var(--space-s);
}
h3 {
  font-size: var(--step-1);
}

p {
  margin: 0 0 var(--space-s);
}

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

ul,
ol {
  margin: 0 0 var(--space-s);
  padding-left: 1.25em;
}

li {
  margin-bottom: 0.3em;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:visited {
  color: var(--link-visited);
}

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

code,
kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-l) 0;
}

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

/* ---------- Layout ---------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--space-m);
}

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

section {
  padding-block: var(--space-l);
}

.section-label {
  font-size: var(--step--1);
  color: var(--text-faint);
  margin-bottom: var(--space-xs);
  font-weight: 400;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--text);
  color: var(--bg);
  padding: var(--space-s) var(--space-m);
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

/* ---------- Header / nav ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-m);
  padding-block: var(--space-s);
}

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

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-m);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links li {
  margin: 0;
}

.nav-links a,
.nav-links a:visited {
  color: var(--text-soft);
  text-decoration: none;
}

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

.nav-links a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* ---------- Hero ---------- */

.hero {
  padding-block: var(--space-xl) var(--space-m);
}

.hero h1 {
  font-size: 2.6rem;
  margin-bottom: var(--space-s);
}

.hero-lede {
  max-width: 60ch;
  font-size: 1.2rem;
  color: var(--text-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  margin-top: var(--space-m);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.45em 0.95em;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: transparent;
  font-size: var(--step--1);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.btn,
.btn:visited {
  color: var(--text);
}

.btn svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

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

.btn-primary,
.btn-primary:visited {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

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

/* ---------- Skills ---------- */

.skill-list {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: var(--space-xs) var(--space-m);
  margin: 0;
  max-width: 52rem;
}

.skill-list dt {
  font-weight: 600;
}

.skill-list dd {
  margin: 0;
  color: var(--text-soft);
}

/* ---------- Tags ---------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--step--1);
  color: var(--text-faint);
}

.tag {
  margin: 0;
}

.tag:not(:last-child)::after {
  content: "·";
  padding-inline: 0.45em;
}

/* ---------- Project list ---------- */

.project-grid {
  list-style: none;
  padding: 0;
  margin: var(--space-m) 0 0;
  border-top: 1px solid var(--border);
}

.project-grid > li {
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.card {
  position: relative;
  display: grid;
  grid-template-columns: 14rem 1fr;
  gap: var(--space-m);
  padding-block: var(--space-m);
  align-items: start;
}

.card-media {
  aspect-ratio: 4 / 3;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-media--fit {
  background: #fff;
  padding: var(--space-xs);
  filter: brightness(0.88);
}

.card-media--fit img {
  object-fit: contain;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.card-title {
  font-size: var(--step-1);
  margin: 0;
}

.card-title a,
.card-title a:visited {
  color: var(--link);
}

.card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card:hover .card-title a {
  color: var(--text);
}

.card-desc {
  margin: 0;
  color: var(--text-soft);
}

.card-links {
  display: flex;
  gap: var(--space-m);
  font-size: var(--step--1);
  position: relative;
  z-index: 1;
}

/* ---------- Filter bar ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: var(--space-m);
}

.filter-btn {
  font: inherit;
  font-size: var(--step--1);
  padding: 0.25em 0.75em;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}

.filter-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

.filter-btn[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

/* ---------- Figures ---------- */

.figure {
  margin: 0 0 var(--space-l);
}

.figure img {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  filter: brightness(0.9);
}

.figure figcaption {
  margin-top: var(--space-xs);
  font-size: var(--step--1);
  color: var(--text-faint);
  line-height: 1.5;
}

.figure-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  gap: var(--space-m);
  margin-bottom: var(--space-l);
}

.figure-row .figure {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.figure-row .figure figcaption {
  margin-top: auto;
  padding-top: var(--space-xs);
}

.figure-tall img {
  max-height: 30rem;
  object-fit: contain;
}

/* ---------- Spec table ---------- */

.spec-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem var(--space-m);
  margin: 0 0 var(--space-l);
  padding-block: var(--space-s);
  border-block: 1px solid var(--border);
  font-size: var(--step--1);
  max-width: var(--measure);
}

.spec-list dt {
  color: var(--text-faint);
  white-space: nowrap;
}

.spec-list dd {
  margin: 0;
}

.table-scroll {
  overflow-x: auto;
  margin-bottom: var(--space-l);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
}

th,
td {
  text-align: left;
  padding: 0.45rem var(--space-s);
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  white-space: nowrap;
}

thead th {
  border-bottom: 2px solid var(--border-strong);
}

/* ---------- Resume entries ---------- */

.entry {
  padding-block: var(--space-m);
  border-top: 1px solid var(--border);
}

.entry:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-m);
  margin-bottom: 0.2rem;
}

.entry-head h3 {
  font-size: var(--step-1);
}

.entry-meta {
  font-size: var(--step--1);
  color: var(--text-faint);
  white-space: nowrap;
}

.entry-org {
  color: var(--text-soft);
  font-style: italic;
  margin-bottom: var(--space-xs);
}

.entry ul {
  color: var(--text-soft);
  margin-bottom: 0;
}

.course-list {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--text-soft);
}

.course-list li {
  margin: 0;
}

.course-list li:not(:last-child)::after {
  content: "·";
  padding-inline: 0.5em;
  color: var(--text-faint);
}

/* ---------- Callout ---------- */

.callout {
  padding: var(--space-s) var(--space-m);
  border-left: 3px solid var(--border-strong);
  background: var(--bg-sunken);
  font-size: var(--step--1);
  color: var(--text-soft);
  margin-bottom: var(--space-l);
  max-width: var(--measure);
}

.callout > :last-child {
  margin-bottom: 0;
}

/* ---------- Detail page header ---------- */

.detail-header {
  padding-block: var(--space-l) var(--space-m);
}

.back-link {
  display: inline-block;
  font-size: var(--step--1);
  margin-bottom: var(--space-m);
}

.detail-header h1 {
  margin-bottom: var(--space-xs);
}

.detail-header .tags {
  margin-bottom: var(--space-m);
}

/* ---------- Contact ---------- */

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  margin-top: var(--space-s);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-m);
  margin-top: var(--space-xl);
  font-size: var(--step--1);
  color: var(--text-faint);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-m);
  justify-content: space-between;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  :root {
    --step-3: 1.75rem;
    --step-2: 1.4rem;
    --space-xl: 2.5rem;
  }

  .wrap {
    padding-inline: 1rem;
  }

  .hero h1 {
    font-size: 2.1rem;
  }

  .hero-lede {
    font-size: 1.1rem;
  }

  .card {
    grid-template-columns: 1fr;
    gap: var(--space-s);
  }

  .card-media {
    aspect-ratio: 16 / 9;
  }

  .skill-list {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .skill-list dd {
    margin-bottom: var(--space-s);
  }

  .entry-head {
    flex-direction: column;
    gap: 0.15rem;
  }
}

/* ---------- Print ---------- */

@media print {
  .site-header,
  .site-footer,
  .filter-bar,
  .hero-actions {
    display: none;
  }

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

  .figure img,
  .card-media--fit {
    filter: none;
  }

  a {
    text-decoration: none;
    color: #000;
  }
}
