/* =========================================================
   ALULA COMMUNICATIONS
   Decoration and illumination system
   ========================================================= */


/* =========================================================
   GLOBAL LAYERS
   ========================================================= */

body {
  position: relative;
  isolation: isolate;
}


/*
   Keep the shared decoration behind the site's content,
   while allowing it to remain visible through the parchment.
*/

.alula-decoration {
  position: fixed;
  inset: 0;

  z-index: 0;

  overflow: hidden;

  pointer-events: none;
}


/*
   Actual site content remains above the drawing.
*/

header,
main,
footer {
  position: relative;
  z-index: 2;
}


/* =========================================================
   GEOMETRIC DRAWINGS
   ========================================================= */

.alula-lines {
  position: absolute;

  top: 50%;

  width:
    min(46vw, 680px);

  height: auto;

  overflow: visible;

  pointer-events: none;

  transform:
    translateY(-50%);
}


/*
   The drawing deliberately continues beyond the viewport.
   We should feel that we're seeing only part of a larger
   system rather than two illustrations placed on a page.
*/

.alula-lines--left {
  left: -5rem;
}


.alula-lines--right {
  right: -5rem;
}


/* =========================================================
   DORMANT INK
   ========================================================= */

.alula-lines-dormant path {
  fill: none;

  stroke:
    rgba(73, 52, 35, 0.34);

  stroke-width: 1.25;

  stroke-linecap: round;
  stroke-linejoin: round;

  vector-effect:
    non-scaling-stroke;

  transition:
    stroke 650ms ease,
    opacity 650ms ease,
    filter 650ms ease;
}


.alula-lines-dormant circle {
  fill:
    rgba(251, 245, 232, 0.94);

  stroke:
    rgba(159, 122, 50, 0.58);

  stroke-width: 1.25;

  vector-effect:
    non-scaling-stroke;

  transition:
    fill 500ms ease,
    stroke 500ms ease,
    filter 500ms ease,
    transform 500ms ease;
}


/*
   Tiny variation stops the nodes looking mechanically
   stamped onto the parchment.
*/

.alula-lines-dormant circle:nth-of-type(3n + 1) {
  fill:
    rgba(215, 185, 104, 0.20);
}


.alula-lines-dormant circle:nth-of-type(3n + 2) {
  stroke:
    rgba(112, 82, 45, 0.46);
}


/* =========================================================
   LIVE LIGHT LAYER
   ========================================================= */

.alula-lines-light path {
  fill: none;

  stroke:
    var(--cyan);

  stroke-width: 1.8;

  stroke-linecap: round;
  stroke-linejoin: round;

  vector-effect:
    non-scaling-stroke;

  /*
     Every path in the ERB has pathLength="1",
     so these values work regardless of its real length.
  */

  stroke-dasharray: 1;
  stroke-dashoffset: 1;

  opacity: 0;

  filter:
    drop-shadow(
      0 0 3px
      rgba(50, 236, 255, 0.95)
    )
    drop-shadow(
      0 0 9px
      rgba(50, 236, 255, 0.38)
    );

  transition:
    stroke-dashoffset
      1.55s
      cubic-bezier(0.22, 1, 0.36, 1),

    opacity
      180ms
      ease;
}


/*
   Different branches wake at slightly different moments,
   producing dissemination rather than one simultaneous flash.
*/

.alula-lines-light path:nth-child(2) {
  transition-delay: 80ms;
}

.alula-lines-light path:nth-child(3) {
  transition-delay: 150ms;
}

.alula-lines-light path:nth-child(4) {
  transition-delay: 220ms;
}

.alula-lines-light path:nth-child(5) {
  transition-delay: 290ms;
}

.alula-lines-light path:nth-child(6) {
  transition-delay: 360ms;
}

.alula-lines-light path:nth-child(7) {
  transition-delay: 430ms;
}

.alula-lines-light path:nth-child(8) {
  transition-delay: 500ms;
}

.alula-lines-light path:nth-child(9) {
  transition-delay: 570ms;
}

.alula-lines-light path:nth-child(10) {
  transition-delay: 640ms;
}

.alula-lines-light path:nth-child(11) {
  transition-delay: 710ms;
}


/* =========================================================
   REACTIVE LIGHT SOURCES
   ========================================================= */

.alula-glow {
  position: absolute;

  width: 24rem;
  aspect-ratio: 1;

  border-radius: 50%;

  opacity: 0;

  filter:
    blur(95px);

  pointer-events: none;

  transition:
    opacity 750ms ease,
    transform 1000ms var(--ease-alula);
}


.alula-glow--cyan {
  left: 18%;
  top: 35%;

  background:
    var(--cyan);
}


.alula-glow--magenta {
  right: 18%;
  top: 40%;

  background:
    var(--magenta);
}


/*
   Nothing glows by default.

   This is important: the dormant page should read as
   parchment and ink, not as neon decoration.
*/

body.light-active
.alula-glow--cyan {
  opacity: 0.07;
}


body.light-active
.alula-glow--magenta {
  opacity: 0.045;
}


/* =========================================================
   AWAKENED NETWORK
   ========================================================= */

/*
   Later our touch / ink interaction only needs to add
   network-awake to the body.

   The same SVG then becomes the illuminated version.
*/

body.network-awake
.alula-lines-light path {
  opacity: 0.95;

  stroke-dashoffset: 0;
}


body.network-awake
.alula-lines-dormant path {
  stroke:
    rgba(50, 236, 255, 0.30);

  filter:
    drop-shadow(
      0 0 3px
      rgba(50, 236, 255, 0.22)
    );
}


body.network-awake
.alula-lines-dormant circle {
  fill:
    rgba(50, 236, 255, 0.13);

  stroke:
    rgba(50, 236, 255, 0.82);

  filter:
    drop-shadow(
      0 0 5px
      rgba(50, 236, 255, 0.58)
    )
    drop-shadow(
      0 0 12px
      rgba(50, 236, 255, 0.22)
    );
}


body.network-awake
.alula-glow--cyan {
  opacity: 0.11;

  transform:
    scale(1.18);
}


body.network-awake
.alula-glow--magenta {
  opacity: 0.07;

  transform:
    scale(1.1);
}


/* =========================================================
   HOME HERO
   ========================================================= */

.alula-hero {
  position: relative;

  min-height:
    calc(100svh - 5rem);

  padding:
    clamp(2rem, 4vw, 4rem)
    var(--page-padding)
    clamp(3rem, 6vw, 5rem);

  display: flex;
  flex-direction: column;
  justify-content: center;

  overflow: hidden;
}


/*
   Very faint mounted-scroll edges.
*/

.alula-hero::before {
  content: "";

  position: absolute;

  inset:
    1.2rem
    clamp(0.75rem, 1.5vw, 1.4rem);

  pointer-events: none;

  border-left:
    1px solid
    rgba(73, 52, 35, 0.055);

  border-right:
    1px solid
    rgba(73, 52, 35, 0.055);
}


/*
   Candlelight stays extremely soft.
*/

.alula-hero::after {
  content: "";

  position: absolute;
  inset: 0;

  z-index: -1;

  pointer-events: none;

  background:
    radial-gradient(
      circle at 50% 18%,
      rgba(255, 244, 207, 0.18),
      transparent 26rem
    );
}


/* =========================================================
   HERO CONTENT
   ========================================================= */

.hero-content {
  position: relative;
  z-index: 3;

  width:
    min(100%, 920px);

  margin-inline: auto;

  padding-block:
    clamp(5rem, 11vh, 9rem);

  text-align: center;
}


.hero-eyebrow {
  margin:
    0
    0
    1.5rem;

  color:
    var(--gold);

  font-family:
    var(--body-font);

  font-size: 0.72rem;
  font-weight: 600;

  letter-spacing: 0.26em;

  text-transform: uppercase;
}


.hero-content h1 {
  max-width: 11ch;

  margin:
    0
    auto;

  color:
    var(--ink);

  font-family:
    var(--display-font);

  font-size:
    clamp(4.2rem, 10vw, 8.8rem);

  font-weight: 400;
  font-style: italic;

  letter-spacing: -0.05em;
  line-height: 0.88;

  text-wrap: balance;
}


.hero-content h1::first-letter {
  color:
    var(--gold);

  text-shadow:
    0 0 1.2rem
    rgba(159, 122, 50, 0.12);
}


.hero-statement {
  max-width: 40rem;

  margin:
    2rem
    auto
    2.6rem;

  color:
    var(--ink-soft);

  font-family:
    var(--display-font);

  font-size:
    clamp(1.08rem, 2vw, 1.35rem);

  line-height: 1.55;
}


/* =========================================================
   HERO LINK
   ========================================================= */

.hero-button {
  position: relative;

  display: inline-flex;
  align-items: center;

  gap: 0.75rem;

  padding:
    0.7rem
    0;

  color:
    var(--ink);

  font-family:
    var(--body-font);

  font-size: 0.76rem;
  font-weight: 600;

  letter-spacing: 0.12em;

  text-decoration: none;
  text-transform: uppercase;
}


.hero-button::after {
  content: "";

  position: absolute;

  left: 0;
  right: 0;
  bottom: 0;

  height: 1px;

  background:
    linear-gradient(
      90deg,
      var(--gold),
      var(--gold-light)
    );

  transition:
    background 300ms ease,
    box-shadow 300ms ease,
    transform 300ms var(--ease-alula);
}


.hero-button:hover::after,
.hero-button:focus-visible::after {
  background:
    linear-gradient(
      90deg,
      var(--cyan),
      var(--magenta)
    );

  box-shadow:
    0 0 0.55rem
      rgba(50, 236, 255, 0.28),

    0 0 0.85rem
      rgba(255, 59, 212, 0.16);

  transform:
    scaleX(0.78);
}


/* =========================================================
   HERO SIGNATURE
   ========================================================= */

.hero-signature {
  position: relative;
  z-index: 3;

  width:
    min(100%, var(--page-width));

  margin:
    auto
    auto
    0;

  color:
    rgba(91, 75, 64, 0.62);

  font-family:
    var(--display-font);

  font-size: 0.95rem;
  font-style: italic;

  text-align: right;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 900px) {

  .alula-lines {
    width: 55vw;
  }


  .alula-lines--left {
    left: -14rem;
  }


  .alula-lines--right {
    right: -14rem;
  }
}


@media (max-width: 760px) {

  .alula-hero {
    min-height:
      calc(100svh - 4rem);

    padding:
      1.5rem
      var(--page-padding)
      2rem;
  }


  .hero-content {
    padding-block:
      clamp(4rem, 10vh, 6rem);
  }


  .hero-content h1 {
    font-size:
      clamp(3.8rem, 18vw, 6.5rem);
  }


  /*
     The drawing remains on mobile but retreats towards
     the edges so it doesn't fight with the text.
  */

  .alula-lines {
    width: 82vw;

    opacity: 0.74;
  }


  .alula-lines--left {
    left: -58vw;
  }


  .alula-lines--right {
    right: -58vw;
  }


  .hero-signature {
    text-align: left;
  }
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

  .alula-lines-light path,
  .alula-lines-dormant path,
  .alula-lines-dormant circle,
  .alula-glow {
    transition: none;
  }
}