/* ==========================================================================
   Kloena Digital — main page
   1. Tokens & resets
   2. Ambient background
   3. Header / footer
   4. Gallery & panels
   5. Responsive
   ========================================================================== */

/* 1. Tokens & resets
   ========================================================================== */
:root {
  --bg: #07080a;
  --surface: #0d1014;
  --ink: #f4f6f8;
  --ink-dim: rgba(244, 246, 248, 0.62);
  --ink-faint: rgba(244, 246, 248, 0.38);
  --line: rgba(255, 255, 255, 0.09);
  --brand-gold: #ffcb00;
  --accent: #ffcb00;
  --accent-2: #ffe680;
  --radius: 24px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --font-display: "Sora", "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-body: "Roboto", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 2. Ambient background
   ========================================================================== */
body::before {
  content: "";
  position: fixed;
  inset: -20% -10%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(46vw 46vw at 10% 6%, rgba(255, 203, 0, 0.13), transparent 62%),
    radial-gradient(42vw 42vw at 90% 12%, rgba(176, 124, 255, 0.14), transparent 62%),
    radial-gradient(54vw 54vw at 50% 106%, rgba(53, 200, 255, 0.12), transparent 62%);
  filter: blur(24px);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* particle field sits above the ambient glows, below the grain and content */
.bg-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.85;
}

/* 3. Header / footer
   ========================================================================== */
.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(16px, 3vw, 40px);
  width: min(1400px, 100%);
  margin-inline: auto;
  padding: clamp(20px, 3.2vw, 38px) clamp(20px, 3vw, 44px) clamp(8px, 1.4vw, 16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  border-radius: 14px;
  transition: transform 0.5s var(--ease), opacity 0.3s ease;
}

.brand:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.brand:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 6px;
}

.brand__logo {
  display: block;
  width: auto;
  height: clamp(45px, 5.4vw, 63px);
  filter: drop-shadow(0 12px 28px rgba(255, 203, 0, 0.16));
}

/* primary navigation */
.site-nav {
  display: flex;
  justify-content: flex-end;
}

.site-nav__list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(6px, 1.1vw, 16px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__list > li {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.1vw, 16px);
}

/* pipe separator between items */
.site-nav__list > li + li::before {
  content: "|";
  font-family: var(--font-display);
  font-size: 11px;
  line-height: 1;
  color: var(--ink-faint);
  opacity: 0.7;
  user-select: none;
}

.site-nav__link {
  position: relative;
  display: inline-block;
  padding: 6px 2px;
  font-family: var(--font-display);
  font-size: clamp(10px, 0.9vw, 12px);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--ink-dim);
  transition: color 0.3s ease;
}

.site-nav__link::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s var(--ease);
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
  color: var(--ink);
}

.site-nav__link:hover::after,
.site-nav__link:focus-visible::after,
.site-nav__link[aria-current="page"]::after {
  transform: scaleX(1);
}

.site-nav__link:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 4px;
  border-radius: 4px;
}

.site-nav__link[aria-current="page"] {
  color: var(--accent-2);
}

/* --- Services dropdown --- */
.site-nav__item--has-menu > .site-nav__link--trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.site-nav__caret {
  display: block;
  flex: none;
  transition: transform 0.35s var(--ease);
}

.site-nav__item--has-menu:hover .site-nav__caret,
.site-nav__item--has-menu.is-open .site-nav__caret {
  transform: rotate(180deg);
}

.site-nav__submenu {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  z-index: 20;
  min-width: 264px;
  margin: 0;
  padding: 8px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(13, 16, 20, 0.94);
  box-shadow: 0 28px 70px -18px rgba(0, 0, 0, 0.85);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -6px);
  transition: opacity 0.24s ease, transform 0.36s var(--ease), visibility 0.24s;
}

/* invisible hover bridge so the menu doesn't close in the gap */
.site-nav__submenu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 14px;
}

.site-nav__item--has-menu:hover .site-nav__submenu,
.site-nav__item--has-menu.is-open .site-nav__submenu {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.site-nav__sublink {
  display: block;
  padding: 10px 14px;
  border-radius: 9px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--ink-dim);
  transition: background 0.25s ease, color 0.25s ease;
}

.site-nav__sublink:hover,
.site-nav__sublink:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.site-nav__sublink:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: -2px;
}

main {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  padding-block: clamp(6px, 1.4vw, 18px);
}

.site-footer {
  position: relative;
  z-index: 2;
  padding: clamp(12px, 1.8vw, 22px) 20px clamp(18px, 2.6vw, 32px);
  text-align: center;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.site-footer p {
  max-width: 56ch;
  margin: 0 auto;
  line-height: 1.6;
  text-wrap: pretty;
}

.site-footer p + p {
  margin-top: 2px;
  color: rgba(244, 246, 248, 0.3);
}

/* 4. Gallery & panels
   ========================================================================== */
.gallery {
  display: flex;
  gap: clamp(6px, 0.8vw, 12px);
  width: min(1400px, 100%);
  height: clamp(440px, 66vh, 660px);
  padding-inline: clamp(12px, 3vw, 44px);
}

.panel {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--surface);
  transition: flex-grow 0.85s var(--ease), border-color 0.6s ease, box-shadow 0.6s var(--ease);
  animation: panel-in 0.9s var(--ease-soft) both;
}

.panel:nth-child(1) { animation-delay: 0.04s; }
.panel:nth-child(2) { animation-delay: 0.11s; }
.panel:nth-child(3) { animation-delay: 0.18s; }
.panel:nth-child(4) { animation-delay: 0.25s; }
.panel:nth-child(5) { animation-delay: 0.32s; }

.panel.is-active {
  flex-grow: 6.2;
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
  box-shadow: 0 44px 90px -52px color-mix(in srgb, var(--accent) 78%, transparent);
}

/* --- background layer --- */
/* --- photo layer --- */
.panel__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background-image: linear-gradient(150deg, var(--accent) 0%, var(--accent-2) 55%, #14161c 100%);
}

.panel__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: grayscale(0.72) brightness(0.58) saturate(0.9);
  transform: scale(1.06);
  transition: filter 0.9s var(--ease), transform 1.4s var(--ease);
}

.panel.is-active .panel__photo {
  filter: grayscale(0) brightness(0.9) saturate(1.06);
  transform: scale(1);
}

.panel:not(.is-active):hover .panel__photo {
  filter: grayscale(0.34) brightness(0.68) saturate(1);
}

/* Photographs with very bright highlights need a touch more depth. */
.panel[data-tone="light"].is-active .panel__photo {
  filter: grayscale(0) brightness(0.7) saturate(1.05);
}

/* --- gradient + grain overlay --- */
.panel__bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(180deg, rgba(7, 8, 10, 0.78) 0%, rgba(7, 8, 10, 0.1) 30%, rgba(7, 8, 10, 0.62) 58%, rgba(7, 8, 10, 0.95) 84%, rgba(7, 8, 10, 1) 100%),
    radial-gradient(85% 65% at 8% 100%, rgba(7, 8, 10, 0.78), transparent 72%),
    linear-gradient(160deg, color-mix(in srgb, var(--accent) 18%, transparent) 0%, transparent 55%);
}

.panel__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* --- collapsed vertical rail --- */
.panel__rail {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(16px, 2.2vw, 26px) 0;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.55s var(--ease);
}

.panel.is-active .panel__rail {
  opacity: 0;
  transform: translateY(14px) scale(0.96);
}

.panel__arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 10px;
  line-height: 1;
  color: var(--accent-2);
  transition: transform 0.45s var(--ease);
}

.panel__arrow::after {
  content: "";
  display: block;
  width: 1px;
  height: 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-2) 70%, transparent), transparent);
}

.panel:not(.is-active):hover .panel__arrow {
  transform: translateY(3px);
}

.panel__rail-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-display);
  font-size: clamp(11px, 0.95vw, 13px);
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(244, 246, 248, 0.82);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.7);
  transition: color 0.4s ease, letter-spacing 0.6s var(--ease);
}

.panel:not(.is-active):hover .panel__rail-text {
  color: #fff;
  letter-spacing: 0.32em;
}

/* --- expanded content --- */
.panel__inner {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(10px, 1.1vw, 16px);
  padding: clamp(20px, 2.4vw, 40px);
  opacity: 0;
  transform: translateY(22px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.7s var(--ease);
}

.panel.is-active .panel__inner {
  opacity: 1;
  transform: none;
  transition-delay: 0.18s;
}

.panel__rule {
  display: block;
  width: 48px;
  height: 1px;
  border-radius: 1px;
  background: var(--accent-2);
  opacity: 0.85;
}

.panel__title {
  margin: 0;
  max-width: 20ch;
  font-family: var(--font-display);
  font-size: clamp(22px, 2.7vw, 46px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.015em;
  text-transform: uppercase;
  color: var(--ink);
  text-wrap: balance;
}

.panel__title em {
  font-style: normal;
  font-weight: 300;
  color: color-mix(in srgb, var(--accent-2) 78%, #ffffff);
}

.panel__desc {
  margin: 0;
  max-width: 46ch;
  font-size: clamp(13px, 0.95vw, 15px);
  font-weight: 300;
  line-height: 1.62;
  color: var(--ink-dim);
}

.panel__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.panel__tags li {
  padding: 6px 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(244, 246, 248, 0.74);
  backdrop-filter: blur(6px);
}

.panel__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.panel__cta svg {
  transition: transform 0.45s var(--ease);
}

.panel:hover .panel__cta svg {
  transform: translateX(5px);
}

/* --- click / focus target covering the whole panel (links to its service page) --- */
.panel__toggle {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.panel__toggle:focus {
  outline: none;
}

.panel__toggle:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: -4px;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(26px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* 5. Responsive
   ========================================================================== */
@media (max-width: 720px) {
  .site-header {
    flex-wrap: wrap;
    gap: 10px 16px;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .site-nav__list {
    gap: 4px 8px;
  }

  .site-nav__list > li {
    gap: 4px 8px;
  }

  .site-nav__link {
    font-size: 10px;
    letter-spacing: 0.12em;
    padding: 4px 2px;
  }

  .site-nav__list > li + li::before {
    font-size: 9px;
  }
}

@media (max-width: 900px) {
  .gallery {
    flex-direction: column;
    width: 100%;
    height: auto;
    gap: 8px;
    padding-inline: clamp(14px, 4vw, 24px);
  }

  .panel {
    flex: 0 0 auto;
    height: 82px;
    border-radius: 18px;
    transition: height 0.7s var(--ease), border-color 0.5s ease, box-shadow 0.5s var(--ease);
  }

  .panel.is-active {
    flex-grow: 0;
    height: 430px;
    height: min(430px, 64svh);
  }

  .panel__rail {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 0 clamp(16px, 4vw, 22px);
    text-align: left;
  }

  .panel.is-active .panel__rail {
    transform: translateX(-14px);
  }

  .panel__arrow::after {
    display: none;
  }

  .panel__arrow {
    font-size: 9px;
  }

  .panel__rail-text {
    writing-mode: horizontal-tb;
    transform: none;
    overflow: hidden;
    max-width: 100%;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-overflow: ellipsis;
  }

  .panel__inner {
    padding: 18px clamp(16px, 4vw, 22px) 22px;
    gap: 10px;
  }

  .panel__title {
    font-size: clamp(21px, 6.4vw, 30px);
    max-width: 100%;
  }

  .panel__desc {
    max-width: 100%;
    font-size: 13px;
  }
}

@media (max-height: 700px) and (min-width: 901px) {
  .gallery {
    height: clamp(380px, 70vh, 520px);
  }
}

/* 6. Floating back-to-top button (all pages except home)
   ========================================================================== */
.to-top {
  position: fixed;
  right: clamp(16px, 3vw, 28px);
  bottom: calc(clamp(16px, 3vw, 28px) + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(13, 16, 20, 0.74);
  color: var(--accent-2);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  pointer-events: none;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease),
              border-color 0.35s var(--ease), color 0.35s var(--ease),
              visibility 0.35s;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.to-top svg {
  transition: transform 0.35s var(--ease);
}

.to-top:hover {
  border-color: var(--accent-2);
  color: var(--accent);
}

.to-top:hover svg {
  transform: translateY(-2px);
}

.to-top:focus {
  outline: none;
}

.to-top:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
