:root {
  --bg: #f5f1e8;
  --header-bg: #e3dccd;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --line: #1a1a1a;
  --max: 1600px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* ---------- Scrollbar + overscroll (thin, always visible) ---------- */
html, body {
  overscroll-behavior: none;       /* вимикає Safari rubber-band */
}

html {
  overflow-y: scroll;              /* скролбар завжди видимий — без миттєвого фулскрін-пробілому при релоаді */
  scrollbar-width: thin;           /* Firefox */
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

/* Safari, Chrome */
html::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
html::-webkit-scrollbar-track {
  background: transparent;
}
html::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}
html::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: #000;
  color: var(--fg);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }

/* ---------- Header ---------- */
.site-header {
  background: var(--header-bg);
  width: 100%;
}

.site-header-inner {
  max-width: none;
  margin: 0;
  padding: 12.5px 1cm;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 700;
  font-size: 1.44rem;
  letter-spacing: -0.01em;
}

.logo img {
  width: 54px;
  height: 54px;
}

.social {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

.social a {
  display: inline-flex;
  transition: transform 0.18s ease;
}
.social a:hover { transform: translateY(-2px); }

/* ---------- Main ---------- */
main {
  max-width: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* ---------- Unified grid (60-col base; supports 1/4, 1/3, 30%, 40%) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(60, 1fr);
  grid-template-rows: repeat(4, auto);
  align-content: start;
  gap: 2px;
  background: var(--line);
}

.card {
  position: relative;
  overflow: hidden;
  grid-column: span 15;         /* default = 25% width */
  aspect-ratio: 1 / 1;
  display: block;
  background: var(--line);
  transition: transform 0.25s ease;
}

.card--third {                  /* 33.33% width */
  grid-column: span 20;
  aspect-ratio: 4 / 3;
}

.card--30 {                     /* 30% width */
  grid-column: span 18;
  aspect-ratio: 6 / 5;
}

.card--40 {                     /* 40% width */
  grid-column: span 24;
  aspect-ratio: 8 / 5;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover img { transform: scale(1.02); }

/* Hero photo: align to top so head isn't cropped */
.card--photo img {
  object-position: center top;
}

/* Friendly Pixels: keep logo (top-right of image) fully visible */
.card img[src$="friendly-pixels.jpg"] {
  object-position: right top;
}

/* Human Rights: align top so heads aren't cropped */
.card img[src$="human-rights.jpg"] {
  object-position: center top;
}

/* ---------- Hero text card ---------- */
.card--text {
  background: #fff;
  padding: clamp(1.25rem, 2.5vw, 2.5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.card--text:hover img { transform: none; }

.card--text h1 {
  font-size: clamp(1.7rem, 2.6vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 1.1rem;
  line-height: 1.1;
}

.lead {
  font-size: clamp(1.1rem, 1.55vw, 1.35rem);
  margin: 0 0 1.4rem;
  color: var(--fg);
  line-height: 1.3;
}

.status {
  font-size: clamp(1.1rem, 1.55vw, 1.35rem);
  color: var(--fg);
  margin: 0 0 1.4rem;
  font-weight: 600;
  line-height: 1.4;
}

.hl {
  background: #d72a2a;
  color: #fff;
  padding: 0.1em 0.45em;
  font-weight: 700;
  white-space: nowrap;
}

.contact {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: clamp(1.05rem, 1.3vw, 1.2rem);
}
.contact a { color: var(--fg); }
.contact a:hover { color: var(--muted); }

/* ---------- Card label overlays ---------- */
.card-label {
  position: absolute;
  left: 16px;
  bottom: 16px;
  --hl-rest: rgba(255, 255, 255, 0.35);
  --hl-active: rgba(255, 255, 255, 0.7);
  background: var(--hl-rest);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #1a1a1a;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.5rem 0.8rem;
  line-height: 1.2;
  border-radius: 6px;
  transition: background 0.2s ease, transform 0.2s ease;
  max-width: calc(100% - 32px);
  z-index: 2;
}

/* Position modifier — bottom-right instead of bottom-left */
.card-label--right {
  left: auto;
  right: 16px;
}

/* Solid color variants — bg fixed (rest = active = solid color) */
.card-label--dark {
  --hl-rest: #1a1a1a;
  --hl-active: #1a1a1a;
  color: #fff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.card-label--red {
  --hl-rest: #d72a2a;
  --hl-active: #d72a2a;
  color: #fff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.card-label--orange {
  --hl-rest: #f24e1a;
  --hl-active: #f24e1a;
  color: #fff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.card-label--purple {
  --hl-rest: #6e3df0;
  --hl-active: #6e3df0;
  color: #fff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Light-bg tile (apple-dev.jpg is mostly white): use gray instead of white */
.card--lightbg .card-label:not(.card-label--dark):not(.card-label--red):not(.card-label--orange):not(.card-label--purple),
.card--lightbg .card-overlay {
  --hl-rest: rgba(0, 0, 0, 0.1);
  --hl-active: rgba(0, 0, 0, 0.22);
}

.card--lightbg {
  background: #fff;
}

/* Hovering the label itself highlights it (independent of card hover) */
.card-label:hover {
  transform: scale(1.04);
  background: var(--hl-active);
}

/* ---------- Background link inside card (for cards with overlay) ---------- */
.card-bg {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 0;
}

.card-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Overlay link (sits on top of card-bg) ---------- */
.card-overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 3;
  --hl-rest: rgba(255, 255, 255, 0.35);
  --hl-active: rgba(255, 255, 255, 0.7);
  background: var(--hl-rest);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #1a1a1a;
  padding: 0.55rem 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  border-radius: 6px;
  max-width: calc(100% - 32px);
  transition: background 0.2s ease, transform 0.2s ease;
}

.card-overlay:hover {
  transform: scale(1.04);
  background: var(--hl-active);
}

.card-overlay--right {
  left: auto;
  right: 16px;
}

.card-overlay svg { flex-shrink: 0; }

.card-overlay--pdf .overlay-pdf-icon {
  background: #ec1c24;
  color: #fff;
  font-weight: 800;
  font-size: 0.68rem;
  padding: 0.25rem 0.4rem;
  letter-spacing: 0.05em;
  border-radius: 3px;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--header-bg);
  text-align: center;
  padding: 1rem 1.5rem;
  color: var(--fg);
  font-size: 0.9rem;
}
.site-footer p { margin: 0; }

/* ---------- Tusya page (3-column layout, vertically centered, full-viewport) ---------- */
body.tusya {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.tusya main {
  flex: 1;
  display: flex;
  align-items: center;
  background: #a0a0a0;
  padding: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

body.tusya .tusya-grid {
  width: 100%;
}

.tusya-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: var(--line);
  border-top: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
}

.tusya-cell {
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2.5rem);
  text-align: center;
  text-transform: uppercase;
  font-weight: 800;
  font-size: clamp(1rem, 2.2vw, 2rem);
  letter-spacing: 0.03em;
  line-height: 1.25;
}

.tusya-cell p {
  margin: 0;
}

.tusya-cell--left {
  background: #6a6a6a;
  color: #fff;
}

.tusya-cell--right {
  background: #d8d4c7;
  color: #1a1a1a;
}

.tusya-cell--photo {
  background: #000;
  padding: 0;
}
.tusya-cell--photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tusya-emph {
  font-size: 1.25em;
  font-weight: 900;
}

.tusya-pink {
  color: #e974f4;
  font-size: 1.18em;
  font-weight: 900;
}

.tusya-red {
  color: #d72a2a;
}

.tusya-overlay {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-weight: 800;
  font-size: clamp(0.95rem, 2vw, 1.7rem);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.1;
  white-space: nowrap;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
  z-index: 2;
}

.tusya-overlay--top { top: 6%; }
.tusya-overlay--bottom { bottom: 6%; }

.tusya-cell a {
  color: inherit;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.tusya-cell a:hover { opacity: 0.7; }

@media (max-width: 720px) {
  .tusya-grid { grid-template-columns: 1fr; }
  .tusya-cell {
    aspect-ratio: auto;
    min-height: 60vh;
    font-size: 2rem;
  }
  .tusya-cell--photo { min-height: 70vh; }
  .tusya-overlay { font-size: 1.9rem; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .card,
  .card--third,
  .card--30,
  .card--40 {
    grid-column: span 1;
    aspect-ratio: 1 / 1;
  }
}

@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }
  .card,
  .card--third,
  .card--30,
  .card--40 {
    grid-column: span 1;
    aspect-ratio: 16 / 10;
  }
  .card--text { aspect-ratio: auto; padding: 1.75rem 1.25rem; }
  .card-label { font-size: 0.7rem; padding: 0.4rem 0.6rem; left: 10px; bottom: 10px; }
  .card-label--right { right: 10px; left: auto; }
  .card-overlay { top: 10px; left: 10px; font-size: 0.7rem; padding: 0.4rem 0.6rem; }
  .card-overlay--right { right: 10px; left: auto; }
}
