:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --ink: #1f2328;
  --muted: #59636e;
  --accent: #0f6b62;
  --accent-ink: #ffffff;
  --line: #e2ddd3;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}

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

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

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

main:focus { outline: none; }

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius);
  transform: translateY(-200%);
}

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

.wrap {
  width: min(64rem, 100% - 2rem);
  margin-inline: auto;
}

/* Header */

.site-header {
  background: var(--ink);
  color: #ffffff;
}

.header-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1.25rem;
}

.site-name {
  color: inherit;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.site-tagline {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c9d1d9;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a,
.nav-dropdown-toggle {
  color: #ffffff;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  padding-block: 0.25rem;
  border-bottom: 2px solid transparent;
}

.nav > li > a:hover,
.nav > li > a[aria-current="page"],
.nav-dropdown-toggle:hover,
.nav-dropdown.is-current > .nav-dropdown-toggle { border-bottom-color: #5fd3c4; }

.site-header :focus-visible { outline-color: #5fd3c4; }

/* Random front page banner (see index.html). The box reserves the image's aspect ratio
   so the page doesn't jump when it loads. */
.banner {
  aspect-ratio: 1500 / 401;
  margin-bottom: 1.5rem;
  overflow: hidden;
  border-radius: var(--radius);
  background: #2d333b;
}

.banner-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Dropdowns: opened by hover, by nav.js on click, or by keyboard focus without JS. */

.nav-dropdown {
  position: relative;
  /* Extend the hover area down to the menu so it doesn't close on the way there. */
  padding-block: 0.5rem;
  margin-block: -0.5rem;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border-inline: 0;
  border-top: 0;
  cursor: pointer;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  min-width: 14rem;
  margin: 0;
  padding: 0.4rem 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu,
html:not(.js) .nav-dropdown:focus-within .nav-dropdown-menu {
  display: block;
}

/* Menus near the right edge open leftwards so they stay on screen. */
.nav-dropdown:nth-last-child(-n + 2) .nav-dropdown-menu {
  left: auto;
  right: 0;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.45rem 1rem;
  border-bottom: 0;
  color: var(--ink);
  font-weight: 400;
  white-space: nowrap;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a[aria-current="page"] {
  background: var(--bg);
  color: var(--accent);
}

.nav-dropdown-menu :focus-visible {
  outline-color: var(--accent);
  outline-offset: -3px;
}

@media (max-width: 40rem) {
  /* On narrow screens open menus push content down instead of overlapping off-screen. */
  .nav-dropdown-menu {
    position: static;
    margin-top: 0.5rem;
  }
}

/* Content */

main { padding-block: 2.5rem 4rem; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem); margin: 0 0 0.5rem; }

.page-header { margin-bottom: 2rem; }
.lead, .page-meta { color: var(--muted); margin: 0; }
.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.prose { max-width: 46rem; }
.prose img { border-radius: var(--radius); }
.prose figure { margin: 1.5rem 0; }
.prose figcaption,
.prose .wp-element-caption {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.4rem;
}
.prose iframe { border: 0; }

/* WordPress gallery blocks from the imported posts. Two markups exist:
   newer: figure.wp-block-gallery > figure.wp-block-image
   older: figure.wp-block-gallery > ul.blocks-gallery-grid > li > figure
   Images keep their own aspect ratio (galleries mostly hold same-sized screenshots). */
.prose .wp-block-gallery {
  --cols: 3;
  margin: 1.5rem 0;
}
.prose .wp-block-gallery.columns-1 { --cols: 1; }
.prose .wp-block-gallery.columns-2 { --cols: 2; }
.prose .wp-block-gallery.columns-4 { --cols: 4; }

.prose .wp-block-gallery:not(:has(> .blocks-gallery-grid)),
.prose .blocks-gallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  align-items: start;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.prose .wp-block-gallery figure,
.prose .blocks-gallery-item { margin: 0; }

.prose .wp-block-gallery img {
  display: block;
  width: 100%;
  height: auto;
}

.prose .wp-block-gallery a { cursor: zoom-in; }

.prose .wp-block-gallery figcaption {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

@media (max-width: 40rem) {
  .prose .wp-block-gallery:not(.columns-1) { --cols: 2; }
}

.prose .aligncenter { text-align: center; }
.prose .aligncenter img { margin-inline: auto; }
.prose .wp-block-embed iframe,
.prose iframe[src*="youtube"] {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.about {
  display: flow-root;
}

/* Lightbox for gallery images (static/gallery.js). The dialog itself is the dark overlay. */
.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 4rem;
  border: 0;
  background: rgba(10, 12, 14, 0.94);
  color: #ffffff;
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop { background: transparent; }

html:has(.lightbox[open]) { overflow: hidden; }

.lightbox figure {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  margin: 0;
}

.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 10rem);
  width: auto;
  height: auto;
  border-radius: 4px;
}

.lightbox figcaption {
  max-width: 40rem;
  text-align: center;
  color: #d0d7de;
}

.lightbox button {
  position: fixed;
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox button:hover { background: rgba(255, 255, 255, 0.25); }
.lightbox :focus-visible { outline-color: #5fd3c4; }
.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-prev,
.lightbox-next { top: 50%; transform: translateY(-50%); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox.single .lightbox-prev,
.lightbox.single .lightbox-next { display: none; }

@media (max-width: 40rem) {
  .lightbox { padding: 4rem 0.5rem; }
  .lightbox-prev,
  .lightbox-next { top: auto; bottom: 1rem; transform: none; }
}

.about-photo {
  float: right;
  width: min(16rem, 40%);
  margin: 0 0 1rem 1.5rem;
}

.block { margin-top: 3.5rem; }
.block h2 a { color: inherit; text-decoration: none; }
.block h2 a:hover { text-decoration: underline; }
.more { font-weight: 600; }

/* Project cards */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.5rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-link {
  color: inherit;
  text-decoration: none;
}

.card-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--line);
}

.card-title {
  margin: 0.9rem 1rem 0;
  font-size: 1.15rem;
}

.card-link:hover .card-title { color: var(--accent); text-decoration: underline; }

.card-meta,
.card-text {
  margin: 0.25rem 1rem 0;
  font-size: 0.95rem;
}

.card-meta { color: var(--muted); }
.card-text { margin-bottom: 1rem; }

/* Chips (tags and categories) */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-block;
  margin: 0 0.35rem 0.35rem 0;
  padding: 0.15rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.9rem;
  text-decoration: none;
}

.chips .chip { margin: 0; }
.chip:hover { border-color: var(--accent); }
.count { color: var(--muted); }

.page-tags {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.page-tags h2 { font-size: 1rem; margin: 0 0 0.75rem; }

/* Footer */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0 2.5rem;
  padding-block: 2rem;
}

.site-footer h2 { font-size: 1rem; margin: 0 0 0.5rem; }
.site-footer p { margin: 0 0 1rem; }

.link-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.copyright {
  grid-column: 1 / -1;
  color: var(--muted);
}

@media (max-width: 40rem) {
  .about-photo {
    float: none;
    width: 100%;
    margin: 0 0 1rem;
  }
}

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