/* ======================================
   Sketch Style - 小马AI课程
   Hand-drawn notebook aesthetic
   ====================================== */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600;700&family=Comic+Neue:wght@300;400;700&display=swap');

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

/* --- Base --- */
:root {
  --ink: #2a2a2a;
  --ink-light: #555;
  --ink-faint: #999;
  --paper: #faf8f4;
  --paper-line: #d4cfca;
  --paper-dark: #f0ece6;
  --accent: #c0392b;
  --accent-blue: #2e86c1;
  --card-bg: #fffef9;
}

body {
  font-family: 'Comic Neue', 'Quicksand', cursive, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.8;
  min-height: 100vh;
  /* Subtle paper texture via CSS */
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(200, 190, 170, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(180, 170, 150, 0.06) 0%, transparent 50%);
}

/* --- Notebook Container --- */
.notebook {
  position: relative;
  max-width: 780px;
  margin: 0 auto;
  min-height: 100vh;
  /* Red margin line */
  border-left: 3px solid rgba(192, 57, 43, 0.2);
  margin-left: max(20px, calc((100vw - 780px) / 2));
  padding-left: 40px;
}

/* --- Spiral Binding --- */
.spiral-binding {
  position: fixed;
  left: max(5px, calc((100vw - 780px) / 2 - 15px));
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 40px 0;
  z-index: 10;
  pointer-events: none;
}

.spiral {
  display: block;
  width: 24px;
  height: 24px;
  border: 3px solid #aaa;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.1);
}

/* --- Container --- */
.container {
  padding: 48px 24px 48px 12px;
}

/* --- Header --- */
header {
  text-align: center;
  margin-bottom: 56px;
  padding-top: 16px;
}

.logo-sketch {
  margin-bottom: 12px;
  opacity: 0.8;
}

.logo-sketch svg {
  filter: url(#sketchy);
}

header h1 {
  font-family: 'Caveat', cursive;
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.5px;
  line-height: 1.2;
  /* Slight tilt for hand-drawn feel */
  transform: rotate(-1deg);
}

.subtitle {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  color: var(--ink-light);
  margin-top: 4px;
  letter-spacing: 2px;
}

.doodle-underline {
  margin-top: 8px;
  opacity: 0.4;
}

/* --- Course Grid --- */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 28px;
  padding: 0 4px;
}

/* --- Course Card --- */
.course-card {
  position: relative;
  background: var(--card-bg);
  padding: 28px 24px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  /* Hand-drawn border effect - irregular radius */
  border: 2px solid var(--ink);
  border-radius: 3px 12px 4px 14px;
  /* Slight rotation for organic feel */
  transform: rotate(-0.5deg);
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
  /* Sketchy shadow */
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.15);
}

.course-card:nth-child(2n) {
  transform: rotate(0.5deg);
  border-radius: 12px 4px 14px 3px;
}

.course-card:nth-child(3n) {
  transform: rotate(-0.3deg);
  border-radius: 8px 3px 10px 5px;
}

.course-card:hover {
  transform: rotate(0deg) translateY(-3px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.2);
}

/* Dog-ear corner fold */
.card-corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 24px;
  height: 24px;
  background: linear-gradient(225deg, var(--paper) 50%, var(--paper-dark) 50%);
  border-bottom-left-radius: 4px;
}

.course-icon {
  margin-bottom: 16px;
  opacity: 0.85;
}

.course-icon svg {
  filter: url(#sketchy);
}

.course-card h2 {
  font-family: 'Caveat', cursive;
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.course-card p {
  font-size: 0.95rem;
  color: var(--ink-light);
  line-height: 1.7;
}

.card-arrow {
  display: block;
  margin-top: 16px;
  text-align: right;
  opacity: 0.3;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.course-card:hover .card-arrow {
  opacity: 0.7;
  transform: translateX(4px);
}

/* --- QR Code Section --- */
.qrcode-section {
  text-align: center;
  margin-top: 64px;
  padding: 24px;
}

.qrcode-img {
  width: 220px;
  height: auto;
  border: 2px solid var(--ink);
  border-radius: 4px 10px 6px 12px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.12);
}

.qrcode-text {
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  color: var(--ink-light);
  margin-top: 10px;
}

/* --- Footer --- */
footer {
  text-align: center;
  margin-top: 32px;
  padding-bottom: 40px;
}

footer p {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  color: var(--ink-faint);
  margin-top: 8px;
}

/* --- Colorful Card Variants --- */
.course-card--blue {
  border-color: #2e86c1;
  background: linear-gradient(135deg, #e8f4fd 0%, #fffef9 100%);
  box-shadow: 4px 4px 0 rgba(46, 134, 193, 0.25);
}
.course-card--blue:hover {
  box-shadow: 6px 6px 0 rgba(46, 134, 193, 0.35);
}
.course-card--blue h2 { color: #1a5276; }

.card-corner--blue {
  background: linear-gradient(225deg, var(--paper) 50%, #d4e6f1 50%);
}

.course-card--green {
  border-color: #27ae60;
  background: linear-gradient(135deg, #eafaf1 0%, #fffef9 100%);
  box-shadow: 4px 4px 0 rgba(39, 174, 96, 0.25);
}
.course-card--green:hover {
  box-shadow: 6px 6px 0 rgba(39, 174, 96, 0.35);
}
.course-card--green h2 { color: #1e8449; }

.course-card--orange {
  border-color: #e67e22;
  background: linear-gradient(135deg, #fef9e7 0%, #fffef9 100%);
  box-shadow: 4px 4px 0 rgba(230, 126, 34, 0.25);
}
.course-card--orange:hover {
  box-shadow: 6px 6px 0 rgba(230, 126, 34, 0.35);
}
.course-card--orange h2 { color: #b9770e; }

.course-card--red {
  border-color: #c0392b;
  background: linear-gradient(135deg, #fdedec 0%, #fffef9 100%);
  box-shadow: 4px 4px 0 rgba(192, 57, 43, 0.25);
}
.course-card--red:hover {
  box-shadow: 6px 6px 0 rgba(192, 57, 43, 0.35);
}
.course-card--red h2 { color: #922b21; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .notebook {
    margin-left: 0;
    padding-left: 28px;
    border-left-width: 2px;
  }

  .spiral-binding {
    display: none;
  }

  header h1 {
    font-size: 2.4rem;
  }

  .subtitle {
    font-size: 1.2rem;
  }

  .course-grid {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 32px 16px 32px 8px;
  }
}

/* --- Accessibility: Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .course-card,
  .card-arrow {
    transition: none;
  }

  .course-card:hover {
    transform: none;
  }
}
