/* page.css */
/* Compact hero + small 3D badge that FLOATS and circles in place (subtle 3D tilt). */

body {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
}
main { flex: 1; }

/* Allow disabling the binary canvas for text-heavy pages */
body[data-bg="off"] #matrix { display: none !important; }

/* Hero */
.page-hero {
  padding-top: clamp(72px, 9vw, 120px);
  padding-bottom: clamp(36px, 6vw, 72px);
  position: relative;
  border-bottom: 1px solid var(--edge);
  background:
    radial-gradient(1000px 460px at 10% -14%, rgba(255,138,92,.10), transparent 65%),
    radial-gradient(1000px 460px at 90% 114%, rgba(180,50,20,.12), transparent 65%);
}

.hero-row {
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  align-items: center;
  gap: clamp(18px, 4vw, 46px);
}

.hero-copy { position: relative; z-index: 2; }

.eyebrow {
  color: #ffb39d;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 700;
  margin: 0 0 .4rem;
  opacity: .9;
}
.page-title {
  font-family: "Cinzel", serif;
  font-weight: 900;
  font-size: clamp(30px, 4.4vw, 56px);
  letter-spacing: .05em;
  margin: 0;
  color: #ffd3c6;
  text-shadow: 0 0 22px rgba(255, 150, 120, .18);
}
.page-subtitle {
  margin: .6rem 0 0;
  color: var(--muted);
  min-height: 1.6em;
}

/* ========= 3D Badge (float + circle-in-place) ========= */
.badge3d-wrap {
  justify-self: end;
  align-self: center;
  perspective: 900px;
  pointer-events: none; /* decorative by default */
  position: relative;
  width: 0; height: 0; /* anchors at right edge of column */
}

/* Small circular drift around anchor */
.badge3d-motion {
  --circle-r: 14px;
  --circle-duration: 14s;
  position: relative;
  width: 0; height: 0;
  transform-style: preserve-3d;
  transform-origin: center;
  animation: microCircle var(--circle-duration) linear infinite;
}

/* Vertical bob */
.badge3d-bob {
  --float-amp: 6px;
  --float-duration: 7s;
  animation: floatBob var(--float-duration) ease-in-out infinite;
}

.badge3d {
  --size: 96px;
  --base-ry: -18deg; /* negative faces left, toward title */
  --base-rx: 6deg;
  --yaw-range: 5deg;
  --pitch-range: 2deg;
  --tilt-duration: 10s;
  --op: .65;

  position: absolute;
  left: 0; top: 0;
  width: var(--size);
  height: var(--size);
  opacity: var(--op);
  transform-style: preserve-3d;
  will-change: transform;

  /* base transform lives in keyframes; card styling below */
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid var(--edge);
  overflow: hidden;
  filter: drop-shadow(0 14px 26px rgba(0,0,0,.45));
  border-radius: 14px; /* default square */

  animation: tiltOsc var(--tilt-duration) ease-in-out infinite;
}

/* Shield option */
.badge3d.shape-shield {
  border-radius: 0;
  clip-path: polygon(50% 0%, 100% 26%, 86% 100%, 14% 100%, 0% 26%);
}

/* Inner core (for optional self effects later) */
.badge3d-core {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.badge3d-img {
  position: absolute;
  inset: 12% 12% 12% 12%;
  width: 76%;
  height: 76%;
  margin: auto;
  object-fit: contain;
}
.badge3d.shape-shield .badge3d-img { inset: 12% 12% 18% 12%; }

/* Gloss */
.badge3d-gloss {
  position: absolute;
  inset: -10%;
  background:
    linear-gradient(120deg, rgba(255,255,255,.22), rgba(255,255,255,0) 30%),
    radial-gradient(260px 200px at 20% 0%, rgba(255,255,255,.10), rgba(255,255,255,0) 60%);
  mix-blend-mode: screen;
  transform: translateZ(1px);
  pointer-events: none;
}

/* Shadow “hover” under the badge */
.badge3d::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 60%;
  height: 18px;
  transform: translateX(-50%);
  background: radial-gradient(50% 60% at 50% 50%, rgba(0,0,0,.38), rgba(0,0,0,0) 70%);
  filter: blur(6px);
  opacity: .45;
  animation: shadowPulse var(--float-duration) ease-in-out infinite;
}

/* ===== Keyframes ===== */

/* Approximated circular path around anchor */
@keyframes microCircle {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(var(--circle-r), calc(var(--circle-r) * -0.5)); }
  50%  { transform: translate(0, calc(var(--circle-r) * -1)); }
  75%  { transform: translate(calc(var(--circle-r) * -1), calc(var(--circle-r) * -0.5)); }
  100% { transform: translate(0, 0); }
}

/* Gentle vertical bob */
@keyframes floatBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(calc(var(--float-amp) * -1)); }
}

/* Oscillate tilt so it “looks around” while floating */
@keyframes tiltOsc {
  0%, 100% {
    transform: rotateY(var(--base-ry)) rotateX(var(--base-rx));
  }
  25% {
    transform: rotateY(calc(var(--base-ry) + var(--yaw-range)))
               rotateX(calc(var(--base-rx) - var(--pitch-range)));
  }
  50% {
    transform: rotateY(calc(var(--base-ry) - var(--yaw-range)))
               rotateX(calc(var(--base-rx) + var(--pitch-range)));
  }
  75% {
    transform: rotateY(calc(var(--base-ry) + var(--yaw-range)))
               rotateX(calc(var(--base-rx) - 1deg));
  }
}

/* Shadow sync with bob */
@keyframes shadowPulse {
  0%, 100% { transform: translateX(-50%) scale(1);   opacity: .45; }
  50%      { transform: translateX(-50%) scale(.9);  opacity: .30; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .badge3d-motion,
  .badge3d-bob,
  .badge3d { animation: none !important; }
}

/* Content area baseline spacing (empty by default) */
.content-area { min-height: 30vh; }

/* Nav current state */
.nav a[aria-current="page"] {
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 138, 92, .35);
}
.nav a[aria-current="page"] .braces {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Responsive */
@media (max-width: 980px) {
  .hero-row {
    grid-template-columns: 1fr auto;
    text-align: center;
    gap: 12px;
  }
  .badge3d { --size: 84px; }
  .badge3d-motion { --circle-r: 11px; }
}
@media (max-width: 640px) {
  .hero-row { grid-template-columns: 1fr; }
  .badge3d-wrap { justify-self: center; margin-top: 8px; }
  .badge3d { --size: 76px; --base-ry: -12deg; }
  .badge3d-motion { --circle-r: 10px; }
}
