/* ══════════════════════════════════════════════════════════════════════
   PHAROS BRAND LAYER — lighthouse beam, shebeke backdrop, scroll motion.
   Everything motion-related is gated behind html.ph-motion (set by
   brand-motion.js), so the site stays fully visible without JS.
   ══════════════════════════════════════════════════════════════════════ */

:root {
  --ph-ease: cubic-bezier(.16, 1, .3, 1);
  --ph-beam: 255, 226, 168;
  --ph-orn: rgba(200, 150, 62, .20);
  --ph-glow-a: rgba(228, 184, 102, .16);
  --ph-glow-b: rgba(13, 85, 96, .12);
}
:root[data-theme="dark"] {
  --ph-orn: rgba(255, 217, 138, .13);
  --ph-glow-a: rgba(228, 184, 102, .10);
  --ph-glow-b: rgba(26, 120, 133, .16);
}

/* ── 1. Fixed backdrop: soft light + two shebeke rosettes ──────────── */
.ph-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(60vmax 44vmax at 92% 8%, var(--ph-glow-a), transparent 70%),
    radial-gradient(54vmax 40vmax at 4% 96%, var(--ph-glow-b), transparent 70%);
}
.ph-rose {
  position: absolute;
  width: 62vmax;
  height: 62vmax;
  color: var(--ph-orn);
  will-change: transform;
}
.ph-rose-a { top: -22vmax; right: -20vmax; }
.ph-rose-b { bottom: -26vmax; left: -22vmax; width: 70vmax; height: 70vmax; }
.ph-rose * { fill: none; stroke: currentColor; stroke-width: .5; vector-effect: non-scaling-stroke; }

/* ── 2. Scroll route line (top of viewport) ────────────────────────── */
.ph-route {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 60;
  pointer-events: none;
}
.ph-route i {
  display: block;
  height: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, #7a1f2b, #c8963e 45%, #ffe9b8);
  box-shadow: 0 0 12px rgba(228, 184, 102, .6);
  will-change: transform;
}

/* ── 3. Hero: lighthouse beam from the Maiden Tower ────────────────── */
.page-home .hero-overlay {
  background:
    radial-gradient(90% 70% at 77% 100%, rgba(228, 184, 102, .16), transparent 60%),
    linear-gradient(180deg, rgba(6, 13, 30, .78) 0%, rgba(13, 45, 74, .46) 48%, rgba(6, 13, 30, .86) 100%);
}
.hero .beam.ph-beam {
  left: 0; top: 0;                       /* positioned from JS (tower tip) */
  width: 130vmax;
  height: 30vmax;
  margin: -15vmax 0 0 0;
  transform-origin: 0 50%;
  transform: rotate(-140deg);            /* resting angle until JS takes over */
  background: linear-gradient(90deg, rgba(var(--ph-beam), .50), rgba(var(--ph-beam), .16) 38%, transparent 82%);
  clip-path: polygon(0 49%, 100% 0, 100% 100%, 0 51%);
  filter: blur(5px);
  mix-blend-mode: screen;
  animation: phBeamBreath 5.5s ease-in-out infinite alternate;
  will-change: transform, opacity;
}
@keyframes phBeamBreath {
  from { opacity: .55; }
  to   { opacity: 1; }
}
.ph-lamp {
  position: absolute;
  width: 14px; height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #fff6dc;
  box-shadow: 0 0 14px 5px rgba(var(--ph-beam), .85), 0 0 60px 22px rgba(var(--ph-beam), .32);
  z-index: 3;
  pointer-events: none;
  animation: phLamp 2.8s ease-in-out infinite alternate;
}
@keyframes phLamp {
  from { transform: scale(.8); opacity: .75; }
  to   { transform: scale(1.15); opacity: 1; }
}

.hero h1 em {
  background: linear-gradient(100deg, #ffe9b8, #e4b866 38%, #fff6dc 52%, #c8963e 78%, #ffe9b8);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: phGoldDrift 8s ease-in-out infinite alternate;
}
@keyframes phGoldDrift {
  from { background-position: 0% 50%; }
  to   { background-position: 100% 50%; }
}

/* ── 4. Surfaces: stats bar, cards, eyebrow marker ─────────────────── */
.sg {
  position: relative;
  border: 1px solid var(--line);
  overflow: hidden;
}
.sg::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold2), var(--pomegranate), var(--gold2), transparent);
  background-size: 200% 100%;
  animation: pharosGoldFlow 9s linear infinite;
}
.st + .st { border-left: 1px solid var(--line); }
@media (max-width: 720px) { .st + .st { border-left: 0; } }

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 10px;
  vertical-align: middle;
  background: currentColor;
  transform: rotate(45deg);
  box-shadow: 0 0 0 3px rgba(200, 150, 62, .18);
}

.card .img img {
  transition: transform 1.4s var(--ph-ease), filter .6s ease;
}
.card:hover .img img {
  transform: scale(1.07);
  filter: saturate(1.08);
}
.card .img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(6, 13, 30, .42));
  pointer-events: none;
}

/* ── 5. Scroll reveals (only when JS + motion are on) ──────────────── */
html.ph-motion .rv-auto:not(.in) {
  opacity: 0;
  transform: translateY(30px) scale(.985);
}
html.ph-motion .rv-auto {
  transition: opacity .8s var(--ph-ease), transform .8s var(--ph-ease),
              border-color .35s ease, box-shadow .35s ease;
}
html.ph-motion .h2::after {
  transform: scaleX(0);
  transition: transform .9s var(--ph-ease) .15s;
}
html.ph-motion .h2.ph-in::after { transform: scaleX(1); }

html.ph-motion .h2,
html.ph-motion .lead {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .8s var(--ph-ease), transform .8s var(--ph-ease);
}
html.ph-motion .lead { transition-delay: .1s; }
html.ph-motion .h2.ph-in,
html.ph-motion .lead.ph-in { opacity: 1; transform: none; }

/* ── 6. Reduced motion / small screens ─────────────────────────────── */
@media (max-width: 720px) {
  .ph-rose { width: 90vmax; height: 90vmax; opacity: .7; }
  .hero .beam.ph-beam { filter: blur(3px); }
}
[data-motion="reduced"] .hero .beam.ph-beam { transform: rotate(-140deg) !important; }
[data-motion="reduced"] .ph-route { display: none; }
@media (prefers-reduced-motion: reduce) {
  .ph-route { display: none; }
}
