/* ============================================================
   components.css - page sections, buttons, shared widgets and
   small utilities used on every page.
   ============================================================ */

/* ----- Sections ----- */

.section {
  padding: 80px 0;
}

/* Light gray variant (services, contacts). The whole site now runs on
   the dark navy, so it is only kept as a semantic alias. */
.section--alt {
  background: var(--dark);
}

/* Dark navy variant (about, best works): white text. */
.section--dark {
  background: var(--dark);
  color: #fff;
}

.section--dark .section__title {
  color: #fff;
}

.section__title {
  color: #fff;
  margin-bottom: 32px;
}

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

/* ----- Buttons -----
   One calm button family: even radius, even padding, a subtle hover.
   The solid accent is reserved for the primary action only. */

.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

/* Solid accent fill: the single loud action on the page. */
.btn--primary {
  background: var(--accent);
  color: var(--dark);
}

.btn--primary:hover {
  background: #d18f2c;
}

/* Outlined white pill: secondary action over the dark hero. */
.btn--ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

/* Disabled buttons (e.g. the edit-mode cancel while submitting). */
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ----- Loading spinner (pure CSS ring) ----- */

.spinner {
  width: 44px;
  height: 44px;
  margin: 40px auto;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  animation: spinner-rotate 0.8s linear infinite;
}

/* Light ring for the dark page hero (work page). */
.spinner--hero {
  margin: 0;
  width: 52px;
  height: 52px;
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
}

@keyframes spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

/* ----- Status messages (loading / empty / error states) ----- */

.status-message {
  text-align: center;
  color: #aab2c0;
  padding: 40px 0;
}

/* ----- Sort tabs (works and reviews pages) ----- */

.sort-control {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.sort-control__btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #cfd4dd;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.sort-control__btn:hover {
  color: #fff;
  border-color: var(--accent);
}

.sort-control__btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--dark);
}

/* ----- Soft fade when a list is re-rendered after a sort change ----- */

.grid-fade {
  animation: grid-fade 0.3s ease-out;
}

@keyframes grid-fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ----- Tooltip (click-to-copy, vote counts, review timestamps) ----- */

/* A small dark pill anchored above an element; the browser keeps a
   single tooltip at a time. Positioning is done in JS. */
.tooltip {
  position: fixed;
  z-index: 300;
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  /* transform centers the tip horizontally above its anchor point */
  transform: translate(-50%, -100%);
  animation: tooltip-in 0.25s ease-out;
}

.tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--surface);
}

.tooltip--out {
  animation: tooltip-out 0.25s ease-in forwards;
}

@keyframes tooltip-in {
  from {
    opacity: 0;
    transform: translate(-50%, -70%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -100%);
  }
}

@keyframes tooltip-out {
  from {
    opacity: 1;
    transform: translate(-50%, -100%);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -130%);
  }
}

/* ----- Lightbox (work page gallery + review attachments) ----- */

/* Work page (work.html) uses a static element toggled with the .open
   class; the reviews page builds the same overlay dynamically. The
   close button and fade-out modifier are only used by the dynamic
   version. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(12, 15, 22, 0.92);
  cursor: zoom-out;
  animation: lightbox-fade 0.2s ease-out;
}

.lightbox.open {
  display: flex;
}

.lightbox img,
.lightbox__img,
.lightbox__video {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 8px;
}

.lightbox__img {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.lightbox__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__media--video {
  flex-direction: column;
  gap: 12px;
}

.lightbox__video {
  object-fit: contain;
  background: #000;
  /* leave room for the controls bar underneath */
  max-height: calc(88vh - 60px);
}

.lightbox__video[hidden],
.lightbox__img[hidden],
.lightbox__controls[hidden],
.lightbox__center[hidden] {
  display: none;
}

/* Big center play/pause button shown over the video on phones and as
   part of the chrome while in fullscreen. */
.lightbox__center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(15, 19, 28, 0.72);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s, color 0.2s;
}

.lightbox__center:hover {
  background: var(--accent);
  color: var(--dark);
}

@media (max-width: 600px) {
  .lightbox__center {
    display: flex;
  }
}

.lightbox:fullscreen .lightbox__center {
  display: flex;
}

/* Fullscreen: the viewer fills the viewport, the video grows and the
   chrome (bar, close, center pause, arrows) fades out on idle. */
.lightbox:fullscreen {
  background: #000;
}

.lightbox:fullscreen .lightbox__media--video {
  width: 100vw;
  height: 100vh;
}

.lightbox:fullscreen .lightbox__video {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
}

.lightbox:fullscreen .lightbox__controls {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: calc(100vw - 32px);
  max-width: 560px;
}

.lightbox:fullscreen .lightbox__controls,
.lightbox:fullscreen .lightbox__close,
.lightbox:fullscreen .lightbox__center,
.lightbox:fullscreen .lightbox__nav {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.25s ease;
}

.lightbox:fullscreen:not(.lightbox--chrome) .lightbox__controls,
.lightbox:fullscreen:not(.lightbox--chrome) .lightbox__close,
.lightbox:fullscreen:not(.lightbox--chrome) .lightbox__center,
.lightbox:fullscreen:not(.lightbox--chrome) .lightbox__nav {
  opacity: 0;
  pointer-events: none;
}

/* Minimal custom player bar (play/pause + scrubber) for the video
   items in the viewer. Kept quiet: thin accents, no native controls. */
.lightbox__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 92vw;
  max-width: 560px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.lightbox__play {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.lightbox__play:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lightbox__seek {
  position: relative;
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.lightbox__seek-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
}

.lightbox__time {
  flex: none;
  font-size: 12px;
  color: #dfe3ea;
  font-variant-numeric: tabular-nums;
  min-width: 88px;
  text-align: right;
}

.lightbox__fs {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.lightbox__fs:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lightbox__video:fullscreen,
.lightbox__video::backdrop {
  background: #000;
}

.lightbox__close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  padding: 14px; /* generous hit area for taps */
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s, transform 0.2s;
}

.lightbox__close:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Prev/next arrows of the gallery viewer: translucent circles at the
   sides (desktop); on phones they are hidden and a swipe flips the
   photos instead. */
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.lightbox__nav:hover {
  background: var(--accent);
  color: var(--dark);
}

.lightbox__nav:active {
  /* Feedback without shrinking: a scale here would move the button
     out from under the finger and retarget the tap's synthesized
     click to the overlay (closing the viewer). */
  background: rgba(255, 255, 255, 0.22);
  color: var(--accent);
}

.lightbox__nav--prev {
  left: 14px;
}

.lightbox__nav--next {
  right: 14px;
}

.lightbox--out {
  animation: lightbox-fade 0.2s ease-in reverse;
}

@keyframes lightbox-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ----- Contact popup (modal on every page) ----- */

/* Full-screen overlay behind a centered dialog; hidden by default,
   toggled with the .is-open class (js/contact-popup.js). */
.contact-popup {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(30, 36, 48, 0.6);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.contact-popup.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Transparent layer over the whole screen: clicking it closes the
   popup (the [data-close] handler in JS listens on it). */
.contact-popup__overlay {
  position: absolute;
  inset: 0;
  cursor: pointer;
}

.contact-popup__dialog {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 28px 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: contact-popup-in 0.22s ease-out;
}

@keyframes contact-popup-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.contact-popup__close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  padding: 6px;
  color: #aab2c0;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
}

.contact-popup__close:hover {
  color: #fff;
  transform: scale(1.1);
}

.contact-popup__title {
  font-size: 20px;
  color: #fff;
  margin-bottom: 6px;
}

.contact-popup__sub {
  font-size: 14px;
  color: #aab2c0;
  margin-bottom: 16px;
}

/* One contact channel: small icon + label on a bordered row. */
.contact-popup__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  text-decoration: none;
  color: #dfe3ea;
  font-size: 15px;
  transition: border-color 0.2s, color 0.2s;
}

.contact-popup__item:hover {
  border-color: var(--accent);
  color: #fff;
}

.contact-popup__item img {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Cancel button: full-width, matches the bordered item rows above. */
.contact-popup__cancel {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: none;
  color: #aab2c0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.contact-popup__cancel:hover {
  color: #fff;
  border-color: var(--accent);
}

/* ----- Footer ----- */

.footer {
  background: var(--dark);
  color: #aab2c0;
  padding: 48px 0 64px; /* generous bottom padding so nothing crowds the edge */
  font-size: 14px;
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.footer__social {
  display: flex;
  gap: 12px;
}

.social {
  display: inline-flex;
  width: 34px;
  height: 34px;
}

.social img {
  width: 100%;
  height: 100%;
  /* icons are white (repainted for the dark theme), so no invert */
  opacity: 0.85;
  transition: opacity 0.2s;
}

.social:hover img {
  opacity: 1;
}

/* ----- Scroll-in animations -----
   Sections and the landing hero fade in when they enter the
   viewport; the about fact cards count up their numbers and reveal
   the labels letter by letter. Both run once and keep their state
   (driven by js/main.js + IntersectionObserver). */

.scroll-fade {
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.scroll-fade--hidden {
  opacity: 0;
  transform: translateY(24px);
}

.fact-letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

/* Whole words must not break between their animated letters. */
.fact-word {
  display: inline-block;
  white-space: nowrap;
}

.about__facts li.is-counting .fact-letter {
  opacity: 1;
  transform: none;
}
