/* ---------------------------------------------------------------------
   The EVIC homepage, dressed.

   Separate from motion.css on purpose. That file is the interaction
   layer for the whole site and has to stay sober. This one is ornament,
   it belongs to one page, and it comes off by deleting the two lines
   that load it from evic_home/show.html.erb.

   Everything here sits behind the content and takes no clicks.
   --------------------------------------------------------------------- */

/* --- Depth -------------------------------------------------------------
   A flat dark page reads as a black rectangle. Three very large, very
   soft pools of light drifting behind everything give it air. They are
   blurred past the point of being a shape, so nothing here competes
   with the type. */
.homepage-shell { position: relative; }
.homepage-shell > header,
.homepage-shell > main,
.homepage-shell > footer { position: relative; z-index: 1; }

.d-aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.d-aurora i {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(90px);
}
.d-aurora i:nth-child(1) {
  width: 58vw; height: 58vw; left: -14vw; top: -16vw;
  background: radial-gradient(circle, rgba(134, 255, 207, 0.16), transparent 68%);
  animation: d-drift-a 44s ease-in-out infinite alternate;
}
.d-aurora i:nth-child(2) {
  width: 46vw; height: 46vw; right: -12vw; top: 8vh;
  background: radial-gradient(circle, rgba(76, 162, 255, 0.14), transparent 68%);
  animation: d-drift-b 56s ease-in-out infinite alternate;
}
.d-aurora i:nth-child(3) {
  width: 64vw; height: 64vw; left: 18vw; bottom: -28vw;
  background: radial-gradient(circle, rgba(134, 255, 207, 0.10), transparent 70%);
  animation: d-drift-c 68s ease-in-out infinite alternate;
}
@keyframes d-drift-a {
  to { transform: translate3d(10vw, 8vh, 0) scale(1.12); }
}
@keyframes d-drift-b {
  to { transform: translate3d(-8vw, 12vh, 0) scale(1.08); }
}
@keyframes d-drift-c {
  to { transform: translate3d(-12vw, -10vh, 0) scale(1.15); }
}

/* --- Grain -------------------------------------------------------------
   Large dark gradients band on ordinary screens. A few percent of noise
   on top hides the banding and, more to the point, makes the surface
   read as a material rather than a fill. */
.d-grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- EVIC along the horizon --------------------------------------------
   The name set enormous and cut off by the bottom of the hero, so only
   the upper half of the letters stands above the edge, the way a
   skyline does. Outlined rather than filled: filled, at this size, it
   would be a wall.

   It sits behind everything in the hero and moves slower than the page
   when scrolling, which is what makes it read as a backdrop instead of
   a graphic that happens to be large. */
.d-word {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 104px;
  z-index: 0;
  margin: 0;
  text-align: center;
  font-size: 15vw;
  line-height: 0.78;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(134, 255, 207, 0.13);
  pointer-events: none;
  user-select: none;
  will-change: transform;
}

/* --- The constellation --------------------------------------------------
   Points are companies, lines join the ones that share a screener. It
   is ornament, but it is also the one sentence the hero panel makes -
   that the same company is reachable from a screener, a filing or a
   written analysis - drawn instead of claimed.

   The whole field drifts as one. Moving each point on its own would
   leave the lines behind, and a mesh whose edges lag looks broken
   rather than alive. */
/* The field belongs to the document, not to the window. Fixed to the
   window it was one arrangement of points that never changed however
   far you scrolled, which is wallpaper. Laid over the whole page it is
   a different set of shapes at every height, and scrolling is what
   reveals them. */
.d-sky {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.26;
}
/* A much smaller drift than before: the page is tall now, and what
   carries the field past the reader is the scrolling. */
.d-sky__field { animation: d-sky 120s ease-in-out infinite alternate; }
@keyframes d-sky {
  to { transform: translate3d(14px, -10px, 0); }
}
/* Drawn in page pixels now, so the widths are plain pixels too. */
.d-sky line { stroke: rgba(134, 255, 207, 0.13); stroke-width: 1; }
.d-sky circle { fill: rgba(134, 255, 207, 0.4); }

/* --- The hero, re-balanced ---------------------------------------------
   Two headings of the same size, side by side, gave the eye nothing to
   start with. The panel on the right keeps its words and loses its
   rank. */
.homepage-shell .hero__copy h1 { max-width: 17ch; }
.homepage-shell .panel--lead h2 {
  font-size: clamp(1.25rem, 1.6vw, 1.6rem);
  line-height: 1.25;
  font-weight: 600;
}

/* The orbit behind that panel was mostly hidden, so the sliver that did
   show read as a clipping bug. It is now larger than the card on
   purpose and turning, which makes it a halo rather than an accident. */
.homepage-shell .hero-orbit__ring {
  animation: d-spin 48s linear infinite;
}
.homepage-shell .hero-orbit__ring--two {
  animation-duration: 72s;
  animation-direction: reverse;
}
@keyframes d-spin {
  to { transform: rotate(360deg); }
}

/* --- Section numbers ----------------------------------------------------
   An old device, but on a dark page set in a serif it does real work:
   it tells the reader how far through they are without a word. */
.d-num {
  display: block;
  margin-bottom: 10px;
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  color: rgba(134, 255, 207, 0.55);
  font-variant-numeric: tabular-nums;
}

/* --- Dividers -----------------------------------------------------------
   A hairline that fades out at both ends with the mark set in the
   middle, so sections are separated by something of EVIC's rather than
   by a hundred pixels of nothing. */
.d-divider {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: var(--page-width, 1240px);
  margin: 0 auto;
  padding: 0 28px;
}
.d-divider::before,
.d-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(134, 255, 207, 0.22), transparent);
}
.d-divider span {
  width: 9px;
  height: 9px;
  border: 1px solid rgba(134, 255, 207, 0.55);
  transform: rotate(45deg);
}

/* --- Rhythm -------------------------------------------------------------
   The gaps between blocks were whatever each section happened to carry,
   so the page read as separate pages stacked. One measure throughout. */
.homepage-shell main > section { padding: 78px 0; }
.homepage-shell main > .hero { padding-top: 68px; padding-bottom: 0; }

/* --- Pictures -----------------------------------------------------------
   The three promotional banners are the weakest thing on the page. A
   very slow drift gives them life while they are on screen; the video
   stills get a lift on hover instead, because six of them breathing at
   once would be a fairground. */
@keyframes d-kenburns {
  from { transform: scale(1); }
  to   { transform: scale(1.07); }
}
.homepage-shell .promo-card img {
  animation: d-kenburns 22s ease-in-out infinite alternate;
}
.homepage-shell .video-card__thumb { overflow: hidden; }
.homepage-shell .video-card__thumb img {
  transition: transform 700ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.homepage-shell .video-card:hover .video-card__thumb img {
  transform: scale(1.05);
}

/* --- The tape -----------------------------------------------------------
   It scrolls, which means it cannot be read. Pointing at it stops it,
   and the ends are feathered so the strip does not end on a cut. */
.homepage-shell .signal-tape:hover .signal-tape__track {
  animation-play-state: paused;
}
.homepage-shell .signal-tape {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

/* --- The thread ---------------------------------------------------------
   How far down the page you are, as one mint hair across the very top. */
.d-thread {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  z-index: 9998;
  background: linear-gradient(90deg, rgba(134, 255, 207, 0.4), #86ffcf);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .d-aurora i,
  .d-sky__field,
  .homepage-shell .hero-orbit__ring,
  .homepage-shell .promo-card img { animation: none !important; }
}

/* --- Arriving in sequence -----------------------------------------------
   Cards come in one after another rather than as a block. The delay is
   set on the element when its section reaches the viewport, so a card
   that is never scrolled to never animates. */
@keyframes d-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.d-stagger { animation: d-in 520ms cubic-bezier(0.22, 0.61, 0.36, 1) both; }
@media (prefers-reduced-motion: reduce) {
  .d-stagger { animation: none !important; }
}

/* --- Wide screens -------------------------------------------------------
   A column of 1240px in the middle of a 2500px monitor leaves six
   hundred pixels of nothing down each side, and nothing is exactly
   what it looks like. Two things for it.

   The column itself grows, but not to the full width: a line of text
   past about ninety characters stops being readable, and the table is
   the only thing here that genuinely wants the room. */
@media (min-width: 1600px) {
  :root { --page-width: 1480px; }
}

/* And the margins are given an edge. Two hairlines at the column's
   boundary, fading out top and bottom, turn the space beside the
   content into a frame instead of a void. Fixed, so they stay as the
   page moves, and drawn with gradients rather than borders so they can
   fade at both ends. */
.d-rails {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: none;
}
.d-rails::before,
.d-rails::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg,
    transparent, rgba(134, 255, 207, 0.14) 18%,
    rgba(134, 255, 207, 0.14) 82%, transparent);
}
.d-rails::before { left: calc(50% - var(--page-width, 1240px) / 2 - 30px); }
.d-rails::after  { left: calc(50% + var(--page-width, 1240px) / 2 + 30px); }

@media (min-width: 1440px) {
  .d-rails { display: block; }
}

/* --- The shape of a screener -------------------------------------------
   Twenty columns of figures do not tell you what a screener did; a line
   does it at a glance. One per row, drawn from that row's own numbers.

   Scaled to its own highest and lowest value rather than to the table,
   so each line shows its own shape. That makes the lines readable and
   not comparable with each other, which is the right trade here: the
   figures beside them are what you compare. */
.spark-col {
  width: 108px;
  padding-left: 14px !important;
  padding-right: 14px !important;
}
.d-spark { display: block; width: 100%; height: 26px; overflow: visible; }
.d-spark polyline {
  fill: none;
  stroke: var(--m-accent, #86ffcf);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0.75;
  stroke-dasharray: var(--len, 0);
  stroke-dashoffset: var(--len, 0);
  animation: d-draw 1100ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.d-spark .d-spark__zero {
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}
@keyframes d-draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .d-spark polyline { animation: none; stroke-dashoffset: 0; }
}
@media (max-width: 900px) {
  .spark-col { display: none; }
}

/* No magnitude rule under the figures in this table. On the overview
   page there are twenty year columns and the rules make a column read
   as a chart; here there are two, so every rule came out nearly full
   width and said nothing except that a number was present. The line
   beside the name already carries the shape. */
.homepage-shell td.color-sign .m-bar { display: none; }

/* --- Three counts -------------------------------------------------------
   Sits tight under the hero rather than as a section of its own: it is a
   caption to the opening, not a block in the page. */
.homepage-shell main > .facts-band { padding: 0 0 54px; }
.facts-band__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 18px 60px;
}
.fact { display: flex; align-items: baseline; gap: 12px; }
.fact__value {
  font-size: clamp(1.9rem, 2.8vw, 2.7rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--m-accent, #86ffcf);
  font-variant-numeric: tabular-nums;
}
.fact__label {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft, #a7b8d4);
}

/* --- The years down the margin ------------------------------------------
   The span the returns cover, 2005 to 2025, set in the empty margin with
   the one you have scrolled to lit.

   It is a progress bar wearing the dates, not a map of the page: the
   sections below are not years and do not pretend to be. What it does
   say is true and is the argument EVIC makes - that this is measured in
   decades - and it gives the margin something to be.

   Only where there is margin to spare. */
.d-years {
  position: fixed;
  top: 50%;
  z-index: 1;
  display: none;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  line-height: 1.95;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.d-years b {
  display: block;
  font-weight: 400;
  opacity: 0.4;
  color: rgba(167, 184, 212, 0.75);
  transition: color 260ms ease, opacity 260ms ease, transform 260ms ease;
}
.d-years b.is-now {
  opacity: 1;
  color: var(--m-accent, #86ffcf);
  transform: translateX(-4px);
}
@media (min-width: 1440px) {
  .d-years { display: block; left: calc(50% - var(--page-width, 1240px) / 2 - 92px); }
}

/* --- Corner brackets ----------------------------------------------------
   Two marks on opposite corners rather than four: four closes the panel
   into a frame, two suggest it. Borrowed from a trading screen, which is
   where this page's readers spend their day. */
.homepage-shell .panel { position: relative; }
.homepage-shell .panel::before,
.homepage-shell .panel::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border: 1px solid rgba(134, 255, 207, 0.4);
  pointer-events: none;
}
.homepage-shell .panel::before {
  top: -1px; left: -1px;
  border-right: 0; border-bottom: 0;
  border-top-left-radius: 4px;
}
.homepage-shell .panel::after {
  bottom: -1px; right: -1px;
  border-left: 0; border-top: 0;
  border-bottom-right-radius: 4px;
}

/* --- Three doors --------------------------------------------------------
   The panel beside the headline says that the same company is reachable
   from a screener, from a filing and from a written analysis. This draws
   it: three ways in, one company, and the lines are the point.

   Built under that paragraph rather than replacing it. The sentence is
   what a reader without the script gets, and it is the better of the two
   on its own. */
.d-doors {
  display: block;
  width: 100%;
  max-width: 320px;
  margin-top: 20px;
  overflow: visible;
}
.d-doors text {
  fill: rgba(167, 184, 212, 0.8);
  font-size: 8.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.d-doors .d-doors__to {
  fill: #ecf3ff;
  font-size: 10px;
  letter-spacing: 0.4px;
  text-transform: none;
}
.d-doors circle { fill: var(--m-accent, #86ffcf); }
.d-doors path,
.d-doors rect {
  fill: none;
  stroke: var(--m-accent, #86ffcf);
  stroke-width: 1;
  opacity: 0.55;
  stroke-dasharray: var(--len, 300);
  stroke-dashoffset: var(--len, 300);
  animation: d-draw 900ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
.d-doors rect { opacity: 0.4; }
.d-doors circle,
.d-doors text {
  opacity: 0;
  animation: d-doors-in 500ms ease forwards;
}
@keyframes d-doors-in { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .d-doors path, .d-doors rect { animation: none; stroke-dashoffset: 0; }
  .d-doors circle, .d-doors text { animation: none; opacity: 1; }
}

/* --- The headline, lit --------------------------------------------------
   A soft band of light crossing the letters, always, rather than an
   entrance that happens once and is gone before most readers arrive.

   Painted as a gradient on the heading and clipped to the glyphs, which
   is why the text colour has to go transparent. Behind @supports: where
   the clip is not understood the rule is skipped entirely and the
   headline keeps its own colour, instead of becoming invisible.

   Nine seconds and mostly plain white: at this size anything faster or
   more coloured stops being light on a surface and becomes an effect. */
/* The sheen is switched off. A band of light crossing near-white
   letters on a dark ground is a deliberately quiet effect, and quiet
   was not what was wanted: measured on the page it ran exactly as
   written and still read as nothing happening.

   What replaces it is below. The letters themselves carry the wave,
   which cannot be missed.

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .homepage-shell .hero__copy h1 {
    /* Measured on the page: the first attempt ran correctly and could
       not be seen. The band was six percent of an image almost three
       times the width of the heading, in a colour a shade off the one
       around it - so a few letters brightened very slightly, one at a
       time. It is wider now, brighter at the peak, and the ground it
       crosses is a little dimmer, which is what makes a sheen read as
       light moving rather than as text changing colour. * /
    background-image: linear-gradient(100deg,
      #c9d8ef 0%, #c9d8ef 30%,
      #9effd2 42%, #ffffff 50%, #9effd2 58%,
      #c9d8ef 70%, #c9d8ef 100%);
    background-size: 200% 100%;
    /* Repeated, not no-repeat. A gradient wider than its box and moved
       by a percentage can end up entirely outside it, and with the
       text colour already transparent there is then nothing to paint
       the letters with - the headline simply disappears. Repeating
       guarantees the box is always covered, and the two ends of the
       gradient are the same colour so the join cannot be seen. * /
    background-repeat: repeat-x;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    /* The heading already had an entrance animation of its own, one
       that starts at zero opacity and fades in. Naming a new
       animation here replaced it, and the opacity stayed where
       that first keyframe had left it: the headline was painted
       correctly and completely transparent. * /
    opacity: 1;
    animation: d-sheen 5s linear infinite;
  }
  .homepage-shell .hero__copy h1 * {
    color: inherit;
    -webkit-text-fill-color: inherit;
  }
} */
@keyframes d-sheen {
  from { background-position: 100% 0; }
  to   { background-position: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .homepage-shell .hero__copy h1 { animation: none; background-position: 50% 0; }
}

/* --- The wave -----------------------------------------------------------
   Each letter brightens, lifts a little and takes a mint glow, one
   after another, so a crest travels along the line and never stops.

   Every letter runs the same animation; what makes it a wave is that
   each starts a beat later than the one before. The delays are
   negative, so at the moment the page paints the crest is already
   somewhere in the middle of the sentence rather than gathering at the
   first letter.

   Letters are boxes here, so each word is a box of its own as well -
   otherwise a word could break across two lines in the middle. */
.d-ltr-word { display: inline-block; white-space: nowrap; }
.d-ltr {
  display: inline-block;
  color: #b9cce6;
  animation: d-wave 3.2s ease-in-out infinite;
  will-change: transform;
}
@keyframes d-wave {
  0%, 100% {
    color: #b9cce6;
    transform: translateY(0);
    text-shadow: none;
  }
  45% {
    color: #ffffff;
    transform: translateY(-5px);
    text-shadow: 0 0 26px rgba(134, 255, 207, 0.55);
  }
  60% {
    color: #d8ffee;
    transform: translateY(-2px);
    text-shadow: 0 0 14px rgba(134, 255, 207, 0.25);
  }
}
@media (prefers-reduced-motion: reduce) {
  .d-ltr { animation: none; color: #e9f1ff; }
}
