/* =========================================================================
   wewewe.dev — hero
   Production CSS for the hero section. Tokens, layout, animations, mobile
   breakpoint at 768px, prefers-reduced-motion.
   ========================================================================= */

/* ----- Design tokens ----- */
:root {
  --hero-bg:        #0a0a0a;
  --hero-bg-deep:   #050608;
  --hero-accent:    #5fffaf;
  --hero-text:      #f5f5f5;

  --hero-w-85:      rgba(255,255,255,0.85);
  --hero-w-70:      rgba(255,255,255,0.70);
  --hero-w-55:      rgba(255,255,255,0.55);
  --hero-w-50:      rgba(255,255,255,0.50);
  --hero-w-36:      rgba(255,255,255,0.36);
  --hero-w-35:      rgba(255,255,255,0.35);
  --hero-w-30:      rgba(255,255,255,0.30);
  --hero-w-24:      rgba(255,255,255,0.24);
  --hero-w-14:      rgba(255,255,255,0.14);
  --hero-w-06:      rgba(255,255,255,0.06);
  --hero-w-02:      rgba(255,255,255,0.02);

  --hero-err-text:  rgba(255,130,130,0.78);
  --hero-err-glyph: #ff8a8a;

  --hero-font: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Headline size — desktop default; overridden in mobile media query */
  --hero-h1: clamp(48px, 8.5vw, 124px);

  /* Build log */
  --bglog-opacity: 0.55;
  --bglog-padding: 80px 40px;
  --bglog-gap:     80px;
  --bglog-font:    13px;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--hero-bg);
  color: var(--hero-text);
  font-family: var(--hero-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main { display: block; }

a { color: inherit; text-decoration: none; }
a:focus-visible {
  outline: 1px solid var(--hero-accent);
  outline-offset: 2px;
}

button { font: inherit; }

/* ----- Keyframes ----- */
@keyframes heroBlink {
  0%, 50%        { opacity: 1; }
  50.01%, 100%   { opacity: 0; }
}

@keyframes logScroll {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); }
}

@keyframes posterFlicker {
  0%, 100% { opacity: 1; }
  47% { opacity: 1; }
  48% { opacity: 0.85; }
  49% { opacity: 1; }
  52% { opacity: 0.92; }
  53% { opacity: 1; }
}

@keyframes posterDrift {
  0%, 100% { transform: translate(0, 0) scale(1.02); }
  50%      { transform: translate(-1.5%, 0.8%) scale(1.04); }
}

/* ============================================================
   Hero root
   ============================================================ */
.hero {
  position: relative;
  width: 100%;
  height: 100vh;
  /* iOS dynamic viewport — falls back gracefully when not supported */
  height: 100dvh;
  background: var(--hero-bg);
  color: var(--hero-text);
  overflow: hidden;
  font-family: var(--hero-font);
}

/* Background slot (video poster + log overlay) */
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* Vignette behind headline */
.hero__vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    ellipse 60% 38% at center,
    rgba(0,0,0,0.6) 0%,
    rgba(0,0,0,0.25) 55%,
    transparent 85%
  );
}

/* CRT scanlines */
.hero__scanlines {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.4;
  background: repeating-linear-gradient(
    0deg,
    rgba(255,255,255,0.02) 0 1px,
    transparent 1px 3px
  );
}

/* ============================================================
   Top bar
   ============================================================ */
.hero__header {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 5;
  padding: 28px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hero__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.hero__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hero-accent);
  box-shadow: 0 0 10px var(--hero-accent), 0 0 2px var(--hero-accent);
  animation: heroBlink 2s steps(2, end) infinite;
}

.hero__brand-name    { color: var(--hero-w-85); }
.hero__brand-divider { color: var(--hero-w-35); }
.hero__status        { color: var(--hero-w-55); }

/* ----- Hamburger ----- */
.hamburger {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 16px;
  background: transparent;
  border: 1px solid var(--hero-w-14);
  border-radius: 0;
  color: var(--hero-w-85);
  font-family: var(--hero-font);
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.hamburger:hover,
.hamburger:focus-visible {
  background: var(--hero-w-06);
  border-color: var(--hero-accent);
}

.hamburger:focus-visible {
  outline: none;
}

.hamburger__icon { display: block; }

/* ============================================================
   Centered headline + subhead
   ============================================================ */
.hero__center {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
}

.hero__headline {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.04em;
  font-size: var(--hero-h1);
  line-height: 1;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 0 60px rgba(0,0,0,0.6);
}

.hero__prefix {
  color: var(--hero-w-30);
  margin-right: 0.32em;
}

.hero__dollar { color: var(--hero-accent); }

.hero__cursor {
  display: inline-block;
  width: 0.55em;
  height: 0.92em;
  background: var(--hero-accent);
  margin-left: 6px;
  vertical-align: -0.08em;
  animation: heroBlink 1s steps(2, end) infinite;
  /* "80" = ~50% alpha hex on the accent */
  box-shadow: 0 0 18px rgba(95,255,175,0.5);
}

.hero__subhead {
  margin: 32px 0 0;
  font-size: 16px;
  color: var(--hero-w-70);
  letter-spacing: 0.3px;
  max-width: 560px;
  text-align: center;
}

/* ============================================================
   Bottom meta
   ============================================================ */
.hero__footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 5;
  padding: 24px 40px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--hero-w-50);
}

.hero__scroll {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero__email a {
  color: inherit;
  transition: color .15s;
}
.hero__email a:hover { color: var(--hero-w-85); }
.hero__at { color: var(--hero-accent); }

.hero__coords { font-variant-numeric: tabular-nums; }

/* Visibility toggles between long/short forms — desktop defaults */
.hero__scroll-short,
.hero__coords-short { display: none; }

/* ============================================================
   Video poster
   ============================================================ */
.poster {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--hero-bg-deep);
}

.poster__drift {
  position: absolute;
  inset: -2%;
  animation: posterDrift 24s ease-in-out infinite;
}

.poster__layer {
  position: absolute;
  inset: 0;
  mix-blend-mode: screen;
}

/* Cool monitor glow — center-left, wide. Dominant in "cool" tint. */
.poster__monitor {
  background: radial-gradient(
    ellipse 55% 40% at 30% 55%,
    rgba(70,140,200,0.45),
    rgba(40,80,140,0.15) 35%,
    transparent 70%
  );
  animation: posterFlicker 7s ease-in-out infinite;
  opacity: 1;
}

/* Warm desk-lamp pool — top-right. */
.poster__lamp {
  background: radial-gradient(
    ellipse 35% 25% at 78% 28%,
    rgba(255,180,90,0.42),
    rgba(200,120,40,0.12) 40%,
    transparent 75%
  );
  opacity: 0.7;
}

/* Secondary screen glow — bottom-right, dim green. */
.poster__screen2 {
  background: radial-gradient(
    ellipse 25% 18% at 72% 72%,
    rgba(95,255,175,0.18),
    transparent 70%
  );
}

/* Horizon line — desk edge. */
.poster__horizon {
  position: absolute;
  left: 0; right: 0;
  top: 62%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.08) 40%,
    rgba(255,255,255,0.12) 50%,
    rgba(255,255,255,0.08) 60%,
    transparent
  );
}

/* Faint vertical bezel hints. */
.poster__bezel {
  position: absolute;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.04), transparent);
}
.poster__bezel--left  { left: 8%;  top: 10%; width: 2px; height: 50%; }
.poster__bezel--right { right: 12%; top: 8%;  width: 1px; height: 55%;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.06), transparent); }

/* Film grain — inline SVG noise via data URI */
.poster__grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='180' height='180' filter='url(%23n)' opacity='0.7'/></svg>");
}

/* ============================================================
   Build-log overlay
   ============================================================ */
.bglog {
  position: absolute;
  inset: 0;
  opacity: var(--bglog-opacity);
}

.bglog__grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: var(--bglog-padding);
  gap: var(--bglog-gap);
}

.bglog__col {
  position: relative;
  height: 100%;
  overflow: hidden;
}

/* The scrolling inner; main.js sets --bglog-dur per column */
.bglog__scroll {
  position: absolute;
  top: 0; left: 0; right: 0;
  font-size: var(--bglog-font);
  line-height: 22px;
  font-family: var(--hero-font);
  animation: logScroll var(--bglog-dur, 90s) linear infinite;
  will-change: transform;
}

.bglog__line {
  display: flex;
  gap: 12px;
  min-height: 22px;
}

.bglog__glyph {
  width: 14px;
  flex-shrink: 0;
}

.bglog__text {
  white-space: pre;
}

/* Per-kind colors */
.bglog__line--cmd    .bglog__glyph { color: var(--hero-accent); }
.bglog__line--cmd    .bglog__text  { color: var(--hero-w-70); }

.bglog__line--ok     .bglog__glyph,
.bglog__line--ok     .bglog__text,
.bglog__line--accent .bglog__glyph,
.bglog__line--accent .bglog__text  { color: var(--hero-accent); }

.bglog__line--err    .bglog__glyph { color: var(--hero-err-glyph); }
.bglog__line--err    .bglog__text  { color: var(--hero-err-text); }

.bglog__line--log    .bglog__glyph,
.bglog__line--log    .bglog__text  { color: var(--hero-w-36); }

.bglog__line--dim    .bglog__glyph,
.bglog__line--dim    .bglog__text  { color: var(--hero-w-24); }

.bglog__line--spacer .bglog__glyph,
.bglog__line--spacer .bglog__text  { color: transparent; }

/* Top + bottom fade to background so the seam reads as natural */
.bglog__fade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    var(--hero-bg-deep) 0%,
    transparent 18%,
    transparent 82%,
    var(--hero-bg-deep) 100%
  );
}

/* ============================================================
   Mobile breakpoint (compact mode)
   ============================================================ */
@media (max-width: 767.98px) {
  :root {
    --hero-h1: clamp(28px, 10vw, 40px);
    --bglog-opacity: 0.4;
    --bglog-padding: 60px 24px;
    --bglog-gap: 0px;
    --bglog-font: 11px;
  }

  .hero__header { padding: 20px 20px; }
  .hero__footer { padding: 20px 20px; }

  .hero__brand-divider,
  .hero__status { display: none; }

  .hero__scroll-long,
  .hero__coords-long { display: none; }

  .hero__scroll-short,
  .hero__coords-short { display: inline; }

  .hero__subhead {
    margin-top: 24px;
    font-size: 13px;
    letter-spacing: 0.4px;
  }

  /* Tighter vignette for mobile */
  .hero__vignette {
    background: radial-gradient(
      ellipse 75% 32% at center,
      rgba(0,0,0,0.72) 0%,
      rgba(0,0,0,0.35) 50%,
      transparent 80%
    );
  }

  /* Single log column on mobile */
  .bglog__grid { grid-template-columns: 1fr; }
  .bglog__col--secondary { display: none; }
}

/* ============================================================
   Reduced motion — kill all animations + flicker
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .hero__cursor,
  .hero__dot {
    animation: none !important;
    opacity: 1 !important;
  }
  .bglog__scroll { animation: none !important; }
  .poster__drift { animation: none !important; }
  .poster__monitor { animation: none !important; }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  .hero { height: auto; min-height: 60vh; background: #fff; color: #000; }
  .hero__bg, .hero__vignette, .hero__scanlines, .hero__cursor, .hero__dot { display: none; }
  .hero__headline, .hero__subhead, .hero__brand, .hero__footer { color: #000; }
}
