/* ==========================================================================
   BBPlan — landing page
   Inženjerska delatnost i tehničko savetovanje
   ========================================================================== */

/* ---- Reset ------------------------------------------------------------- */

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
}

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

a {
  color: inherit;
}

/* ---- Theme tokens -------------------------------------------------------
   Light is the default palette; the dark palette overrides the same
   custom properties inside the prefers-color-scheme query. Everything
   else in this file only ever reads the variables below, so the whole
   page switches automatically with the OS/browser theme.
   -------------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --bg: #f0f0f0;
  --fg: #1a1a1a;
  --fg-muted: rgba(26, 26, 26, 0.68);
  --fg-faint: rgba(26, 26, 26, 0.42);
  --underline: rgba(26, 26, 26, 0.32);

  --tile-bg: rgba(255, 255, 255, 0.5);
  --tile-shadow: rgba(20, 20, 20, 0.16);
  --tile-filter: saturate(0.94) brightness(0.99) contrast(1.01);

  --focus-ring: #1a1a1a;

  --font-heading: clamp(2.5rem, 1.4rem + 4.2vw, 5rem);
  --font-body: clamp(1rem, 0.86rem + 0.55vw, 1.15rem);
  --font-contact: clamp(1rem, 0.9rem + 0.4vw, 1.1rem);

  --ease-reveal: cubic-bezier(0.16, 0.8, 0.24, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #292929;
    --fg: #fbfbfb;
    --fg-muted: rgba(255, 255, 255, 0.66);
    --fg-faint: rgba(255, 255, 255, 0.4);
    --underline: rgba(255, 255, 255, 0.34);

    --tile-bg: rgba(0, 0, 0, 0.35);
    --tile-shadow: rgba(0, 0, 0, 0.55);
    --tile-filter: saturate(0.9) brightness(0.82) contrast(1.03);

    --focus-ring: #ffffff;
  }
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Google Sans Flex", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-feature-settings: "ss01" 1;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.5s ease, color 0.5s ease;
  overflow-x: hidden;
}

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

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

.hero {
  --content-pad: clamp(1.5rem, 0.6rem + 4.6vw, 5.5rem);
  --content-w: min(620px, 88vw);

  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  overflow: hidden;
  padding-block: clamp(3.5rem, 2.6rem + 4vh, 7rem) 4rem;
}

.hero__content {
  position: relative;
  z-index: 2;
  width: var(--content-w);
  padding-inline-start: var(--content-pad);
  padding-inline-end: clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

.hero h1 {
  margin: 0 0 clamp(1.1rem, 0.8rem + 1.4vw, 1.9rem);
  font-family: "Google Sans Flex", -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-style: normal;
  font-weight: 500;
  font-size: var(--font-heading);
  line-height: 1.25; /* 100px at the 80px reference size */
  /* leading-trim / text-edge are draft CSS properties that pull the
     line box in to the cap-height; unsupported browsers just keep the
     line-height above. https://drafts.csswg.org/css-inline-3/#leading-trim */
  leading-trim: both;
  text-edge: cap;
  font-feature-settings: "tnum" on, "lnum" on, "zero" on, "ss01" on, "ss02" on;
  color: var(--fg);
}

.hero__desc {
  margin: 0 0 clamp(2.25rem, 1.5rem + 3.4vw, 4rem);
  font-size: var(--font-body);
  font-weight: 400;
  line-height: 1.55;
  color: var(--fg-muted);
}

.hero__contact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
}

.hero__contact a {
  position: relative;
  font-size: var(--font-contact);
  font-weight: 400;
  color: var(--fg-muted);
  text-decoration: none;
  padding-bottom: 0.15em;
  transition: color 0.3s ease;
}

.hero__contact a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--underline);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease-reveal);
}

.hero__contact a:hover,
.hero__contact a:focus-visible {
  color: var(--fg);
}

.hero__contact a:hover::after,
.hero__contact a:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ---- Gallery -------------------------------------------------------------
   A single filmstrip of renders sits flush along the bottom of the
   screen, edge to edge, and drifts sideways forever. Small tiles, hard
   edges (no fade/mask), same treatment at every breakpoint.
   -------------------------------------------------------------------- */

.hero__gallery {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(10px, 1.6vh, 22px);
  height: clamp(88px, 8.3vw, 160px);
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.gallery__track {
  display: flex;
  height: 100%;
  gap: clamp(8px, 0.85vw, 16px);
  animation: marquee-x 100s linear infinite;
  animation-play-state: running;
  will-change: transform;
}

.gallery__track img {
  height: 100%;
  width: auto;
  flex: 0 0 auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: clamp(6px, 0.6vw, 10px);
  background: var(--tile-bg);
  box-shadow: 0 10px 24px -16px var(--tile-shadow);
  filter: var(--tile-filter);
  opacity: 0;
  transition: opacity 0.7s ease, filter 0.6s ease;
}

.gallery__track img.is-loaded {
  opacity: 1;
}

@keyframes marquee-x {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* paused by script.js while the browser tab is in the background */
body.is-tab-hidden .gallery__track {
  animation-play-state: paused;
}

/* ---- Reveal animation -----------------------------------------------------
   Content is fully visible by default (see script.js) — the hidden→shown
   transition is only ever applied by JS once it confirms it can run, so
   the page never depends on JavaScript to show its own contact details.
   -------------------------------------------------------------------- */

.reveal {
  transition: opacity 0.9s var(--ease-reveal), transform 0.9s var(--ease-reveal);
}

.hero__gallery.reveal {
  transition: opacity 1.1s var(--ease-reveal);
}

/* ---- Responsive ------------------------------------------------------- */

@media (max-width: 980px) {
  .hero {
    --content-w: min(560px, 90vw);
  }
}

@media (max-width: 840px) {
  .hero {
    align-items: flex-start;
    padding-block: clamp(3rem, 2.4rem + 4vh, 4.5rem) clamp(6rem, 20vh, 9rem);
  }

  .hero__content {
    width: 100%;
    padding-inline: clamp(1.25rem, 1rem + 3vw, 2rem);
  }
}

/* ---- Reduced motion & accessibility ------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .gallery__track {
    animation: none !important;
  }

  .reveal {
    transition-duration: 0.4s !important;
  }

  .hero__contact a::after {
    transition: none;
  }
}
