/* zo.di.ac — the company's front door.
   One mark, one line, four apps. Everything here serves those three things. */

/* The name is set the way Berkshire Hathaway sets its own on its home page:
   the reader's own Times New Roman, bold, in capitals, the initials large.
   Tinos is the open face cut to the same metrics, fetched only by a device
   that has no Times New Roman (Android, most Linux). */
@font-face {
  font-family: "Tinos";
  src: url("/fonts/tinos-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Tinos";
  src: url("/fonts/tinos-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Libre Franklin";
  src: url("/fonts/libre-franklin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* How far the mark has been drawn, as a share of the way from home to its
   farthest edge. Registered so it can be animated (see "reveal" below). */
@property --reveal {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 104%;
}

:root {
  /* Tyrian night → imperial velvet → amethyst light. Gold appears sparingly:
     at home on the map, and on the keyboard focus ring. */
  --night: #0a0312;
  --velvet: #1a0932;
  --imperial: #3c1480;
  --amethyst: #9160ff;
  --lilac: #ece3ff;
  --gold: #e9cf93;

  --ink: var(--lilac);
  --ink-soft: rgba(236, 227, 255, 0.7);
  --ink-faint: rgba(236, 227, 255, 0.5);

  /* Times for the name and the line. A plain grotesk, capitals and tracked,
     for the labels under the icons. */
  --serif: "Times New Roman", Times, "Tinos", "Liberation Serif", serif;
  --sans: "Libre Franklin", "Franklin Gothic Medium", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Where the Sun sits inside the mark's box (the map is lopsided: the line to
     the galactic centre runs far to the right). Set by tools/build-mark.mjs. */
  --home-x: 28.36%;
  --home-y: 50%;

  --tile: clamp(76px, 9.8vw, 126px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* A hundredth of the height you can actually see. On a phone `vh` is the
     height with the browser's bars tucked away, which is taller than what is
     on screen when the page opens; `svh` is the height with them showing.
     Every vertical measure below is taken from this, so the page is laid out
     for the screen as it first appears and never needs a scroll to finish. */
  --vh: 1vh;
}
@supports (height: 1svh) {
  :root {
    --vh: 1svh;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow-x: hidden;
  background: var(--night);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--serif);
  background:
    radial-gradient(120% 78% at 50% 34%, #2b0f5c 0%, #1a0932 36%, rgba(10, 3, 18, 0) 74%),
    radial-gradient(90% 60% at 50% 108%, rgba(96, 32, 168, 0.5) 0%, rgba(10, 3, 18, 0) 70%),
    var(--night);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Velvet has a nap. A little grain keeps the gradients from banding. */
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.sky-grain {
  position: absolute;
  inset: 0;
  background: url("/img/grain.svg");
  opacity: 0.13;
  mix-blend-mode: soft-light;
}

.page {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(34px, calc(var(--vh) * 6), 68px);
  padding: clamp(24px, calc(var(--vh) * 4.6), 56px) 20px clamp(16px, calc(var(--vh) * 2.4), 28px);
}

/* ---------- The mark ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.mark-wrap {
  position: relative;
  width: min(84vw, calc(var(--vh) * 46), 520px);
  /* On a wide screen, home sits on the page's centre line and the long ray
     runs out to the right of it. On a phone the whole map is centred instead. */
  translate: 0 0;
}
@media (min-width: 760px) {
  .mark-wrap {
    width: min(54vw, calc(var(--vh) * 50), 600px);
    translate: calc(50% - var(--home-x)) 0;
  }
}

.mark-light {
  position: relative;
  filter: drop-shadow(0 0 5px rgba(196, 160, 255, 0.55)) drop-shadow(0 0 22px rgba(145, 96, 255, 0.45));
}

/* The map is drawn from home outward, every ray at once and to its very end:
   the long ray toward the galactic centre finishes last. It is one mask, a
   disc centred on home whose edge travels out, so the solid strokes and the
   binary marks beyond them appear as one continuous line. */
.mark {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  color: var(--lilac);
  -webkit-mask-image: radial-gradient(circle farthest-side at var(--home-x) var(--home-y), #000 calc(var(--reveal) - 3%), transparent var(--reveal));
  mask-image: radial-gradient(circle farthest-side at var(--home-x) var(--home-y), #000 calc(var(--reveal) - 3%), transparent var(--reveal));
  animation: reveal 2.9s cubic-bezier(0.3, 0.55, 0.3, 1) 0.3s both;
}
.mark line,
.mark path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.mark-rays line {
  stroke-width: 1.15px;
}
.mark-code {
  stroke-width: 1px;
}
.mark-home {
  fill: var(--gold);
  stroke: none;
  filter: drop-shadow(0 0 6px rgba(233, 207, 147, 0.9));
}

/* The aura: light leaving home. Two soft bodies, one breathing, one turning. */
.aura {
  position: absolute;
  left: var(--home-x);
  top: var(--home-y);
  width: 0;
  height: 0;
  pointer-events: none;
}
.aura i {
  position: absolute;
  left: 0;
  top: 0;
  translate: -50% -50%;
  border-radius: 50%;
  opacity: 0;
}
.aura i:first-child {
  width: min(118vw, 780px);
  aspect-ratio: 1;
  background: radial-gradient(
    closest-side,
    rgba(214, 184, 255, 0.5) 0%,
    rgba(150, 96, 255, 0.34) 16%,
    rgba(110, 48, 214, 0.2) 38%,
    rgba(72, 22, 150, 0.08) 62%,
    rgba(72, 22, 150, 0) 100%
  );
  animation:
    bloom 2.6s var(--ease-out) forwards 0.05s,
    breathe 9s ease-in-out infinite 2.65s;
}
.aura i:last-child {
  width: min(84vw, 540px);
  aspect-ratio: 1;
  background: conic-gradient(from 20deg, #7a3cf0, #d04bd6, #5b49f0, #b06cff, #7a3cf0);
  -webkit-mask-image: radial-gradient(closest-side, #000 0%, rgba(0, 0, 0, 0.5) 34%, transparent 72%);
  mask-image: radial-gradient(closest-side, #000 0%, rgba(0, 0, 0, 0.5) 34%, transparent 72%);
  filter: blur(34px);
  mix-blend-mode: screen;
  animation:
    bloom-soft 2.8s var(--ease-out) forwards 0.2s,
    turn 80s linear infinite;
}

/* ---------- Words ---------- */

/* ZODIAC GAMES, as BERKSHIRE HATHAWAY INC. is set: bold capitals, the two
   initials at HTML size 6 and the rest at size 4 (32px to 18px, 16:9). The
   font-size here is the small letters'; .cap is the initials. */
.wordmark {
  margin: clamp(26px, calc(var(--vh) * 4.8), 48px) 0 0;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2.75vw, 2.05rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 34px rgba(160, 112, 255, 0.4);
  opacity: 0;
  animation: rise 1.2s var(--ease-out) forwards 0.95s;
}
.wordmark .cap {
  font-size: 1.7778em;
}

/* ---------- The apps ---------- */

.apps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, var(--tile));
  justify-content: center;
  gap: clamp(14px, 3.2vw, 44px);
}

.app {
  opacity: 0;
  animation: rise 1.1s var(--ease-out) forwards;
  animation-delay: calc(1.4s + var(--n) * 110ms);
}

.app-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, calc(var(--vh) * 1.9), 18px);
  color: inherit;
  text-decoration: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

/* Each icon is a posed slab (tools/icons.mjs). It holds still; under the
   pointer it rises a few pixels, no more, and its shadow tightens a touch. */
.tile {
  position: relative;
  display: block;
  width: var(--tile);
}
.tile::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -11%;
  height: 24%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(3, 0, 8, 0.85), rgba(3, 0, 8, 0));
  filter: blur(6px);
  transition:
    transform 0.5s var(--ease-out),
    opacity 0.5s var(--ease-out);
}
.tile-art {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 14px 26px var(--glow));
  transition: transform 0.5s var(--ease-out);
}
.app:hover .tile-art,
a.app-link:focus-visible .tile-art {
  transform: translateY(-3px);
}
.app:hover .tile::before,
a.app-link:focus-visible .tile::before {
  transform: scale(0.94);
  opacity: 0.85;
}

.app-name {
  font-family: var(--sans);
  font-size: clamp(0.56rem, 0.86vw, 0.68rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.2em;
  /* Same correction as the name: tracking trails the last letter. */
  margin-right: -0.2em;
  text-transform: uppercase;
  text-align: center;
  max-width: calc(var(--tile) + 18px);
  text-wrap: balance;
  color: var(--ink-soft);
  transition: color 0.3s ease;
}
.app--soon .app-name {
  color: var(--ink-faint);
}

a.app-link:hover .app-name,
a.app-link:focus-visible .app-name {
  color: var(--ink);
}
a.app-link:focus-visible .tile {
  outline: 1px solid var(--gold);
  outline-offset: 8px;
  border-radius: 22%;
}

/* ---------- Foot ---------- */

.foot {
  position: relative;
  z-index: 1;
  padding: 0 20px clamp(18px, calc(var(--vh) * 3), 30px);
  font-family: var(--sans);
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-align: center;
  color: var(--ink-faint);
  opacity: 0;
  animation: fade 1.4s ease forwards 2.2s;
}
.foot p {
  margin: 0;
}

/* ---------- The share card (tools/render-images.sh draws og.png from this) ---------- */

.card {
  justify-content: center;
  gap: 0;
  padding: 0;
}
.card .mark-wrap {
  width: 470px;
  translate: calc(50% - var(--home-x)) 0;
}
.card .wordmark {
  margin-top: 34px;
  font-size: 2.2rem;
}

/* ---------- The 404 ---------- */

.lost {
  gap: clamp(20px, calc(var(--vh) * 4), 34px);
  text-align: center;
}
.lost .mark-wrap {
  width: min(64vw, 300px);
  translate: 0 0;
}
.lost-title {
  margin: 0;
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  font-weight: 400;
  line-height: 1.2;
}
.lost-link {
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 10px 2px;
  border-bottom: 1px solid rgba(236, 227, 255, 0.28);
  transition:
    color 0.3s ease,
    border-color 0.3s ease;
}
.lost-link:hover,
.lost-link:focus-visible {
  color: var(--ink);
  border-color: var(--gold);
  outline: none;
}

/* ---------- Motion ---------- */

@keyframes reveal {
  from {
    --reveal: 0%;
  }
  to {
    --reveal: 104%;
  }
}
@keyframes fade {
  to {
    opacity: 1;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes bloom {
  from {
    opacity: 0;
    scale: 0.55;
  }
  to {
    opacity: 1;
    scale: 1;
  }
}
@keyframes bloom-soft {
  from {
    opacity: 0;
    scale: 0.6;
  }
  to {
    opacity: 0.42;
    scale: 1;
  }
}
@keyframes breathe {
  0%,
  100% {
    scale: 1;
    opacity: 1;
  }
  50% {
    scale: 1.07;
    opacity: 0.84;
  }
}
@keyframes turn {
  to {
    rotate: 360deg;
  }
}

@media (max-width: 759px) {
  /* The period marks are a pixel apart at this size: draw them finer. */
  .mark-code {
    stroke-width: 0.7px;
  }
}

/* On a phone the four apps are two rows of two: what is out now on top, what
   is coming underneath. Everything is measured from the visible height, so
   the whole page (mark, name, both rows, the foot) fits without a scroll on
   any phone down to about 500px of visible height: the mark and the icons
   give way first, the gaps second. */
@media (max-width: 560px) {
  :root {
    --tile: min(27vw, 118px, calc(var(--vh) * 16.5));
  }
  .page {
    gap: clamp(12px, calc(var(--vh) * 3.4), 34px);
    padding: clamp(10px, calc(var(--vh) * 2.6), 30px) 20px clamp(6px, calc(var(--vh) * 1.4), 16px);
  }
  .mark-wrap {
    width: min(80vw, calc(var(--vh) * 37), 520px);
  }
  .wordmark {
    margin-top: clamp(10px, calc(var(--vh) * 3.2), 32px);
  }
  .apps {
    grid-template-columns: repeat(2, var(--tile));
    gap: clamp(10px, calc(var(--vh) * 2.6), 30px) clamp(34px, 12vw, 56px);
  }
  .app-link {
    gap: clamp(6px, calc(var(--vh) * 1.3), 15px);
  }
  .foot {
    padding-bottom: clamp(8px, calc(var(--vh) * 1.9), 22px);
  }
}

@media (max-height: 620px) and (min-width: 760px) {
  .mark-wrap {
    width: min(46vw, calc(var(--vh) * 54));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .wordmark,
  .app,
  .foot,
  .aura i:first-child {
    opacity: 1;
  }
  .aura i:last-child {
    opacity: 0.42;
  }
}
