/* ══════════════════════════════════════════════════════════════════════
   The night skyline, for Tibeb's public pages (Nov 2026)

   The look habeshamarketresearch.com has: the coin, made a place. Its navy
   is the night sky, its champagne is the light (the moon, the lit windows,
   the zigzag under the ground line), and its three stelae stand in ivory in
   a skyline of Aksum stelae.

   Every public page links this file after its own styles. A page's own
   <style> still holds its layout and its tokens; this file adds what the
   pages share: the gold button, rounder controls, a stela's head on a
   panel, the sky (stars, a shooting star, the moon, the skyline) and how
   it all moves. The terminal itself (index.html) does not load it.

   Colour still means something and nothing else: green is for / passed,
   red is against / hurt, ochre is open. Gold with white type is the one
   thing to press.

   Motion: html.anim (set in a page's head, or by night.js, unless the
   visitor asked for reduced motion) lets things play; html.js (night.js)
   lets what is below the first screen rise as it is scrolled to. Without
   either class every element is in its finished state.
   ══════════════════════════════════════════════════════════════════════ */
:root {
  --night:   #0A1733;
  --dusk:    #14306B;
  --gold:    #86662A;
  --gold-hi: #9B7732;
  --on-gold: #FFFFFF;
  --sky-h:   max(220px, 25vw);     /* the skyline's height: its drawing is 1440 by 400 */
  --ease:    cubic-bezier(.2, .8, .2, 1);
}
:focus-visible { outline-color: var(--accent); }

/* ─── What is pressed ─── */
.btn, a.button, button:not([class]), button.btn-quiet, button.btn-danger {
  border-radius: 24px;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
}
.btn { min-height: 46px; padding-left: 22px; padding-right: 22px; }
.btn-primary, a.button:not(.btn-quiet), button:not([class]) {
  background: var(--gold); border-color: var(--gold); color: var(--on-gold);
}
.btn-primary:hover, a.button:not(.btn-quiet):hover, button:not([class]):hover:not(:disabled) {
  background: var(--gold-hi); border-color: var(--gold-hi); color: var(--on-gold);
  transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}
.nav-links .btn.btn-primary, .nav-links .btn.btn-primary:hover { color: var(--on-gold); }
.nav-links .btn { border-radius: 22px; min-height: 44px; }
.brand-tag { white-space: nowrap; }
.btn-quiet, button.btn-quiet { border-color: var(--line-2); }
.btn-quiet:hover, button.btn-quiet:hover:not(:disabled) { border-color: var(--accent); }
.text-link { color: var(--accent); }
.text-link:hover { color: var(--ink); }
.nav-burger { border-color: var(--line-2); border-radius: 12px; }

/* Fields are wells with soft corners. */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], select, textarea {
  border-radius: 12px; border-color: var(--line-2);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-color: var(--accent); }

/* A panel has a stela's head. */
.card, .plan, .apply, .panel-card { border-radius: 30px 30px 10px 10px; }
.code-card, .status, .disabled-notice { border-radius: 12px; }

/* ─── The sky: stars, a shooting star, the moon, the skyline ─── */
.sky {
  position: relative; overflow: hidden; isolation: isolate;
  background: radial-gradient(1100px 720px at 82% 4%, var(--dusk) 0%, var(--night) 62%);
  --p: 0;                      /* how far the sky has been scrolled past, 0 to 1 (night.js) */
}
.sky::before {
  content: ""; position: absolute; inset: 0 0 calc(var(--sky-h) * 0.4) 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(circle at 24px 36px, rgba(246, 238, 220, 0.75) 0 0.8px, transparent 1.4px),
    radial-gradient(circle at 150px 88px, rgba(246, 238, 220, 0.55) 0 0.7px, transparent 1.3px),
    radial-gradient(circle at 96px 190px, rgba(230, 207, 156, 0.7) 0 0.8px, transparent 1.4px),
    radial-gradient(circle at 228px 152px, rgba(246, 238, 220, 0.6) 0 0.7px, transparent 1.3px),
    radial-gradient(circle at 196px 22px, rgba(246, 238, 220, 0.45) 0 0.6px, transparent 1.2px),
    radial-gradient(circle at 48px 250px, rgba(246, 238, 220, 0.5) 0 0.7px, transparent 1.3px);
  background-size: 280px 280px;
  transform: translate3d(0, calc(var(--p) * 50px), 0);
}
/* The stars thin out lower in the sky, so none sits among the words like a stray full stop. */
.sky::before, .stars {
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 300px, rgba(0, 0, 0, 0.18) 620px);
          mask-image: linear-gradient(to bottom, #000 0, #000 300px, rgba(0, 0, 0, 0.18) 620px);
}
.stars {
  position: absolute; inset: -80px 0 calc(var(--sky-h) * 0.5) 0; z-index: -1; pointer-events: none;
  transform: translate3d(0, calc(var(--p) * 90px), 0);
}
.stars-1 {
  background-image:
    radial-gradient(circle at 6% 22%, #F6EEDC 0 1.5px, transparent 2px),
    radial-gradient(circle at 17% 48%, #F6EEDC 0 1px, transparent 1.6px),
    radial-gradient(circle at 29% 15%, #E6CF9C 0 1.6px, transparent 2.2px),
    radial-gradient(circle at 43% 34%, #F6EEDC 0 1px, transparent 1.6px),
    radial-gradient(circle at 56% 17%, #F6EEDC 0 1.4px, transparent 2px),
    radial-gradient(circle at 64% 52%, #E6CF9C 0 1px, transparent 1.6px),
    radial-gradient(circle at 73% 28%, #F6EEDC 0 1px, transparent 1.6px),
    radial-gradient(circle at 91% 44%, #F6EEDC 0 1.4px, transparent 2px),
    radial-gradient(circle at 97% 14%, #F6EEDC 0 1px, transparent 1.6px);
}
.stars-2 {
  transform: translate3d(0, calc(var(--p) * 150px), 0);
  background-image:
    radial-gradient(circle at 10% 66%, #F6EEDC 0 1px, transparent 1.6px),
    radial-gradient(circle at 23% 30%, #F6EEDC 0 1.4px, transparent 2px),
    radial-gradient(circle at 37% 60%, #E6CF9C 0 1px, transparent 1.6px),
    radial-gradient(circle at 50% 76%, #F6EEDC 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 61% 30%, #F6EEDC 0 1px, transparent 1.6px),
    radial-gradient(circle at 78% 70%, #F6EEDC 0 1.4px, transparent 2px),
    radial-gradient(circle at 85% 20%, #E6CF9C 0 1px, transparent 1.6px),
    radial-gradient(circle at 3% 40%, #F6EEDC 0 1px, transparent 1.6px);
}
.shoot {
  position: absolute; top: 96px; left: -190px; z-index: -1; pointer-events: none;
  width: 170px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent));
  opacity: 0;
}
.moon {
  position: absolute; z-index: 0; pointer-events: none;
  width: 220px; aspect-ratio: 1 / 1;
  transform: translate3d(0, calc(var(--p) * 120px), 0);
}
.moon-in { position: absolute; inset: 0; }
.moon-halo {
  position: absolute; inset: -34%; border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 207, 156, 0.42) 0%, rgba(230, 207, 156, 0.12) 42%, rgba(230, 207, 156, 0) 68%);
}
.moon-ring { position: absolute; inset: -9%; border-radius: 50%; border: 2px dotted rgba(230, 207, 156, 0.55); }
.moon img { position: relative; display: block; width: 100%; height: 100%; filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.45)); }

.skyline { position: absolute; left: 0; right: 0; bottom: 0; z-index: 0; height: var(--sky-h); pointer-events: none; }
.skyline svg { display: block; width: 100%; height: 100%; }
.sk-r { transform-box: fill-box; transform-origin: 50% 100%; }
/* The skyline's ground line closes a sky: the page's own rule under it would be a second line. */
.sky + .thread-rule { display: none; }

/* A page that is one small card (sign in, a lost page): the sky is the whole
   window behind it, and the coin above the card is its moon. */
.night-back { position: fixed; inset: 0; z-index: -1; }
.night-coin { filter: drop-shadow(0 0 26px rgba(230, 207, 156, 0.5)); }
/* Words that end up over the skyline sit on a patch of night, and on a short window the skyline dims. */
.night-back ~ * .legal { position: relative; width: fit-content; margin-left: auto; margin-right: auto; padding: 8px 16px; border-radius: 18px; background: rgba(10, 23, 51, 0.86); }
@media (max-height: 760px) { .night-back .skyline { opacity: 0.3; } }

/* ══════════ Motion ══════════ */
@keyframes night-word     { from { opacity: 0; transform: translateY(46px) rotate(3deg); } to { opacity: 1; transform: none; } }
@keyframes night-lift     { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes night-moonrise { from { opacity: 0; transform: translateY(150px); } to { opacity: 1; transform: none; } }
@keyframes night-halo     { from { opacity: 0.45; transform: scale(0.92); } to { opacity: 1; transform: scale(1.06); } }
@keyframes night-turn     { to { transform: rotate(360deg); } }
@keyframes night-glint    { from { opacity: 0.35; } to { opacity: 1; } }
@keyframes night-twinkle  { 0%, 100% { opacity: 0.12; } 50% { opacity: 1; } }
@keyframes night-shoot    { 0% { opacity: 0; transform: translate(0, 0) rotate(18deg); } 3% { opacity: 1; } 13% { opacity: 0; transform: translate(130vw, 42vw) rotate(18deg); } 100% { opacity: 0; transform: translate(130vw, 42vw) rotate(18deg); } }
@keyframes night-glow     { from { filter: drop-shadow(0 0 16px rgba(230, 207, 156, 0.3)); } to { filter: drop-shadow(0 0 34px rgba(230, 207, 156, 0.65)); } }

.anim .w          { display: inline-block; animation: night-word 0.9s var(--ease) both; animation-delay: var(--d, 0s); }
.anim .night-in   { animation: night-lift 0.8s ease-out both; animation-delay: var(--d, 0s); }
.anim .moon-in    { animation: night-moonrise 1.9s var(--ease) 0.25s both; }
.anim .moon-halo  { animation: night-halo 4s ease-in-out infinite alternate; }
.anim .moon-ring  { animation: night-turn 80s linear infinite; }
.anim .stars-1    { animation: night-glint 2.6s ease-in-out infinite alternate; }
.anim .stars-2    { animation: night-glint 4.4s ease-in-out 1s infinite alternate; }
.anim .shoot      { animation: night-shoot 9s linear 2.5s infinite; }
.anim .night-coin { animation: night-glow 3.6s ease-in-out infinite alternate; }

/* The skyline rises when it comes into view; its windows never stop. */
.anim .sk-r { transition: transform 1.3s var(--ease); transition-delay: var(--d, 0s); }
.anim .skyline:not(.in) .sk-r { transform: scaleY(0); }
.anim .sk-t { animation: night-twinkle var(--t, 3.2s) ease-in-out var(--d, 0s) infinite; }
.anim .sk-z { transition: clip-path 2.2s ease-out 0.9s; }
.anim .skyline:not(.in) .sk-z { clip-path: inset(0 100% 0 0); }

/* Below the first screen, things rise as they are scrolled to. */
.anim.js .reveal.in { transition: opacity 0.8s ease-out, transform 0.9s var(--ease); transition-delay: var(--d, 0s); }
.anim.js .reveal:not(.in) { opacity: 0; transform: translateY(36px); }

@media (max-width: 1080px) {
  /* One column: the words run the width of the sky, so the stars stop above them. */
  .sky::before, .stars {
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 220px, transparent 420px);
            mask-image: linear-gradient(to bottom, #000 0, #000 220px, transparent 420px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .stars, .moon, .sky::before { transform: none; }
  .anim .w, .anim .night-in, .anim .moon-in, .anim .moon-halo, .anim .moon-ring, .anim .stars-1, .anim .stars-2, .anim .shoot, .anim .night-coin, .anim .sk-t { animation: none; }
  .btn-primary:hover, a.button:not(.btn-quiet):hover, button:not([class]):hover:not(:disabled) { transform: none; }
}
