/* ════════════════════════════════════════════════════
   OldTownKid — Shared UI layer (no framework required)
   Header, scroll reveals, count-ups, dual before/after
   ════════════════════════════════════════════════════ */

/* ── Canonical header (identical on every page) ── */
#otk-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 90;
  padding: 24px 16px;
  font-family: 'Space Grotesk', sans-serif;
}
#otk-header .otk-h-bar {
  max-width: 80rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(0,0,0,0.42);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
#otk-header .otk-h-logo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
}
#otk-header .otk-h-logo img { height: 26px; width: auto; display: block; }
#otk-header nav {
  display: none;
  align-items: center;
  gap: 30px;
}
#otk-header nav a {
  font-size: 14px;
  color: #a1a1a1;
  text-decoration: none;
  transition: color 0.25s;
  position: relative;
}
#otk-header nav a:hover { color: #fff; }
#otk-header nav a.otk-h-active { color: #fff; }
#otk-header nav a.otk-h-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 1px;
  background: #D4AF37;
}
#otk-header .otk-h-cta {
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 20px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.25s;
}
#otk-header .otk-h-cta:hover { background: #e8e8e8; }
#otk-header .otk-h-burger {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
#otk-header .otk-h-burger span {
  display: block;
  height: 2px;
  background: #fff;
  transition: all 0.3s;
}
#otk-header .otk-h-burger span:nth-child(1) { width: 24px; }
#otk-header .otk-h-burger span:nth-child(2) { width: 16px; }
@media (min-width: 900px) {
  #otk-header nav { display: flex; }
  #otk-header .otk-h-burger { display: none; }
  #otk-header { padding: 24px; }
}
@media (max-width: 899px) {
  #otk-header .otk-h-cta { display: none; }
}

/* Mobile overlay */
#otk-menu {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px;
  background: rgba(0,0,0,0.96);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-14px);
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
  font-family: 'Space Grotesk', sans-serif;
}
#otk-menu.otk-open { opacity: 1; visibility: visible; transform: none; }
#otk-menu .otk-m-top { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
#otk-menu .otk-m-close { background: none; border: none; color: #fff; font-size: 34px; font-weight: 300; cursor: pointer; line-height: 1; }
#otk-menu nav { display: flex; flex-direction: column; gap: 26px; margin: auto 0; }
#otk-menu nav a {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 38px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  opacity: 0;
  transform: translateY(16px);
  transition: color 0.25s, opacity 0.45s cubic-bezier(0.22,1,0.36,1), transform 0.45s cubic-bezier(0.22,1,0.36,1);
}
#otk-menu.otk-open nav a { opacity: 1; transform: none; }
#otk-menu nav a:hover, #otk-menu nav a.otk-h-active { color: #fff; }
#otk-menu .otk-m-foot { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 28px; display: flex; flex-direction: column; gap: 14px; }
#otk-menu .otk-m-cta {
  border-radius: 999px; background: #fff; color: #000;
  font-size: 14px; font-weight: 500; text-align: center;
  padding: 12px 24px; text-decoration: none;
}
#otk-menu .otk-m-mail { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255,255,255,0.4); text-align: center; }

/* ── Generic scroll reveal (applied by site-ui.js) ── */
.otk-rvl {
  opacity: 0;
  transform: translateY(30px);
  filter: blur(5px);
  transition:
    opacity 0.75s cubic-bezier(0.22,1,0.36,1),
    transform 0.75s cubic-bezier(0.22,1,0.36,1),
    filter 0.75s cubic-bezier(0.22,1,0.36,1);
  transition-delay: var(--rvl-d, 0s);
  will-change: transform, opacity;
}
.otk-rvl.otk-rvl-in { opacity: 1; transform: none; filter: none; }
@media (prefers-reduced-motion: reduce) {
  .otk-rvl { opacity: 1; transform: none; filter: none; transition: none; }
}

/* ── Dual before/after transformation cards ── */
#transformations { padding: 112px 24px; background: #000; }
#transformations .tr-wrap { max-width: 72rem; margin: 0 auto; }
#transformations .tr-head { text-align: center; max-width: 44rem; margin: 0 auto 56px; }
#transformations .tr-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr;
}
@media (min-width: 820px) { #transformations .tr-grid { grid-template-columns: 1fr 1fr; gap: 32px; } }

.tr-card {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.tr-card img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.tr-before-wrap {
  position: absolute; inset: 0;
  overflow: hidden;
  clip-path: inset(0 calc(100% - var(--split, 50%)) 0 0);
}
.tr-line {
  position: absolute; top: 0; bottom: 0;
  left: var(--split, 50%);
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(180deg, rgba(212,175,55,0), #D4AF37 30%, #D4AF37 70%, rgba(212,175,55,0));
  z-index: 3;
}
.tr-knob {
  position: absolute;
  top: 50%; left: var(--split, 50%);
  transform: translate(-50%, -50%);
  z-index: 4;
  width: 46px; height: 46px;
  border-radius: 999px;
  background: rgba(10,10,10,0.75);
  border: 1px solid rgba(212,175,55,0.7);
  color: #D4AF37;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform 0.2s;
}
.tr-card:hover .tr-knob { transform: translate(-50%, -50%) scale(1.08); }
.tr-tag {
  position: absolute; top: 14px; z-index: 5;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.24em; text-transform: uppercase;
  padding: 7px 13px; border-radius: 999px;
  background: rgba(0,0,0,0.6); color: #fff;
  border: 1px solid rgba(255,255,255,0.14);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.tr-tag-b { left: 14px; }
.tr-tag-a { right: 14px; color: #D4AF37; border-color: rgba(212,175,55,0.5); }
.tr-caption {
  margin-top: 16px;
  text-align: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #8e8e8e;
}
/* idle auto-sweep until first interaction */
@keyframes tr-sweep {
  0%   { --split: 22%; }
  50%  { --split: 78%; }
  100% { --split: 22%; }
}
@property --split { syntax: '<percentage>'; inherits: true; initial-value: 50%; }
.tr-card.tr-auto { animation: tr-sweep 7s ease-in-out infinite; }
.tr-card.tr-auto:nth-child(1) { animation-delay: 0s; }
@media (prefers-reduced-motion: reduce) { .tr-card.tr-auto { animation: none; } }

/* ── Site preloader ── */
#otk-loader {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #050505;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  transition: opacity 0.6s ease, visibility 0.6s;
}
#otk-loader.otk-loaded { opacity: 0; visibility: hidden; pointer-events: none; }
#otk-loader .otk-l-word {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(15px, 3vw, 21px);
  font-weight: 700;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: #fff;
  display: flex;
}
#otk-loader .otk-l-word span {
  opacity: 0;
  transform: translateY(14px);
  filter: blur(5px);
  animation: otk-l-letter 0.55s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes otk-l-letter { to { opacity: 1; transform: none; filter: none; } }
#otk-loader .otk-l-line {
  width: min(180px, 40vw);
  height: 1px;
  background: rgba(255,255,255,0.12);
  position: relative;
  overflow: hidden;
}
#otk-loader .otk-l-line::after {
  content: '';
  position: absolute;
  left: -40%;
  top: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #D4AF37, transparent);
  animation: otk-l-sweep 1.1s ease-in-out infinite;
}
@keyframes otk-l-sweep { to { left: 100%; } }
#otk-loader .otk-l-sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 15px;
  color: rgba(255,255,255,0.4);
  opacity: 0;
  animation: otk-l-letter 0.6s 0.5s forwards;
}
@media (prefers-reduced-motion: reduce) {
  #otk-loader { display: none; }
}

/* ── Luxury mobile menu polish ── */
#otk-menu nav a {
  display: flex;
  align-items: baseline;
  gap: 16px;
  overflow: hidden;
}
#otk-menu nav a .otk-m-num {
  font-family: 'Space Grotesk', sans-serif;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: #D4AF37;
  opacity: 0.85;
}
#otk-menu nav a .otk-m-label {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.6s cubic-bezier(0.22,1,0.36,1);
  transition-delay: inherit;
}
#otk-menu.otk-open nav a .otk-m-label { transform: none; }
#otk-menu nav a .otk-m-label::after {
  content: '';
  display: block;
  height: 1px;
  margin-top: 6px;
  background: linear-gradient(90deg, #D4AF37, transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.22,1,0.36,1);
}
#otk-menu nav a:hover .otk-m-label::after,
#otk-menu nav a.otk-h-active .otk-m-label::after { transform: scaleX(1); }
#otk-menu .otk-m-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  margin-bottom: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-style: normal;
}
#otk-header .otk-h-burger.otk-x span:nth-child(1) { transform: translateY(4px) rotate(45deg); width: 24px; }
#otk-header .otk-h-burger.otk-x span:nth-child(2) { transform: translateY(-4px) rotate(-45deg); width: 24px; }

/* ── Footer social icon bar (injected on every page) ── */
.otk-social {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.otk-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  color: #a1a1a1;
  transition: color 0.3s, border-color 0.3s, transform 0.25s, background 0.3s;
}
.otk-social a:hover {
  color: #D4AF37;
  border-color: rgba(212,175,55,0.65);
  background: rgba(212,175,55,0.06);
  transform: translateY(-3px);
}
.otk-social svg { width: 18px; height: 18px; display: block; }

/* ── Mobile menu: same typeface as the header ── */
#otk-menu nav a {
  font-family: 'Space Grotesk', sans-serif;
  font-style: normal;
}
#otk-menu nav a .otk-m-label {
  font-size: clamp(24px, 6.2vw, 30px);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.15;
}
#otk-menu nav a .otk-m-label::after {
  margin-top: 8px;
}

/* three transformation cards read better as a 3-up row */
@media (min-width: 1050px) {
  #transformations .tr-grid.tr-grid-3 { grid-template-columns: repeat(3, 1fr); gap: 24px; }
}

/* ── Connection status banner ── */
#otk-net-banner {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 130%);
  z-index: 120;
  max-width: calc(100vw - 32px);
  padding: 11px 20px;
  border-radius: 999px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: transform 0.45s cubic-bezier(0.16,1,0.3,1);
  pointer-events: none;
}
#otk-net-banner.otk-net-in { transform: translate(-50%, 0); }
#otk-net-banner.off { background: rgba(212,175,55,0.16); color: #D4AF37; border: 1px solid rgba(212,175,55,0.4); }
#otk-net-banner.ok  { background: rgba(37,211,102,0.16); color: #25D366; border: 1px solid rgba(37,211,102,0.4); }
@media (max-width: 820px) { #otk-net-banner { bottom: 150px; } }
