/* Widey — widey.fun
   Inks sampled from the artwork. The page is one red field; the receipt that
   spills out of the car in the illustration keeps going and carries the content. */

@font-face {
  font-family: "Overpass";
  src: url("assets/fonts/overpass.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Overpass Mono";
  src: url("assets/fonts/overpass-mono.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --red: #E53C24;      /* billboard red */
  --paper: #F7DDB8;    /* the receipt */
  --ink: #140C08;      /* the outline */
  --yellow: #FDCC1C;   /* Widey's screen */
  --line: 6px;         /* outline weight; main.js matches it to the artwork's scale */
  --gutter: clamp(16px, 2.6vw, 40px);
  --sans: "Overpass", "Helvetica Neue", Arial, sans-serif;
  --mono: "Overpass Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--red);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.45;
  overflow-x: hidden;
}

img, svg { display: block; }
p, h1, h2, ol, ul, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
[hidden] { display: none !important; }

::selection { background: var(--yellow); color: var(--ink); }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: var(--gutter); top: -80px; z-index: 10;
  padding: 10px 16px; background: var(--paper); border: 3px solid var(--ink); border-radius: 10px;
  font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35em;
  padding: 14px 22px 11px;                 /* Overpass sits high in its box */
  background: var(--yellow); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 14px;
  font: 800 17px/1 var(--sans); letter-spacing: .005em; text-decoration: none; white-space: nowrap;
  cursor: pointer;
  transition: background-color .12s, color .12s;
}
.btn:hover { background: var(--ink); color: var(--yellow); }
.btn:active { transform: translateY(1px); }
.btn .x-logo { width: 1.05em; height: 1.05em; fill: currentColor; transform: translateY(-1.5px); }   /* optical: the label sits high */
.btn-line { background: transparent; }
.btn-line:hover { background: var(--ink); color: var(--paper); }

/* ---------- top bar ---------- */

.top {
  display: flex; align-items: center; gap: 28px;
  padding: 20px var(--gutter);
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  font-weight: 900; font-size: 26px; line-height: 1; letter-spacing: -.01em; text-decoration: none;
}
.brand img { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ink); }
.brand span { padding-top: 5px; }
.top-nav { display: flex; gap: 28px; margin-left: auto; }
.top-nav a {
  padding: 6px 0 2px; font-weight: 700; font-size: 17px; line-height: 1;
  text-decoration: none; border-bottom: 3px solid transparent;
}
.top-nav a:hover { border-bottom-color: var(--ink); }
.top .btn { padding: 11px 18px 8px; }
[tabindex="-1"]:focus { outline: none; }

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

.hero { padding: clamp(12px, 2.2vw, 36px) var(--gutter) clamp(24px, 2.6vw, 40px); }

.hero h1 {
  color: var(--paper);
  font-weight: 900;
  font-size: clamp(3rem, 12.6vw, 5.4rem);
  line-height: .9;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.hero h1 span { display: block; }

.hero-foot {
  display: flex; flex-direction: column; gap: 22px;
  margin-top: clamp(18px, 2vw, 30px);
}
.lede { max-width: 31em; font-size: clamp(1.06rem, 1.45vw, 1.3rem); font-weight: 500; line-height: 1.4; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

@media (min-width: 760px) {
  .hero h1 { font-size: min(8.3vw, 10.4rem); }
  .hero h1 span { white-space: nowrap; }
  .hero-foot { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 40px; }
  .hero-cta { flex-wrap: nowrap; }
}
@media (min-width: 1180px) {
  .hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 4vw; }
  .hero-foot { flex-direction: column; align-items: flex-start; gap: 20px; margin: 0 0 .9vw; max-width: 24em; }
  .hero-cta { flex-wrap: wrap; }
}

/* ---------- the panel: the banner artwork, framed like a comic panel ---------- */

.panel {
  position: relative; z-index: 2;
  border-top: var(--line) solid var(--ink);
  background: #EC573C;
}
.panel-art {
  width: 100%;
  height: max(33.3333vw, 270px);
  object-fit: cover;
  object-position: 90% 50%;               /* when cropped (phones): keep Widey and the receipt */
}
/* the bottom rule of the frame stops where the receipt leaves the picture */
.frame { position: absolute; bottom: 0; height: var(--line); background: var(--ink); }
.frame-l { left: 0; width: var(--exit-l, 30%); }
.frame-r { right: 0; left: var(--exit-r, 56%); }

/* ---------- below the panel: the roll + Widey watching ---------- */

.below { position: relative; z-index: 1; padding-bottom: clamp(56px, 8vw, 120px); }

.roll { animation: feed 1.05s steps(10, end) .3s both; }
@keyframes feed { from { transform: translateY(-170px); } to { transform: none; } }

.feed { width: 100%; height: var(--feed-h, 110px); overflow: visible; }
.feed .sheet { fill: var(--paper); }
.feed .edge, .feed .print { fill: none; stroke: var(--ink); }
.feed .print { stroke-linecap: round; }

.receipt {
  width: var(--col-w, min(520px, 100% - 32px));
  margin-left: var(--col-x, auto);
  margin-right: auto;
  padding: 4px clamp(18px, 5.5%, 34px) 30px;
  background: var(--paper);
  border-inline: var(--line) solid var(--ink);
  font-family: var(--mono);
  font-size: clamp(13.5px, calc(var(--col-w, 440px) / 29), 17px);
  line-height: 1.55;
  font-weight: 500;
  font-variant-ligatures: none;
}

.tear { width: var(--col-w, min(520px, 100% - 32px)); margin-left: var(--col-x, auto); margin-right: auto; }
.tear path { fill: var(--paper); stroke: var(--ink); stroke-width: var(--line); stroke-linejoin: miter; }

/* receipt: header */
.r-head { text-align: center; }
.r-logo { width: 200px; height: 200px; margin: 0 auto 6px; image-rendering: pixelated; }
.r-name {
  font: 900 clamp(2.6rem, 11vw, 3.6rem)/.9 var(--sans); letter-spacing: -.03em;
  padding-top: .12em;
}

/* receipt: dashed separators between blocks */
.r-meta, .r-bill, .r-block, .r-foot {
  margin-top: 22px; padding-top: 20px;
  border-top: 2px dashed var(--ink);
}

.r-meta div { display: flex; justify-content: space-between; gap: 16px; }
.r-meta dd { text-align: right; }

.r-item { display: flex; justify-content: space-between; gap: 16px; font-weight: 700; }
.r-lines { margin: 2px 0 0; padding-left: 2ch; }
.r-lines li { display: flex; align-items: baseline; gap: .7ch; }
.r-lines i { flex: 1; min-width: 2ch; border-bottom: 2px dotted var(--ink); transform: translateY(-.28em); }

.r-total {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  margin-top: 16px; padding: 12px 0 6px;
  border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  font: 900 clamp(1.6rem, 7vw, 2.1rem)/1 var(--sans); letter-spacing: -.02em;
}
.r-note { margin-top: 12px; font-size: .93em; }

.r-block h2 {
  margin-bottom: 10px;
  font: 800 clamp(1.3rem, 5.6vw, 1.55rem)/1.1 var(--sans); letter-spacing: -.015em;
}

.r-ca { font-weight: 700; font-size: 1.12em; line-height: 1.35; overflow-wrap: anywhere; }
.r-ca[data-empty] { font-weight: 500; }
#copy { margin-top: 12px; }
.r-barcode { width: 100%; height: 64px; margin-top: 18px; }
.r-barcode rect { fill: var(--ink); }

.r-steps { counter-reset: step; display: grid; gap: 12px; }
.r-steps li { counter-increment: step; position: relative; padding-left: 3ch; }
.r-steps li::before { content: counter(step) "."; position: absolute; left: 0; font-weight: 700; }
.r-steps strong { font-weight: 700; }

.r-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.r-foot { text-align: center; }
.r-copy { font: 800 1.25rem/1.1 var(--sans); margin-bottom: 4px; }
.r-fine { margin-top: 16px; font-size: .82em; line-height: 1.5; text-align: left; }

/* Widey, parked in the margin, commenting on whatever is being read */
.watcher { display: none; }
@media (min-width: 1040px) {
  .watcher {
    display: block; position: absolute;
    top: calc(var(--feed-h, 110px) + 24px); bottom: clamp(56px, 8vw, 120px);
    left: calc(var(--col-x, 50%) + var(--col-w, 0px)); right: 0;
  }
  .watcher-pin {
    position: sticky; top: max(40px, 50vh - 220px);
    width: min(280px, 70%); margin: 0 auto;
  }
  .watcher img {
    width: 100%; height: auto;
    border: var(--line) solid var(--ink); border-radius: 22% / 22%;
  }
  .caption {
    margin-top: 14px; padding: 12px 16px 9px;
    background: var(--ink); color: var(--paper); border-radius: 10px;
    font-weight: 600; font-size: 18px; line-height: 1.3; text-wrap: pretty;
    transition: opacity .14s;
  }
  .caption.swap { opacity: 0; }
}

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

.bottom {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 18px var(--gutter) 22px;
  border-top: 3px solid var(--ink);
  font-weight: 700; font-size: 15px;
}

@media (max-width: 520px) {
  .top { gap: 16px; }
  .top-x { display: none; }                      /* the hero's "Follow on X" is right below */
  .top-nav { gap: 18px; }
  .top-nav a { font-size: 15px; }
  .brand { font-size: 22px; }
  .brand img { width: 38px; height: 38px; }
  .r-logo { width: 160px; height: 160px; }     /* 200 px bitmap scaled by .8 would blur the dither: crop instead */
  .r-logo { object-fit: none; object-position: 50% 30%; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  .roll { animation: none; }
  .btn, .caption { transition: none; }
}
