/* ── Trimline signature loader — 2s ── */

.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #050505;
  transition: opacity 0.42s cubic-bezier(.76, 0, .24, 1), visibility 0.42s;
}

.loader::before,
.loader::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.loader::before {
  opacity: .6;
  background:
    linear-gradient(90deg, transparent 49.92%, rgba(201, 169, 98, .12) 50%, transparent 50.08%),
    linear-gradient(transparent 49.92%, rgba(201, 169, 98, .12) 50%, transparent 50.08%),
    radial-gradient(circle at center, rgba(201, 169, 98, .11), transparent 27%);
  background-size: 80px 80px, 80px 80px, auto;
  -webkit-mask-image: radial-gradient(circle, #000 0 29%, transparent 70%);
  mask-image: radial-gradient(circle, #000 0 29%, transparent 70%);
  animation: loaderGrid 1.5s cubic-bezier(.16, 1, .3, 1) both;
}

.loader::after {
  background: linear-gradient(105deg, transparent 42%, rgba(232, 213, 163, .12) 49%, rgba(232, 213, 163, .28) 50%, rgba(232, 213, 163, .12) 51%, transparent 58%);
  transform: translateX(-130%);
  animation: loaderSweep .62s .54s cubic-bezier(.76, 0, .24, 1) both;
}

.loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loader__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(78vw, 310px);
  padding: 3.5rem 0 1rem;
}

.loader__ring {
  position: absolute;
  top: -1.05rem;
  left: 50%;
  /* vmin-like sizing keeps the orbit inside both narrow and short viewports. */
  width: min(68vw, 48vh, 278px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translateX(-50%) scale(.72) rotate(-76deg);
  opacity: 0;
  background:
    radial-gradient(circle, transparent 61%, rgba(201, 169, 98, .2) 61.3% 61.8%, transparent 62.1%),
    repeating-conic-gradient(from 0deg, rgba(232, 213, 163, .74) 0deg 1deg, transparent 1deg 12deg),
    conic-gradient(transparent 0 18%, var(--gold) 24%, transparent 31% 53%, var(--gold-light) 62%, transparent 69% 100%);
  -webkit-mask: radial-gradient(transparent 0 55%, #000 55.5% 69%, transparent 69.5%);
  mask: radial-gradient(transparent 0 55%, #000 55.5% 69%, transparent 69.5%);
  filter: drop-shadow(0 0 16px rgba(201, 169, 98, .2));
  animation: loaderRingIn .56s .08s cubic-bezier(.16, 1, .3, 1) both, loaderRingTurn 1.08s .55s cubic-bezier(.65, 0, .35, 1) both;
}

.loader__crosshair {
  position: absolute;
  top: 7.4rem;
  left: 50%;
  width: 1px;
  height: 0;
  background: linear-gradient(var(--gold), transparent);
  box-shadow: 0 0 10px var(--gold-glow);
  animation: loaderCrosshair .42s .38s ease-out both;
}

.loader__crosshair::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
  transform: translateX(-50%);
  animation: loaderCrossbar .42s .48s ease-out both;
}

.loader__logo-wrap {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: clamp(108px, 25vw, 146px);
  aspect-ratio: 1;
  opacity: 0;
  transform: scale(.42);
  animation: loaderLogoIn .54s .24s cubic-bezier(.16, 1, .3, 1) both;
}

.loader__logo-wrap::before {
  content: "";
  position: absolute;
  inset: -25%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 169, 98, .3), transparent 65%);
  filter: blur(8px);
  animation: loaderHalo 1.5s ease-out both;
}

.loader__logo-wrap::after {
  content: "";
  position: absolute;
  inset: -5%;
  border-radius: 50%;
  border: 1px solid rgba(232, 213, 163, .7);
  clip-path: inset(0 100% 0 0);
  animation: loaderTrace .36s .63s linear both;
}

.loader__logo {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 23px rgba(201, 169, 98, .55));
}

.loader__particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.loader__particle { position: absolute; width: 3px; aspect-ratio: 1; border-radius: 50%; background: var(--gold-light); box-shadow: 0 0 10px var(--gold); opacity: 0; animation: loaderParticle .8s ease-out both; }
.loader__particle:nth-child(1) { top: 25%; left: 23%; animation-delay: .3s; }
.loader__particle:nth-child(2) { top: 68%; left: 75%; animation-delay: .5s; }
.loader__particle:nth-child(3) { top: 82%; left: 31%; animation-delay: .62s; }
.loader__particle:nth-child(4) { top: 18%; left: 78%; animation-delay: .42s; }
.loader__particle:nth-child(5) { top: 46%; left: 13%; animation-delay: .7s; }
.loader__particle:nth-child(6) { top: 45%; left: 88%; animation-delay: .76s; }

body.is-loading { overflow: hidden; }
body.is-loading .page, body.is-loading .grain, body.is-loading .glow, body.is-loading .line-accent { opacity: 0; }
body:not(.is-loading) .page { animation: pageReveal .58s cubic-bezier(.16, 1, .3, 1) both; }

@keyframes loaderGrid { from { opacity: 0; transform: scale(1.12); } to { opacity: .6; transform: scale(1); } }
@keyframes loaderSweep { to { transform: translateX(130%); } }
@keyframes loaderRingIn { to { opacity: 1; transform: translateX(-50%) scale(1) rotate(-76deg); } }
@keyframes loaderRingTurn { to { transform: translateX(-50%) scale(1) rotate(104deg); } }
@keyframes loaderCrosshair { to { height: 150px; opacity: .7; } }
@keyframes loaderCrossbar { to { width: 150px; } }
@keyframes loaderLogoIn { to { opacity: 1; transform: scale(1); } }
@keyframes loaderHalo { 0% { opacity: 0; transform: scale(.4); } 45% { opacity: 1; } 100% { opacity: .38; transform: scale(1.25); } }
@keyframes loaderTrace { to { clip-path: inset(0); } }
@keyframes loaderParticle { 0% { opacity: 0; transform: scale(0); } 40% { opacity: .9; } 100% { opacity: 0; transform: translateY(-24px) scale(.4); } }
@keyframes pageReveal { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: scale(1); } }

/* Compact touch screens: preserve the composition without crowding the viewport. */
@media (max-width: 480px) {
  .loader::before { background-size: 56px 56px, 56px 56px, auto; }

  .loader__inner {
    width: min(84vw, 68vh, 260px);
    padding-top: 3rem;
  }

  .loader__ring {
    top: 0;
    /* Keep a consistent, close orbit around the scaled mobile logo. */
    width: min(54vw, 38vh, 200px);
  }

  .loader__logo-wrap { width: clamp(90px, 27vw, 118px); }

  .loader__crosshair { top: 6.1rem; }
  .loader__crosshair::after { width: 0; }

  @keyframes loaderCrosshair { to { height: 122px; opacity: .7; } }
  @keyframes loaderCrossbar { to { width: 122px; } }
}

/* Landscape phones and short devices retain breathing room above and below the mark. */
@media (max-height: 620px) {
  .loader__inner { transform: scale(.84); }
}

@media (max-width: 767px) and (orientation: landscape) {
  .loader__inner { transform: scale(.72); }
}

@media (prefers-reduced-motion: reduce) {
  .loader *, .loader::before, .loader::after, body:not(.is-loading) .page { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
