/* ------------------------------------------------------------------
   That Garage Dude
   ------------------------------------------------------------------ */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-variable.woff2") format("woff2-variations"),
       url("../fonts/archivo-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Permanent Marker";
  src: url("../fonts/permanent-marker.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --bg: #0b0d11;
  --ink: #f4f0e6;
  --ink-2: rgba(244, 240, 230, 0.74);
  --ink-3: rgba(244, 240, 230, 0.5);
  --tape: #e7d7a9;
  --tape-ink: #17150f;
  --cta-bg: #ff3424;
  --cta-ink: #fff;
  --line: rgba(244, 240, 230, 0.16);
  --gutter: clamp(20px, 4.2vw, 64px);
  --display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --marker: "Permanent Marker", "Marker Felt", "Comic Sans MS", cursive;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; }

/* ---------- stage ----------------------------------------------- */

.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #0b0d11 center / cover no-repeat;
}
/* poster only when WebGL is unavailable; with GL the canvas fades in once its first frame is drawn */
.no-gl .stage { background-image: url("../og-image.jpg"); }

#scene {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.gl-ready #scene { opacity: 1; }

.scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(7, 8, 11, 0.92) 0%, rgba(7, 8, 11, 0.8) 28%, rgba(7, 8, 11, 0.4) 44%, rgba(7, 8, 11, 0) 60%),
    linear-gradient(0deg, rgba(7, 8, 11, 0.7) 0%, rgba(7, 8, 11, 0) 22%),
    radial-gradient(120% 90% at 66% 45%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.grain {
  position: absolute;
  inset: -50%;
  pointer-events: none;
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.6 -.3'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 0.9s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); }
  75% { transform: translate(-1%, -2%); }
  100% { transform: translate(3%, 1%); }
}

/* ---------- camcorder viewfinder ------------------------------- */

.viewfinder {
  position: fixed;
  inset: clamp(12px, 2vw, 24px);
  z-index: 2;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.vf-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 0 solid rgba(255, 255, 255, 0.55);
}
.vf-corner.tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.vf-corner.tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.vf-corner.bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.vf-corner.br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

.vf-rec {
  position: absolute;
  top: 14px;
  left: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.vf-rec #timecode { opacity: 0.75; font-variant-numeric: tabular-nums; margin-left: 6px; }
.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff2a1e;
  box-shadow: 0 0 10px #ff2a1e;
  animation: blink 1.25s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0.15; } }

.vf-meta {
  position: absolute;
  top: 14px;
  right: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.battery {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  position: relative;
}
.battery::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 3px;
  width: 2px;
  height: 5px;
  background: currentColor;
}
.battery i { width: 4px; height: 7px; background: currentColor; }
.battery i.low { opacity: 0.18; }

/* ---------- hero copy ------------------------------------------- */

.hero {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: calc(var(--gutter) + 40px) calc(var(--gutter) + 20px) calc(var(--gutter) + 64px);
  pointer-events: none;
}
.hero > * { pointer-events: auto; }

.copy { max-width: 40rem; }

.handle { margin: 0 0 clamp(16px, 2.4vh, 28px); }

.tape {
  display: inline-block;
  position: relative;
  padding: 0.5em 1.1em 0.45em;
  font-family: var(--marker);
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  line-height: 1;
  color: var(--tape-ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 40%),
    var(--tape);
  transform: rotate(-2.2deg);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  /* torn tape ends */
  clip-path: polygon(0 6%, 3% 0, 6% 9%, 9% 1%, 92% 0, 95% 8%, 98% 2%, 100% 10%, 100% 92%, 97% 100%, 94% 91%, 91% 99%, 8% 100%, 5% 92%, 2% 99%, 0 90%);
}

.headline {
  margin: 0;
  font-weight: 860;
  font-stretch: 68%;
  font-size: clamp(3.2rem, 7.4vw, 8.6rem);
  line-height: 0.84;
  letter-spacing: -0.012em;
  text-transform: uppercase;
  text-wrap: balance;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.55));
}
.headline .line { display: block; white-space: nowrap; }
.headline em {
  font-style: normal;
  color: transparent;
  -webkit-text-stroke: 2px var(--ink);
  text-stroke: 2px var(--ink);
  position: relative;
}
@supports not (-webkit-text-stroke: 2px #fff) {
  .headline em { color: var(--ink); }
}

.lede {
  margin: clamp(18px, 3vh, 30px) 0 0;
  max-width: 31rem;
  font-size: clamp(1.02rem, 1.25vw, 1.2rem);
  line-height: 1.5;
  font-weight: 420;
  font-stretch: 100%;
  color: var(--ink-2);
  text-wrap: pretty;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 26px;
  margin-top: clamp(24px, 4vh, 40px);
}

.cta {
  --lift: 0px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px 18px 20px;
  background: var(--cta-bg);
  color: var(--cta-ink);
  text-decoration: none;
  font-weight: 760;
  font-stretch: 88%;
  font-size: 1.12rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 10px 30px -8px rgba(255, 52, 36, 0.7),
    0 4px 0 #a6150b;
  transform: translateY(var(--lift));
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}
.cta:hover {
  --lift: -2px;
  background: #ff4a3a;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12) inset,
    0 16px 40px -8px rgba(255, 52, 36, 0.85),
    0 6px 0 #a6150b;
}
.cta:active { --lift: 3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset, 0 4px 14px -6px rgba(255, 52, 36, 0.7), 0 1px 0 #a6150b; }
.cta-icon { width: 28px; height: 20px; color: #fff; flex: none; }
.cta-arrow { width: 18px; height: 18px; flex: none; transition: transform 0.18s ease; }
.cta:hover .cta-arrow { transform: translateX(4px); }

.subscribe {
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 1.5px solid var(--line);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.subscribe:hover { border-color: var(--tape); color: var(--tape); }

:focus-visible {
  outline: 2px solid var(--tape);
  outline-offset: 4px;
}

/* ---------- spec tag -------------------------------------------- */

.spec {
  position: absolute;
  right: calc(var(--gutter) + 28px);
  bottom: 100px;
  width: 300px;
  padding: 36px 22px 16px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.2;
  color: #1a1913;
  background:
    repeating-linear-gradient(0deg, transparent 0 29px, rgba(60, 70, 120, 0.07) 29px 30px),
    #efe9da;
  border-radius: 3px;
  transform: rotate(2.4deg);
  box-shadow: 0 18px 40px -10px rgba(0, 0, 0, 0.7), 0 2px 4px rgba(0, 0, 0, 0.25);
}
.spec::before { /* string */
  content: "";
  position: absolute;
  left: 50%;
  top: -58px;
  width: 2px;
  height: 70px;
  background: linear-gradient(#0000, rgba(230, 220, 190, 0.7));
  transform: rotate(-8deg);
  transform-origin: bottom;
}
.spec-hole {
  position: absolute;
  top: 13px;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: #0b0d11;
  box-shadow: 0 0 0 3px #c9c1ab;
}
.spec-title {
  margin: 0 0 10px;
  font-family: var(--marker);
  font-size: 24px;
  color: #c3261a;
  transform: rotate(-1.5deg);
}
.spec dl { margin: 0; }
.spec dl > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px dashed rgba(26, 25, 19, 0.25);
}
.spec dt { text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.7; white-space: nowrap; }
.spec dt::after {
  content: "";
  display: inline-block;
}
.spec dd {
  margin: 0 0 0 auto;
  font-family: var(--marker);
  font-size: 19px;
  white-space: nowrap;
}
.spec .spec-key dd {
  color: #c3261a;
  position: relative;
}
.spec .spec-key dd::after { /* hand-drawn circle */
  content: "";
  position: absolute;
  inset: -5px -9px -4px -8px;
  border: 2px solid #c3261a;
  border-radius: 50%;
  transform: rotate(-4deg);
  opacity: 0.85;
}

/* ---------- footer + controls ----------------------------------- */

.foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 calc(var(--gutter) + 20px) calc(clamp(12px, 2vw, 24px) + 16px);
  pointer-events: none;
}
.foot > * { pointer-events: auto; }

.copyright {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.controls { display: flex; gap: 10px; }

.ctl {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 7px 7px;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: rgba(14, 16, 20, 0.55);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}
.ctl:hover { color: var(--ink); border-color: rgba(244, 240, 230, 0.34); }
.ctl-state { color: var(--ink-3); margin-left: 4px; }
.ctl[aria-pressed="true"] .ctl-state { color: var(--tape); }

.ctl-plate {
  position: relative;
  width: 22px;
  height: 30px;
  border-radius: 3px;
  background: linear-gradient(160deg, #f2efe6, #cfcabd);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.4);
}
.ctl-toggle {
  position: absolute;
  left: 7px;
  top: 7px;
  width: 8px;
  height: 16px;
  border-radius: 2px;
  background: #e9e5da;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.ctl-toggle::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  height: 7px;
  bottom: 1px;
  border-radius: 1.5px;
  background: linear-gradient(#cfc9bb, #fbf8f0);
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.25);
  transition: bottom 0.15s ease;
}
[aria-pressed="true"] .ctl-toggle::after { bottom: 8px; }

.ctl-btn { /* opener wall button */
  position: absolute;
  left: 5px;
  top: 9px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ff6a4f, #b8170b 70%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4), inset 0 -1px 1px rgba(0, 0, 0, 0.3);
}
.ctl:active .ctl-btn { transform: scale(0.9); }

/* ---------- entrance -------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) calc(var(--d) * 110ms),
    transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) calc(var(--d) * 110ms);
}
.spec.reveal { transform: translateY(24px) rotate(6deg); }
.is-ready .reveal { opacity: 1; transform: none; }
.is-ready .spec.reveal { transform: rotate(2.4deg); }
.is-ready .handle .tape { animation: tape-slap 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) 0.05s both; }
@keyframes tape-slap {
  from { transform: rotate(-9deg) scale(1.25); opacity: 0; }
  to { transform: rotate(-2.2deg) scale(1); opacity: 1; }
}

.viewfinder, .controls, .copyright { opacity: 0; transition: opacity 1s ease 0.6s; }
.is-ready .viewfinder, .is-ready .controls, .is-ready .copyright { opacity: 1; }

/* poster mode (used to render the share image) */
.is-poster .hero, .is-poster .foot, .is-poster .viewfinder, .is-poster .grain { display: none; }
.is-poster .scrim { background: radial-gradient(130% 100% at 60% 45%, transparent 60%, rgba(0, 0, 0, 0.45) 100%); }

/* ---------- responsive ------------------------------------------ */

@media (max-width: 1180px) {
  .spec { display: none; }
  .hero { grid-template-columns: 1fr; }
}

@media (max-aspect-ratio: 23/20) {
  /* portrait & square-ish: garage on top, copy anchored to bottom */
  .hero {
    align-items: end;
    padding-top: 45vh;
    padding-bottom: calc(var(--gutter) + 92px);
  }
  .scrim {
    background:
      linear-gradient(0deg, rgba(7, 8, 11, 0.97) 0%, rgba(7, 8, 11, 0.9) 34%, rgba(7, 8, 11, 0.35) 55%, rgba(7, 8, 11, 0) 66%),
      radial-gradient(140% 70% at 50% 25%, transparent 50%, rgba(0, 0, 0, 0.5) 100%);
  }
  .copy { max-width: 36rem; }
  .headline { font-size: clamp(2.9rem, 14.2vw, 7rem); }
}

@media (max-width: 560px) {
  :root { --gutter: 20px; }
  .hero { padding-left: 24px; padding-right: 24px; padding-bottom: 104px; }
  .viewfinder { inset: 10px; font-size: 10.5px; }
  .vf-rec { left: 30px; top: 11px; }
  .vf-meta { right: 30px; top: 11px; }
  .vf-corner { width: 18px; height: 18px; }
  .cta { width: 100%; justify-content: center; padding: 18px; font-size: 1.05rem; }
  .actions { gap: 16px; }
  .subscribe { margin: 0 auto; }
  .foot { padding: 0 24px 26px; align-items: center; }
  .copyright { font-size: 10px; max-width: 9em; line-height: 1.4; }
  .ctl { padding: 6px 10px 6px 6px; font-size: 10px; }
  .ctl-plate { width: 18px; height: 26px; }
  .ctl-toggle { left: 5px; top: 5px; }
  .ctl-btn { left: 3px; top: 7px; }
}

@media (max-height: 560px) and (min-aspect-ratio: 23/20) {
  .headline { font-size: clamp(2.6rem, 14vh, 6rem); }
  .lede { font-size: 0.98rem; }
  .spec { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .rec-dot { animation: none; }
  .reveal, .viewfinder, .controls, .copyright { transition: none; }
  .is-ready .handle .tape { animation: none; }
}
