/* ============================================================
   The Posy Academy — Student Portal Shared Styles
   ============================================================ */

/* --- Design tokens --- */
:root {
  --blush: #E8C4B8;
  --blush-light: #F5E1DA;
  --blush-soft: #FDF5F2;
  --cream: #FAF8F5;
  --cream-warm: #F5F0EB;
  --sage: #8FA68A;
  --sage-light: #C5D4C0;
  --sage-dark: #6B8B65;
  --rose: #C4897A;
  --rose-dark: #b07568;
  --coral: #E07A5F;
  --coral-dark: #C4664B;
  --charcoal: #3D3D3D;
  --text: #444;
  --text-secondary: #7A7572;
  --text-muted: #A09A94;
  --white: #FFF;
  --border: #E8E3DE;
  --error: #c62828;
  --error-bg: #fce8e6;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--charcoal);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body.has-bottom-nav { padding-bottom: 80px; }

h1, h2, h3, h4 {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  line-height: 1.3;
  color: var(--charcoal);
}

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

/* Links inside lesson content should be visible and clickable */
.lesson-text a, .callout a {
  color: var(--rose-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lesson-text a:hover, .callout a:hover {
  color: var(--coral);
}

/* --- Top nav --- */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  max-width: 720px;
  margin: 0 auto;
}
.logo {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--charcoal);
  text-decoration: none;
}
.logo span { color: var(--rose); }

.desktop-links { display: none; gap: 24px; }
.desktop-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--charcoal);
  text-decoration: none;
  transition: color 0.2s;
}
.desktop-links a:hover,
.desktop-links a.active-link { color: var(--rose); }

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--charcoal);
  border-radius: 2px;
  transition: all 0.3s ease;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Mobile menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(61, 61, 61, 0.7);
  z-index: 90;
}
.mobile-menu.open { display: block; }
.mobile-menu-panel {
  position: absolute;
  top: 0; right: 0;
  width: 280px;
  max-width: 85vw;
  height: 100%;
  background: var(--cream);
  padding: 72px 24px 24px;
  box-shadow: -4px 0 24px rgba(0,0,0,0.1);
}
.mobile-menu-panel a {
  display: block;
  padding: 14px 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--charcoal);
  text-decoration: none;
  border-bottom: 1px solid var(--blush);
  transition: color 0.2s;
}
.mobile-menu-panel a:hover { color: var(--rose); }

/* --- Bottom nav (mobile) --- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 80;
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--charcoal);
  padding: 10px 14px;
  transition: color 0.2s;
}
.bottom-nav a.active,
.bottom-nav a:hover { color: var(--rose); }
.bottom-nav a svg { width: 24px; height: 24px; }

/* --- Shared components --- */

/* Cards */
.card {
  background: var(--white);
  border-radius: 12px;
  padding: 18px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s ease, transform 0.1s ease;
}
.card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

/* Badges */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.tier-badge.starter { background: rgba(143,166,138,0.18); color: var(--sage-dark); }
.tier-badge.pro { background: rgba(196,137,122,0.18); color: var(--rose-dark); }
.tier-badge svg { width: 16px; height: 16px; }

/* Callout */
.callout {
  background: rgba(143, 166, 138, 0.15);
  border-left: 4px solid var(--sage);
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.65;
}

.wizard-btn {
  display: inline-block;
  background: var(--sage);
  color: #fff;
  padding: 14px 36px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
  text-decoration: none;
  margin-top: 12px;
  transition: background 0.25s, transform 0.2s;
}
.wizard-btn:hover {
  background: var(--sage-dark, #6B8B65);
  color: #fff;
  transform: translateY(-1px);
  text-decoration: none;
}

/* Section divider */
.section-divider {
  border: none;
  border-top: 1px solid var(--blush);
  margin: 28px 0;
}

/* Prompt block (lesson page) */
.prompt-block {
  position: relative;
  background: var(--cream-warm);
  border-radius: 12px;
  padding: 20px 56px 20px 20px;
  margin-bottom: 16px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  border: 1px solid var(--border);
}

/* Copy button */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: var(--rose);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}
.copy-btn:hover { background: var(--rose-dark); }
.copy-btn:active { transform: scale(0.95); }
.copy-btn:focus-visible { outline: 3px solid var(--rose); outline-offset: 2px; }
.copy-btn svg { width: 16px; height: 16px; }
.copy-btn.copied { background: var(--sage); }

/* Error messages */
.error-msg {
  background: var(--error-bg);
  color: var(--error);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: .9rem;
  margin-bottom: 20px;
}

/* Primary button */
.btn-primary {
  display: block;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: var(--coral);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}
.btn-primary:hover { background: var(--coral-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }

.btn-sage {
  background: var(--sage);
}
.btn-sage:hover { background: var(--sage-dark); }

/* Lesson nav buttons */
.lesson-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.lesson-nav-link {
  flex: 1;
  display: block;
  text-align: center;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  transition: all 0.2s ease;
  min-width: 120px;
}
.lesson-nav-link.prev {
  background: var(--blush-light);
  color: var(--charcoal);
}
.lesson-nav-link.prev:hover { background: var(--blush); }
.lesson-nav-link.next {
  background: rgba(196, 137, 122, 0.15);
  color: var(--rose-dark);
}
.lesson-nav-link.next:hover { background: rgba(196, 137, 122, 0.25); color: var(--rose-dark); }
.lesson-nav-link:focus-visible { outline: 3px solid var(--rose); outline-offset: 2px; }

/* Focus states for all interactive elements */
.desktop-links a:focus-visible,
.mobile-menu-panel a:focus-visible,
.bottom-nav a:focus-visible,
.hamburger:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }

/* --- Responsive --- */
@media (min-width: 640px) {
  body.has-bottom-nav { padding-bottom: 24px; }
  .bottom-nav { display: none; }
}

@media (min-width: 768px) {
  .hamburger { display: none; }
  .desktop-links { display: flex; }
}
@media (max-width: 767px) {
  .desktop-links { display: none !important; }
}
