/*
Theme Name: KingWorksheet Pro
Theme URI: https://kingworksheet.com/
Author: KingWorksheet
Description: Warm exercise-book WordPress theme for KingWorksheet — ruled notebook paper, red margin line, Fraunces + Instrument Sans + Caveat typography, Morning Warm-up stamp & confetti, interactive K–5 Worksheet Forge, Royal Road grade explorer, expandable Library Index with floating preview, and Monday Pack signup.
Version: 3.5.0
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kingworksheet
*/

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

:root {
  --paper: #F6EFE0;
  --paper-deep: #EEE4CE;
  --sheet: #FFFCF3;
  --ink: #231C10;
  --ink-2: #4A4030;
  --mut: rgba(35, 28, 16, .62);
  --line: rgba(35, 28, 16, .16);
  --rule: rgba(96, 126, 158, .16);
  --gold: #D99A1B;
  --gold-deep: #8A6106;
  --gold-soft: rgba(217, 154, 27, .16);
  --red: #C7472F;
  --red-soft: rgba(199, 71, 47, .45);
  --green: #2E7D46;
  --f-d: 'Fraunces', Georgia, serif;
  --f-b: 'Instrument Sans', sans-serif;
  --f-h: 'Caveat', cursive;
  --shadow: 0 30px 60px -30px rgba(46, 34, 10, .35);
}

html { scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
  font-family: var(--f-b);
  color: var(--ink);
  background: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 35px, var(--rule) 35px 36px);
  line-height: 1.6;
  overflow-x: hidden;
  isolation: isolate;
}

/* Red exercise-book margin line */
body::before {
  content: '';
  position: fixed;
  left: 64px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--red-soft);
  z-index: -1;
  pointer-events: none;
}

/* Subtle paper grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

::selection { background: var(--gold); color: var(--ink); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
img, svg { display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; color: inherit; }

.container { max-width: 1160px; margin-inline: auto; padding-inline: clamp(20px, 5vw, 48px); }
.crown-ic { width: 1em; height: auto; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 15px;
  padding: 14px 26px;
  border-radius: 999px;
  transition: transform .18s ease, box-shadow .18s ease, background .18s;
  line-height: 1;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn-ink { background: var(--ink); color: var(--sheet); }
.btn-ink:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -12px rgba(35, 28, 16, .5); }
.btn-ink:active { transform: translateY(0); }
.btn-ghost { border: 1.5px solid var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--sheet); transform: translateY(-2px); }
.btn-sm { padding: 10px 18px; font-size: 13.5px; }
.btn-sm svg { width: 15px; height: 15px; }

.icon-btn {
  width: 46px;
  height: 46px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .18s;
}
.icon-btn:hover { background: var(--ink); color: var(--sheet); }
.icon-btn svg { width: 18px; height: 18px; }

@keyframes spinOnce { to { transform: rotate(360deg); } }
.spin svg { animation: spinOnce .55s ease; }

/* Nav */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transition: background .3s, border-color .3s, box-shadow .3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(246, 239, 224, .9);
  backdrop-filter: blur(10px);
  border-color: var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 34px; height: 76px; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-d);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -.01em;
}
.brand .crown-ic { width: 26px; color: var(--gold); }
.brand em { font-style: normal; font-weight: 400; color: var(--ink-2); }

.nav-links { display: flex; gap: 28px; margin-left: 6px; }
.nav-links a { font-size: 14px; font-weight: 500; color: var(--ink-2); position: relative; padding: 4px 0; }
.nav-links a::after { content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--gold); transition: width .25s; }
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { width: 100%; }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.name-field { display: flex; align-items: baseline; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.name-field input {
  border: none;
  background: transparent;
  border-bottom: 2px solid var(--ink);
  width: 110px;
  font-family: var(--f-h);
  font-size: 19px;
  font-weight: 600;
  color: var(--gold-deep);
  padding: 0 4px 1px;
  outline: none;
}
.name-field input::placeholder { color: rgba(35, 28, 16, .35); font-size: 15px; }

.menu-btn {
  display: none;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
}
.menu-btn svg { width: 18px; height: 18px; }

/* Mobile menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 150;
  display: flex;
  flex-direction: column;
  padding: 26px clamp(22px, 7vw, 44px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, visibility .3s;
  background-image: repeating-linear-gradient(to bottom, transparent 0 35px, var(--rule) 35px 36px);
}
body.menu-open .mobile-menu { opacity: 1; visibility: visible; }
body.menu-open { overflow: hidden; }
.mm-top { display: flex; justify-content: space-between; align-items: center; }
.mm-links { margin-top: 8vh; display: flex; flex-direction: column; gap: 6px; }
.mm-links a {
  font-family: var(--f-d);
  font-size: clamp(32px, 8vw, 44px);
  font-weight: 600;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mm-links a svg { width: 22px; height: 22px; color: var(--gold); }
.mm-name { margin-top: auto; padding-top: 30px; }

/* Hero */
.hero { padding-top: 168px; padding-bottom: 70px; }
.hero-grid { display: grid; grid-template-columns: 1.02fr .98fr; gap: 56px; align-items: center; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.kicker .crown-ic { width: 20px; color: var(--gold); }
.hero h1 {
  font-family: var(--f-d);
  font-weight: 600;
  font-size: clamp(46px, 6.2vw, 84px);
  line-height: 1.02;
  letter-spacing: -.02em;
  margin: 22px 0 24px;
}
.royal { position: relative; display: inline-block; font-style: italic; }
.scribble {
  position: absolute;
  left: -3%;
  bottom: -10px;
  width: 106%;
  height: 16px;
  overflow: visible;
}
.scribble path {
  stroke: var(--gold);
  stroke-width: 6;
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}
.reveal.in .scribble path { animation: drawP .9s .55s cubic-bezier(.5, 0, .3, 1) forwards; }
@keyframes drawP { to { stroke-dashoffset: 0; } }

.lede { font-size: 17.5px; color: var(--ink-2); max-width: 520px; }
.circled { position: relative; display: inline-block; padding: 0 3px; white-space: nowrap; }
.circled svg {
  position: absolute;
  inset: -6px -8px;
  width: calc(100% + 16px);
  height: calc(100% + 12px);
  overflow: visible;
  pointer-events: none;
}
.circled ellipse {
  fill: none;
  stroke: var(--red);
  stroke-width: 2;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transform: rotate(-2deg);
  transform-origin: center;
}
.reveal.in .circled ellipse { animation: drawP .8s 1.1s ease forwards; }

.hero-cta { display: flex; align-items: center; gap: 16px; margin-top: 34px; flex-wrap: wrap; position: relative; }
.scribble-note { font-family: var(--f-h); font-size: 19px; font-weight: 600; color: var(--gold-deep); transform: rotate(-2deg); }
.hero-facts { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 0; margin-top: 30px; font-size: 13.5px; font-weight: 600; color: var(--mut); }
.hero-facts .sep { width: 5px; height: 5px; background: var(--gold); transform: rotate(45deg); margin: 0 16px; flex: none; }

/* Paper sheets */
.sheet {
  background: var(--sheet);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background-image:
    linear-gradient(to right, transparent 34px, rgba(199, 71, 47, .38) 34px, rgba(199, 71, 47, .38) 35.5px, transparent 35.5px),
    repeating-linear-gradient(to bottom, transparent 0 27px, rgba(96, 126, 158, .12) 27px 28px);
}
.holes { display: flex; gap: 30px; justify-content: center; padding-top: 12px; }
.hole {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 1.5px 3px rgba(0, 0, 0, .28), 0 1px 0 #fff;
}

/* Hero stage & warm-up card */
.hero-stage { position: relative; min-height: 540px; display: flex; align-items: center; justify-content: center; }
.ghost {
  position: absolute;
  width: 74%;
  height: 82%;
  border: 1px solid var(--line);
  background: var(--sheet);
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, rgba(96, 126, 158, .12) 27px 28px);
  box-shadow: 0 18px 40px -22px rgba(46, 34, 10, .3);
}
.g1 { transform: rotate(6deg) translate(26px, 6px); }
.g1 .grade-mark {
  position: absolute;
  top: 22px;
  right: 26px;
  font-family: var(--f-h);
  font-size: 52px;
  font-weight: 700;
  color: var(--red-soft);
  transform: rotate(8deg);
}
.g2 { transform: rotate(-7deg) translate(-30px, -8px); }
.g2 .star { position: absolute; top: 26px; left: 30px; width: 30px; color: var(--gold); }

.warmup {
  position: relative;
  width: min(430px, 100%);
  padding: 6px 30px 26px 44px;
  transform: rotate(-1.6deg);
  transition: transform .3s, box-shadow .3s;
  z-index: 3;
}
.warmup:hover { transform: rotate(-.6deg) translateY(-4px); }
.wu-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; }
.wu-head h3 { font-family: var(--f-d); font-size: 21px; font-weight: 600; }
.wu-no { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--mut); }
.wu-name { margin-top: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.wu-name .hand {
  font-family: var(--f-h);
  font-size: 20px;
  font-weight: 600;
  color: var(--gold-deep);
  border-bottom: 1.5px dotted var(--line);
  min-width: 130px;
  display: inline-block;
  line-height: 1.1;
  padding: 0 4px;
}
.wu-instr { font-size: 13px; font-style: italic; color: var(--mut); margin-top: 4px; }
.wu-problems { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.wu-p { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 17px; }
.wu-p input {
  width: 100%;
  border: none;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  padding: 2px 0;
  outline: none;
  border-radius: 0;
  transition: border-color .2s, background .2s;
}
.wu-p input:focus { border-color: var(--gold); background: var(--gold-soft); }
.wu-p.ok input { border-color: var(--green); color: var(--green); }
.wu-p.bad input { border-color: var(--red); color: var(--red); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.wu-p.bad { animation: shake .35s ease; }

.wu-actions { display: flex; align-items: center; gap: 16px; margin-top: 20px; }
.wu-new { font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.wu-new:hover { color: var(--gold-deep); }
.wu-note {
  margin-top: 12px;
  font-family: var(--f-h);
  font-size: 21px;
  font-weight: 600;
  color: var(--red);
  min-height: 26px;
  transform: rotate(-1deg);
}
.warmup.passed .wu-check { display: none; }

.stamp {
  position: absolute;
  top: 46%;
  left: 50%;
  width: 172px;
  transform: translate(-50%, -50%) rotate(-14deg);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
  z-index: 4;
}
.stamp .st-ring { fill: none; stroke: var(--red); stroke-width: 3.5; }
.stamp .st-ring.thin { stroke-width: 1.4; }
.stamp .st-txt { fill: var(--red); font-family: var(--f-d); font-weight: 700; font-size: 12.5px; letter-spacing: 3.5px; }
.stamp .st-crown path, .stamp .st-crown rect, .stamp .st-crown circle {
  fill: var(--gold);
  stroke: var(--red);
  stroke-width: .8;
}

@keyframes stampIn {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-30deg) scale(2.6); }
  60% { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(.94); }
  80% { transform: translate(-50%, -50%) rotate(-15deg) scale(1.04); }
  100% { opacity: .95; transform: translate(-50%, -50%) rotate(-14deg) scale(1); }
}
.warmup.passed .stamp { animation: stampIn .65s cubic-bezier(.2, 1.4, .4, 1) forwards; }

/* Marquee */
.marquee { background: var(--ink); color: var(--paper); overflow: hidden; padding: 15px 0; margin-top: 36px; }
.mq-track { display: flex; width: max-content; animation: mq 30s linear infinite; }
.marquee:hover .mq-track { animation-play-state: paused; }
@keyframes mq { to { transform: translateX(-50%); } }
.mq-group { display: flex; align-items: center; gap: 38px; padding-right: 38px; }
.mq-item { font-size: 12.5px; font-weight: 600; letter-spacing: .2em; white-space: nowrap; }
.mq-item.gold { color: var(--gold); }
.mq-crown { width: 15px; flex: none; color: var(--gold); opacity: .9; }

/* Section scaffolding */
section.kw-section { padding-block: clamp(70px, 9vw, 116px); }
.sec-head {
  border-top: 1px solid var(--line);
  padding-top: 26px;
  margin-bottom: 46px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px 60px;
  align-items: end;
}
.sec-kicker { font-size: 12px; font-weight: 700; letter-spacing: .2em; color: var(--gold-deep); display: block; margin-bottom: 12px; }
.sec-head h2 {
  font-family: var(--f-d);
  font-weight: 600;
  font-size: clamp(30px, 3.8vw, 50px);
  line-height: 1.08;
  letter-spacing: -.015em;
  max-width: 560px;
}
.sec-sub { max-width: 400px; color: var(--ink-2); font-size: 15.5px; padding-bottom: 6px; }

/* Forge */
.forge-grid { display: grid; grid-template-columns: 390px 1fr; gap: 60px; align-items: start; }
.ctl-group { border-top: 1px solid var(--line); padding: 20px 0; }
.ctl-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-2);
  display: block;
  margin-bottom: 14px;
}
.seg-row { display: flex; flex-wrap: wrap; gap: 9px; }
.seg { border: 1.5px solid var(--ink); border-radius: 999px; padding: 9px 17px; font-weight: 600; font-size: 14px; transition: all .16s; line-height: 1; }
.seg:hover { transform: translateY(-1.5px); }
.seg.on { background: var(--ink); color: var(--sheet); }
.chip.on { background: var(--gold); border-color: var(--gold); color: var(--ink); }

@keyframes flashSeg {
  0% { background: var(--gold-soft); }
  100% { background: transparent; }
}
.flash { animation: flashSeg 1.1s ease; }

.chk {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 7px 0;
  user-select: none;
}
.chk input { position: absolute; opacity: 0; pointer-events: none; }
.chk .box { width: 19px; height: 19px; border: 1.8px solid var(--ink); border-radius: 4px; position: relative; flex: none; transition: background .15s; }
.chk .box::after {
  content: '';
  position: absolute;
  left: 3.5px;
  top: 4px;
  width: 9px;
  height: 4.5px;
  border-left: 2.2px solid var(--sheet);
  border-bottom: 2.2px solid var(--sheet);
  transform: rotate(-45deg);
  opacity: 0;
}
.chk input:checked + .box { background: var(--ink); }
.chk input:checked + .box::after { opacity: 1; }

.forge-actions { display: flex; align-items: center; gap: 14px; padding-top: 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.seed-note { font-size: 12.5px; color: var(--mut); font-weight: 500; margin-top: 14px; }
.seed-note b { color: var(--gold-deep); }
.sheet-tag { display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 14px; }
.sheet-tag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); animation: pulseDot 1.8s infinite; }
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

.forge-sheet { padding: 6px 36px 24px 48px; transform: rotate(.5deg); }
#sheetBody { margin-top: 8px; }
.sh-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sh-brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-d); font-weight: 600; font-size: 14px; letter-spacing: .02em; }
.sh-brand .crown-ic { width: 18px; color: var(--gold); }
.sh-meta { font-size: 12px; font-weight: 600; color: var(--mut); letter-spacing: .06em; text-transform: uppercase; }
.sh-namedate { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 16px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.sh-namedate .hand {
  font-family: var(--f-h);
  font-size: 20px;
  font-weight: 600;
  color: var(--gold-deep);
  border-bottom: 1.5px dotted var(--line);
  min-width: 150px;
  display: inline-block;
  line-height: 1.1;
  padding: 0 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sh-namedate .dateblank { flex: 1; min-width: 100px; border-bottom: 1.5px dotted var(--line); align-self: flex-end; height: 1.2em; }
.sh-instr { font-size: 13px; font-style: italic; color: var(--mut); margin-top: 10px; }
.sh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 30px; margin-top: 10px; }
.sh-grid.cols-1 { grid-template-columns: 1fr; }
.prob {
  padding: 11px 2px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.45;
  border-bottom: 1px dashed rgba(35, 28, 16, .1);
  break-inside: avoid;
}
.viz { display: block; margin-bottom: 7px; }
.viz .clock, .viz .pie { width: 58px; height: auto; }
.viz .shapes { width: auto; max-width: 132px; height: auto; }
.viz .rectf { width: auto; max-width: 150px; height: auto; }
.blank {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  min-width: 58px;
  height: 25px;
  border-bottom: 2px solid var(--ink);
  padding: 0 6px;
  margin: 0 3px;
  vertical-align: baseline;
}
.wide .blank { min-width: 150px; }
.blank .ans { font-family: var(--f-h); font-size: 20px; font-weight: 600; color: var(--gold-deep); line-height: 1.1; }
.sh-foot {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--mut);
}
.score-blank { display: inline-block; width: 44px; border-bottom: 1.5px solid var(--mut); height: .9em; vertical-align: bottom; }

.clock circle.face { fill: #fff; stroke: var(--ink); stroke-width: 2; }
.clock line { stroke: var(--ink); stroke-width: 1.4; stroke-linecap: round; }
.clock .hand-h { stroke-width: 3; }
.clock .pin { fill: var(--ink); }
.pie path { fill: #fff; stroke: var(--ink); stroke-width: 1.4; }
.pie .shaded { fill: var(--gold); }
.shapes path, .shapes circle, .shapes rect { fill: var(--gold); stroke: rgba(35, 28, 16, .55); stroke-width: 1.2; }
.rectf rect { fill: var(--gold-soft); stroke: var(--ink); stroke-width: 1.6; }
.rectf text { font-family: var(--f-b); font-weight: 700; font-size: 11px; fill: var(--ink-2); }
.fr { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; font-size: 13px; vertical-align: middle; font-weight: 600; }
.fr b { padding: 0 5px 2px; }
.fr i { font-style: normal; border-top: 1.6px solid var(--ink); padding: 2px 5px 0; }

.forge-why { display: flex; flex-wrap: wrap; gap: 8px 0; align-items: center; margin-top: 26px; font-size: 13px; font-weight: 600; color: var(--mut); }
.forge-why svg { width: 15px; height: 15px; color: var(--green); }
.forge-why span { display: inline-flex; align-items: center; gap: 7px; }
.forge-why .sep { width: 5px; height: 5px; background: var(--gold); transform: rotate(45deg); margin: 0 15px; }

/* Royal Road */
.road-track { position: relative; display: flex; justify-content: space-between; margin: 8px 4px 40px; }
.road-line {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 9px;
  height: 2px;
  z-index: 0;
  background-image: repeating-linear-gradient(to right, var(--line) 0 7px, transparent 7px 14px);
}
.road-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gold); transition: width .5s cubic-bezier(.6, 0, .2, 1); }
.rnode { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rdot { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--paper); transition: all .2s; }
.rnode:hover .rdot { transform: scale(1.15); }
.rnode.on .rdot { background: var(--gold); transform: scale(1.2); }
.rlab { font-family: var(--f-d); font-weight: 600; font-size: 17px; }
.rnode.on .rlab { color: var(--gold-deep); }

.road-panel { padding: clamp(28px, 4vw, 46px); transform: rotate(-.4deg); display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; }
.rp-tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 10px; }
.rp-left h3 { font-family: var(--f-d); font-weight: 600; font-size: clamp(24px, 2.6vw, 32px); letter-spacing: -.01em; }
.rp-left p { margin-top: 12px; color: var(--ink-2); font-size: 15.5px; }
.rp-skills { list-style: none; margin-top: 18px; }
.rp-skills li { display: flex; gap: 11px; align-items: flex-start; font-size: 14.5px; font-weight: 600; padding: 5px 0; }
.rp-skills svg { width: 16px; height: 16px; color: var(--green); flex: none; margin-top: 3px; }
.rp-chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 6px; }
.rp-right .rp-btn { margin-top: 24px; }
.rp-swap { animation: rpIn .35s ease; }
@keyframes rpIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* Library Index */
.lib-list { border-bottom: 1px solid var(--line); }
.lib-row {
  border-top: 1px solid var(--line);
  padding: 26px 6px;
  display: grid;
  grid-template-columns: 96px 1fr auto 40px;
  gap: 26px;
  align-items: start;
  cursor: pointer;
  transition: background .2s;
}
.lib-row:hover { background: rgba(255, 252, 243, .75); }
.lib-no {
  font-family: var(--f-d);
  font-style: italic;
  font-weight: 600;
  font-size: 42px;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.3px var(--ink);
  transition: all .25s;
  padding-top: 2px;
}
.lib-row:hover .lib-no { color: var(--gold); -webkit-text-stroke: 1.3px var(--gold); }
.lib-main h3 {
  font-family: var(--f-d);
  font-weight: 600;
  font-size: clamp(22px, 2.4vw, 29px);
  letter-spacing: -.01em;
  transition: transform .25s;
}
.lib-row:hover .lib-main h3 { transform: translateX(6px); }
.lib-main > p { color: var(--ink-2); font-size: 14.5px; max-width: 520px; margin-top: 5px; }
.lib-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding-top: 6px; }
.lib-count { font-family: var(--f-d); font-weight: 600; font-size: 19px; white-space: nowrap; }
.lib-grades { display: flex; gap: 5px; }
.lib-grades span { font-size: 10.5px; font-weight: 700; border: 1px solid var(--line); border-radius: 999px; padding: 2.5px 7px; color: var(--ink-2); }
.lib-chev { padding-top: 12px; color: var(--ink-2); transition: transform .3s; }
.lib-chev svg { width: 19px; height: 19px; }
.lib-row.open .lib-chev { transform: rotate(180deg); }
.lib-more { grid-column: 2 / -1; overflow: hidden; max-height: 0; transition: max-height .45s ease; }
.lib-row.open .lib-more { max-height: 260px; }
.lib-more-in { padding: 6px 0 8px; }
.lib-samples { font-size: 13.5px; color: var(--mut); font-weight: 500; }
.lib-samples b { color: var(--ink-2); font-weight: 600; }
.lib-actions { display: flex; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

#hoverPreview {
  position: fixed;
  z-index: 90;
  width: 232px;
  pointer-events: none;
  opacity: 0;
  transform: scale(.92) rotate(4deg);
  transition: opacity .22s, transform .22s;
  will-change: left, top;
}
#hoverPreview.show { opacity: 1; transform: scale(1) rotate(-2.5deg); }
.hp-card {
  background: var(--sheet);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 22px, rgba(96, 126, 158, .12) 22px 23px);
}
.hp-brand { display: flex; align-items: center; gap: 6px; font-family: var(--f-d); font-weight: 600; font-size: 10.5px; letter-spacing: .03em; }
.hp-brand .crown-ic { width: 12px; color: var(--gold); }
.hp-title { display: flex; align-items: center; gap: 8px; font-family: var(--f-d); font-weight: 600; font-size: 16.5px; margin-top: 9px; }
.hp-title svg { width: 16px; height: 16px; color: var(--gold-deep); }
.hp-line { height: 6px; background: rgba(35, 28, 16, .14); border-radius: 3px; margin-top: 10px; }
.hp-line.short { width: 62%; }
.hp-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.hp-count { font-size: 11px; font-weight: 700; color: var(--mut); }
.hp-mark { font-family: var(--f-h); font-size: 23px; font-weight: 700; color: var(--red); transform: rotate(-4deg); }
@media (hover: none) { #hoverPreview { display: none; } }

/* Quote band & Monday Pack */
.band { background: var(--ink); color: var(--paper); position: relative; overflow: hidden; overflow: clip; padding-block: clamp(70px, 9vw, 116px); }
.band::before { display: none; }
.band .container { position: relative; z-index: 2; }
.band-crown { position: absolute; right: -30px; top: 50%; transform: translateY(-50%); width: min(400px, 42vw); opacity: .22; pointer-events: none; }
.band-crown path { fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.band.in .band-crown path { animation: drawP 1.6s .25s ease forwards; }
.band.in .band-crown path:nth-child(2) { animation-delay: .9s; }
.band-grid { display: grid; grid-template-columns: 1.12fr .88fr; gap: clamp(40px, 6vw, 84px); align-items: center; }

.kw-blockquote {
  font-family: var(--f-d);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.35;
  letter-spacing: -.01em;
  position: relative;
}
.aplus { position: relative; display: inline-block; }
.aplus svg { position: absolute; top: -.55em; right: -1.5em; width: 1.6em; height: 1.6em; overflow: visible; }
.aplus circle { fill: none; stroke: #E2604A; stroke-width: 2.4; stroke-dasharray: 100; stroke-dashoffset: 100; }
.band.in .aplus circle { animation: drawP .7s 1.3s ease forwards; }
.aplus tspan, .aplus-text { font-family: var(--f-h); font-weight: 700; font-size: 30px; fill: #E2604A; }

.kw-cite {
  display: block;
  margin-top: 26px;
  font-style: normal;
  font-family: var(--f-b);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .16em;
  color: rgba(246, 239, 224, .6);
}

.mp-card { position: relative; color: var(--ink); padding: 34px 34px 30px; transform: rotate(1.4deg); border: 1px solid var(--line); }
.tape { position: absolute; width: 88px; height: 26px; background: rgba(233, 221, 186, .85); box-shadow: 0 2px 5px rgba(0, 0, 0, .12); top: -13px; }
.tape.tl { left: 26px; transform: rotate(-6deg); }
.tape.tr { right: 26px; transform: rotate(5deg); }
.mp-card h3 { font-family: var(--f-d); font-weight: 600; font-size: 25px; }
.mp-card > p { font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.mp-row { display: flex; gap: 12px; margin-top: 20px; align-items: flex-end; }
.mp-row input { flex: 1; border: none; border-bottom: 2px solid var(--ink); background: transparent; font-size: 16px; font-weight: 600; padding: 7px 2px; outline: none; border-radius: 0; }
.mp-row input:focus { border-color: var(--gold); }
.mp-note { margin-top: 12px; font-family: var(--f-h); font-size: 18px; font-weight: 600; color: var(--red); min-height: 22px; }
.mp-done { display: none; align-items: center; gap: 10px; margin-top: 20px; font-weight: 600; font-size: 15px; color: var(--green); }
.mp-done svg { width: 19px; height: 19px; }
.mp-card.done form { display: none; }
.mp-card.done .mp-done { display: flex; }

@keyframes shake2 {
  0%, 100% { transform: rotate(1.4deg) translateX(0); }
  25% { transform: rotate(1.4deg) translateX(-6px); }
  75% { transform: rotate(1.4deg) translateX(6px); }
}
.mp-card.err { animation: shake2 .35s ease; }

/* Footer */
footer.kw-footer {
  background: var(--paper-deep);
  border-top: 1px solid var(--line);
  padding: 70px 0 36px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 35px, rgba(96, 126, 158, .1) 35px 36px);
}
.foot-grid { display: grid; grid-template-columns: 1.4fr repeat(3, auto); gap: clamp(30px, 5vw, 90px); }
.foot-brand .brand { font-size: 26px; }
.foot-brand .brand .crown-ic { width: 30px; }
.foot-tag {
  margin-top: 14px;
  font-family: var(--f-h);
  font-size: 21px;
  font-weight: 600;
  color: var(--gold-deep);
  transform: rotate(-1deg);
  display: inline-block;
}
.foot-col h4 { font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--mut); margin-bottom: 16px; }
.foot-col a, .foot-col button {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  padding: 5px 0;
  color: var(--ink-2);
  text-align: left;
  transition: color .15s;
}
.foot-col a:hover, .foot-col button:hover { color: var(--gold-deep); text-decoration: underline; text-underline-offset: 3px; }
.foot-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 54px;
  padding-top: 24px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mut);
}
.to-top { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--ink-2); }
.to-top svg { width: 15px; height: 15px; }
.to-top:hover { color: var(--gold-deep); }

/* Toasts & confetti */
#toasts {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  width: min(94vw, 480px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--ink);
  color: var(--paper);
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translateY(16px);
  transition: all .35s cubic-bezier(.2, .9, .3, 1.2);
  max-width: 100%;
}
.toast.show { opacity: 1; transform: none; }
.toast svg { width: 17px; height: 17px; color: var(--gold); flex: none; }

#confettiLayer { position: fixed; inset: 0; pointer-events: none; z-index: 250; overflow: hidden; }
.cf { position: absolute; will-change: transform; }
.cf-bar { width: 5px; height: 12px; border-radius: 2px; }
.cf-dot { width: 7px; height: 7px; border-radius: 50%; }
.cf-tri { width: 11px; height: 11px; clip-path: polygon(50% 0, 100% 100%, 0 100%); }

/* Reveal */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }

/* Print */
#printArea { display: none; }
@media print {
  @page { size: A4; margin: 14mm 16mm; }
  html, body { background: #fff !important; }
  body > *:not(#printArea) { display: none !important; }
  body::before, body::after { display: none !important; }
  #printArea { display: block; }
  .psheet { font-family: var(--f-b); color: #000; max-width: 176mm; margin: 0 auto; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .psheet .sh-top { font-size: 11pt; }
  .psheet .sh-namedate { font-size: 11pt; margin-top: 6mm; }
  .psheet .sh-instr { font-size: 10pt; margin-top: 3mm; }
  .psheet .sh-grid { gap: 1mm 8mm; margin-top: 3mm; }
  .psheet .prob { font-size: 13pt; min-height: 11mm; padding: 3mm 1mm; border-bottom: 1px dashed #ddd; }
  .psheet .blank { min-width: 16mm; }
  .psheet .wide .blank { min-width: 44mm; }
  .psheet .ans { color: #7A5606; font-size: 14pt; }
  .psheet .viz { margin-bottom: 2mm; }
  .psheet .viz .clock, .psheet .viz .pie { width: 16mm; }
  .psheet .viz .shapes { max-width: 38mm; }
  .psheet .viz .rectf { max-width: 42mm; }
  .psheet .sh-foot { font-size: 9pt; margin-top: 5mm; }
  .psheet .score-blank { width: 12mm; }
}

/* Responsive */
@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero { padding-top: 140px; }
  .hero-stage { min-height: auto; padding: 20px 0 30px; }
  .forge-grid { grid-template-columns: 1fr; gap: 44px; }
  .band-grid { grid-template-columns: 1fr; gap: 56px; }
  .road-panel { grid-template-columns: 1fr; gap: 26px; }
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 36px; }
  .foot-brand { grid-column: 1 / -1; }
}
@media (max-width: 920px) {
  .nav-links { display: none; }
  .menu-btn { display: inline-flex; }
  body::before { left: 18px; opacity: .4; }
}
@media (max-width: 760px) {
  .nav .name-field { display: none; }
  .nav .btn { display: none; }
  .lib-row { grid-template-columns: 56px 1fr 32px; gap: 16px; }
  .lib-no { font-size: 30px; }
  .lib-meta { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; }
  .lib-chev { grid-row: 1; grid-column: 3; }
  .lib-more { grid-column: 1 / -1; }
  .road-track { overflow-x: auto; gap: 26px; justify-content: flex-start; padding-bottom: 8px; }
  .road-line { left: 10px; right: 10px; }
  .hero-cta .scribble-note { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
  .mq-track { animation: none; }
}

/* WooCommerce Cart & Slide-Over Drawer */
.kw-cart-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: var(--sheet);
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
.kw-cart-btn:hover {
  background: var(--ink);
  color: var(--sheet);
  transform: translateY(-1px);
}
.kw-cart-btn svg { width: 18px; height: 18px; }
.kw-cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.kw-cart-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(35, 28, 16, .38);
  backdrop-filter: blur(3px);
  z-index: 210;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.kw-cart-backdrop.open { opacity: 1; visibility: visible; }

.kw-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 92vw);
  z-index: 220;
  padding: 24px 26px 28px;
  display: flex;
  flex-direction: column;
  transform: translateX(104%);
  transition: transform .32s cubic-bezier(.2, .8, .2, 1);
  border-left: 1px solid var(--line);
}
.kw-cart-drawer.open { transform: translateX(0); }

.kw-cd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.kw-cd-head h3 { font-family: var(--f-d); font-size: 22px; font-weight: 600; }

.kw-cd-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kw-cd-empty {
  color: var(--ink-2);
  font-size: 14.5px;
  padding: 20px 0;
}
.kw-cd-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(246, 239, 224, .55);
}
.kw-cd-item-title { font-weight: 600; font-size: 14.5px; }
.kw-cd-item-meta { font-size: 12.5px; color: var(--mut); }
.kw-cd-foot {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kw-cd-total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 16px;
}
.kw-cd-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* WooCommerce Shop, Product, Cart & Checkout Layout Integration */
.woocommerce-page .kw-wc-wrap {
  padding-top: 118px;
  padding-bottom: 96px;
}

.woocommerce-page .kw-wc-card {
  padding: 28px 34px 34px;
}

.woocommerce .woocommerce-breadcrumb {
  font-size: 13px;
  font-weight: 600;
  color: var(--mut);
  margin-bottom: 14px;
}
.woocommerce .woocommerce-breadcrumb a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.woocommerce-products-header__title.page-title {
  font-family: var(--f-d);
  font-weight: 600;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.1;
  margin-bottom: 18px;
}

.woocommerce .woocommerce-notices-wrapper {
  margin-bottom: 18px;
}

.woocommerce .kw-wc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.woocommerce .woocommerce-result-count {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

.woocommerce .woocommerce-ordering select {
  border: 1.5px solid var(--ink);
  background: var(--sheet);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--f-b);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.woocommerce ul.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
  display: none;
  content: none;
}

.woocommerce ul.products li.product {
  position: relative;
  margin: 0 !important;
  width: 100% !important;
  float: none !important;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 14px 30px -24px rgba(46, 34, 10, .35);
}

.woocommerce ul.products li.product .onsale,
.woocommerce span.onsale {
  position: absolute;
  top: 12px;
  left: 12px;
  min-height: 0;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--red);
  color: var(--sheet);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  z-index: 2;
}

.woocommerce ul.products li.product a img {
  width: 100%;
  height: 210px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 14px;
  background: var(--paper-deep);
}

.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product h2 {
  font-family: var(--f-d);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 8px;
}

.woocommerce ul.products li.product .price,
.woocommerce div.product p.price {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
}

.woocommerce ul.products li.product .price del,
.woocommerce div.product p.price del {
  color: var(--mut);
  font-weight: 500;
  margin-right: 6px;
}

.woocommerce ul.products li.product .price ins,
.woocommerce div.product p.price ins {
  text-decoration: none;
  color: var(--gold-deep);
}

.woocommerce ul.products li.product .button,
.woocommerce #respond input#submit,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ink);
  color: var(--sheet);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 10px 18px;
  font-family: var(--f-b);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}

.woocommerce ul.products li.product .button:hover,
.woocommerce #respond input#submit:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover {
  background: var(--gold-deep);
  border-color: var(--gold-deep);
  color: var(--sheet);
  transform: translateY(-1px);
}

.woocommerce ul.products li.product .added_to_cart {
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Single product & cart/checkout tables */
.woocommerce div.product .product_title {
  font-family: var(--f-d);
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.15;
  margin-bottom: 10px;
}

.woocommerce div.product form.cart .quantity .qty {
  width: 68px;
  height: 40px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--sheet);
  text-align: center;
  font-weight: 700;
  margin-right: 10px;
}

.woocommerce table.shop_table {
  width: 100%;
  border-collapse: collapse;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
}

.woocommerce table.shop_table th,
.woocommerce table.shop_table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

/* Admin bar offset for fixed header */
body.admin-bar .nav {
  top: 32px;
}
@media screen and (max-width: 782px) {
  body.admin-bar .nav {
    top: 46px;
  }
}

/* Clear fixed header (76px) + breathing room on WooCommerce pages */
.woocommerce-page .kw-wc-wrap {
  padding-top: 124px;
  padding-bottom: 96px;
}
body.admin-bar.woocommerce-page .kw-wc-wrap {
  padding-top: 156px;
}

.woocommerce-page .kw-wc-card {
  padding: 32px 36px 38px;
}

/* Prevent oversized or uncontained images in shop/single product */
.woocommerce div.product div.images {
  max-width: 420px;
}
.woocommerce div.product div.images img {
  width: 100%;
  max-width: 420px;
  height: auto;
  border-radius: 8px;
}

/* Keep sale badge neatly positioned without overlapping adjacent text */
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link {
  position: relative;
  display: block;
}
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link .onsale {
  top: 10px;
  right: 10px;
  left: auto;
}

.nav {
  z-index: 120;
}
body.admin-bar .nav {
  top: 32px;
}
@media screen and (max-width: 782px) {
  body.admin-bar .nav {
    top: 46px;
  }
}

.woocommerce-page .kw-wc-wrap {
  padding-top: 148px;
  padding-bottom: 96px;
}
body.admin-bar.woocommerce-page .kw-wc-wrap {
  padding-top: 180px;
}

.woocommerce .kw-wc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

/* WordPress Customizer Menu Integration in Header */
.nav-links ul {
  list-style: none;
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
}
.nav-links li {
  display: inline-flex;
  align-items: center;
}
.nav-links li.current-menu-item > a,
.nav-links li.current_page_item > a {
  color: var(--ink);
}
.nav-links li.current-menu-item > a::after,
.nav-links li.current_page_item > a::after {
  width: 100%;
}

/* Guarantee cart drawer never peeks onto screen when closed */
.kw-cart-drawer:not(.open) {
  transform: translateX(110%);
  visibility: hidden;
  pointer-events: none;
}
.kw-cart-drawer.open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

/* Single-line header menu so longer Customizer menus never wrap with a vertical gap */
.nav-inner {
  gap: 20px;
}
.nav-links,
.nav-links ul {
  list-style: none;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 18px;
  margin: 0;
  padding: 0;
}
.nav-links li {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.nav-links a {
  font-size: 13px;
  white-space: nowrap;
}
.nav-right {
  gap: 12px;
  flex-shrink: 0;
}

/* Extra top clearance on WooCommerce pages so "Shop" never touches the fixed header */
.woocommerce-page .kw-wc-wrap {
  padding-top: 168px;
  padding-bottom: 96px;
}
body.admin-bar.woocommerce-page .kw-wc-wrap {
  padding-top: 200px;
}

/* Balanced outer margin & inner exercise-book margin/padding for Shop & WooCommerce pages */
.woocommerce-page .kw-wc-wrap {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 172px;
  padding-bottom: 96px;
}
body.admin-bar.woocommerce-page .kw-wc-wrap {
  padding-top: 204px;
}

.woocommerce-page .kw-wc-card {
  margin: 0 auto;
  padding: 34px 40px 40px 52px;
  border-radius: 6px;
}

.woocommerce-page .woocommerce-products-header,
.woocommerce-page .woocommerce-breadcrumb,
.woocommerce-page .kw-wc-toolbar,
.woocommerce-page ul.products {
  margin-left: 0;
  margin-right: 0;
}

@media (max-width: 760px) {
  .woocommerce-page .kw-wc-wrap {
    padding-top: 148px;
    padding-bottom: 72px;
  }
  body.admin-bar.woocommerce-page .kw-wc-wrap {
    padding-top: 180px;
  }
  .woocommerce-page .kw-wc-card {
    padding: 24px 20px 28px 26px;
  }
}

/* Blend WooCommerce shop into the notebook background & ensure generous clearance below fixed nav */
.woocommerce-page .kw-wc-section,
.woocommerce-page .kw-wc-wrap,
.woocommerce-page .kw-wc-card,
.woocommerce-page .kw-wc-body {
  background: transparent !important;
  background-image: none !important;
  border: none !important;
  box-shadow: none !important;
}

.woocommerce-page .kw-wc-section {
  padding-top: 156px;
  padding-bottom: 96px;
}
body.admin-bar.woocommerce-page .kw-wc-section {
  padding-top: 188px;
}

.woocommerce-page .kw-wc-wrap {
  padding-top: 0;
  padding-bottom: 0;
}

.woocommerce-page .kw-wc-card,
.woocommerce-page .kw-wc-body {
  padding: 0;
  margin: 0;
}

/* Keep top nav single-line cleanly */
.nav-links,
.nav-links ul {
  flex-wrap: nowrap !important;
  gap: 16px !important;
}
.nav-links a {
  font-size: 13px !important;
  white-space: nowrap !important;
}

@media (max-width: 760px) {
  .woocommerce-page .kw-wc-section {
    padding-top: 132px;
    padding-bottom: 72px;
  }
  body.admin-bar.woocommerce-page .kw-wc-section {
    padding-top: 164px;
  }
}

/* Blog Archive & Single Post Alignment (blends with ruled notebook paper) */
.kw-blog-section {
  padding-top: 168px;
  padding-bottom: 96px;
  background: transparent;
}
body.admin-bar .kw-blog-section {
  padding-top: 200px;
}

.kw-blog-wrap {
  max-width: 920px;
}

.kw-blog-section .sec-head h1 {
  font-family: var(--f-d);
  font-weight: 600;
  font-size: clamp(34px, 4.2vw, 52px);
  line-height: 1.08;
  letter-spacing: -.015em;
  color: var(--ink);
}

.kw-blog-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.kw-blog-item {
  padding: 24px 0 28px;
  border-bottom: 1px solid var(--line);
}

.kw-blog-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mut);
  margin-bottom: 8px;
}

.kw-blog-cat {
  color: var(--gold-deep);
}

.kw-blog-title {
  font-family: var(--f-d);
  font-weight: 600;
  font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1.2;
  margin-bottom: 10px;
}
.kw-blog-title a:hover {
  color: var(--gold-deep);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.kw-blog-excerpt p,
.kw-single-content p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-2);
  margin-bottom: 14px;
}

.kw-blog-excerpt ul,
.kw-blog-excerpt ol,
.kw-single-content ul,
.kw-single-content ol {
  margin: 12px 0 18px 24px;
  padding-left: 10px;
  list-style-position: outside;
  color: var(--ink-2);
}

.kw-blog-excerpt li,
.kw-single-content li {
  margin-bottom: 6px;
  padding-left: 4px;
}

.kw-blog-read {
  margin-top: 6px;
}

.kw-single-title {
  font-family: var(--f-d);
  font-weight: 600;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.12;
  margin-bottom: 20px;
}

.kw-single-back {
  margin-top: 32px;
}

.kw-blog-pagination {
  margin-top: 36px;
}
.kw-blog-pagination ul {
  list-style: none;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
}
.kw-blog-pagination a,
.kw-blog-pagination span.current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  font-weight: 600;
  font-size: 13.5px;
}
.kw-blog-pagination span.current {
  background: var(--ink);
  color: var(--sheet);
}

/* WooCommerce My Account link in header */
.kw-account-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  padding: 8px 13px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--sheet);
  white-space: nowrap;
  transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
}
.kw-account-link:hover {
  background: var(--ink);
  color: var(--sheet);
  border-color: var(--ink);
  transform: translateY(-1px);
}
.kw-account-link svg {
  width: 15px;
  height: 15px;
}

/* Blog Archive Tiles (Columns & Rows) */
.kw-blog-wrap-wide {
  max-width: 1160px;
}

.kw-blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.kw-blog-tile {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 16px 32px -24px rgba(46, 34, 10, .35);
}

.kw-blog-thumb img {
  width: 100%;
  height: 190px;
  object-fit: cover;
}

.kw-blog-tile-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.kw-blog-tile .kw-blog-title {
  font-size: 21px;
  line-height: 1.25;
}

.kw-blog-tile .kw-blog-excerpt {
  flex: 1;
}

@media (max-width: 980px) {
  .kw-blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .kw-blog-grid {
    grid-template-columns: 1fr;
  }
  .kw-account-link span {
    display: none;
  }
}

/* Clickable Header Cart Link */
.kw-cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--sheet);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
.kw-cart-link:hover {
  background: var(--ink);
  color: var(--sheet);
  transform: translateY(-1px);
}
.kw-cart-link svg {
  width: 16px;
  height: 16px;
}
.kw-cart-link .kw-cart-badge {
  position: static;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  line-height: 15px;
  font-size: 11px;
}

/* Blog Cards Grid (matching reference card layout) */
.kw-blog-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}

.kw-story-card {
  border-radius: 14px;
  overflow: hidden;
  background: #EAF2FC;
  box-shadow: 0 12px 28px -20px rgba(24, 39, 75, .22);
  display: flex;
  flex-direction: column;
}

.kw-story-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--paper-deep);
}

.kw-story-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.kw-story-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #EEE4CE, #D9C8A6);
}

.kw-story-body {
  padding: 20px 22px 24px;
  background: #EAF2FC;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.kw-story-title {
  font-family: var(--f-b);
  font-weight: 700;
  font-size: 21px;
  line-height: 1.25;
  color: #1F2430;
}

.kw-story-title a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.kw-story-meta {
  font-family: var(--f-b);
  font-size: 12px;
  font-weight: 500;
  color: #5C7FA6;
  margin: 0;
}

@media (max-width: 960px) {
  .kw-blog-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .kw-blog-cards-grid {
    grid-template-columns: 1fr;
  }
  .kw-cart-link span:not(.kw-cart-badge) {
    display: none;
  }
}

/* Standard Pages & WooCommerce Cart / Checkout / My Account Pages */
.kw-page-section {
  padding-top: 164px;
  padding-bottom: 96px;
  background: transparent;
}
body.admin-bar .kw-page-section {
  padding-top: 196px;
}

.kw-page-section .sec-head h1 {
  font-family: var(--f-d);
  font-weight: 600;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.1;
  color: var(--ink);
}

.kw-page-content {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-2);
}
.kw-page-content p {
  margin-bottom: 16px;
}

/* WooCommerce My Account Navigation & Forms */
.woocommerce-account .woocommerce-MyAccount-navigation ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 28px;
  padding: 0;
}
.woocommerce-account .woocommerce-MyAccount-navigation li a {
  display: inline-flex;
  align-items: center;
  padding: 9px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--sheet);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}
.woocommerce-account .woocommerce-MyAccount-navigation li.is-active a,
.woocommerce-account .woocommerce-MyAccount-navigation li a:hover {
  background: var(--ink);
  color: var(--sheet);
}

.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--f-b);
  font-size: 15px;
}

/* Force 3-Column x Row Card Grid on Blog Archive (cache-busted v3.1.0) */
.kw-blog-section .kw-blog-wrap-wide {
  max-width: 1160px !important;
  width: 100% !important;
}

.kw-blog-section .kw-blog-cards-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 28px !important;
  width: 100% !important;
  align-items: stretch !important;
}

.kw-blog-section .kw-story-card {
  display: flex !important;
  flex-direction: column !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  background: #EAF2FC !important;
  border: 1px solid rgba(35, 28, 16, .08) !important;
  box-shadow: 0 12px 28px -18px rgba(24, 39, 75, .22) !important;
  margin: 0 !important;
  width: 100% !important;
  transition: transform .2s ease, box-shadow .2s ease !important;
}

.kw-blog-section .kw-story-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 18px 34px -18px rgba(24, 39, 75, .3) !important;
}

.kw-blog-section .kw-story-img {
  display: block !important;
  width: 100% !important;
  aspect-ratio: 16 / 10 !important;
  overflow: hidden !important;
  background: var(--paper-deep) !important;
  margin: 0 !important;
}

.kw-blog-section .kw-story-img img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 0 !important;
  margin: 0 !important;
}

.kw-blog-section .kw-story-body {
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  flex: 1 !important;
  padding: 20px 22px 22px !important;
  background: #EAF2FC !important;
  gap: 10px !important;
}

.kw-blog-section .kw-story-title {
  font-family: var(--f-b) !important;
  font-weight: 700 !important;
  font-size: 20px !important;
  line-height: 1.28 !important;
  color: #1F2430 !important;
  margin: 0 !important;
}

.kw-blog-section .kw-story-meta {
  font-family: var(--f-b) !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  color: #5C7FA6 !important;
  margin: 0 !important;
}

@media (max-width: 960px) {
  .kw-blog-section .kw-blog-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  .kw-blog-section .kw-blog-cards-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Astra & Spectra Block Editor Compatibility */
.wp-block-group.alignfull,
.wp-block-uagb-container.alignfull {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.wp-block-group.alignwide,
.wp-block-uagb-container.alignwide {
  max-width: 1160px;
  margin-inline: auto;
}

.kw-page-content .wp-block-button__link,
.kw-page-content .uagb-buttons-repeater {
  border-radius: 999px;
  font-family: var(--f-b);
  font-weight: 600;
}

/* Seamless Notebook Blend for Block Editor / Spectra Homepage Content */
.kw-editor-front {
  padding-top: 108px;
  padding-bottom: 84px;
  background: transparent;
}
body.admin-bar .kw-editor-front {
  padding-top: 140px;
}

.kw-editor-front .wp-block-group,
.kw-editor-front .wp-block-cover,
.kw-editor-front .wp-block-uagb-container {
  background-color: transparent;
}
