:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #444444;
  --accent-red: #b23a2e;
  --accent-green: #2f7d32;
  --accent-orange: #b35a20;
  --border: #1f1f1f;
  --surface: #f8f8f8;
  --focus: #2f7d32;
  --max-content: 70ch;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: "IBM Plex Mono", "JetBrains Mono", "Fira Code", "Cascadia Mono", "Consolas",
    "Menlo", monospace;
  font-size: 16px;
  line-height: 1.6;
  overflow-wrap: break-word;
}

.skip-link {
  position: absolute;
  top: -1000px;
  left: 0.5rem;
  background: var(--bg);
  color: var(--fg);
  border: 2px solid var(--focus);
  padding: 0.5rem 0.75rem;
  z-index: 99;
}

.skip-link:focus-visible {
  top: 0.5rem;
}

a {
  color: var(--accent-green);
  text-decoration-thickness: 0.1em;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.site-header,
.content,
.site-footer {
  width: min(92vw, var(--max-content));
  margin-inline: auto;
}

.site-header {
  padding-top: 1rem;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.ascii-tag {
  margin: 0;
  color: var(--accent-orange);
  font-weight: 600;
}

.site-title {
  margin: 0;
  padding: 0.25rem 0 0.75rem;
  border-bottom: 2px dashed var(--border);
  color: var(--fg);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0.75rem 0 1rem;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  border: 1px solid var(--border);
  padding: 0.35rem 0.6rem;
  text-decoration: none;
  color: var(--fg);
  background: var(--surface);
}

.site-nav a[aria-current="page"] {
  border-width: 2px;
  border-style: solid;
  border-color: var(--accent-red);
  font-weight: 700;
}

.lang-links {
  margin: 0;
  font-size: 0.9em;
}

.lang-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent-orange);
}

.lang-flag {
  font-size: 1rem;
  line-height: 1;
}

@media (max-width: 640px) {
  .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
  }

  .site-nav a {
    width: 100%;
    padding: 0.65rem 0.75rem;
    display: flex;
    align-items: center;
    min-height: 2.75rem;
  }
}

.content {
  margin-top: 0.75rem;
}

.card {
  border: 1px solid var(--border);
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fff;
}

.card h2,
.card h3 {
  margin-top: 0;
}

.card p,
.card li {
  hyphens: auto;
}

.ascii-block {
  display: block;
  overflow-x: auto;
  margin: 0.75rem 0 0;
  border-left: 4px solid var(--accent-orange);
  padding: 0.75rem;
  background: var(--surface);
}

.quick-links {
  margin: 0;
  padding-left: 1rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.gallery-item {
  border: 1px solid var(--border);
  background: #fff;
  margin: 0;
  padding: 0.5rem;
  min-height: 190px;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid #c8c8c8;
}

.gallery-item img.gallery-openable {
  cursor: zoom-in;
}

.gallery-item figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.gallery-item.is-broken {
  border-style: dashed;
}

.gallery-item.is-broken img {
  display: none;
}

.gallery-item.is-broken::before {
  content: "Image unavailable";
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--accent-red);
  color: var(--accent-red);
}

.lightbox-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 1rem;
  border: none;
  background: transparent;
}

.lightbox-dialog[open] {
  display: grid;
}

.lightbox-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.lightbox-content {
  max-height: 92vh;
  margin: 0;
  background: #ffffff;
  border: 2px solid var(--border);
  padding: 0.75rem;
  overflow: auto;
}

.lightbox-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border: 1px solid #c8c8c8;
  background: #f4f4f4;
}

.lightbox-caption {
  margin-top: 0.65rem;
  color: var(--muted);
}

body.lightbox-open {
  overflow: hidden;
}

.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  padding: 0.5rem;
  background: #fff;
  color: var(--fg);
}

textarea {
  resize: vertical;
}

.btn {
  border: 1px solid var(--border);
  color: var(--fg);
  background: var(--surface);
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  min-height: 2.75rem;
}

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

.field-error {
  min-height: 1.2em;
  color: var(--accent-red);
  margin: 0.25rem 0 0;
}

/* CV page */
.cv-job {
  margin-bottom: 1.2rem;
}

.cv-job h3 {
  margin: 0;
  font-size: 1em;
}

.cv-job--outline {
  margin-bottom: 0.45rem;
}

.cv-job--outline h3 {
  font-size: 1em;
  font-weight: 600;
  margin-bottom: 0;
}

.cv-location {
  font-size: 0.9em;
  color: var(--muted);
  font-weight: normal;
}

.cv-date-inline {
  font-size: 0.9em;
  color: var(--muted);
  font-weight: normal;
}

.cv-dates,
.cv-roles-list {
  color: var(--muted);
  font-size: 0.9em;
  margin: 0.08rem 0 0.45rem;
}

.cv-team {
  background: var(--surface);
  padding: 0.5rem 0.75rem;
  margin: 0.75rem 0;
}

.cv-team h4 {
  margin: 0 0 0.25rem;
}

.cv-team-dates {
  font-size: 0.85em;
  color: var(--muted);
  font-weight: normal;
}

.cv-env {
  font-size: 0.8em;
  color: var(--muted);
  border-top: 1px dashed var(--border);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.cv-skills {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
}

.cv-skills dt {
  font-weight: 700;
}

.cv-skills dd {
  margin: 0;
}

.cv-expertise {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.cv-expertise li {
  padding: 0.3rem 0;
  border-bottom: 1px dashed var(--border);
}

.cv-expertise li:last-child {
  border-bottom: none;
}

.cv-education {
  list-style: none;
  padding-left: 0;
}

.cv-education li {
  margin-bottom: 0.75rem;
}

.form-status {
  min-height: 1.2em;
  margin-top: 0.75rem;
  color: var(--accent-green);
}

.form-status.is-error {
  color: var(--accent-red);
}

.site-footer {
  padding: 1rem 0 2rem;
  border-top: 1px dashed var(--border);
  color: var(--muted);
}

@media (min-width: 800px) {
  body {
    font-size: 18px;
    line-height: 1.55;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 0.75rem;
  }

  .cv-skills {
    grid-template-columns: 1fr;
  }

  .cv-skills dt {
    margin-top: 0.5rem;
    border-top: 1px dashed var(--border);
    padding-top: 0.4rem;
  }

  .cv-skills dt:first-of-type {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
  }

  .cv-env {
    font-size: 0.85em;
  }
}