/*
 * Qaraqoyunlu — shared base styles.
 * Each site's style.css defines the brand tokens below on :root and builds
 * its own components on top. Keep this file identical across the three sites.
 */

:root {
  /* Brand tokens — overridden per site */
  --bg: #f5f3ef;
  --bg-alt: #ebe7e0;
  --surface: #ffffff;
  --ink: #161513;
  --ink-soft: #55524c;
  --line: rgba(22, 21, 19, 0.12);
  --accent: #b4875a;
  --accent-ink: #ffffff;
  --font-display: system-ui, sans-serif;
  --font-body: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Layout */
  --container: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --section: clamp(72px, 11vw, 148px);
  --radius: 14px;
  --radius-lg: 24px;
  --header-h: 76px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur: 0.9s;
}

/* ---------------------------------------------------------------- reset */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(16px, 0.25vw + 15px, 18px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 1000; padding: 10px 16px;
  background: var(--ink); color: var(--bg); border-radius: 8px; transition: top 0.2s;
}
.skip-link:focus { top: 16px; }

/* ------------------------------------------------------------- layout */

.container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: var(--section) 0; position: relative; }

/* ---------------------------------------------------- scroll progress */

.scroll-progress {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 200;
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(0);
  pointer-events: none;
}

/* ------------------------------------------------------------- reveal */

/* No will-change and only 2D transforms here: either one gives every hidden block its own
   compositing layer (translate3d counts as a 3D transform even with z = 0); the browser
   promotes a block by itself for the short reveal transition. */
.js [data-reveal] { opacity: 0; }
.js [data-reveal="up"] { transform: translate(0, 36px); }
.js [data-reveal="down"] { transform: translate(0, -36px); }
.js [data-reveal="left"] { transform: translate(-48px, 0); }
.js [data-reveal="right"] { transform: translate(48px, 0); }
.js [data-reveal="scale"] { transform: scale(0.94); }
.js [data-reveal="clip"] { opacity: 1; clip-path: inset(0 0 100% 0); }
/* The transition lives on the visible state only: core.js adds .js after the first
   frame may already be painted, and a transition on the hidden state would then fade
   every reveal element on the page OUT at once (hundreds of main-thread animations). */
.js [data-reveal].is-visible {
  opacity: 1; transform: none;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), clip-path 1.2s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.js [data-reveal="clip"].is-visible { clip-path: inset(0 0 0 0); }

/* split headings: words rise from behind a mask */
.split-word { display: inline-block; overflow: hidden; vertical-align: top; padding: 0.14em 0.12em 0.3em; margin: -0.14em -0.12em -0.3em; }
.split-done .split-word { overflow: visible; }

/* endless animations pause while their container is off-screen (core.js) */
.is-offscreen, .is-offscreen * { animation-play-state: paused !important; }
.split-inner { display: inline-block; }
.js [data-split] .split-inner {
  transform: translate(0, 105%); /* 2D: no layer per hidden word */
  transition: transform 1s var(--ease-out);
  transition-delay: calc(var(--w, 0) * 45ms + var(--reveal-delay, 0ms));
}
.js [data-split].is-visible .split-inner { transform: none; }

/* language switch cross-fade */
main, .site-footer { transition: opacity 0.18s ease; }
.is-switching-lang main, .is-switching-lang .site-footer { opacity: 0.25; }

/* ------------------------------------------------------------- filter */

[data-cat] { transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out); }
[data-cat].is-hidden { display: none; }

/* ----------------------------------------------------------- lightbox */

.lightbox {
  position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 72px 80px 24px;
  background: rgba(8, 8, 8, 0.9); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity 0.35s var(--ease-out), visibility 0.35s;
}
.lightbox.is-open { opacity: 1; visibility: visible; transition: opacity 0.35s var(--ease-out), visibility 0s; } /* visible at once so focus can move in */
.lightbox__stage { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: min(1200px, 100%); min-width: 0; }
.lightbox__img {
  max-width: 100%; max-height: calc(100vh - 150px); border-radius: var(--radius);
  transform: scale(0.96); transition: transform 0.5s var(--ease-out), opacity 0.3s ease;
}
.lightbox.is-open .lightbox__img { transform: none; }
.lightbox__img.is-loading { opacity: 0; }
.lightbox__cap { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; color: rgba(255, 255, 255, 0.88); font-size: 14px; line-height: 1.4; text-align: center; }
.lightbox__count { color: rgba(255, 255, 255, 0.6); letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.lightbox__count[hidden] { display: none; }
.lightbox__btn {
  position: absolute; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; background: rgba(255, 255, 255, 0.12); transition: background-color 0.3s;
}
.lightbox__btn:hover { background: rgba(255, 255, 255, 0.24); }
.lightbox__btn[hidden] { display: none; }
.lightbox__btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.lightbox__close { top: 16px; right: 16px; }
.lightbox__prev, .lightbox__next { top: 50%; margin-top: -24px; }
.lightbox__prev { left: 16px; }
.lightbox__next { right: 16px; }
@media (max-width: 640px) {
  .lightbox { padding: 72px 12px 96px; }
  .lightbox__img { max-height: calc(100vh - 230px); }
  .lightbox__prev, .lightbox__next { top: auto; bottom: 24px; margin-top: 0; }
  .lightbox__prev { left: calc(50% - 58px); }
  .lightbox__next { right: calc(50% - 58px); }
}
.lightbox-open { overflow: hidden; }

/* ------------------------------------------------------------ marquee */

.marquee { overflow: hidden; display: flex; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee__track { display: flex; flex-shrink: 0; gap: var(--marquee-gap, 48px); padding-right: var(--marquee-gap, 48px); animation: marquee var(--marquee-speed, 40s) linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-100%); } }

/* ------------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0ms !important; }
  .js [data-reveal], .js [data-split] .split-inner { opacity: 1 !important; transform: none !important; clip-path: none !important; }
  .marquee__track { animation: none; }
}
