/* ==========================================================================
   House Of Splain Readers' Poll
   TEMPORARY LOOK, after Rik's mock-up of the mid-80s Smash Hits readers' poll
   page (source-art/splain-poll-temp-image.png, cut up by tools/cut_art.py).
   Fonts are stored in vendor/fonts (see its README), not loaded from Google.
   ========================================================================== */

@font-face { font-family: 'Barlow Condensed'; font-weight: 400; font-display: swap; src: url('vendor/fonts/barlowcondensed-400.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-display: swap; src: url('vendor/fonts/barlowcondensed-700.woff2') format('woff2'); }
@font-face { font-family: 'Kalam'; font-weight: 700; font-display: swap; src: url('vendor/fonts/kalam-700.ttf') format('truetype'); }

:root {
  --border-grey: #c9c7c3;   /* behind the doodle frame */
  --paper: #ece5dc;         /* sampled from the ruled area */
  --panel: #e3e0d9;         /* the grey left panel */
  --rule: #2b2b2b;
  --ink: #1d1d1d;
  --label: #3b3b3b;
  --biro: #1c3f94;          /* what the answers are "written" in */
  --cut-blue: #3fa9dc;
  --coupon: #afbd5d;
  --red: #e8231e;
  --yellow: #f6c90e;

  --font-label: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-hand: 'Kalam', 'Comic Sans MS', cursive;

  --frame: clamp(14px, 3.4vw, 46px);
}

* { box-sizing: border-box; }

html { background: var(--border-grey); }

body {
  margin: 0;
  padding: clamp(8px, 2vw, 32px) clamp(6px, 2vw, 32px) 24px;
  background: var(--border-grey);
  color: var(--ink);
  font-family: var(--font-label);
  font-size: 18px;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
}

/* ---------- The sheet: doodle border round the paper ---------- */

.sheet {
  max-width: 1180px;
  margin: 0 auto;
  background: var(--paper);
  /* frame.webp is the whole mock-up with the paper blanked; slice = its border
     in source pixels (top 56, right 52, bottom 76, left 68). The masthead
     already carries the top strip, so the frame has no top edge. */
  border-style: solid;
  border-width: 0 var(--frame) calc(var(--frame) * 1.3) calc(var(--frame) * 1.2);
  border-image: url('assets/frame.webp') 56 52 76 68 / 0 var(--frame) calc(var(--frame) * 1.3) calc(var(--frame) * 1.2) round;
}

.masthead { margin: 0; line-height: 0; }
.masthead img { width: 100%; height: auto; display: block; }

.sheet__body {
  display: grid;
  grid-template-columns: minmax(200px, 31%) 4px 1fr;
}

/* ---------- Left panel ---------- */

.blurb {
  background: var(--panel);
  padding: 20px clamp(16px, 2.4vw, 32px) 28px;
  font-size: 19px;
}
.blurb p { margin: 0 0 .8em; }
.blurb__lead {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 26px;
  letter-spacing: .02em;
  color: var(--red);
  transform: rotate(-2deg);
  transform-origin: left center;
}

.cut-line {
  background: repeating-linear-gradient(to bottom, var(--cut-blue) 0 14px, transparent 14px 26px);
  width: 3px;
  margin: 0 auto;
}

/* ---------- Categories ---------- */

.answers { padding: 12px clamp(14px, 2.6vw, 40px) 0; min-width: 0; }

.categories {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px clamp(20px, 4vw, 64px);
}

.cat { min-width: 0; padding-bottom: 14px; border: 0; margin: 0; padding-inline: 0; }
.cat__title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: 17px;
  line-height: 1.15;
  color: var(--label);
  padding: 0;
  margin: 10px 0 2px;
  min-height: 2.3em;
  display: flex;
  align-items: flex-end;
}
.cat__need {
  display: none;
  font-family: var(--font-hand);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--red);
  font-size: 17px;
  margin: 0 0 2px;
}
.cat.is-missing .cat__need { display: block; }
.cat.is-missing .cat__line:first-child { border-bottom-color: var(--red); border-bottom-width: 2px; }

.cat__line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  border-bottom: 1px solid var(--rule);
  height: 42px;
}
.cat__num {
  font-size: 13px;
  color: #8a857c;
  width: 1em;
  flex: none;
}
.cat__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 22px;
  color: var(--biro);
  padding: 8px 0 0;
  height: 41px;
  outline: none;
}
.cat__input::placeholder { color: #a39d93; font-size: 18px; }
.cat__line:focus-within { border-bottom-color: var(--biro); box-shadow: 0 1px 0 var(--biro); }

/* ---------- The cut-out coupon ---------- */

.coupon { position: relative; margin: 18px 0 18px; padding-left: 0; }
/* Sits on the blue cut line, level with the strip, as in the mock-up. */
.coupon__scissors {
  position: absolute;
  left: calc(-1 * clamp(14px, 2.6vw, 40px) - 16px);
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: auto;
}
.coupon__strip {
  position: relative;
  background:
    repeating-linear-gradient(to bottom, transparent 0 29px, rgba(0,0,0,.25) 29px 30px),
    var(--coupon);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.coupon__label {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 18px;
  letter-spacing: .04em;
}
.coupon__name {
  flex: 1 1 220px;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 22px;
  color: var(--biro);
  padding: 6px 2px 0;
  height: 40px;
  outline: none;
}
.coupon__name::placeholder { color: #5f6a2c; font-size: 18px; }
.coupon__name:focus { border-bottom: 2px solid var(--biro); }
.coupon.is-missing .coupon__name { border-bottom: 2px solid var(--red); }

.send-btn {
  font-family: var(--font-label);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 22px;
  letter-spacing: .04em;
  color: var(--yellow);
  background: #111;
  border: 3px solid #111;
  border-radius: 10px 4px 12px 5px;
  padding: 8px 22px 6px;
  cursor: pointer;
  transform: rotate(-2deg);
  box-shadow: 3px 3px 0 var(--red);
  transition: transform .12s, box-shadow .12s;
}
.send-btn:hover { transform: rotate(-2deg) translate(-1px, -1px); box-shadow: 4px 4px 0 var(--red); }
.send-btn:active { transform: rotate(-2deg) translate(2px, 2px); box-shadow: 1px 1px 0 var(--red); }
.send-btn:focus-visible { outline: 3px solid var(--cut-blue); outline-offset: 3px; }
.send-btn[disabled] { opacity: .6; cursor: progress; }

.form-error {
  min-height: 1.4em;
  margin: 8px 0 0;
  color: var(--red);
  font-weight: 700;
}

.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.page-version {
  text-align: center;
  font-size: 13px;
  color: #6f6a62;
  margin: 0;
  padding: 0 0 6px;
}

/* ---------- Thank-you / result ---------- */

.result {
  position: fixed;
  inset: 0;
  background: rgba(30, 30, 30, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}
.result[hidden] { display: none; }
.result__card {
  background: var(--paper);
  max-width: 560px;
  width: 100%;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px 24px 24px;
  border: 4px solid #111;
  box-shadow: 8px 8px 0 var(--cut-blue);
  outline: none;
}
.result__title {
  margin: 0 0 6px;
  font-size: 30px;
  text-transform: uppercase;
  color: var(--red);
  transform: rotate(-1.5deg);
  transform-origin: left center;
}
.result__message { margin: 0 0 12px; }
.result__list h3 {
  margin: 12px 0 2px;
  font-size: 15px;
  text-transform: uppercase;
  color: var(--label);
}
.result__list ul { margin: 0; padding: 0 0 0 1.1em; font-family: var(--font-hand); font-weight: 700; color: var(--biro); font-size: 19px; }
.result__close { margin-top: 18px; }

/* ---------- Narrow screens ---------- */

@media (max-width: 860px) {
  .sheet__body { grid-template-columns: 1fr; }
  .cut-line {
    width: auto;
    height: 3px;
    margin: 0;
    background: repeating-linear-gradient(to right, var(--cut-blue) 0 14px, transparent 14px 26px);
  }
  .blurb { padding-top: 14px; padding-bottom: 14px; font-size: 18px; }
  .coupon__scissors { display: none; }
}

@media (max-width: 620px) {
  body { font-size: 17px; }
  .categories { grid-template-columns: 1fr; }
  .cat__title { min-height: 0; }
  .send-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .001ms !important; }
}
