/* Hellblazer front page prototype.
   Layout follows superlogical.com's front page; colours and type come from
   the tech videos' "product" theme (tech-video-v1/src/theme.ts). */

:root {
  color-scheme: dark;

  /* tech-video-v1 product palette */
  --bg: #0b0d10;
  --panel: #14181e;
  --line: #242a33;
  --ink: #e8ecf1;
  --ink-soft: #8a94a3;
  --accent: #5ee1c2;

  --rule: color-mix(in srgb, var(--ink) 14%, transparent);
  --wheel-muted: color-mix(in oklab, var(--ink-soft) 55%, var(--panel));

  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --text-base: min(calc(0.36vw + 1rem), 1.54rem);
  --text-h1: calc(var(--text-base) * 1.6);
  --radius: 22px;
  --pad: 2rem;
}

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

html {
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- page shell ---------- */

.page {
  display: flex;
  flex-direction: column;
  margin: 1.5rem 0 2rem;
  padding: 0 1.5rem;
}

.top a,
.bar-mark {
  display: block;
  width: max-content;
}

/* The figlet wordmark: real text in the mono face, set small. */
.wordmark {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 6px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0;
  white-space: pre;
  color: var(--ink);
}

/* ---------- the two boxes ---------- */

.boxes {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin-top: 1.5rem;
}

.box {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: var(--pad);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: clip;
}

/* 1px lit edge, brightest at the top-left corner */
.box::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    145deg,
    #ffffff52 0%,
    #ffffff1f 14%,
    #ffffff08 38%,
    #0000 55%,
    #ffffff08 80%,
    #ffffff1a 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

.box-statement::after {
  background:
    radial-gradient(90% 55% at 0 0, #ffffff1a, #ffffff06 45%, #0000 75%),
    radial-gradient(60% 35% at 100% 100%, #ffffff06, #0000 70%);
}

.headline {
  margin: 0;
  min-height: 3lh;
  font-size: var(--text-h1);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.box-launch .headline {
  text-wrap: balance;
}

.headline .sub {
  color: color-mix(in srgb, var(--ink) 62%, transparent);
}

.line {
  display: block;
  white-space: nowrap;
}

.cta {
  position: absolute;
  bottom: var(--pad);
  left: var(--pad);
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.15rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.25rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.cta:hover {
  opacity: 0.82;
}

/* ---------- left box: green wallpaper ---------- */

.box-launch {
  min-height: 22rem;
  background: #0d3a31;
}

.wallpaper,
.grain {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.wallpaper {
  background:
    radial-gradient(55% 50% at 0% 0%, rgb(94 225 194 / 0.6), transparent 72%),
    radial-gradient(60% 55% at 100% 100%, rgb(11 13 16 / 0.9), transparent 78%),
    radial-gradient(50% 45% at 12% 100%, rgb(11 13 16 / 0.55), transparent 75%),
    radial-gradient(75% 60% at 80% 12%, rgb(18 104 86 / 0.9), transparent 72%),
    linear-gradient(160deg, #1a8870 0%, #11604f 42%, #0a2b26 100%);
}

.grain {
  opacity: 0.22;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

.mark {
  position: absolute;
  top: var(--pad);
  left: var(--pad);
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--bg);
  box-shadow:
    0 0 0 1px rgb(255 255 255 / 0.1) inset,
    0 6px 18px rgb(0 0 0 / 0.35);
}

.mark svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: var(--accent);
}

/* ---------- right box: statement and phrase wheel ---------- */

.box-statement {
  min-height: 30rem;
  justify-content: flex-start;
  padding-top: 6rem;
}

.slot {
  position: relative;
  --step: 15deg;
  --r: 4.6em;
  --half: 5.2em;
}

.slot .selected {
  color: var(--accent);
}

/* Once the wheel is running it draws the selected phrase itself. */
.slot.entered .selected {
  color: transparent;
}

.wheel {
  position: absolute;
  left: -0.3em;
  right: 0;
  top: calc(50% - var(--half));
  height: calc(2 * var(--half));
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  /* Show the selected line and let the rows below it fade away; fade long
     phrases out before the right edge. */
  --window: linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(50% - 0.8lh),
    #000 calc(50% - 0.5lh),
    #000 calc(50% + 0.6lh),
    transparent 100%
  );
  --edge: linear-gradient(to right, #000 0, #000 calc(100% - 2.5em), transparent 100%);
  -webkit-mask-image: var(--window), var(--edge);
  -webkit-mask-composite: source-in;
  mask-image: var(--window), var(--edge);
  mask-composite: intersect;
}

.stage {
  position: absolute;
  inset: 0;
  perspective: calc(var(--r) * 6);
  perspective-origin: 0.3em 50%;
}

.drum {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: translateZ(calc(-1 * var(--r)));
}

.row {
  position: absolute;
  top: 50%;
  left: 0.3em;
  display: block;
  width: max-content;
  margin-top: -0.5lh;
  white-space: nowrap;
  color: var(--wheel-muted);
  backface-visibility: hidden;
  will-change: transform, opacity;
}

.wheel-hit {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(50% + var(--half));
  cursor: grab;
  /* A finger dragged here spins the wheel instead of scrolling the page. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.slot.dragging .wheel-hit {
  cursor: grabbing;
}

/* ---------- bottom bar ---------- */

.bar {
  margin-top: 1.5rem;
}

.bar nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--ink);
}

.bar a:not(.bar-mark) {
  text-underline-offset: 4px;
}

.bar a:not(.bar-mark):hover {
  text-decoration: underline;
}

.bar p {
  margin: 0;
}

.bar-mark,
.bar-rule,
.bar-year {
  display: none;
}

.bar-name {
  width: 100%;
}

.bar-rule {
  flex: 1;
  align-self: center;
  min-width: 0.375rem;
  height: 1px;
  background: var(--rule);
}

/* ---------- square-corner variant (index.html?square) ---------- */

.square .box,
.square .cta,
.square .mark {
  border-radius: 0;
}

/* ---------- breakpoints (same as the reference: 40 / 48 / 64rem) ---------- */

@media (width < 40rem) {
  :root {
    --pad: 1.5rem;
  }

  .mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }
}

@media (width < 48rem) {
  .headline {
    font-size: clamp(1.5rem, 7.8vw, 2rem);
    line-height: 1.08;
  }
}

@media (width >= 40rem) {
  .page {
    margin: 1.75rem 0 2.5rem;
    padding: 0 2.5rem;
  }

  .boxes {
    margin-top: 1.75rem;
  }

  .bar {
    margin-top: 1.75rem;
  }

  .bar nav {
    flex-wrap: nowrap;
    gap: 1.25rem;
  }

  .bar-name {
    width: auto;
    margin-right: auto;
  }

  .bar-rule {
    display: block;
  }
}

@media (width >= 48rem) {
  .box-launch,
  .box-statement {
    aspect-ratio: 3 / 2;
    min-height: 0;
  }

  .box-statement {
    justify-content: center;
    padding-top: var(--pad);
  }
}

@media (width >= 64rem) {
  .page {
    min-height: 100svh;
    margin: 0;
    padding: 2rem 4rem 0;
  }

  .top {
    display: none;
  }

  .boxes {
    flex: 1 0 auto;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    min-height: 28rem;
    margin-top: 0;
  }

  .box-launch,
  .box-statement {
    aspect-ratio: auto;
  }

  .bar {
    margin-top: 2rem;
    padding-bottom: 2rem;
  }

  .bar-mark {
    display: block;
    flex-shrink: 0;
    margin-right: auto;
  }

  .bar-year {
    display: block;
  }

  .bar-name {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cta {
    transition: none;
  }
}
