/* ==========================================================================
   Portfolio — layout/typography system reproduced from the jackscott.co
   reference (Cargo "predefined style" preset), rebuilt as static HTML/CSS/JS.

   Root rem scaling (measured from the reference at 375/768/1024/1280/1600):
     desktop : max(11.52px, 0.81vw)
     mobile  : max(9.6px,  1.92vw)
   Every size below is expressed in those rems, so the whole page scales
   exactly like the original.
   ========================================================================== */

:root {
  /* Тёмная тема: фон чёрный, весь текст #efefef */
  --color-text: #efefef;
  --color-text-strong: #efefef;
  --color-link-hover: #7a7a7a;   /* приглушение при наведении */
  --color-nav-active: #8a8a8a;   /* текущий пункт меню */
  --color-bg: #000;
  --color-thumb-overlay: rgba(0, 0, 0, 0.75);

  /* Roboto Mono для всего сайта (в оригинале — Alte/Neue Haas Grotesk). */
  --font-display: "Roboto Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-ui: "Roboto Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Layout */
  --container-width: 80%;      /* header + project/text pages */
  --thumbs-width: 72%;         /* thumbnail grid container */
  --content-padding: 3.9rem;
  --grid-gutter: 6rem;         /* negative margin on the thumbnail wrapper */
  --thumb-pad: 0.5rem;         /* padding on each thumbnail cell */
  --thumb-columns: 3;
}

html {
  font-size: max(10.368px, 0.81vw);
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-display);
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--color-link-hover); }

/* --------------------------------------------------------------------------
   Shared container / padding
   -------------------------------------------------------------------------- */
.container {
  width: var(--container-width);
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}
.content-padding { padding: var(--content-padding); }

/* 12-column row, matching the reference's grid-row / grid-col attributes */
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}
.col { flex: 0 0 auto; min-width: 0; }
.col-1  { width: 8.3333%; }
.col-2  { width: 16.6666%; }
.col-3  { width: 25%; }
.col-4  { width: 33.3333%; }
.col-5  { width: 41.6666%; }
.col-6  { width: 50%; }
.col-7  { width: 58.3333%; }
.col-8  { width: 66.6666%; }
.col-12 { width: 100%; }

.text-center { text-align: center; }
.text-right  { text-align: right; }

/* --------------------------------------------------------------------------
   Type scale
   -------------------------------------------------------------------------- */
/* Название студии — ровно того же кегля и веса, что «О НАС» / «КОНТАКТЫ» */
.t-logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.7;
  margin: 0;
  letter-spacing: normal;
}
.logo-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  cursor: default;   /* логотип не ссылка */
}
.logo-mark {
  width: auto;
  flex: 0 0 auto;
}
.t-major {                /* h1 — ABOUT ME / CONTACT */
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.7;
  margin: 0;
}
.t-small {                /* small — nav + captions */
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 2;
}
.t-title {                /* project page title */
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Header (scrolls with the page — the reference header is NOT sticky)
   -------------------------------------------------------------------------- */
.site-header { position: relative; z-index: 20; }

/* Reference proportions: wordmark 4/12, categories 4/12, ABOUT+CONTACT 4/12.
   Groups are flexible so longer (Russian, monospaced) labels still fit. */
.header-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}
/* Логотип и правый блок занимают ровно столько, сколько нужно;
   разделы забирают остаток и стоят по центру. Пять русских слов
   моноширинным шрифтом в жёсткие 33% не помещались. */
.logo-col {
  flex: 0 0 auto;
  min-width: 0;
  white-space: nowrap;
}
.nav-group {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: center;
  gap: 2.4rem;
  padding: 0 2rem;
}
.primary-group {
  flex: 0 0 auto;
  display: flex;
  gap: 4rem;
  white-space: nowrap;
}

.nav-cell { flex: 0 0 auto; text-align: center; }
.primary-cell { flex: 0 0 auto; text-align: right; }

/* the reference wraps the category links in <sub>, which drops them slightly */
.site-header .nav-link { position: relative; top: 0.45rem; white-space: nowrap; }

/* Текущий раздел: тонкая линия под названием */
.site-header .nav-link.active::after,
.site-header .primary-cell a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.6rem;
  height: 1px;
  background: currentColor;
  opacity: 0.75;
}
.site-header .primary-cell a { position: relative; }

.site-header .t-major a.active { color: var(--color-nav-active); }

.header-burger { display: none; }

/* На узком десктопе пяти русским разделам тесно — ужимаем шапку по ступеням */
@media (min-width: 901px) and (max-width: 1200px) {
  .t-logo,
  .t-major { font-size: 1.4rem; }
  .nav-group { gap: 1.4rem; padding: 0 1rem; }
  .primary-group { gap: 2.6rem; }
}
@media (min-width: 901px) and (max-width: 1050px) {
  .t-logo,
  .t-major { font-size: 1.25rem; }
  .nav-group { gap: 0.9rem; padding: 0 0.6rem; }
  .primary-group { gap: 1.8rem; }
  .site-header .nav-link { font-size: 0.95rem; }
}

/* --------------------------------------------------------------------------
   Thumbnail grid
   -------------------------------------------------------------------------- */
.thumbnails { position: relative; z-index: 1; padding-bottom: 10rem; }
.thumbnails-container {
  width: var(--thumbs-width);
  margin-left: auto;
  margin-right: auto;
}
.thumbnails-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-start;
  margin: calc(var(--grid-gutter) * -1);
  padding: var(--thumb-pad);
}
.thumbnail {
  width: calc(100% / var(--thumb-columns));
  padding: var(--thumb-pad);
}
.thumbnail > a {
  position: relative;
  display: block;
  text-decoration: none;
}
.thumb-image {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 100%;   /* square by default; overridden per aspect ratio */
  overflow: hidden;
}
.thumb-image img,
.thumb-image video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb-image[data-aspect="4x3"]  { padding-bottom: 75%; }
.thumb-image[data-aspect="3x4"]  { padding-bottom: 133.3333%; }
.thumb-image[data-aspect="16x9"] { padding-bottom: 56.25%; }

/* Hover: translucent white sheet with the centred project title */
.thumbnail .title {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  padding: 0.5rem 1.2rem 0.7rem;
  background-color: var(--color-thumb-overlay);
  color: var(--color-text-strong);
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.thumbnail .title span { margin: auto; display: inline-block; text-align: center; }
.thumbnail:hover .title { opacity: 1; }

/* --------------------------------------------------------------------------
   Шторка «О нас» / «Контакты» — поверх работ, без перезагрузки страницы
   -------------------------------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s;
}
.overlay.open { opacity: 1; visibility: visible; }

.overlay-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12rem 4rem 8rem;
}

.overlay-panel {
  display: none;
  width: 100%;
  transform: translateY(24px);
  transition: transform 0.5s ease;
}
.overlay-panel.active { display: block; }
.overlay.open .overlay-panel.active { transform: none; }

.overlay-close {
  position: absolute;
  top: 1.4rem;
  left: 3.9rem;
  z-index: 2;
  width: 4rem;
  height: 4rem;
  font-size: 3rem;
  line-height: 1;
  background: none;
  border: 0;
  color: var(--color-text);
  cursor: pointer;
  transition: color 0.15s ease;
}
.overlay-close:hover { color: var(--color-link-hover); }

/* шапка остаётся поверх шторки и кликабельной */
body.overlay-open { overflow: hidden; }

/* Шапка остаётся поверх шторки, чтобы можно было переключаться между
   разделами не закрывая её. Но её пустая область — прозрачная коробка на всю
   ширину — перехватывала клики по крестику, который лежит ниже. Поэтому саму
   шапку делаем «сквозной», а клики принимают только ссылки в ней. */
body.overlay-open .site-header {
  position: relative;
  z-index: 60;
  pointer-events: none;
}
body.overlay-open .site-header a { pointer-events: auto; }

/* на мобильном бургер и крестик шторки стоят в одной точке — прячем бургер */
body.overlay-open .header-burger { display: none; }

@media (max-width: 900px) {
  .overlay-scroll { padding: 9rem 2.5rem 6rem; align-items: flex-start; }
  .overlay-close { top: 0.8rem; left: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .overlay,
  .overlay-panel { transition: none; }
  .overlay-panel { transform: none; }
}

/* Раздел без работ */
.empty-state {
  min-height: 34vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 2rem;
  opacity: 0.55;
  letter-spacing: 0.06em;
}

/* Кнопка «показать ещё» */
.more-wrap {
  display: flex;
  justify-content: center;
  /* сетка поднята отрицательным полем −6rem, компенсируем его,
     иначе кнопка прилипает к нижнему ряду плиток */
  margin-top: var(--grid-gutter);
  padding: 2rem 0 2rem;
}
.more-wrap:empty { margin: 0; padding: 0; }

/* без рамки — просто надпись, чтобы не спорила с плитками */
.more-button {
  font-family: var(--font-ui);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--color-text);
  background: none;
  border: 0;
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: color 0.15s ease;
}
.more-button:hover { color: var(--color-link-hover); }

/* --------------------------------------------------------------------------
   Scroll reveal (reference: transform 1s ease-in-out, opacity 0.8s ease-in-out)
   -------------------------------------------------------------------------- */
.scroll-fade {
  transition: transform 1s ease-in-out, opacity 0.8s ease-in-out;
}
.scroll-fade.below-viewport {
  opacity: 0;
  transform: translateY(40px);
}
@media (prefers-reduced-motion: reduce) {
  .scroll-fade { transition: none; }
  .scroll-fade.below-viewport { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Project detail page
   -------------------------------------------------------------------------- */
.project-media { margin-bottom: 0; }
.project-media img { width: 100%; height: auto; }
.project-media + .project-media { margin-top: 2.6rem; }

/* Видео занимает ту же площадь, что и квадратная обложка.
   Вертикальный ролик вписывается целиком (contain), поля сливаются с фоном. */
.project-video {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 100%;
}
.project-video[data-aspect="4x3"]  { padding-bottom: 75%; }
.project-video[data-aspect="3x4"]  { padding-bottom: 133.3333%; }
.project-video[data-aspect="16x9"] { padding-bottom: 56.25%; }
.project-video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.project-meta { margin-top: 2.6rem; }
.project-meta .t-small { display: block; }
.spacer-1 { height: 1.3rem; }
.spacer-2 { height: 2.6rem; }
.spacer-4 { height: 5.2rem; }
.spacer-8 { height: 10.4rem; }

.back-link {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text-strong);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
.back-link:hover { color: var(--color-link-hover); }

/* Text pages (About / Contact) */
.text-page { min-height: 40vh; }

.about-body {
  max-width: 62rem;
  margin: 0 auto;
  text-align: center;
}
.about-body p {
  margin: 0 0 1.8rem;
  line-height: 1.9;
}
.about-body p:last-child { margin-bottom: 0; }

.contact-body {
  text-align: center;
}
.contact-body p {
  margin: 0 0 1.2rem;
  line-height: 1.9;
}
.contact-body p:last-child { margin-bottom: 0; }
.icon-link { font-size: 1.6rem; }

/* --------------------------------------------------------------------------
   Mobile (the reference switches to its mobile shell below ~900px:
   full-bleed one-column grid, burger left, wordmark centred)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  html { font-size: max(9.6px, 1.92vw); }

  :root {
    --thumb-columns: 1;
    --grid-gutter: 0rem;
    --thumb-pad: 0.3rem;
    --content-padding: 2rem;
  }

  .site-header .container { width: 100%; }
  .site-header .content-padding { padding: 1.6rem 1rem; }
  .site-header .desktop-only { display: none; }
  .site-header .header-row { margin-bottom: 0; }
  .site-header .logo-col { width: 100%; text-align: center; }
  .site-header .logo-col .t-logo { font-size: 2.4rem; }

  .header-burger {
    display: block;
    position: absolute;
    top: 0.8rem;
    left: 1rem;
    z-index: 60;
    width: 3.4rem;
    height: 3.4rem;
    padding: 0.6rem;
    background: none;
    border: 0;
    cursor: pointer;
  }
  .header-burger span {
    display: block;
    height: 2px;
    background: var(--color-text-strong);
    margin: 0.55rem 0;
    border-radius: 1px;
  }

  .thumbnails { padding-bottom: 4rem; }
  .thumbnails-container { width: 100%; }
  .thumbnails .content-padding { padding: 0; }
  .thumbnails-grid { margin: 0; }
  /* no hover on touch — the reference hides the overlay on mobile too */
  .thumbnail .title { display: none; }

  /* project + text pages go full width on mobile */
  .content .container { width: 100%; }
  .content .content-padding { padding: 2rem; }
  .content .col-7,
  .content .col-8 { width: 100%; }
  .content .col-4,
  .content .col-5 { display: none; }
}

/* Mobile menu overlay */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  background: rgba(0, 0, 0, 0.93);
  padding: 9rem 4rem;
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: block;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 2.4;
  color: var(--color-text-strong);
}
.mobile-menu a.active { opacity: 0.4; }
.mobile-menu .menu-gap { height: 2.4rem; }
.mobile-menu-close {
  position: absolute;
  top: 0.8rem;
  left: 1rem;
  width: 4rem;
  height: 4rem;
  font-size: 3rem;
  line-height: 1;
  background: none;
  border: 0;
  color: var(--color-text-strong);
  cursor: pointer;
}
body.menu-open { overflow: hidden; }
body.menu-open .header-burger { display: none; }

/* --------------------------------------------------------------------------
   Roboto Mono грузится из Google Fonts (<link> в <head> каждой страницы).
   Если захотите положить шрифт локально — раскомментируйте блок ниже и
   положите файлы в assets/fonts/.
   -------------------------------------------------------------------------- */
/*
@font-face {
  font-family: "Roboto Mono";
  src: url("../fonts/RobotoMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Roboto Mono";
  src: url("../fonts/RobotoMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
*/
