/* Shared mechanics for a Danit example site: reset, accessibility, the hero video stack,
   demo badge, sticky mobile action, lightbox and motion gates. Everything visual about a brand
   (type, colour, layout) lives in style.css. Expects these custom properties on :root:
   --bg, --fg, --accent, --accent-ink, --gutter. */

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote, fieldset { margin: 0; }
ul, ol { padding: 0; list-style: none; }
fieldset { padding: 0; border: 0; min-width: 0; }
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
address { font-style: normal; }
[hidden] { display: none !important; }

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

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -5rem;
  z-index: 60;
  padding: .6rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
}
.skip-link:focus { top: 1rem; }

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap, 74rem));
  margin-inline: auto;
}

/* ---------- Hero video stack ---------- */

.hero { position: relative; isolation: isolate; overflow: hidden; }

.hero__media { position: absolute; inset: 0; z-index: -1; overflow: hidden; background: var(--hero-bg, #000); }

.hero__poster,
.hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--hero-focus, 50% 50%);
}

.hero__video { opacity: 0; transition: opacity .8s; }
.hero__video.is-playing { opacity: 1; }

.hero__shade { position: absolute; inset: 0; }

/* A flex or grid child must be allowed to shrink, or long lines push it past a phone's edge. */
.hero__content { min-width: 0; max-width: 100%; }

.video-toggle {
  position: absolute;
  right: var(--gutter);
  bottom: clamp(1.25rem, 4vh, 2.5rem);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .9rem;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: var(--toggle-radius, 999px);
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-size: .9rem;
  cursor: pointer;
}
.video-toggle:hover { border-color: #fff; background: rgba(0, 0, 0, .8); }

.video-toggle__icon { width: .7rem; height: .8rem; border-inline: .22rem solid currentColor; }
.video-toggle[aria-pressed="true"] .video-toggle__icon {
  width: 0;
  height: 0;
  border-block: .4rem solid transparent;
  border-inline: .7rem solid currentColor;
  border-inline-end-width: 0;
}

/* Phones: a 44px round icon button in the hero's bottom-right corner. */
@media (max-width: 46rem) {
  .video-toggle {
    right: 1rem;
    bottom: 1rem;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border-radius: 50%;
  }
  .video-toggle__label {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* ---------- Demo badge: footer link on phones, pinned in the left gutter on wider screens ---------- */

.demo-badge {
  display: inline-block;
  padding: .4rem .8rem;
  border: 1px solid var(--badge-line, rgba(255, 255, 255, .35));
  border-radius: 999px;
  background: var(--badge-bg, rgba(0, 0, 0, .9));
  color: var(--badge-fg, #fff);
  font-size: .8rem;
  text-decoration: none;
}
.demo-badge:hover { border-color: var(--accent); }

@media (min-width: 46.01rem) {
  .demo-badge {
    position: fixed;
    left: max(.3rem, calc(var(--gutter) / 2 - .85rem));
    bottom: .9rem;
    z-index: 30;
    padding: .7rem .3rem;
    font-size: .72rem;
    line-height: 1;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
  }
}

/* ---------- Sticky mobile action ---------- */

.mobile-cta { display: none; }

@media (max-width: 46rem) {
  .mobile-cta {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 25;
    display: block;
    padding: 1rem;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transform: translateY(100%);
    visibility: hidden;
    transition: transform .35s cubic-bezier(.2, .7, .2, 1), visibility 0s .35s;
  }
  .mobile-cta.is-visible { transform: none; visibility: visible; transition-delay: 0s; }
}

/* ---------- Photo slots: where a client's own pictures go ---------- */

.slot {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  overflow: hidden;
  color: inherit;
  text-align: left;
}
button.slot { cursor: zoom-in; }

.slot::after {
  content: "";
  position: absolute;
  inset: .6rem;
  border: 1px dashed var(--slot-line, rgba(255, 255, 255, .45));
  pointer-events: none;
}

.slot__label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: .35rem .8rem;
  border-radius: 999px;
  background: var(--slot-pill, rgba(0, 0, 0, .78));
  color: var(--slot-pill-fg, #fff);
  font-size: .85rem;
  white-space: nowrap;
}

/* ---------- Lightbox ---------- */

.lightbox {
  width: min(92vw, 62rem);
  max-height: 92vh;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  overflow: visible;
}
.lightbox::backdrop { background: rgba(0, 0, 0, .9); }
.lightbox__image { aspect-ratio: 3 / 2; max-height: 70vh; }
.lightbox__caption { margin-top: 1rem; font-size: 1.25rem; }
.lightbox__controls { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1rem; }
.lightbox__position { font-variant-numeric: tabular-nums; opacity: .8; }
.lightbox__close { margin-left: auto; }
.lightbox__button {
  padding: .55rem 1rem;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: var(--toggle-radius, 999px);
  background: #000;
  color: #fff;
  cursor: pointer;
}
.lightbox__button:hover { border-color: var(--accent); }

/* ---------- Motion, only with JS running and no reduced-motion request ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero__video { animation: drift 20s ease-in-out infinite alternate; }

  html.js .reveal {
    opacity: 0;
    transform: translateY(1.5rem);
    transition: opacity .8s cubic-bezier(.2, .7, .2, 1), transform .8s cubic-bezier(.2, .7, .2, 1);
    transition-delay: calc(var(--i, 0) * 90ms);
  }
  html.js .reveal.is-in { opacity: 1; transform: none; }

  html.js [data-split] .word { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .14em; margin-bottom: -.14em; }
  html.js [data-split] .word__inner {
    display: inline-block;
    transform: translateY(115%);
    animation: word-up .9s cubic-bezier(.2, .7, .2, 1) forwards;
    animation-delay: calc(250ms + var(--i) * 110ms);
  }
  html.js .hero__after { opacity: 0; animation: fade-in .9s ease forwards 900ms; }

  .lightbox[open] { animation: lightbox-in .3s cubic-bezier(.2, .7, .2, 1); }
  .is-entering { animation: item-in .4s cubic-bezier(.2, .7, .2, 1) both; }
}

@keyframes drift { from { transform: scale(1); } to { transform: scale(1.06); } }
@keyframes word-up { to { transform: none; } }
@keyframes fade-in { to { opacity: 1; } }
@keyframes lightbox-in { from { opacity: 0; transform: scale(.97); } }
@keyframes item-in { from { opacity: 0; transform: translateY(.5rem); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__video { display: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
