:root {
  --font-family: "Atkinson Hyperlegible", sans-serif;
  --background: #fffeed;
  --foreground: #111111;
  --muted: #666666;
  --border: #ddd9bf;
  --surface: #fffbea;
  --max-width: 96rem;
  --text-width: 44rem;
  --cv-text-width: 41rem;
  --header-height: 4rem;
  --page-shell-padding-top: 2rem;
  --page-shell-padding-bottom: 3rem;
  --work-meta-space: 5.75rem;
  --font-size-body: 1rem;
  --font-size-body-large: 1.125rem;
  --font-size-meta: 0.95rem;
  --font-size-title: 0.95rem;
  --font-size-nav: 1rem;
  --font-size-site-title: 1.12rem;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  color: var(--foreground);
  background: var(--background);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--foreground);
  background: transparent;
  cursor: pointer;
}

textarea,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  background: var(--background);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--background);
}

.site-header__inner,
.page-section {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: var(--header-height);
  padding-top: 0.5rem;
}

.site-title {
  letter-spacing: 0.04em;
  font-size: var(--font-size-site-title);
  line-height: 1.1;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  text-transform: none;
  letter-spacing: 0.04em;
  font-size: var(--font-size-nav);
  line-height: 1.1;
}

.site-nav a {
  display: inline-block;
}

.site-nav a[aria-current="page"] {
  font-style: italic;
  padding-right: 0.08em;
}

.page-shell {
  padding: var(--page-shell-padding-top) 0 var(--page-shell-padding-bottom);
}

.page-section {
  display: grid;
  gap: var(--space-3);
}

.public-section[hidden] {
  display: none !important;
}

.page-section--narrow {
  width: min(calc(100% - 2rem), var(--cv-text-width));
}

.text-block {
  display: grid;
  gap: var(--space-2);
}

.bio-text,
.work-description,
.work-description-de,
.work-size {
  margin: 0;
  white-space: pre-line;
}

.bio-text {
  font-size: var(--font-size-body-large);
  line-height: 1.6;
}

.work-description,
.work-description-de,
.work-size,
.message,
.field,
.checkbox-field,
button,
.button-link,
input,
textarea {
  font-size: var(--font-size-meta);
}

.works-grid,
.works-admin-list {
  display: grid;
  gap: var(--space-4);
}

.work-card,
.panel,
.admin-work-card {
  display: grid;
  gap: var(--space-2);
}

.work-figure {
  margin: 0;
}

.page-section--works .works-grid {
  gap: var(--space-5);
}

.page-section--works .work-card {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(
    100svh - var(--header-height) - var(--page-shell-padding-top) - var(--page-shell-padding-bottom)
  );
  overflow: hidden;
}

.page-section--works .work-frame {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-start;
  max-width: 100%;
}

.page-section--works .work-figure {
  margin: 0;
  width: max-content;
  max-width: 100%;
}

.page-section--works .work-figure img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(
    100svh - var(--header-height) - var(--page-shell-padding-top) - var(--page-shell-padding-bottom) - var(--measured-work-meta-space, var(--work-meta-space))
  );
  object-fit: contain;
}

.work-title,
.panel-title,
.admin-work-card h2 {
  margin: 0;
  font-size: var(--font-size-title);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.work-meta {
  display: grid;
  gap: 0;
  align-content: start;
  width: 100%;
  text-align: left;
}

.work-title {
  text-transform: none;
  letter-spacing: 0.02em;
  margin-bottom: 0.18rem;
}

.work-description-de {
  margin-bottom: 0.04rem;
  line-height: 1.2;
}

.work-description {
  font-style: italic;
  line-height: 1.2;
}

.work-size {
  line-height: 1.2;
}

.work-title,
.work-description-de,
.work-description,
.work-size {
  overflow-wrap: anywhere;
}

.empty-state,
.panel {
  padding: var(--space-3);
  border: 1px solid var(--border);
}

.panel {
  background: var(--surface);
}

.panel-header,
.panel-actions,
.admin-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  justify-content: space-between;
}

.stack,
.stack-form {
  display: grid;
  gap: var(--space-2);
}

.field,
.checkbox-field {
  display: grid;
  gap: 0.35rem;
}

.checkbox-field {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-field input {
  margin: 0;
}

.message {
  margin: 0;
}

.message--error {
  color: #a10000;
}

.message--success {
  color: #0b6a2b;
}

.admin-work-card__image img,
.admin-preview img {
  width: 100%;
  object-fit: cover;
}

@media (max-width: 48rem) {
  .page-section--works .work-card {
    height: auto;
    min-height: calc(
      100svh - var(--header-height) - var(--page-shell-padding-top) - var(--page-shell-padding-bottom)
    );
    align-items: start;
    overflow: visible;
  }

  .page-section--works .work-frame {
    width: 100%;
    align-items: stretch;
  }

  .page-section--works .work-figure {
    width: 100%;
    max-width: 100%;
  }

  .page-section--works .work-figure img {
    width: 100%;
    max-width: 100%;
    max-height: calc(
      100svh - var(--header-height) - var(--page-shell-padding-top) - var(--page-shell-padding-bottom)
    );
    margin: 0 auto;
  }
}

@media (max-width: 24rem) {
  :root {
    --work-meta-space: 7rem;
  }

  .page-section--works .work-frame {
    gap: 0.5rem;
    max-width: calc(100vw - 2rem);
    padding-right: 0.2rem;
    padding-bottom: 0.2rem;
  }

  .page-section--works .work-meta {
    padding-right: 0.15rem;
    padding-bottom: 0.15rem;
  }
}

@media (min-width: 48rem) {
  :root {
    --page-shell-padding-top: 3rem;
    --work-meta-space: 6.25rem;
    --font-size-title: 1rem;
    --font-size-nav: 1.05rem;
    --font-size-site-title: 1.48rem;
    --font-size-body-large: 1.2rem;
  }

  .site-header__inner {
    width: min(calc(100% - 4rem), var(--max-width));
  }

  .page-shell {
    padding-top: var(--space-5);
  }

  .admin-work-card {
    grid-template-columns: minmax(16rem, 22rem) 1fr;
    align-items: start;
  }
}
