/* Self-hosted brand font (savi-v1 Regular, SIL OFL), converted from the savi-v1-family source files */
@font-face {
  font-family: "savi-v1";
  src: url("fonts/savi-v1.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #6a463f;            /* default background, overridden by main.js */
  --fg: #ffffff;
  --muted: 0.6;             /* opacity for secondary text (from Figma) */
  --label-col: 120px;       /* fixed first column in every row */
  --pad-x: clamp(24px, 10vw, 160px);
  --pad-top: clamp(32px, 8vh, 96px);
  --pad-bottom: clamp(32px, 8vh, 100px);
  --font: "savi-v1", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 400 13px/1.5 var(--font);   /* line-height 150% (Figma) */
  -webkit-font-smoothing: antialiased;
  transition: background-color 480ms cubic-bezier(.2, .7, .2, 1);
  cursor: default;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a.muted:hover, li a:hover + .muted { opacity: 0.9; }
ul { list-style: none; }
h2 { font: inherit; }

.muted { opacity: var(--muted); }

/* ---------- layout ---------- */
.page {
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    calc(var(--pad-top) + env(safe-area-inset-top))
    calc(var(--pad-x) + env(safe-area-inset-right))
    calc(var(--pad-bottom) + env(safe-area-inset-bottom))
    calc(var(--pad-x) + env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.identity { display: flex; align-items: center; gap: 20px; }
.identity__text { display: flex; flex-direction: column; }
.avatar { width: 40px; height: 40px; border-radius: 2px; object-fit: cover; display: block; }
.clock { font-size: 12px; padding-top: 3px; font-variant-numeric: tabular-nums; }

.lists {
  display: flex;
  flex-direction: column;
  gap: 40px;                                   /* between groups (Figma) */
  padding-top: clamp(48px, 10vh, 96px);        /* header → first group: 96px at 1200px tall */
  padding-bottom: 64px;
}

.group { display: flex; flex-direction: column; gap: 8px; }   /* label → rows → rows (Figma) */
.group ul { display: flex; flex-direction: column; gap: inherit; }
.group li { display: flex; align-items: center; }
.group li > :first-child:not(.row) { width: var(--label-col); flex: none; }

/* Full-row link for products & companies — top-aligned so a wrapped description keeps the name on its first line */
.row { display: flex; align-items: flex-start; }
.row:hover { text-decoration: none; }
.row__name { width: var(--label-col); flex: none; }
.row .muted { transition: opacity 160ms ease; }
.row__arrow {
  margin-left: 8px;
  opacity: 0;
  transform: translate(-4px, 2px);
  transition: opacity 160ms ease, transform 160ms ease;
}
.row:hover .muted, .row:focus-visible .muted { opacity: 1; }
.row:hover .row__arrow, .row:focus-visible .row__arrow { opacity: .6; transform: none; }
.row:focus-visible { outline: 1px solid rgba(255, 255, 255, .5); outline-offset: 4px; border-radius: 2px; }

/* Clock colon blinks once per second */
.clock__colon { display: inline-block; transition: opacity 120ms linear; }
.clock.is-off .clock__colon { opacity: 0; }

.bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 48px;
}

.contact { width: 268px; }

/* ---------- dot map ---------- */
.dotmap-wrap { position: relative; width: min(605px, 100%); }

.dotmap {
  all: unset;
  display: grid;
  grid-template-columns: repeat(32, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 3px;
  width: 100%;
  aspect-ratio: 605 / 92;
  cursor: pointer;
}
.dotmap:focus-visible { outline: 1px solid rgba(255, 255, 255, .6); outline-offset: 6px; border-radius: 2px; }

.dot {
  background: #fff;
  border-radius: 2px;
  mix-blend-mode: overlay;   /* tints the dot with whatever background is active */
  opacity: 0.15;
  transition: opacity 200ms ease, transform 200ms ease;
}
.dot.is-on { opacity: 1; }
.dotmap:hover .dot:hover { opacity: .6; }
.dotmap:hover .dot.is-on:hover { opacity: 1; transform: scale(1.12); }
.dot.is-pop { animation: pop 420ms cubic-bezier(.2, 1.6, .4, 1); }

/* B. Twinkle (idle): JS briefly raises one dot at a time */
.dot.is-twinkle { opacity: .5; transition-duration: 600ms; }
.dot.is-on.is-twinkle { opacity: .55; }

/* A. Ripple (on click): wave of flashes spreading from the clicked dot */
.dot.is-flash { opacity: .75; transform: scale(1.12); transition-duration: 80ms; }

@keyframes pop {
  0% { transform: scale(.4); opacity: .15; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- tile: a dot grown into its content ---------- */
.tile {
  position: absolute;
  z-index: 2;
  overflow: hidden;
  border-radius: 3px;
  background: color-mix(in srgb, var(--bg) 70%, #000);
  box-shadow: 0 0 0 3px var(--bg);   /* gap-coloured rim so it sits in the grid */
  transition: box-shadow 480ms ease, background-color 480ms ease;
}
.tile[hidden] { display: none !important; }  /* must beat .tile.is-text { display:flex } */
.tile:hover { text-decoration: none; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Only an arrow on hover — no caption */
.tile__arrow {
  position: absolute;
  right: 6px; bottom: 6px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  font-size: 12px;
  border-radius: 2px;
  background: rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity 160ms ease, transform 160ms ease;
}
.tile:hover .tile__arrow, .tile:focus-visible .tile__arrow { opacity: 1; transform: none; }
@media (hover: none) { .tile__arrow { opacity: 1; transform: none; } }

/* Text tiles (quotes, links) */
.tile.is-text { padding: 12px 14px; display: flex; align-items: center; }
.tile__quote { font-size: 13px; line-height: 1.4; }
.tile__text { display: flex; flex-direction: column; gap: 4px; }
.tile__kicker { font-size: 12px; opacity: var(--muted); }
.tile.is-text .tile__arrow { background: none; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  :root { --label-col: 96px; }
  .group li { align-items: flex-start; }
  .lists { padding-top: 56px; }
  .bottom { flex-direction: column; align-items: stretch; gap: 40px; }  /* dot map above contact */
  .contact { width: auto; }
  .surprise { width: min(280px, 100%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- lightbox (Drive artworks) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(16px, 6vw, 80px);
  background: color-mix(in srgb, var(--bg) 35%, rgba(0, 0, 0, .85));
  cursor: zoom-out;
  animation: lb-in 220ms ease;
}
.lightbox[hidden] { display: none; }
.lightbox__figure { margin: 0; display: flex; flex-direction: column; gap: 12px; max-width: 100%; max-height: 100%; }
.lightbox__figure img,
.lightbox__figure video {
  display: block;
  max-width: min(1200px, 100%);
  max-height: calc(100vh - 2 * clamp(16px, 6vw, 80px) - 32px);
  max-height: calc(100dvh - 2 * clamp(16px, 6vw, 80px) - 32px);
  object-fit: contain;
  border-radius: 3px;
  animation: lb-zoom 320ms cubic-bezier(.2, .8, .2, 1);
}
.lightbox__figure figcaption { font-size: 12px; opacity: var(--muted); }
body.has-lightbox { overflow: hidden; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes lb-zoom { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

/* iOS Safari only fires click on "clickable" elements — this lets taps on empty
   space close an open tile and change the background, like clicks do on desktop */
@media (hover: none) { body { cursor: pointer; } }
