:root {
  --background: #f4f1ea;
  --ink: #10131d;
  --accent: #fa6a21;
  --topbar-height: 72px;
  --topbar-offset: 20px;
  --page-gutter: 24px;
  --footer-offset: 20px;
  --project-grid-gap: clamp(32px, 6vw, 96px);
  --project-name-gap: clamp(18px, 2vw, 28px);
  --project-name-size: 16px;
  --about-scroll-top: 96px;
  --about-scroll-bottom: 48px;
}

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

html {
  min-width: 320px;
  background: var(--background);
}

body {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: "Zeitkreis Barlow Condensed", "Arial Narrow", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  height: var(--topbar-height);
  padding:
    max(var(--topbar-offset), env(safe-area-inset-top))
    max(var(--page-gutter), env(safe-area-inset-right))
    0
    max(var(--page-gutter), env(safe-area-inset-left));
  background: var(--background);
}

.wordmark {
  color: var(--ink);
  font-family: "Zeitkreis Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
}

.project-selector {
  min-height: 0;
  flex: 1 0 auto;
  display: grid;
  place-items: center;
  padding:
    max(var(--topbar-height), env(safe-area-inset-top))
    max(var(--page-gutter), env(safe-area-inset-right))
    max(var(--topbar-height), calc(var(--footer-offset) + 32px + env(safe-area-inset-bottom)))
    max(var(--page-gutter), env(safe-area-inset-left));
}

.projects {
  width: min(100%, 1080px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--project-grid-gap);
  align-items: start;
}

.project {
  min-width: 0;
  color: var(--ink);
  text-align: center;
  text-decoration: none;
}

.project-image {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
}

.project img {
  display: block;
  width: 100%;
  height: 100%;
}

.project-name {
  display: inline-block;
  margin-top: var(--project-name-gap);
  font-family: "Zeitkreis Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: var(--project-name-size);
  font-weight: 400;
  -webkit-text-stroke: 0 currentColor;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  transition: -webkit-text-stroke-width 160ms ease;
}

.project:hover .project-name,
.project:focus-visible .project-name {
  -webkit-text-stroke-width: 0.45px;
}

.project:focus-visible {
  outline: none;
}

.project:focus-visible .project-name {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.35em;
}

.site-footer {
  position: static;
  flex: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding:
    0
    max(var(--page-gutter), env(safe-area-inset-right))
    max(var(--footer-offset), env(safe-area-inset-bottom))
    max(var(--page-gutter), env(safe-area-inset-left));
  color: var(--ink);
  font-family: "Zeitkreis Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-meta {
  display: flex;
  gap: 0.45em;
  align-items: center;
}

.about-trigger {
  margin: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  font-family: "Zeitkreis Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  transition: color 160ms ease;
}

.about-trigger:hover,
.about-trigger:focus-visible {
  color: var(--ink);
  outline: none;
}

.about-trigger:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.35em;
}

.about-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 360ms;
}

.about-layer.is-open {
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.about-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 19, 29, 0.16);
  opacity: 0;
  transition: opacity 260ms ease;
}

.about-layer.is-open .about-backdrop {
  opacity: 1;
}

.about-panel {
  position: absolute;
  inset: 0 auto 0 0;
  width: min(100vw, clamp(360px, 40vw, 740px));
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.92);
  background: #10131d;
  box-shadow: 16px 0 48px rgba(16, 19, 29, 0.18);
  transform: translateX(-100%);
  transition: transform 360ms cubic-bezier(.4, 0, .2, 1);
}

.about-layer.is-open .about-panel {
  transform: translateX(0);
  transition-duration: 520ms;
  transition-timing-function: cubic-bezier(.22, 1, .36, 1);
}

.about-panel-topbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  height: var(--topbar-height);
  background: #10131d;
}

.about-close,
.about-language-trigger,
.about-language-option {
  margin: 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.92);
  background: transparent;
  border: 0;
  font-family: "Zeitkreis Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  outline: none;
}

.about-close {
  position: absolute;
  top: max(var(--topbar-offset), env(safe-area-inset-top));
  right: max(var(--page-gutter), env(safe-area-inset-right));
  letter-spacing: 0;
  transition: color 160ms ease;
}

.about-close:hover,
.about-close:focus-visible,
.about-language-trigger:hover,
.about-language-trigger:focus-visible,
.about-language.is-open .about-language-trigger {
  color: var(--accent);
}

.about-language {
  position: absolute;
  top: max(var(--topbar-offset), env(safe-area-inset-top));
  left: max(var(--page-gutter), env(safe-area-inset-left));
  width: 64px;
  min-width: 64px;
  text-align: left;
}

.about-language-trigger {
  display: block;
  width: max-content;
  min-width: 2ch;
  height: 20px;
  transition: color 160ms ease;
}

.about-language-menu {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  background: #10131d;
  box-shadow: 12px 10px 18px 10px #10131d;
  transform: translateY(-4px);
  pointer-events: none;
  transition:
    grid-template-rows 280ms cubic-bezier(.4, 0, .2, 1),
    opacity 220ms ease-out,
    transform 280ms cubic-bezier(.4, 0, .2, 1);
}

.about-language-options {
  display: flex;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.about-language-option {
  display: block;
  height: 20px;
  color: rgba(255, 255, 255, 0.52);
  opacity: 0;
  transform: translateY(-4px);
  transition:
    color 160ms ease,
    opacity 220ms ease-out,
    transform 260ms cubic-bezier(.4, 0, .2, 1);
}

.about-language-option:first-child {
  margin-top: 8px;
}

.about-language-option[aria-selected="true"] {
  color: rgba(255, 255, 255, 0.88);
}

.about-language-option:hover,
.about-language-option:focus-visible {
  color: var(--accent);
}

.about-language.is-open .about-language-menu {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  transition:
    grid-template-rows 380ms cubic-bezier(.22, 1, .36, 1),
    opacity 180ms ease,
    transform 380ms cubic-bezier(.22, 1, .36, 1);
}

.about-language.is-open .about-language-option {
  opacity: 1;
  transform: translateY(0);
  transition-delay: var(--language-delay);
}

.about-scroll {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding:
    max(var(--about-scroll-top), calc(env(safe-area-inset-top) + var(--about-scroll-top)))
    max(28px, env(safe-area-inset-right))
    max(var(--about-scroll-bottom), env(safe-area-inset-bottom))
    max(var(--page-gutter), env(safe-area-inset-left));
  scrollbar-color: rgba(255, 255, 255, 0.24) transparent;
  scrollbar-width: thin;
}

.about-copy {
  max-width: 42rem;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(15px, calc(1.05vw + 1px), 17px);
  font-weight: 400;
  letter-spacing: 0.015em;
  line-height: 1.42;
}

.about-copy p {
  margin: 0;
}

.about-copy > p + p {
  margin-top: 1em;
}

.about-section {
  margin-top: 2.1em;
}

.about-section h2 {
  margin: 0 0 0.55em;
  color: #fff;
  font-size: 1em;
  font-weight: 600;
  letter-spacing: 0.035em;
  line-height: 1.25;
}

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

body.about-open {
  overflow: hidden;
}

@media (orientation: portrait) and (max-width: 700px) {
  :root {
    --topbar-height: 64px;
    --topbar-offset: 18px;
    --project-grid-gap: 48px;
    --project-name-gap: 16px;
  }

  .project-selector {
    min-height: 0;
    place-items: start center;
    padding-top: calc(var(--topbar-height) + 36px);
  }

  .projects {
    width: min(100%, 320px);
    grid-template-columns: 1fr;
  }

  .about-panel {
    width: 100vw;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  :root {
    --topbar-height: 52px;
    --topbar-offset: 14px;
    --page-gutter: 16px;
    --footer-offset: 14px;
    --project-grid-gap: clamp(12px, 3vw, 28px);
    --project-name-gap: 8px;
    --project-name-size: clamp(11px, 1.8vw, 14px);
    --about-scroll-top: 68px;
    --about-scroll-bottom: 20px;
  }

  .projects {
    width: min(100%, 960px);
  }

  .about-copy {
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-name,
  .about-trigger,
  .about-backdrop,
  .about-panel,
  .about-close,
  .about-language-trigger,
  .about-language-menu,
  .about-language-option {
    transition: none;
  }
}
