/* ============================================================
   EDUCATION FIRST PAYROLL LTD — notepad version
   Loaded after styles.css by notepad.html only. Everything
   between the hero and the footer is one yellow legal pad;
   text writes itself in, notes pop on, pen marks draw.
   ============================================================ */

/* ─── The pad ────────────────────────────────────────────── */

/* Every line of text sits on a --rule grid so the handwriting
   lands on the printed lines; notepad.js tops up section
   heights so the grid never drifts. */
.pad {
  --rule: 44px;
  --ink: #0f2152;
  --pen: #24479c;
  --red: #c8352a;
  /* marker colours chosen to stay clear and bright on yellow paper */
  --hl-pink: rgba(255, 105, 170, 0.55);
  --hl-green: rgba(105, 215, 95, 0.6);
  --hl-aqua: rgba(80, 200, 240, 0.55);
  --hl-orange: rgba(255, 140, 50, 0.55);
  position: relative;
  /* own block context, so the last section's line-snapping margin
     stays inside the pad instead of leaking out as a gap */
  display: flow-root;
  overflow: hidden;
  overflow: clip;
  color: var(--pen);
  background-color: #f9e48a;
  background-image:
    radial-gradient(ellipse 70% 60% at 45% 30%, rgba(255, 252, 225, 0.35), transparent 70%),
    linear-gradient(90deg, rgba(150, 110, 20, 0.07), transparent 12%, transparent 88%, rgba(150, 110, 20, 0.08)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .32 0 0 0 0 .08 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, transparent calc(var(--rule) - 1px), rgba(64, 132, 222, 0.55) calc(var(--rule) - 1px));
  background-size: 100% 100vh, 100% 100%, 220px 220px, 100% var(--rule);
  background-repeat: repeat-y, no-repeat, repeat, repeat;
  background-position: 0 0, 0 0, 0 0, 0 calc(var(--rule) * -0.26);
}

/* red double margin line */
.pad::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: max(12px, calc(50% - var(--wrap) / 2 + 16px));
  width: 5px;
  border-inline: 1px solid rgba(214, 72, 62, 0.55);
  pointer-events: none;
}

/* perforation holes under the binding */
.pad::after {
  content: "";
  position: absolute;
  inset: 22px 0 auto;
  height: 4px;
  background: radial-gradient(circle, rgba(120, 90, 20, 0.22) 1.2px, transparent 1.8px) 0 50% / 9px 4px repeat-x;
  pointer-events: none;
}

.pad-binding { z-index: 5; }

.pad-sec { position: relative; padding: var(--rule) 0; }

.pad-sec[id],
#faq { scroll-margin-top: var(--header-h); }

/* handwriting everywhere on the pad */
.pad h2,
.pad h3,
.pad p,
.pad li,
.pad .faq-q {
  font-family: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  letter-spacing: 0;
}

.pad p,
.pad li { font-size: 1.55rem; font-weight: 500; line-height: var(--rule); }

.pad h2 {
  color: var(--ink);
  font-size: clamp(2.4rem, 3.6vw, 3.1rem);
  font-weight: 700;
  line-height: var(--rule);
}

.pad a { color: var(--ink); text-underline-offset: 4px; }

.ink-red { color: var(--red); }

.pad-label {
  color: var(--red);
  font-weight: 700 !important;
  font-size: 1.6rem !important;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
}

.pad-split {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: var(--rule) clamp(32px, 6vw, 96px);
  align-items: start;
}

/* Section titles: a fuller marker stroke behind each line */
/* Thinner and lower than the text box, so on two-line titles each
   line gets its own stroke instead of the two merging. */
.hl-title .mark {
  padding: 0 0.22em;
  margin: 0 -0.22em;
  background-position: 0 86%;
}

@keyframes mark-title { to { background-size: 100% 40%; } }

@supports (animation-timeline: view()) {
  .hl-title .mark { animation-name: mark-title; animation-range: cover 10% cover 40%; }
}

@supports not (animation-timeline: view()) {
  .hl-title .mark.is-marked { background-size: 100% 40%; }
}

/* ─── Motto ──────────────────────────────────────────────── */

.pad-motto { padding-top: calc(var(--rule) * 3); text-align: center; }

.pad-sec:last-child { padding-bottom: calc(var(--rule) * 3); }

.motto-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.35em;
  color: var(--ink);
  font-size: clamp(3rem, 8vw, 6rem) !important;
  font-weight: 700 !important;
  line-height: calc(var(--rule) * 2) !important;
}

.motto-last { position: relative; display: inline-block; }

.motto-swash {
  position: absolute;
  left: 2%;
  bottom: -6px;
  width: 96%;
  height: 20px;
  color: var(--red);
}

/* ─── About us: one big sticky note ──────────────────────── */

.pad .postit.about-note {
  width: min(100%, 820px);
  min-height: 0;
  margin: var(--rule) auto 0;
  padding: 48px clamp(24px, 5vw, 64px) 40px;
  text-align: center;
}

.pad .postit.about-note p { font-size: clamp(1.55rem, 2.2vw, 1.85rem); line-height: 1.4; color: var(--ink); }

/* ─── One centred column (Why us) ────────────────────────── */

.pad-one { display: flex; flex-direction: column; align-items: center; text-align: center; }

.pad-one .w { margin-inline: auto; }

.pad-one h2.hl-title:not(.w) { align-items: center; }

.pad-one .report { width: min(100%, 760px); margin: var(--rule) auto 0; text-align: left; }

.pad-one .btn-ink { margin-top: calc(var(--rule) * 1.5); }

/* Typed on a loop by notepad.js: letters are spans that switch on */
.js .motto-line .ch { opacity: 0; }
.motto-line .ch.on { opacity: 1; }

.caret {
  display: inline-block;
  width: 3px;
  height: 0.75em;
  margin-left: 3px;
  border-radius: 2px;
  background: currentColor;
  vertical-align: -0.04em;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.motto-swash path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.motto-swash.on path { stroke-dashoffset: 0; transition: stroke-dashoffset 0.5s ease-out; }
html:not(.js) .motto-swash path { stroke-dashoffset: 0; }

/* ─── What we do ─────────────────────────────────────────── */

.pad-list { margin: 0; padding: 0; list-style: none; }

.pad-list li { position: relative; padding-left: 30px; }

.pad-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: calc(var(--rule) * 0.48);
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--pen);
  transform: rotate(-4deg);
}

.pad-list h3 {
  color: var(--ink);
  font-size: clamp(1.75rem, 2.4vw, 2.05rem);
  font-weight: 700;
  line-height: var(--rule);
}

/* ─── How it works: sticky notes ─────────────────────────── */

.postits {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  margin: var(--rule) 0 0;
  padding: 0;
  list-style: none;
}

.postit {
  position: relative;
  min-height: 200px;
  padding: 26px 20px 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 45%), var(--c);
  color: #2a3350;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08), 0 14px 18px -12px rgba(70, 50, 0, 0.45);
  transform: rotate(var(--r));
}

/* the slightly darker adhesive strip */
.postit::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 26px;
  background: rgba(0, 0, 0, 0.035);
}

.pad .postit p,
.pad .postit h3 { line-height: 1.15; }

.pi-num { display: block; color: var(--red); font: 700 2.2rem/1 "Caveat", cursive; }

.pad .postit h3 { margin: 8px 0 6px; color: var(--ink); font-size: 1.85rem; font-weight: 700; }

.pad .postit p { font-size: 1.35rem; }

.pad-note {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: var(--rule);
  font-size: 1.6rem !important;
  transform: rotate(-2deg);
}

.pad-note svg { width: 54px; height: 26px; }

/* ─── Why us: taped report card ──────────────────────────── */

.pad .report { margin-top: 12px; }

.pad .report .rp-comment,
.pad .report .rp-foot p { line-height: 1.15; }

.tape {
  position: absolute;
  z-index: 2;
  top: -16px;
  width: 112px;
  height: 32px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  -webkit-mask: linear-gradient(90deg, transparent 2px, #000 3px calc(100% - 3px), transparent calc(100% - 2px));
  mask: linear-gradient(90deg, transparent 2px, #000 3px calc(100% - 3px), transparent calc(100% - 2px));
}

.tape-l { left: 14%; transform: rotate(-6deg); }
.tape-r { right: 12%; transform: rotate(5deg); }

/* hand-drawn outline button */
.btn-ink {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: var(--rule);
  padding: 8px 26px 10px;
  border: 2px solid var(--ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  color: var(--ink);
  font: 700 1.5rem/1 "Caveat", cursive;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.btn-ink svg { width: 18px; height: 18px; }

.btn-ink:hover { background: var(--ink); color: #f9e48a; }

/* ─── FAQ: questions written on the lines ────────────────── */

.pad .faq { display: block; max-width: none; margin-top: var(--rule); }

.pad .faq-item { border: 0; border-radius: 0; background: none; box-shadow: none; }

.pad .faq-q {
  padding: 0;
  gap: 16px;
  color: var(--ink);
  font-size: clamp(1.4rem, 2vw, 1.65rem);
  font-weight: 700;
  line-height: var(--rule);
}

.pad .faq-icon { width: 22px; height: 22px; background: none; }

.pad .faq-icon::before,
.pad .faq-icon::after { width: 14px; height: 2.5px; margin: -1.25px 0 0 -7px; background: var(--red); }

.pad .faq-item.is-open .faq-icon { background: none; }

.pad .faq-item.is-open .faq-icon::before,
.pad .faq-item.is-open .faq-icon::after { background: var(--red); }

.pad .faq-a p { padding: 0 0 0 18px; font-size: 1.4rem; }

/* ─── Contact: clipped index card ────────────────────────── */

/* FAQ and form share this section half and half */
#contact .pad-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.pad-details { margin: var(--rule) 0 0; padding: 0; list-style: none; }

.pd-k { color: var(--red); font-weight: 700; margin-right: 6px; }

.pad .index-card {
  position: relative;
  padding: 58px clamp(22px, 3.4vw, 40px) 30px;
  border: 0;
  border-radius: 3px;
  background:
    linear-gradient(180deg, transparent 46px, rgba(214, 72, 62, 0.5) 46px 48px, transparent 48px) 0 0 / 100% 100% no-repeat,
    repeating-linear-gradient(180deg, transparent 0 35px, rgba(64, 132, 222, 0.28) 35px 36px) 0 48px / 100% calc(100% - 48px) no-repeat,
    #fffef8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 24px 40px -22px rgba(70, 50, 0, 0.5);
  transform: rotate(var(--r));
}

.clip {
  position: absolute;
  top: -30px;
  right: 46px;
  width: 26px;
  height: 72px;
  color: #8d97a8;
  filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, 0.2));
}

.pad .form-card h3 { color: var(--ink); font-size: 2.1rem; line-height: 1; margin-top: -40px; }

.pad .form-card > p,
.pad .form-card #form-wrap > p { font-size: 1.2rem; line-height: 1.3; }

.pad .field label { color: #5a6b8f; font: 600 1.25rem/1.2 "Caveat", cursive; }

.pad .field label .opt { color: #8a96ad; }

.pad .field input,
.pad .field select,
.pad .field textarea {
  padding: 2px 4px 6px;
  border: 0;
  border-bottom: 2px solid rgba(22, 40, 94, 0.3);
  border-radius: 0;
  background-color: transparent;
  color: var(--pen);
  font: 500 1.45rem/1.3 "Caveat", cursive;
  box-shadow: none;
}

.pad .field textarea {
  border: 2px solid rgba(22, 40, 94, 0.25);
  border-radius: 8px 14px 10px 12px;
  padding: 8px 12px;
}

.pad .field input:focus,
.pad .field select:focus,
.pad .field textarea:focus {
  border-color: var(--pen);
  background-color: rgba(64, 132, 222, 0.06);
  box-shadow: none;
}

.pad .field input::placeholder,
.pad .field textarea::placeholder { color: #a3aec4; }

.pad .field.has-error input,
.pad .field.has-error select,
.pad .field.has-error textarea { border-color: var(--red); }

.pad .field-error { font: 600 1.15rem/1.2 "Caveat", cursive; }

.pad .consent span { font: 500 1.2rem/1.3 "Caveat", cursive; }

.pad .form-note { font: 500 1.15rem/1.2 "Caveat", cursive; }

.pad .form-status { font: 600 1.2rem/1.3 "Caveat", cursive; }

.pad .btn-primary {
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  background: var(--ink);
  font: 700 1.5rem/1 "Caveat", cursive;
  box-shadow: 3px 4px 0 rgba(22, 40, 94, 0.22);
}

.pad .btn-primary:hover { transform: translate(-1px, -2px); box-shadow: 4px 6px 0 rgba(22, 40, 94, 0.22); filter: none; }

.pad .form-success h3 { margin-top: 0; }

/* ─── Writing, popping and drawing ───────────────────────── */

/* Writing: a soft-edged mask sweeps left to right, like a pen. */
/* Padding (cancelled by negative margin) makes the mask box big
   enough for the handwriting's loops and tails, which overhang
   the text box; without it they get clipped. */
.w {
  display: block;
  width: fit-content;
  max-width: calc(100% + 0.7em);
  padding: 0 0.35em;
  margin: 0 -0.35em;
}

/* Big headings also overhang above and below their line. Their
   line spans sit in a flex column so the negative margins can't
   collapse together and open up gaps between lines. */
.pad h2.w,
.pad h2 .w { padding-block: 0.4em; margin-block: -0.4em; }

.pad h2.hl-title:not(.w) { display: flex; flex-direction: column; align-items: flex-start; }


.js .w {
  -webkit-mask: linear-gradient(90deg, #000 70%, transparent) 0 0 / 0% 100% no-repeat;
  mask: linear-gradient(90deg, #000 70%, transparent) 0 0 / 0% 100% no-repeat;
}

.js .w.is-in { animation: write var(--dur, 1s) cubic-bezier(0.45, 0.1, 0.6, 1) var(--d, 0s) forwards; }

/* finished: drop the mask entirely (notepad.js adds is-done) */
.js .w.is-done { -webkit-mask: none; mask: none; animation: none; }

@keyframes write {
  to { -webkit-mask-size: 145% 100%; mask-size: 145% 100%; }
}

/* Popping: notes and cards land with a little bounce */
.js .pop { opacity: 0; transform: translate3d(0, 28px, 0) rotate(var(--r, 0deg)) scale(0.9); }

.js .pop.is-in {
  opacity: 1;
  transform: rotate(var(--r, 0deg));
  transition: opacity 0.3s ease var(--d, 0s), transform 0.65s cubic-bezier(0.3, 1.5, 0.5, 1) var(--d, 0s);
}

/* Sticky notes: slapped onto the page. Each swings down from its
   sticky strip (top edge), taps the paper, flutters and settles.
   Only transform and opacity animate, so it stays on the GPU. */
.js .postit.pop {
  opacity: 0;
  transform-origin: 50% 0;
  transform: perspective(900px) translate3d(0, -36px, 40px) rotateX(-32deg) rotate(calc(var(--r, 0deg) + 6deg)) scale(1.04);
  will-change: transform, opacity;
}

.js .postit.pop.is-in {
  transition: none;
  animation: stick 0.95s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0s) both;
}

.js .postit.pop.is-stuck { will-change: auto; }

@keyframes stick {
  0% { opacity: 0; transform: perspective(900px) translate3d(0, -36px, 40px) rotateX(-32deg) rotate(calc(var(--r, 0deg) + 6deg)) scale(1.04); }
  30% { opacity: 1; }
  48% { transform: perspective(900px) translate3d(0, 3px, 0) rotateX(5deg) rotate(calc(var(--r, 0deg) - 1deg)) scale(0.99); }
  70% { transform: perspective(900px) translate3d(0, -2px, 0) rotateX(-2deg) rotate(calc(var(--r, 0deg) + 0.4deg)) scale(1.004); }
  86% { transform: perspective(900px) translate3d(0, 0.5px, 0) rotateX(0.6deg) rotate(var(--r, 0deg)) scale(1); }
  100% { opacity: 1; transform: perspective(900px) translate3d(0, 0, 0) rotateX(0deg) rotate(var(--r, 0deg)) scale(1); }
}

/* Drawing: SVG pen strokes */
.js .draw path { stroke-dasharray: 1; stroke-dashoffset: 1; }

.js .draw.is-in path { stroke-dashoffset: 0; transition: stroke-dashoffset var(--dur, 0.7s) ease-out var(--d, 0s); }

/* Page turn at the top of the pad (sheet hinges under the binding) */
.pad-motto .pad-flip { inset: 16px 0 auto; height: 100vh; z-index: 4; }

.pad-motto.is-flipped .pad-flip span { animation: page-turn 0.95s cubic-bezier(0.5, 0.05, 0.4, 1) forwards; }
.pad-motto.is-flipped .pad-flip span::after { animation: page-shade 0.95s ease-in forwards; }

/* ─── Responsive ─────────────────────────────────────────── */

@media (max-width: 980px) {
  .pad-split,
  #contact .pad-split { grid-template-columns: 1fr; }
  .postits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .pad::before { left: 10px; }
  .pad .wrap { padding-left: 34px; }
  .pad-flip span::before { left: 10px; }
  .postits { grid-template-columns: 1fr; gap: 22px; }
  .postit { min-height: 0; }
  .pad-note { justify-content: flex-start; }
  .btn-ink { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .js .postit.pop { opacity: 1; transform: rotate(var(--r, 0deg)); animation: none; }
  .js .motto-line .ch { opacity: 1; }
  .motto-swash path { stroke-dashoffset: 0; }
  .caret { display: none; }
  .hl-title .mark { background-size: 100% 40%; }
  .js .w { -webkit-mask: none; mask: none; }
  .js .pop { opacity: 1; transform: rotate(var(--r, 0deg)); }
  .js .draw path { stroke-dashoffset: 0; }
  .pad-flip { display: none; }
}

/* ─── Footer: the closing line's highlight in handwriting ── */

.notepad ~ .site-footer .footer-big .gold {
  display: inline-block;
  font-family: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  font-size: 1.32em;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.9;
  transform: rotate(-2deg);
  transform-origin: left center;
}
