/* Fonts are served from this site (Latin + Cyrillic subsets of the Google Fonts files),
   so the page doesn't wait on a second server before it can paint */
@font-face {
  font-family: 'Cormorant';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/cormorant-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Cormorant';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/cormorant-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/nunito-sans-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/nunito-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* =========================================
   PROJECT PAGE — /projects/<slug>
   Shared by every page that scripts/build-projects.mjs generates.
   Laid out like a photographer's client gallery: full-screen cover,
   sticky tab bar, white masonry of uncropped photos.
   ========================================= */
.project-page {
  --ink:   #000;
  --muted: #797979;
  --line:  #e6e6e6;
  --serif: 'Cormorant', Georgia, serif;
  --sans:  'Nunito Sans', Arial, Helvetica, sans-serif;
  background: #fff;
}

/* styles.css makes <picture> display: contents; the full-bleed ones need a box */
.project-hero-bg,
.project-next-bg {
  display: block;
  position: absolute;
  inset: 0;
}

.project-hero-bg img,
.project-next-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Cover */
.project-hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 48px 22vh;
  overflow: hidden;
  background: #222;
  color: #fff;
  font-family: var(--sans);
  text-align: center;
}

.project-hero::after,
.project-next::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .32);
}

.project-hero-text {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.project-hero-kicker {
  margin: 0 0 22px;
  font-size: 13px;
  opacity: .75;
}

.project-hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 64px;
  font-weight: 400;
  line-height: 1.1;
}

.project-hero-sub {
  margin: 24px 0 0;
  font-size: 15px;
}
.project-hero-sub .sep { margin: 0 16px; }
.project-hero-sub a,
.project-next-link {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.project-hero-down {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  padding: 8px;
}
.project-hero-down svg { display: block; width: 26px; height: 26px; }

/* Optional intro — only when a project has a description or facts */
.project-intro {
  max-width: 760px;
  margin: 0 auto;
  padding: 72px 24px 8px;
  font-family: var(--sans);
  text-align: center;
}
.project-intro p { margin: 0; font-size: 18px; line-height: 1.6; }
.project-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 48px;
  margin: 28px 0 0;
}
.project-facts dt { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.project-facts dd { margin: 0; font-family: var(--serif); font-size: 30px; }

/* Photos + sticky tab bar */
.project-photos {
  padding: 26px 48px 96px;
  background: #fff;
  font-family: var(--sans);
}

.project-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  height: 90px;
  margin-bottom: 26px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.project-tabs { display: flex; gap: 32px; min-width: 0; }

.project-tabs a {
  display: flex;
  align-items: center;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: color .2s;
}
.project-tabs a:hover { color: var(--ink); }
.project-tabs a.is-active { color: var(--ink); border-bottom-color: var(--ink); }

.project-actions { display: flex; align-items: center; gap: 6px; }

.project-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: background .2s;
}
.project-icon:hover { background: #f2f2f2; }
.project-icon svg { width: 22px; height: 22px; }

.project-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 223px;
  height: 43px;
  margin-left: 24px;
  padding: 0 28px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  transition: background .2s, color .2s;
}
.project-cta:hover { background: var(--ink); color: #fff; }

[data-share][data-copied]::after {
  content: "Ссылка скопирована";
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  pointer-events: none;
}

/* Masonry — project.js deals the photos into .project-col columns */
.project-grid {
  --cols: 3;
  --gap: 20px;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  align-items: start;
  gap: var(--gap);
}

.project-col {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* Boxed, or the <source> inside each one turns into an empty flex item and doubles the gap */
.project-grid picture { display: block; }

.project-grid img {
  width: 100%;
  height: auto;
  cursor: zoom-in;
  transition: opacity .2s;
}
.project-grid img:hover { opacity: .9; }

/* Next project — a second cover */
.project-next {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 72vh;
  min-height: 72svh;
  padding: 80px 24px;
  overflow: hidden;
  background: #222;
  color: #fff;
  font-family: var(--sans);
  text-align: center;
}

.project-next-bg img { transition: transform .8s ease; }
.project-next:hover .project-next-bg img { transform: scale(1.03); }

.project-next span { position: relative; z-index: 1; }
.project-next-kicker { margin-bottom: 20px; font-size: 13px; opacity: .75; }
.project-next-title { font-family: var(--serif); font-size: 64px; line-height: 1.1; }
.project-next-link { margin-top: 24px; font-size: 15px; }

/* Mobile action dock — hidden until the cover scrolls away */
.project-dock { display: none; }

/* Lightbox */
.lb {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.92);
  align-items: center;
  justify-content: center;
}
.lb.open { display: flex; }

.lb-img {
  max-width: 92vw;
  max-height: 90svh;
  object-fit: contain;
  display: block;
  border-radius: 2px;
  user-select: none;
}

.lb-close {
  position: absolute;
  top: 20px; right: 24px;
  background: none; border: none;
  color: #fff; font-size: 36px;
  cursor: pointer; opacity: .7;
  line-height: 1; padding: 8px;
  transition: opacity .2s;
}
.lb-close:hover { opacity: 1; }

.lb-prev, .lb-next {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.1);
  border: none; color: #fff;
  font-size: 28px; cursor: pointer;
  padding: 20px 18px;
  opacity: .7; transition: opacity .2s, background .2s;
  line-height: 1;
}
.lb-prev { left: 0; border-radius: 0 4px 4px 0; }
.lb-next { right: 0; border-radius: 4px 0 0 4px; }
.lb-prev:hover, .lb-next:hover { opacity: 1; background: rgba(255,255,255,.2); }

.lb-counter {
  position: absolute;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.5);
  font-size: 14px; font-weight: 600;
  letter-spacing: 1px;
}

.lb-project {
  position: absolute;
  top: 22px; left: 24px;
  color: rgba(255,255,255,.75);
  font-size: 15px; font-weight: 700;
  letter-spacing: 0.5px;
  pointer-events: none;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 900px) {
  .project-hero {
    justify-content: flex-start;
    padding: 0 35px 112px;
    text-align: left;
  }
  .project-hero h1 { font-size: 50px; }
  .project-hero-kicker { margin-bottom: 18px; }
  .project-hero-sub { margin-top: 24px; line-height: 1.6; }
  .project-hero-sub .sep { display: none; }
  .project-hero-sub a { display: block; }
  .project-hero-down { left: 27px; bottom: 40px; transform: none; }

  .project-intro { padding: 48px 20px 0; text-align: left; }
  .project-intro p { font-size: 16px; }
  .project-facts { justify-content: flex-start; gap: 12px 32px; }

  .project-photos { padding: 0 4px 72px; }
  .project-bar { height: 60px; margin: 0 -4px 4px; padding: 0 12px; }
  .project-tabs { gap: 24px; }
  .project-actions { display: none; }
  .project-grid { --cols: 2; --gap: 4px; }

  .project-next { min-height: 60vh; min-height: 60svh; }
  .project-next-title { font-size: 50px; }

  .project-dock {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 60;
    display: flex;
    padding: 8px 6px;
    border-radius: 22px;
    background: rgba(28, 28, 28, .82);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: #fff;
    font-family: var(--sans);
    transform: translateY(calc(100% + 24px));
    transition: transform .3s ease;
  }
  .project-dock.visible { transform: none; }

  .project-dock a,
  .project-dock button {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-size: 11px;
    cursor: pointer;
  }
  .project-dock svg { width: 22px; height: 22px; }
  .project-dock [data-copied]::after { top: auto; bottom: calc(100% + 10px); }
}

@media (max-width: 600px) {
  .lb-prev, .lb-next { padding: 16px 12px; font-size: 22px; }
  .lb-img { max-width: 100vw; max-height: 88svh; }
}

@media (max-width: 390px) {
  .project-hero { padding: 0 24px 104px; }
  .project-hero h1, .project-next-title { font-size: 44px; }
  .project-hero-down { left: 16px; }
}

@media (hover: none) and (pointer: coarse) {
  .project-cta:active { opacity: .8; }
}

@media (prefers-reduced-motion: reduce) {
  .project-next-bg img, .project-dock { transition: none; }
}
