/* =============================================================================
   COMPONENT: FINALE (eye-test CTA) + COLOPHON (site footer)
   Loud graphics, calm copy: the rays stay low-contrast so the text reads first.
   ============================================================================= */
.finale {
  --pad-b: clamp(56px, 7vw, 96px);   /* memes.css reads this to stand on the edge */
  position: relative;
  isolation: isolate;
  overflow: clip;
  padding-block: var(--sec-pad) var(--pad-b);
  background: var(--c-salmon);
  border-top: var(--b) solid var(--c-ink);
  text-align: center;
}

/* Comic speed-lines bursting from behind the headline */
.finale::before {
  content: "";
  position: absolute;
  inset: -60%;
  z-index: -1;
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgb(255 236 220 / 0.55) 0 7deg, transparent 7deg 18deg);
  -webkit-mask: radial-gradient(closest-side, #000 30%, transparent 78%);
  mask: radial-gradient(closest-side, #000 30%, transparent 78%);
  animation: rays-turn 60s linear infinite;
}

/* ---- Eye test: the closing CTA ------------------------------------------
   One compact card, two panels: the "test chart" (title + banana photo) and
   the quiz (answers, verdict, contact). Picking an answer hue-shifts the
   banana and swaps the verdict line. Behaviour: js/components/eye-test.js */
.eye-test {
  --yellow: #f2c230;
  --green: #2bb79a;
  --purple: #9b5fc0;
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  max-width: 820px;
  margin-inline: auto;
  overflow: hidden;
  background: var(--c-paper);
  border: var(--b) solid var(--c-ink);
  border-radius: var(--r);
  box-shadow: 8px 8px 0 var(--c-ink);
  text-align: left;
}

/* ---- Left: the chart, on graph paper ----------------------------------- */
.eye-test__intro {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: clamp(18px, 3vw, 28px);
  background:
    linear-gradient(rgb(22 19 15 / 0.07) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, rgb(22 19 15 / 0.07) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--c-butter-tint);
  border-right: var(--b) solid var(--c-ink);
  text-align: center;
}

.eye-test__kicker {
  font: 700 var(--t-xs)/1.2 var(--f-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
}

.eye-test__title {
  font: 400 clamp(2.4rem, 1.8rem + 2.6vw, 3.6rem)/0.95 var(--f-display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* The photo is purple; answers shift its hue. It rocks gently while idle
   (paused off screen by data-pause-offscreen on .finale). */
.eye-test__banana {
  width: min(100%, 240px);
  margin-top: 10px;
  filter: hue-rotate(var(--hue, 0deg)) saturate(var(--sat, 1)) brightness(var(--lum, 1)) drop-shadow(3px 4px 0 rgb(22 19 15 / 0.18));
  transform-origin: 50% 80%;
  transition: filter 420ms var(--e-out);
  animation: banana-rock 4s ease-in-out infinite;
}

/* Tuned by eye: CSS hue-rotate isn't a true colour wheel */
.eye-test[data-picked="yellow"] { --hue: 128deg; --sat: 2.2; --lum: 1.45; }
.eye-test[data-picked="green"]  { --hue: 220deg; --sat: 1.2; }

@keyframes banana-rock { 50% { rotate: -4deg; } }

.eye-test__banana.is-wobbling { animation: banana-wobble 560ms var(--e-back), banana-rock 4s ease-in-out 560ms infinite; }
@keyframes banana-wobble { 30% { rotate: -8deg; scale: 1.06; } 60% { rotate: 5deg; } }

/* ---- Right: the quiz --------------------------------------------------- */
.eye-test__quiz { padding: clamp(18px, 3vw, 26px); }

.eye-test__ask {
  font: 700 var(--t-xs)/1.2 var(--f-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eye-test__options { display: grid; gap: 8px; margin-top: 10px; }

/* Each answer: colour label + line, one tappable row */
.eye-opt {
  display: flex;
  width: 100%;
  min-height: 44px;
  text-align: left;
  background: var(--c-paper);
  border: var(--b-thin) solid var(--c-ink);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  transition: translate var(--d-fast) var(--e-out), box-shadow var(--d-fast) var(--e-out), opacity var(--d-mid);
}

.eye-opt__swatch {
  flex: none;
  display: grid;
  align-items: center;
  width: 5.6em;
  padding: 6px 10px;
  background: var(--swatch);
  border-right: var(--b-thin) solid var(--c-ink);
  font: 400 1rem/1 var(--f-display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.eye-opt__text {
  align-self: center;
  padding: 6px 12px;
  font: 400 var(--t-sm)/1.3 var(--f-body);
}

.eye-opt__text b { font-weight: 800; }

[data-pick="yellow"] { --swatch: var(--yellow); }
[data-pick="green"]  { --swatch: var(--green); }
[data-pick="purple"] { --swatch: var(--purple); }
[data-pick="purple"] .eye-opt__swatch { color: #fff; }

@media (hover: hover) {
  .eye-opt:hover { translate: -2px -2px; box-shadow: 5px 5px 0 var(--c-ink); }
}

.eye-opt:active { translate: 2px 2px; box-shadow: 0 0 0 var(--c-ink); }

/* Once picked: chosen row stays raised with a tick, the others step back */
.eye-test[data-picked] .eye-opt[aria-pressed="false"] { opacity: 0.45; }
.eye-opt[aria-pressed="true"] { translate: -2px -2px; box-shadow: 5px 5px 0 var(--c-ink); }
.eye-opt[aria-pressed="true"] .eye-opt__text::after { content: " ✓"; font-weight: 800; }

/* ---- Verdict + contact ------------------------------------------------- */
.eye-test__verdict {
  min-height: 2.7em;
  margin-top: 12px;
  font: 700 var(--t-base)/1.35 var(--f-accent);
}

.eye-test__verdict.is-new { animation: verdict-in 420ms var(--e-out); }
@keyframes verdict-in { from { opacity: 0; translate: 0 6px; } }

.eye-test__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 2px dashed rgb(22 19 15 / 0.3);
}

.eye-test__linkedin { --btn-bg: #fff; }
.eye-test__linkedin img { width: 18px; height: 18px; border-radius: 3px; }

/* The right answer gets a little cheer from the buttons */
.eye-test[data-picked="purple"] .eye-test__cta .btn { animation: cta-hop 520ms var(--e-back) backwards; }
.eye-test[data-picked="purple"] .eye-test__cta .btn:nth-child(2) { animation-delay: 70ms; }
.eye-test[data-picked="purple"] .eye-test__cta .btn:nth-child(3) { animation-delay: 140ms; }
@keyframes cta-hop { 40% { translate: 0 -7px; } }

/* Phones: one column; the chart becomes a slim header (title left, banana right) */
@media (max-width: 760px) {
  .eye-test { grid-template-columns: 1fr; }

  .eye-test__intro {
    grid-template-columns: 1fr auto;
    align-items: center;
    justify-items: start;
    gap: 0 12px;
    padding: 16px 18px;
    border-right: 0;
    border-bottom: var(--b) solid var(--c-ink);
    text-align: left;
  }

  .eye-test__banana { grid-column: 2; grid-row: 1 / span 2; width: min(40vw, 150px); margin: 0; }
  .eye-test__quiz { padding: 16px 18px 18px; }
  .eye-test__cta .btn { flex: 1 1 auto; }
}

/* ---- Colophon: big social tiles, the small print under them ----------- */
.colophon {
  background: var(--c-ink);
  color: var(--c-cream);
}

.colophon__inner {
  display: grid;
  justify-items: center;
  gap: 18px;
  padding-block: clamp(28px, 4vw, 40px);
}

.socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.socials a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px 10px 10px;
  border: var(--b-thin) solid rgb(250 241 220 / 0.22);
  border-radius: var(--r);
  font: 400 clamp(1.1rem, 1rem + 0.4vw, 1.35rem)/1 var(--f-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: translate var(--d-fast) var(--e-out), border-color var(--d-fast), background-color var(--d-fast);
}

.socials img { width: 44px; height: 44px; border-radius: 10px; }

@media (hover: hover) {
  .socials a:hover { translate: 0 -3px; border-color: var(--c-mustard); background: rgb(250 241 220 / 0.06); }
}

.colophon__note {
  font: 400 var(--t-xs)/1.5 var(--f-label);
  text-align: center;
  opacity: 0.7;
}

/* Phones: a tidy 2 × 2 grid of tiles */
@media (max-width: 560px) {
  .colophon__inner { padding-bottom: 84px; }   /* clear of the floating back-to-top */
  .socials { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 10px; }
  .socials a { padding: 8px 12px 8px 8px; gap: 10px; }
  .socials img { width: 36px; height: 36px; }
}

/* ---- Floating back-to-top --------------------------------------------- */
.to-top {
  position: fixed;
  right: clamp(14px, 2.5vw, 28px);
  bottom: clamp(14px, 2.5vw, 28px);
  z-index: 45;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: var(--c-ink);
  background: var(--c-mustard);
  border: var(--b) solid var(--c-ink);
  border-radius: 50%;
  box-shadow: var(--sh-sm);
  opacity: 0;
  visibility: hidden;
  translate: 0 16px;
  transition: opacity var(--d-mid) var(--e-out), translate var(--d-mid) var(--e-back), visibility 0s var(--d-mid), box-shadow var(--d-fast);
}

.to-top.is-shown { opacity: 1; visibility: visible; translate: none; transition-delay: 0s; }
.to-top svg { transition: translate var(--d-mid) var(--e-back); }

@media (hover: hover) {
  .to-top:hover { box-shadow: 5px 5px 0 var(--c-ink); }
  .to-top:hover svg { translate: 0 -3px; }
}

.to-top:active { box-shadow: 0 0 0 var(--c-ink); }

/* ---- Floating résumé (bottom-left): doc icon + label, always visible ---- */
.resume-fab {
  position: fixed;
  left: clamp(14px, 2.5vw, 28px);
  bottom: clamp(14px, 2.5vw, 28px);
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 18px 0 14px;
  color: var(--c-ink);
  background: var(--c-salmon);
  border: var(--b) solid var(--c-ink);
  border-radius: 99px;
  box-shadow: var(--sh-sm);
  font: 700 var(--t-sm)/1 var(--f-body);
  transition: translate var(--d-fast) var(--e-out), box-shadow var(--d-fast) var(--e-out);
  animation: fab-in 600ms var(--e-back) 1s backwards;
}

.resume-fab svg { flex: none; transition: rotate var(--d-mid) var(--e-back); }

@media (hover: hover) {
  .resume-fab:hover { translate: -2px -2px; box-shadow: 5px 5px 0 var(--c-ink); }
  .resume-fab:hover svg { rotate: -10deg; }
}

.resume-fab:active { translate: 2px 2px; box-shadow: 0 0 0 var(--c-ink); }

@keyframes fab-in { from { opacity: 0; translate: 0 24px; } }

/* Phones & tablets: résumé lives in the burger menu instead */
@media (max-width: 980px) {
  .resume-fab { display: none; }
}

/* Out of the way while the menu or a portal is open */
html.has-menu .to-top,
html.has-portal .to-top,
html.has-menu .resume-fab,
html.has-portal .resume-fab { visibility: hidden; opacity: 0; }
