:root {
  --ink: #302e29;
  --nav-underline: #994b20;
  --line: #dedbd3;
  --paper: #faf9f5;
  --viewer-paper: #242420;
  --viewer-ink: #edeae2;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}
:root[data-theme="dark"] {
  --ink: var(--viewer-ink);
  --nav-underline: #edae78;
  --line: #4b4a43;
  --paper: var(--viewer-paper);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 16px; line-height: 1.55; }
body.viewer-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible { outline: 2px solid currentColor; outline-offset: 6px; }
img { display: block; max-width: 100%; }
h1, h2, p, figure { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 10; padding: 12px 20px; background: var(--paper); transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.site-header { position: relative; display: flex; flex-direction: column; align-items: center; padding: 22px 24px 20px; gap: 18px; }
.brand img { width: 136px; height: 136px; object-fit: contain; }
:root[data-theme="dark"] .brand img { filter: drop-shadow(0 0 1px rgb(255 244 211 / 45%)); }
.site-header nav { display: flex; gap: 36px; }
.site-header nav a { padding: 4px 0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; border-bottom: 1px solid transparent; }
.site-header nav a:hover { border-color: currentColor; }
.site-header nav a[aria-current="page"] { border-color: var(--nav-underline); }
.theme-toggle { position: absolute; top: 18px; right: 24px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; }
.theme-toggle:hover { background: var(--line); }
.theme-toggle[hidden],
.theme-toggle[aria-pressed="false"] .theme-sun,
.theme-toggle[aria-pressed="true"] .theme-moon { display: none; }
.hero { height: min(73vw, 740px); min-height: 520px; background: var(--paper); overflow: hidden; }
.hero > img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 55%; }
.eyebrow { font-size: 11px; line-height: 1.5; letter-spacing: .16em; text-transform: uppercase; }
.section { width: min(100% - 96px, 1320px); margin-inline: auto; }
.selected { padding-top: 56px; padding-bottom: 64px; scroll-margin-top: 20px; }
h2 { font-size: clamp(28px, 3.2vw, 40px); font-weight: 300; line-height: 1.2; letter-spacing: -.02em; margin-top: 12px; }
.featured-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 26px; row-gap: 34px; }
.featured-grid .photo-card > a { aspect-ratio: 3 / 2; }
.featured-grid .photo-card img { height: 100%; object-fit: cover; }
.photo-card { min-width: 0; }
.photo-card > a { display: block; position: relative; background: var(--paper); overflow: hidden; }
.photo-card img { width: 100%; height: auto; transition: transform .35s ease; }
.photo-card > a:hover img { transform: scale(1.025); }
img.mirrored { transform: scaleX(-1); }
.photo-card > a:hover img.mirrored { transform: scale(-1.025, 1.025); }
.photo-open { position: absolute; right: 12px; bottom: 12px; width: 32px; height: 32px; display: grid; place-items: center; color: var(--viewer-ink); background: rgb(36 36 32 / 76%); opacity: 0; transition: opacity .2s; }
.photo-card a:hover .photo-open, .photo-card a:focus-visible .photo-open { opacity: 1; }
.gallery-link { text-align: center; margin-top: 50px; }
.text-link { display: inline-flex; align-items: center; gap: 40px; padding: 10px 0; border-bottom: 1px solid var(--ink); font-size: 14px; }
.text-link span { font-size: 20px; }
.text-link:hover { border-bottom-width: 2px; padding-bottom: 9px; }
.site-footer { width: min(100% - 96px, 1320px); margin: 0 auto; padding: 25px 0 30px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: start; gap: 28px; color: var(--ink); font-size: 11px; letter-spacing: .015em; }
.copyright { max-width: 880px; line-height: 1.65; }
.site-footer > a { flex-shrink: 0; white-space: nowrap; }
.site-footer a:hover { text-decoration: underline; }
.portfolio { padding-top: 16px; padding-bottom: 64px; }
.not-found h1 { font-size: clamp(40px, 4.2vw, 60px); font-weight: 300; letter-spacing: -.035em; line-height: 1.15; margin: 16px 0 18px; }
.portfolio-grid { display: flex; flex-direction: column; gap: 20px; }
.portfolio-row { display: flex; align-items: start; gap: 20px; }
.portfolio-row .photo-card { flex: var(--ratio) 1 0px; }
/* Высота неполного ряда соответствует трём горизонтальным кадрам 3:2. */
.portfolio-row:last-child:not(:has(> .photo-card:nth-child(3))) .photo-card {
  flex: 0 1 calc((100% - 40px) / 4.5 * var(--ratio));
}
.portfolio-row .photo-card > a { aspect-ratio: var(--ratio); }
.portfolio-row .photo-card img { height: 100%; object-fit: contain; }
.not-found { padding-block: 110px 160px; min-height: 65vh; }
.not-found > p { max-width: 520px; }
.not-found .text-link { margin-top: 30px; }
.lightbox { position: fixed; inset: 0; margin: auto; width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; padding: 0; background: transparent; color: var(--viewer-ink); }
.lightbox::backdrop { background: rgb(36 36 32 / 96%); }
.lightbox-shell { min-height: 100%; display: grid; place-items: center; padding: 64px 84px 28px; }
.viewer-figure { max-width: 1400px; width: 100%; display: flex; flex-direction: column; align-items: center; }
.viewer-image { display: block; margin-inline: auto; width: auto; max-width: 100%; height: auto; max-height: min(58dvh, 1000px); object-fit: contain; }
.viewer-caption { max-width: 850px; width: 100%; margin-top: 18px; text-align: center; }
.viewer-title { margin: 0; font-size: 17px; font-weight: 400; line-height: 1.4; letter-spacing: 0; }
.viewer-species-latin { font-size: 15px; font-weight: 300; white-space: nowrap; }
.viewer-description, .viewer-range { margin-top: 8px; font-size: 13px; line-height: 1.6; }
.viewer-size { margin-top: 7px; font-size: 12px; }
.viewer-conservation { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.viewer-conservation[hidden] { display: none; }
.viewer-conservation a { padding: 4px 9px; border: 1px solid #79776e; border-radius: 3px; font-size: 11px; line-height: 1.4; }
.viewer-conservation a:hover { text-decoration: underline; }
.viewer-conservation-note { margin-top: 8px; font-size: 11px; line-height: 1.5; }
.viewer-count { margin-top: 10px; text-align: center; font-size: 11px; font-variant-numeric: tabular-nums; }
.lightbox-shell > button, .viewer-toolbar > button { border: 0; background: transparent; color: var(--viewer-ink); cursor: pointer; width: 48px; height: 48px; font-weight: 300; line-height: 1; }
.lightbox-shell > button { position: fixed; }
.viewer-toolbar { position: fixed; z-index: 2000; top: 14px; right: 14px; display: flex; gap: 4px; }
.viewer-toolbar > button { display: grid; place-items: center; padding: 0; }
.viewer-toolbar > button[hidden] { display: none; }
.viewer-collapse-icon, .is-inspecting .viewer-expand-icon { display: none; }
.is-inspecting .viewer-collapse-icon { display: block; }
.lightbox-shell > button:hover, .viewer-toolbar > button:hover { background: rgb(255 255 255 / 10%); }
.lightbox-shell > button:focus-visible, .viewer-toolbar > button:focus-visible { outline-offset: 0; }
.lightbox.is-inspecting { overflow: hidden; }
.is-inspecting > .lightbox-shell { visibility: hidden; }
.lightbox .pswp { --pswp-root-z-index: 1000; --pswp-bg: var(--viewer-paper); }
.lightbox .pswp__top-bar { padding: 8px 14px 0; pointer-events: none; }
.viewer-prev, .viewer-next { top: calc(50% - 24px); font-size: 30px; }
.viewer-prev { left: 16px; }
.viewer-next { right: 16px; }
.viewer-error { position: absolute; bottom: 12px; padding: 12px 24px; text-align: center; background: var(--viewer-paper); font-size: 13px; }
.viewer-error a { text-decoration: underline; }
@media (min-width: 1800px) { .hero { height: 780px; max-width: 1920px; margin-inline: auto; } }
@media (max-width: 1000px) {
  .section, .site-footer { width: calc(100% - 56px); }
  .featured-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 22px; }
}
@media (max-width: 600px) {
  .site-header { padding: 14px 20px 18px; gap: 14px; }
  .theme-toggle { top: 10px; right: 12px; }
  .brand img { width: 112px; height: 112px; }
  .site-header nav { gap: 28px; }
  .site-header nav a { font-size: 10px; }
  .hero { height: 590px; min-height: 0; }
  .hero > img { object-position: 42% 55%; }
  .section, .site-footer { width: calc(100% - 40px); }
  .selected { padding-block: 28px 40px; }
  .featured-grid { grid-template-columns: minmax(0, 1fr); row-gap: 28px; }
  .photo-open { opacity: 1; }
  .gallery-link { margin-top: 32px; }
  .site-footer { padding-block: 22px; flex-direction: column; gap: 14px; }
  .site-footer > a { align-self: flex-end; }
  .portfolio { padding-top: 20px; padding-bottom: 36px; }
  .portfolio-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .lightbox-shell { padding: 65px 16px 80px; }
  .viewer-image { max-height: 45dvh; }
  .viewer-caption { margin-top: 14px; }
  .viewer-title { font-size: 16px; }
  .viewer-species-latin { font-size: 14px; }
  .viewer-description, .viewer-range { font-size: 12px; line-height: 1.5; }
  .viewer-prev, .viewer-next { top: auto; bottom: 14px; }
  .viewer-prev { left: 24px; }
  .viewer-next { right: 24px; }
  .viewer-toolbar { right: 8px; top: 8px; }
  .lightbox .pswp__top-bar { padding: 2px 8px 0; }
  .viewer-error { bottom: 70px; margin-inline: 16px; }
  .not-found { padding-block: 70px 110px; }
}
@media (min-width: 1001px) {
  .lightbox { background: var(--viewer-paper); }
  .lightbox-shell { padding: 48px 72px 32px; }
  .viewer-figure { max-width: 1800px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: center; gap: 32px; }
  .viewer-image { min-width: 0; max-height: calc(100dvh - 80px); }
  .viewer-caption { max-width: none; max-height: calc(100dvh - 80px); overflow-y: auto; overscroll-behavior: contain; margin-top: 0; text-align: left; }
  .viewer-title { font-size: 20px; }
  .viewer-species-latin { display: block; margin-top: 4px; white-space: normal; }
  .viewer-description, .viewer-range { margin-top: 14px; }
  .viewer-conservation { justify-content: flex-start; }
  .viewer-count { margin-top: 18px; text-align: left; }
}
@media (max-width: 1000px) and (max-height: 600px) and (orientation: landscape) {
  .lightbox { background: var(--viewer-paper); }
  .lightbox-shell { height: 100%; min-height: 0; padding: 16px 44px; }
  .viewer-figure { height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) clamp(180px, 29vw, 260px); gap: 16px; align-items: center; }
  .viewer-image { min-width: 0; max-height: calc(100dvh - 32px); }
  .viewer-caption { min-height: 0; max-height: 100%; margin-top: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 8px; text-align: left; }
  .viewer-species-latin { display: block; white-space: normal; font-size: 12px; }
  .viewer-description, .viewer-range { font-size: 12px; line-height: 1.5; }
  .viewer-conservation { justify-content: flex-start; }
  .viewer-count { text-align: left; }
  .viewer-prev, .viewer-next { top: calc(50% - 24px); bottom: auto; }
  .viewer-prev { left: 4px; }
  .viewer-next { right: 4px; }
  .viewer-toolbar { top: 4px; right: 4px; }
  .lightbox .pswp__top-bar { padding: 0 4px; }
}
@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
