/* ==========================================================================
   Tuisskool Akademie – Brand Updated Whiteboard Theme
   Palette: board white, purple/orange/pink markers, aluminium frame
   Type: Caveat Brush (headings, marker) + Patrick Hand (body, handwriting)
   ========================================================================== */

:root {
  --board: #fbfcfb;
  --ink: #1f2328;
  
  /* Brand Colors from Logo/Banner */
  --blue: #7D44D8;  /* Brand Purple (Replaces old blue) */
  --red: #FF8A3D;   /* Brand Orange (Replaces old red) */
  --green: #FF57A0; /* Brand Pink (Replaces old green) */
  
  --metal: #d3d8dc;
  --metal-d: #8f979e;
  --smudge: rgba(125, 68, 216, 0.08); /* Tinted smudge with new purple */
  --brand-gradient: linear-gradient(90deg, #7D44D8 0%, #FF57A0 100%);
  
  --font-head: "Caveat Brush", "Segoe Print", "Comic Sans MS", cursive;
  --font-body: "Patrick Hand", "Segoe Print", "Comic Sans MS", cursive;
  --frame: 10px;
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.3rem;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 40% at 15% 0%, #fff, transparent 70%),
    radial-gradient(ellipse 60% 30% at 90% 100%, rgba(255, 255, 255, .8), transparent 70%),
    var(--board);
  overflow-x: hidden;
}

/* Aluminium frame around the whole viewport */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 var(--frame) var(--metal),
    inset 0 0 0 calc(var(--frame) + 1px) var(--metal-d),
    inset 0 0 0 calc(var(--frame) + 2px) rgba(255, 255, 255, .8),
    inset 0 0 22px 14px rgba(0, 0, 0, .06);
}

img, svg { max-width: 100%; }
a { color: var(--blue); text-underline-offset: .18em; }
a:hover { color: var(--red); }

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

.skip {
  position: fixed; left: 1rem; top: -4rem; z-index: 200;
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 8px;
}
.skip:focus { top: 1rem; }

h1, h2, h3 { font-family: var(--font-head); font-weight: 400; line-height: 1.05; margin: 0; letter-spacing: .01em; }
p { margin: 0 0 1rem; max-width: 72ch; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.top {
  position: fixed;
  z-index: 40;
  top: var(--frame); left: var(--frame); right: var(--frame);
  height: 62px;
  padding: 0 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(251, 252, 251, .95);
  backdrop-filter: blur(6px);
  /* Added gradient border bottom to match the banner */
  border-bottom: 3px solid transparent;
  border-image: var(--brand-gradient) 1;
}
.logo {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-head); font-size: 1.7rem; color: var(--blue); text-decoration: none;
}
.logo:hover { color: var(--red); }
.logo__img { flex: none; width: 50px; height: 50px; border-radius: 50%; object-fit: contain; }

#site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 1.4rem; }
#site-nav a { text-decoration: none; color: var(--ink); font-size: 1.2rem; padding: .2rem .1rem; }
#site-nav a:hover { color: var(--red); text-decoration: underline wavy var(--red) 2px; }
#site-nav a[aria-current="location"] { color: var(--blue); text-decoration: underline wavy var(--blue) 2px; text-underline-offset: .3em; }
#site-nav .nav-cta {
  border: 2.5px solid var(--red); color: var(--red);
  padding: .15rem .95rem; border-radius: 14px 22px 12px 20px / 20px 12px 22px 14px;
}
#site-nav .nav-cta:hover { background: var(--red); color: #fff; text-decoration: none; }

.burger { display: none; background: none; border: 0; padding: .6rem; cursor: pointer; }
.burger span { display: block; width: 26px; height: 3px; margin: 5px 0; background: var(--ink); border-radius: 3px; transition: transform .2s, opacity .2s; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* --------------------------------------------------------------------------
   Boards (sections)
   -------------------------------------------------------------------------- */
.board {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;
  padding: 7.5rem 0 4.5rem;
  overflow: hidden;
}
.hero { padding-top: 8.5rem; }

.wrap { position: relative; z-index: 1; width: min(1100px, 100% - 3rem); margin-inline: auto; }
.narrow { max-width: 760px; }
.wrap.narrow { width: min(760px, 100% - 3rem); }

.hd { margin-bottom: 1.6rem; }
.hd h2 { font-size: clamp(2.3rem, 5.4vw, 3.8rem); color: var(--blue); }
.underline { display: block; width: 240px; height: 14px; margin-top: .3rem; }
.underline path { fill: none; stroke: var(--red); stroke-width: 4; stroke-linecap: round; }

/* Ghost residue the eraser cleans away */
.ghost {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0;
  background:
    radial-gradient(ellipse 28% 5% at 22% 26%, var(--smudge), transparent 70%),
    radial-gradient(ellipse 34% 4% at 70% 38%, var(--smudge), transparent 70%),
    radial-gradient(ellipse 22% 6% at 40% 62%, var(--smudge), transparent 70%),
    radial-gradient(ellipse 30% 4% at 82% 78%, var(--smudge), transparent 70%),
    radial-gradient(ellipse 26% 5% at 14% 86%, var(--smudge), transparent 70%),
    repeating-linear-gradient(172deg, transparent 0 46px, rgba(125, 68, 216, .03) 46px 48px);
}
.ghost::before, .ghost::after {
  position: absolute; font-family: var(--font-head); color: rgba(125, 68, 216, .08); white-space: nowrap;
}
.ghost::before { content: var(--g1); top: 17%; right: 7%; font-size: clamp(2rem, 6vw, 4.5rem); transform: rotate(-5deg); }
.ghost::after  { content: var(--g2); bottom: 11%; left: 6%; font-size: clamp(1.8rem, 5vw, 3.6rem); transform: rotate(3deg); }
.board:nth-of-type(3n+1) { --g1: "(x + 2)(x + 3)"; --g2: "H₂O"; }
.board:nth-of-type(3n+2) { --g1: "E = mc²";         --g2: "3 × 7 = 21"; }
.board:nth-of-type(3n)   { --g1: "a² + b² = c²";    --g2: "Impaq"; }
.js .ghost { opacity: 1; }
.is-wiping .ghost { animation: clean 1.3s cubic-bezier(.5, .1, .4, 1) forwards; }
@keyframes clean { from { clip-path: inset(0 0 0 -2%); } to { clip-path: inset(0 0 0 102%); } }

/* The eraser */
.wipe { position: absolute; inset: 0; z-index: 5; overflow: hidden; pointer-events: none; }
.eraser { position: absolute; top: var(--sy, 50%); left: -10%; opacity: 0; }
.eraser__body {
  width: 112px; height: 46px;
  transform: translate(-100%, -50%);
  border-radius: 8px 8px 6px 6px;
  background: linear-gradient(#39424f 0 42%, #8aa3bd 42% 100%);
  box-shadow: 0 8px 14px rgba(0, 0, 0, .25), inset 0 2px 0 rgba(255, 255, 255, .25);
}
.is-wiping .eraser { animation: sweep 1.3s cubic-bezier(.5, .1, .4, 1) forwards; }
.is-wiping .eraser__body { animation: scrub .30s ease-in-out 4 alternate; }
@keyframes sweep {
  0%   { left: -2%;  opacity: 1; }
  92%  { opacity: 1; }
  100% { left: 102%; opacity: 0; }
}
@keyframes scrub {
  from { transform: translate(-100%, calc(-50% - 20vh)) rotate(-4deg); }
  to   { transform: translate(-100%, calc(-50% + 20vh)) rotate(4deg); }
}

/* --------------------------------------------------------------------------
   Write animation primitives
   -------------------------------------------------------------------------- */
.u { display: inline-block; }
.wd { display: inline-block; white-space: nowrap; }
.js [data-write]:not(.is-split) { opacity: 0; }
.js .u { opacity: 0; }
.js .is-writing .u {
  animation: ink .35s ease-out forwards;
  animation-delay: calc(var(--d, 0) * 1ms);
}
@keyframes ink {
  from { opacity: 1; clip-path: inset(-20% 100% -20% -10%); }
  to   { opacity: 1; clip-path: inset(-20% -10% -20% -10%); }
}

.js [data-fade] { opacity: 0; }
.js .is-writing [data-fade] { animation: fadein .5s ease-out forwards; animation-delay: calc(var(--d, 0) * 1ms); }
@keyframes fadein { to { opacity: 1; } }

.js .sketch { clip-path: inset(-8px 100% -8px -8px); }
.js .is-writing .sketch { animation: rule .55s ease-out forwards; animation-delay: calc(var(--d, 0) * 1ms); }
@keyframes rule { to { clip-path: inset(-8px -8px -8px -8px); } }

.s { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.js .s { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .is-writing .s { animation: draw .6s ease-in-out forwards; animation-delay: calc(var(--d, 0) * 1ms); }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 2rem; align-items: center; }
.brand { display: block; font-family: var(--font-head); font-size: clamp(3.2rem, 9.5vw, 6.8rem); color: var(--blue); line-height: .95; text-shadow: 2px 2px 0px rgba(0,0,0,0.05); }
.h1sub { display: block; margin-top: .6rem; font-family: var(--font-head); font-size: clamp(1.7rem, 4.2vw, 2.7rem); color: var(--ink); line-height: 1.1; }
.lead { font-size: 1.45rem; color: var(--red); margin-top: 1.2rem; }

.ticks { list-style: none; margin: 0 0 1.6rem; padding: 0; }
.ticks li { display: flex; align-items: center; gap: .6rem; margin-bottom: .35rem; }
.tick { flex: none; width: 28px; height: 28px; }
.tick path { stroke: var(--green); stroke-width: 3.4; }
.ticks--big li { font-size: 1.45rem; margin-bottom: .6rem; }
.ticks--big .tick { width: 34px; height: 34px; }

.cta { display: flex; flex-wrap: wrap; gap: .9rem; }
.btn {
  display: inline-block; text-decoration: none; cursor: pointer;
  font-family: var(--font-head); font-size: 1.45rem; line-height: 1;
  padding: .8rem 1.4rem; border: 3px solid currentColor;
  border-radius: 16px 24px 14px 22px / 22px 14px 24px 16px;
  transition: background .15s, color .15s, transform .15s;
}
.btn--red  { background: var(--red); border-color: var(--red); color: #fff; }
.btn--red:hover  { background: #fff; color: var(--red); }
.btn--blue { background: transparent; color: var(--blue); border-color: var(--blue); }
.btn--blue:hover { background: var(--blue); color: #fff; }

.hero__art { text-align: center; }
.doodle { width: 100%; max-width: 440px; height: auto; }
.doodle .s { stroke-width: 5; }
.c-blue { stroke: var(--blue); } .c-red { stroke: var(--red); } .c-green { stroke: var(--green); } .c-ink { stroke: var(--ink); }
.scribble { font-family: var(--font-head); font-size: 1.7rem; color: var(--ink); transform: rotate(-3deg); margin: .2rem auto 0; }

/* About / notes */
.note { font-family: var(--font-head); font-size: 1.9rem; color: var(--red); transform: rotate(-1.5deg); margin-top: 1.4rem; }

/* --------------------------------------------------------------------------
   Cards, chips, steps
   -------------------------------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 1.6rem; }
.cards--4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card {
  --c: var(--blue);
  padding: 1.3rem 1.5rem 1rem;
  border: 3px solid var(--c);
  border-radius: 14px 24px 12px 22px / 22px 12px 24px 14px;
}
.cards > :nth-child(3n+1) { --c: var(--blue); }
.cards > :nth-child(3n+2) { --c: var(--red); }
.cards > :nth-child(3n)   { --c: var(--green); }
.cards > :nth-child(odd)  { transform: rotate(-.4deg); }
.cards > :nth-child(even) { transform: rotate(.4deg); }
.card h3 { font-size: 1.9rem; color: var(--c); margin-bottom: .5rem; }
.card p:last-child { margin-bottom: .3rem; }
.phase .grade { font-family: var(--font-head); font-size: 2.3rem; line-height: 1; color: var(--c); margin-bottom: .2rem; }
.phase h3 { font-size: 1.5rem; color: var(--ink); }

.chips { list-style: none; margin: 1.4rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .8rem; }
.chip { --c: var(--blue); padding: .25rem 1rem; border: 2.5px solid var(--c); color: var(--c); border-radius: 18px 26px 16px 24px / 24px 16px 26px 18px; }
.chips > :nth-child(3n+2) { --c: var(--red); }
.chips > :nth-child(3n)   { --c: var(--green); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.8rem 1.4rem; }
.num {
  display: inline-grid; place-items: center; width: 3.4rem; height: 3.4rem; margin-bottom: .6rem;
  font-family: var(--font-head); font-size: 2rem; color: var(--red);
  border: 3px solid var(--red); border-radius: 50% 46% 52% 48% / 48% 52% 46% 50%;
}
.step h3 { font-size: 1.6rem; color: var(--blue); margin-bottom: .3rem; }
.step p { font-size: 1.15rem; }

/* --------------------------------------------------------------------------
   FAQ
   -------------------------------------------------------------------------- */
.faq details { border-bottom: 2px dashed var(--metal-d); padding: .8rem 0; }
.faq summary {
  position: relative; display: block; list-style: none; cursor: pointer;
  padding-right: 2.5rem;
  font-family: var(--font-head); font-size: 1.6rem; color: var(--ink); line-height: 1.2;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: .2rem; top: 50%; transform: translateY(-50%);
  color: var(--red); font-size: 2rem; line-height: 1;
}
.faq details[open] summary::after { content: "–"; }
.faq details[open] summary { color: var(--blue); }
.faq details p { margin: .6rem 0 .2rem; }

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */
.intro { margin-bottom: 1.6rem; }
.contact__grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 2.4rem; align-items: start; }
address { font-style: normal; }
address p { margin-bottom: .5rem; }
address a { font-family: var(--font-head); font-size: 1.5rem; }
.hours { margin: 1.2rem 0; max-width: 320px; }
.hours div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1.5px dashed var(--metal-d); padding: .2rem 0; }
.hours dt { color: var(--blue); }
.hours dd { margin: 0; }
.areas { font-size: 1.1rem; color: #3b4148; }

.form { padding: 1.5rem; border: 3px solid var(--blue); border-radius: 16px 26px 14px 24px / 24px 14px 26px 16px; }
.form label { display: block; color: var(--blue); margin-bottom: 1rem; }
.form input, .form select, .form textarea {
  display: block; width: 100%; font: inherit; color: var(--ink);
  background: transparent; border: 0; border-bottom: 3px solid var(--ink);
  padding: .35rem .2rem; border-radius: 0;
}
.form textarea { resize: vertical; min-height: 6rem; background: repeating-linear-gradient(transparent 0 1.9rem, rgba(125, 68, 216, .15) 1.9rem calc(1.9rem + 2px)); line-height: 1.95rem; border-bottom: 3px solid var(--ink); }
.form input:focus, .form select:focus, .form textarea:focus { outline: 0; border-bottom-color: var(--red); box-shadow: 0 3px 0 var(--red); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form .btn { margin-top: .4rem; }
.form .btn[disabled] { opacity: .6; cursor: wait; }
.form-msg { margin: 1rem 0 0; min-height: 1.5em; font-size: 1.2rem; }
.form-msg.is-ok { color: var(--green); }
.form-msg.is-err { color: var(--red); }

.map { margin-top: 2.4rem; border: 3px solid var(--green); border-radius: 14px 24px 12px 22px / 22px 12px 24px 14px; overflow: hidden; line-height: 0; }
.map iframe { width: 100%; height: 300px; border: 0; }

/* --------------------------------------------------------------------------
   Marker tray footer
   -------------------------------------------------------------------------- */
.tray {
  position: relative;
  padding: 2.4rem 0 calc(1.2rem + var(--frame));
  /* Added gradient background to the tray reflecting the brand banner */
  background: linear-gradient(135deg, rgba(125, 68, 216, 0.1), rgba(255, 87, 160, 0.1)), linear-gradient(#e4e8eb, #bfc5ca);
  border-top: 3px solid var(--metal-d);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .8);
  font-size: 1.15rem;
}
.tray p { margin-bottom: .3rem; }
.tray a { color: var(--ink); }
.tray__inner { width: min(1100px, 100% - 3rem); margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.4rem 3rem; }
.tray__brand { font-family: var(--font-head); font-size: 1.9rem; color: var(--blue); }
.tray__copy { width: min(1100px, 100% - 3rem); margin: 1.4rem auto 0; font-size: 1rem; color: #3b4148; }
.markers { position: absolute; top: -26px; right: 8%; display: flex; gap: 14px; }
.m { display: block; width: 74px; height: 22px; border-radius: 11px 5px 5px 11px; box-shadow: 0 3px 4px rgba(0, 0, 0, .25); position: relative; }
.m::before { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 20px; border-radius: 3px 5px 5px 3px; background: rgba(255, 255, 255, .85); }
.m--blue { background: var(--blue); } .m--red { background: var(--red); } .m--green { background: var(--green); } .m--ink { background: var(--ink); }
.markers .m:nth-child(even) { transform: rotate(-3deg); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .burger { display: block; }
  #site-nav {
    position: absolute; left: 0; right: 0; top: 100%;
    background: rgba(251, 252, 251, .98); border-bottom: 2px solid var(--metal);
    max-height: 0; overflow: hidden; transition: max-height .25s ease;
  }
  #site-nav.is-open { max-height: 440px; }
  #site-nav ul { flex-direction: column; align-items: flex-start; gap: .4rem; padding: 1rem 1.4rem 1.4rem; }
  #site-nav a { font-size: 1.4rem; }
}
@media (max-width: 860px) {
  .hero__grid, .contact__grid { grid-template-columns: 1fr; }
  .hero__art { max-width: 340px; margin-inline: auto; }
}
@media (max-width: 600px) {
  :root { --frame: 6px; }
  body { font-size: 1.2rem; }
  .board { padding: 6.5rem 0 3.5rem; }
  .hero { padding-top: 7rem; }
  .top { padding: 0 .8rem; }
  .logo { font-size: 1.45rem; gap: .45rem; }
  .logo__img { width: 42px; height: 42px; }
  .eraser__body { width: 76px; height: 34px; }
  .markers { right: 4%; }
  .m { width: 54px; }
}

/* --------------------------------------------------------------------------
   Reduced motion: show everything, no sweeping
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ghost, .wipe { display: none; }
}