:root {
  color-scheme: light;
  --paper: #f2efe9;
  --ink: #34322f;
  --muted: #615d56;
  --cover: #d3d0cb;
  --font: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 0.875rem / 1.55 var(--font);
}

.layout {
  display: grid;
  grid-template-columns: minmax(8.25rem, 10.5rem) minmax(0, 45rem);
  align-items: start;
  gap: clamp(2rem, 4vw, 4rem);
  padding: 1.25rem clamp(1rem, 2.5vw, 2rem) 7rem;
}

.sidebar {
  position: sticky;
  top: 1.25rem;
  max-height: calc(100svh - 8rem);
  overflow-y: auto;
}

/* Логотип закреплён у нижнего края окна независимо от длины страницы. */
.footer-logo {
  position: fixed;
  left: clamp(1rem, 2.5vw, 2rem);
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  width: 60px;
  margin: 0;
  z-index: 1;
}

.logo-placeholder {
  display: grid;
  place-items: center;
  height: 60px;
  padding: 0.5rem;
  background: var(--cover);
  font-size: 0.8125rem;
  text-align: center;
}

.footer-logo img {
  display: block;
  width: 100%;
  height: 60px;
  object-fit: contain;
}

.name {
  margin: 0 0 1.4rem;
  font-size: 0.8125rem;
  font-weight: 400;
}

.name a {
  display: block;
  width: min(100%, 9rem);
}

.label-placeholder {
  display: grid;
  min-height: 3.75rem;
  place-items: center;
  padding: 0.5rem;
  background: var(--cover);
  text-align: center;
}

.label-image {
  display: block;
  width: 100%;
  height: auto;
}

.nav-group a { display: table; min-height: 1.5rem; }
.nav-group a.project-link { padding-left: 0.75rem; }
/* Первая строка сетки резервирует место под раскрытый список проектов.
   Нижние ссылки остаются на одной высоте при открытии и закрытии списка. */
nav {
  display: grid;
  grid-template-rows: 20rem auto;
  align-items: start;
}

summary {
  display: block;
  width: fit-content;
  min-height: 1.5rem;
  cursor: pointer;
  list-style: none;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.22em;
  transition: text-decoration-color 140ms ease;
}

summary::-webkit-details-marker { display: none; }
summary:hover, summary:focus-visible { text-decoration-color: currentColor; }
summary:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 3px;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 0.22em;
  transition: text-decoration-color 140ms ease;
}

a:hover, a:focus-visible { text-decoration-color: currentColor; }

a:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 3px;
}

/* На главной видно меню. Якорь в адресе открывает нужный раздел. */
main { padding-top: clamp(8rem, 26vh, 17rem); }

.view, .project { display: none; scroll-margin-top: 1.25rem; }

.view:target, .view:has(.project:target) {
  display: block;
  animation: appear 180ms ease-out;
}

.project:target { display: block; }

@keyframes appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.project-name {
  width: min(100%, 22rem);
  margin: 0 0 1.25rem;
  font-size: 0.8125rem;
  font-weight: 400;
}

.project-placeholder {
  display: grid;
  place-items: center;
  min-height: 7rem;
  padding: 0.75rem;
  background: var(--cover);
  text-align: center;
}

.project-image {
  display: block;
  width: 100%;
  height: auto;
}
.project-description, .prose { max-width: 54ch; }
p { margin: 0 0 1rem; }
.prose a { text-decoration-color: currentColor; overflow-wrap: anywhere; }

.albums {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 11rem));
  gap: 1rem;
}

figure { margin: 0; }

.section-photo {
  width: min(100%, 22rem);
  margin-bottom: 1.25rem;
}

.photo-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0.75rem;
  background: var(--cover);
  font-size: 0.8125rem;
  text-align: center;
}

.section-photo img { display: block; width: 100%; height: auto; }

.cover {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  padding: 0.75rem;
  background: var(--cover);
  color: var(--ink);
  font-size: 0.8125rem;
  text-align: center;
}

img.cover { display: block; padding: 0; object-fit: cover; }
figcaption { margin-top: 0.35rem; color: var(--muted); font-size: 0.8125rem; }

@media (max-width: 38rem) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 2.25rem; }
  .sidebar { position: static; }
  main { padding-top: 0; }
  .albums { grid-template-columns: repeat(2, minmax(0, 11rem)); }
  .nav-group a, summary { min-height: 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  a, summary, .view:target, .view:has(.project:target) {
    animation: none;
    transition: none;
  }
}
