/* ═══════════════════════════════════════════════════════════════
   KENPAI.CSS  —  Shared Stylesheet v1.0
   Used by: index.html · courses.html · about.html
            checkout.html · dashboard.html
   All page-specific overrides go at the BOTTOM of each HTML file
   inside a <style> tag (not here).
═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   1. DESIGN TOKENS  (CSS Custom Properties)
───────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:    #0e0e0e;
  --bg2:   #141414;
  --bg3:   #1a1a1a;
  --card:  #161616;

  /* Borders */
  --border:  #252525;
  --border2: #2e2e2e;

  /* Text */
  --text:  #e8e8e8;
  --sub:   #a0a0a0;
  --muted: #606060;
  --white: #f5f5f5;

  /* Brand Colours */
  --gold:   #c9a84c;
  --teal:   #4a9eba;
  --purple: #8b6fd4;
  --green:  #4caf7d;
  --red:    #e05c5c;

  /* Typography */
  --ser: 'Instrument Serif', Georgia, serif;
  --san: 'Inter', system-ui, sans-serif;

  /* Spacing */
  --section-pad: 84px 6%;
  --inner-max: 1100px;

  /* Transitions */
  --t-fast: 0.18s ease;
  --t-med:  0.28s ease;
}

/* ─────────────────────────────────────────────
   2. RESET & BASE
───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background:  var(--bg);
  color:       var(--text);
  font-family: var(--san);
  font-size:   15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: var(--san);
}

img, video, iframe {
  display: block;
  max-width: 100%;
}

/* Scrollbar */
::-webkit-scrollbar               { width: 5px; }
::-webkit-scrollbar-track         { background: var(--bg); }
::-webkit-scrollbar-thumb         { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover   { background: var(--muted); }

/* ─────────────────────────────────────────────
   3. LOADING OVERLAY  (page-level + form-level)
───────────────────────────────────────────── */
#kenpai-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#kenpai-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-logo {
  animation: loader-pulse 1.6s ease-in-out infinite;
}
.loader-logo svg {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}

.loader-wordmark {
  font-family: var(--ser);
  font-size: 1.1rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.loader-dots {
  display: flex;
  gap: 7px;
}
.loader-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border2);
  animation: loader-dot-bounce 1.2s ease-in-out infinite;
}
.loader-dots span:nth-child(2) { animation-delay: 0.18s; }
.loader-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes loader-pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.97); }
  50%       { opacity: 1;   transform: scale(1); }
}
@keyframes loader-dot-bounce {
  0%, 80%, 100% { transform: translateY(0);    background: var(--border2); }
  40%           { transform: translateY(-6px); background: var(--gold); }
}

/* Inline / section loader (smaller, used inside panels) */
.section-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
  gap: 8px;
}
.section-loader span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border2);
  animation: loader-dot-bounce 1.2s ease-in-out infinite;
}
.section-loader span:nth-child(2) { animation-delay: 0.18s; }
.section-loader span:nth-child(3) { animation-delay: 0.36s; }

/* ─────────────────────────────────────────────
   4. TOAST NOTIFICATIONS
───────────────────────────────────────────── */
#kenpai-toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.k-toast {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 9px;
  padding: 12px 18px;
  font-size: 0.82rem;
  color: var(--text);
  max-width: 320px;
  pointer-events: auto;
  transform: translateY(16px);
  opacity: 0;
  animation: toast-in 0.3s var(--t-fast) forwards;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.k-toast.success { border-left: 3px solid var(--green); }
.k-toast.error   { border-left: 3px solid var(--red); }
.k-toast.info    { border-left: 3px solid var(--teal); }
.k-toast.fade-out {
  animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
  to { transform: translateY(0); opacity: 1; }
}
@keyframes toast-out {
  to { transform: translateY(8px); opacity: 0; }
}

/* ─────────────────────────────────────────────
   5. NAVIGATION  (shared public nav)
───────────────────────────────────────────── */
nav.kp-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6%;
  background: rgba(14,14,14,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* data-kp-logo: JS injects SVG into these spans — must be sized in every context */
[data-kp-logo] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 0;
}
[data-kp-logo] svg { display: block; width: 100%; height: 100%; }

/* Nav */
.nav-logo [data-kp-logo],
.nav-logo svg {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
}
.nav-wordmark {
  font-family: var(--ser);
  font-size: 1.15rem;
  color: var(--white);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}
.nav-links a {
  font-size: 0.82rem;
  color: var(--sub);
  letter-spacing: 0.02em;
  transition: color var(--t-fast);
}
.nav-links a:hover { color: var(--text); }

.nav-cta {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--white);
  border: 1px solid var(--border2);
  padding: 8px 20px;
  border-radius: 6px;
  transition: border-color var(--t-fast), color var(--t-fast);
}
.nav-cta:hover { border-color: var(--gold); color: var(--gold); }

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  z-index: 200;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--sub);
  border-radius: 2px;
  transition: all 0.3s;
}
.nav-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.nav-drawer {
  display: none;
  position: fixed;
  top: 64px; left: 0; right: 0;
  background: rgba(14,14,14,0.98);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 20px 6%;
  flex-direction: column;
  gap: 0;
  z-index: 99;
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
  font-size: 0.9rem;
  color: var(--sub);
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  transition: color var(--t-fast);
}
.nav-drawer a:last-child { border-bottom: none; }
.nav-drawer a:hover { color: var(--text); }

/* ─────────────────────────────────────────────
   6. FOOTER  (shared public footer)
───────────────────────────────────────────── */
footer.kp-footer {
  background: var(--bg);
  padding: 48px 6% 26px;
}
.footer-inner {
  max-width: var(--inner-max);
  margin: 0 auto;
}
.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.footer-logo-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}
.footer-logo-row [data-kp-logo],
.footer-logo-row svg { width: 28px; height: 28px; border-radius: 7px; overflow: hidden; }
.footer-name { font-family: var(--ser); font-size: 0.98rem; color: var(--white); }
.footer-tagline {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 230px;
}
.footer-col-head {
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.footer-col-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-col-links a {
  font-size: 0.78rem;
  color: var(--muted);
  transition: color var(--t-fast);
}
.footer-col-links a:hover { color: var(--sub); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-copy  { font-size: 0.74rem; color: var(--muted); }
.footer-kanji { font-size: 1.05rem; color: var(--border2); letter-spacing: 6px; }

/* ─────────────────────────────────────────────
   7. SECTION LAYOUT UTILITIES
───────────────────────────────────────────── */
section.kp-section {
  padding: var(--section-pad);
  border-bottom: 1px solid var(--border);
}
.inner {
  max-width: var(--inner-max);
  margin: 0 auto;
}
.eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.heading {
  font-family: var(--ser);
  font-size: clamp(1.7rem, 2.5vw, 2.2rem);
  font-weight: 400;
  line-height: 1.25;
  color: var(--white);
  margin-bottom: 12px;
}
.lead {
  font-size: 0.9rem;
  color: var(--sub);
  font-weight: 300;
  line-height: 1.8;
  max-width: 480px;
}

/* ─────────────────────────────────────────────
   8. BUTTONS  (shared button types)
───────────────────────────────────────────── */
.btn-main {
  display: inline-flex;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--white);
  background: var(--bg3);
  border: 1px solid var(--border2);
  padding: 11px 26px;
  border-radius: 6px;
  transition: border-color var(--t-fast), color var(--t-fast);
  cursor: pointer;
}
.btn-main:hover { border-color: var(--teal); color: var(--teal); }

.btn-ghost {
  font-size: 0.84rem;
  color: var(--sub);
  transition: color var(--t-fast);
  background: none;
  border: none;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); }

.btn-submit {
  width: 100%;
  margin-top: 6px;
  padding: 11px;
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--san);
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.btn-submit:hover  { border-color: var(--teal); color: var(--teal); }
.btn-submit:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-enroll {
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--sub);
  border: 1px solid var(--border2);
  padding: 7px 15px;
  border-radius: 5px;
  transition: all var(--t-fast);
  display: inline-flex;
  align-items: center;
}
.btn-enroll:hover               { border-color: var(--teal);   color: var(--teal); }
.btn-enroll.gold-hover:hover    { border-color: var(--gold);   color: var(--gold); }
.btn-enroll.purple-hover:hover  { border-color: var(--purple); color: var(--purple); }

.btn-sm {
  font-size: 0.73rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 5px;
  border: 1px solid var(--border2);
  color: var(--sub);
  background: none;
  transition: border-color var(--t-fast), color var(--t-fast);
  cursor: pointer;
}
.btn-sm:hover    { border-color: var(--teal); color: var(--teal); }
.btn-sm:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-sm.primary  { background: var(--gold); color: #111; border-color: var(--gold); }
.btn-sm.primary:hover { opacity: 0.85; color: #111; border-color: var(--gold); }

.btn-bundle {
  font-size: 0.81rem;
  font-weight: 500;
  color: #111;
  background: var(--gold);
  padding: 10px 20px;
  border-radius: 6px;
  border: none;
  transition: opacity var(--t-fast);
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.btn-bundle:hover         { opacity: 0.86; }
.btn-bundle.purple        { background: var(--purple); color: var(--white); }
.btn-bundle.purple:hover  { opacity: 0.86; }

/* ─────────────────────────────────────────────
   9. FORM ELEMENTS
───────────────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 13px;
  color: var(--text);
  font-family: var(--san);
  font-size: 0.86rem;
  outline: none;
  transition: border-color var(--t-fast);
  -webkit-appearance: none;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--muted); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus  { border-color: var(--teal); }
.form-group select option   { background: var(--bg2); }
.form-group textarea        { resize: vertical; min-height: 100px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-title {
  font-family: var(--ser);
  font-size: 1.15rem;
  color: var(--white);
  margin-bottom: 24px;
}
.form-error {
  font-size: 0.78rem;
  color: var(--red);
  margin-top: 10px;
  display: none;
}
.form-success {
  text-align: center;
  padding: 32px 0;
  display: none;
}
.form-success-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}
.form-success-title {
  font-family: var(--ser);
  font-size: 1.1rem;
  color: var(--white);
  margin-bottom: 8px;
}
.form-success-text {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ─────────────────────────────────────────────
   10. CARDS (generic shared)
───────────────────────────────────────────── */
.kp-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px 22px;
  transition: background var(--t-fast);
}
.kp-card:hover { background: var(--bg3); }

/* Progress bar */
.progress-bar-wrap {
  background: var(--border);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--gold);
  transition: width 0.5s ease;
}

/* Status / Role pills */
.pill {
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}
.pill.active    { color: var(--green);  background: rgba(76,175,125,0.1); }
.pill.pending   { color: var(--gold);   background: rgba(201,168,76,0.1); }
.pill.paused    { color: var(--muted);  background: var(--bg3); }
.pill.done      { color: var(--teal);   background: rgba(74,158,186,0.1); }
.pill.admin     { color: var(--gold);   border: 1px solid rgba(201,168,76,0.3); }
.pill.student   { color: var(--teal);   border: 1px solid rgba(74,158,186,0.3); }

/* Track colour tags — plain coloured text, no background, no pill */
.track-tag {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.track-tag.young  { color: var(--green); }
.track-tag.python { color: var(--teal); }
.track-tag.ai     { color: var(--purple); }
.track-tag.bundle { color: var(--gold); }

/* Section header block */
.section-head   { margin-bottom: 18px; }
.section-title  { font-family: var(--ser); font-size: 1.15rem; color: var(--white); margin-bottom: 4px; }
.section-sub    { font-size: 0.78rem; color: var(--muted); }

/* ─────────────────────────────────────────────
   11. LOGO SVG  (inline, reusable via JS)
───────────────────────────────────────────── */
/* Logo is injected via JS snippet in kenpai.js, not hardcoded. */

/* ─────────────────────────────────────────────
   12. PAGE-LOAD ANIMATION  (content reveal)
───────────────────────────────────────────── */
.kp-fade-in {
  opacity: 0;
  transform: translateY(12px);
  animation: kp-fade-up 0.5s ease forwards;
}
.kp-fade-in.d1 { animation-delay: 0.05s; }
.kp-fade-in.d2 { animation-delay: 0.12s; }
.kp-fade-in.d3 { animation-delay: 0.20s; }
.kp-fade-in.d4 { animation-delay: 0.30s; }
.kp-fade-in.d5 { animation-delay: 0.42s; }

@keyframes kp-fade-up {
  to { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────────
   13. RESPONSIVE BREAKPOINTS  (shared rules)
───────────────────────────────────────────── */
@media (max-width: 860px) {
  /* Nav */
  nav.kp-nav .nav-links,
  nav.kp-nav .nav-cta { display: none; }
  .nav-hamburger       { display: flex; }

  /* Footer */
  .footer-top { grid-template-columns: 1fr 1fr; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; }

  /* Section padding */
  section.kp-section { padding: 56px 5%; }
}

@media (max-width: 540px) {
  body { font-size: 14px; }
  .footer-top { grid-template-columns: 1fr; }
  .heading { font-size: 1.6rem; }
  section.kp-section { padding: 44px 5%; }
}

/* ─────────────────────────────────────────────
   14. UTILITY CLASSES
───────────────────────────────────────────── */
.text-gold   { color: var(--gold); }
.text-teal   { color: var(--teal); }
.text-purple { color: var(--purple); }
.text-green  { color: var(--green); }
.text-muted  { color: var(--muted); }
.text-sub    { color: var(--sub); }
.text-white  { color: var(--white); }
.text-red    { color: var(--red); }
.text-serif  { font-family: var(--ser); }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.hidden     { display: none !important; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
