/* ==========================================================================
   321 Study — Home page styles
   Ported pixel-for-pixel from the Claude Design handoff (index.dc.html)
   built on the Genesis Design System tokens.
   ========================================================================== */

/* ---- Genesis tokens: colors ---- */
:root {
  --indigo-500: #6366F1;
  --indigo-600: #4F46E5;
  --green-600:  #20970B;

  --gray-950: #0A0A0A;
  --gray-600: #6B6B6B;
  --gray-500: #9C9C9C;
  --gray-200: #E8E8EC;
  --gray-100: #F2F2F4;
  --gray-50:  #FAFAFA;
  --white:    #FFFFFF;

  --success-500: #10B981;
  --warning-500: #F59E0B;
  --error-500:   #EF4444;

  --color-primary:       var(--indigo-500);
  --color-primary-hover: var(--indigo-600);
  --color-brand-accent:  var(--green-600);

  --text-primary:    var(--gray-950);
  --text-secondary:  var(--gray-600);
  --text-muted:      var(--gray-500);
  --text-on-primary: var(--white);

  --bg-page:      var(--gray-50);
  --bg-alt:       var(--gray-100);
  --surface:      var(--white);
  --surface-card: var(--white);

  --border:        var(--gray-200);
  --border-strong: var(--gray-500);
  --border-focus:  var(--indigo-500);

  --ring-focus:   0 0 0 3px rgba(99, 102, 241, 0.12);
  --glow-primary: 0 4px 12px rgba(99, 102, 241, 0.35);

  /* ---- Genesis tokens: typography ---- */
  --font-display: "General Sans", "DM Sans", system-ui, sans-serif;
  --font-body:    "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* ---- Genesis tokens: radius ---- */
  --radius-xs:   4px;
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-full: 9999px;

  /* ---- Genesis tokens: elevation / motion ---- */
  --shadow-card-hover: 0 8px 30px rgba(0, 0, 0, 0.08);
  --shadow-lg:         0 12px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow:       0 4px 12px rgba(99, 102, 241, 0.35);
  --ring:              0 0 0 3px rgba(99, 102, 241, 0.12);
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --nav-blur: saturate(180%) blur(12px);

  color-scheme: light;
}

/* ---- Genesis base ---- */
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin: 0;
}

code, pre, kbd { font-family: var(--font-mono); }

::selection { background: rgba(99, 102, 241, 0.18); }

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

input::placeholder, textarea::placeholder { color: #9C9C9C; }

a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px #6366F1, 0 0 0 4px rgba(99, 102, 241, 0.16);
  border-radius: 6px;
}

/* ==========================================================================
   Buttons (Genesis Button component)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
  font-family: var(--font-body);
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--duration-base) var(--ease),
              transform var(--duration-fast) var(--ease),
              box-shadow var(--duration-base) var(--ease),
              color var(--duration-base) var(--ease);
}
.btn-lg { height: 44px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--color-primary);
  color: var(--text-on-primary);
  border: 1px solid transparent;
}
.btn-primary:hover {
  transform: translateY(-1px);
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-glow);
  color: var(--text-on-primary);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  transform: translateY(-1px);
  background: var(--bg-alt);
  color: var(--text-primary);
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-link {
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: background 200ms cubic-bezier(0.4, 0, 0.2, 1),
              color 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-link:hover { background: var(--bg-alt); color: var(--text-primary); }
.nav-link[aria-current="page"] {
  color: var(--text-primary);
  background: var(--bg-alt);
}

.nav-drop .nav-drop-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
}
.nav-drop:hover .nav-drop-menu,
.nav-drop:focus-within .nav-drop-menu {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

.nav-drop-item {
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
}
.nav-drop-item:hover { background: var(--bg-alt); color: var(--text-primary); }

.nav-icon-btn {
  position: relative;
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 200ms cubic-bezier(0.4, 0, 0.2, 1),
              color 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-icon-btn:hover { background: var(--bg-alt); color: var(--text-primary); }

/* ==========================================================================
   Cards, links, footer
   ========================================================================== */
.lift {
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }

.lift-popular {
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.lift-popular:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(99, 102, 241, 0.16); }

.link-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-primary);
  padding: 8px 4px;
}
.link-primary:hover { color: var(--color-primary-hover); }

.footer-link {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
}
.footer-link:hover { color: var(--text-primary); }

.social-btn {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background 200ms cubic-bezier(0.4, 0, 0.2, 1),
              color 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.social-btn:hover { background: var(--bg-alt); color: var(--text-primary); }

/* ==========================================================================
   Mobile navigation (Udemy-style drawer)
   ========================================================================== */
.mnav-burger {
  display: none !important;
  width: 42px;
  height: 42px;
  margin-right: 2px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
}
.mnav-burger:hover { background: var(--bg-alt); }

@media (max-width: 860px) {
  .mnav-burger { display: inline-flex !important; }
  .nav-links { display: none !important; }
  .nav-auth { display: none !important; }
  /* static + no backdrop-filter: a filtered ancestor would trap the
     fixed-position drawer inside the header strip */
  .site-header {
    position: static !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--surface) !important;
  }
}

@keyframes mnavIn   { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes mnavFade { from { opacity: 0; } to { opacity: 1; } }

.mnav-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(10, 10, 10, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: mnavFade 200ms ease both;
}

.mnav-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background: var(--surface);
  box-shadow: 12px 0 40px rgba(10, 10, 10, 0.22);
  display: flex;
  flex-direction: column;
  animation: mnavIn 260ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.mnav-close {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
}
.mnav-close:hover { background: var(--bg-alt); color: var(--text-primary); }

.mnav-link {
  display: block;
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
}
.mnav-link.sub {
  padding: 10px 14px 10px 32px;
  font-size: 14px;
  color: var(--text-secondary);
}
.mnav-link.active {
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-alt);
}
.mnav-link:not(.active):hover { background: var(--bg-alt); }

.mnav-cart {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 10px 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
}
.mnav-cart:hover { background: var(--bg-alt); }

/* ==========================================================================
   AI chat widget
   ========================================================================== */
@keyframes cwDot {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30%           { opacity: 1;    transform: translateY(-3px); }
}

.cw-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  font-family: var(--font-body);
}

.cw-panel {
  width: min(370px, calc(100vw - 32px));
  height: min(540px, calc(100vh - 120px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(10, 10, 10, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cw-header-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.75);
}
.cw-header-btn:hover { background: rgba(255, 255, 255, 0.2); color: #FFFFFF; }

.cw-quick {
  background: var(--surface);
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  border-radius: 9999px;
  padding: 7px 13px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 160ms ease;
}
.cw-quick:hover { background: rgba(99, 102, 241, 0.08); }

.cw-send {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  border: none;
  background: var(--color-primary);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 160ms ease;
}
.cw-send:hover { background: var(--color-primary-hover); }

.cw-launcher {
  display: inline-flex;
  width: 54px;
  height: 54px;
  border-radius: 9999px;
  border: none;
  background: var(--color-primary);
  color: #FFFFFF;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(99, 102, 241, 0.45);
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1), background 200ms ease;
}
.cw-launcher:hover { transform: scale(1.08); background: var(--color-primary-hover); }

.cw-wa-link { font-size: 11px; color: var(--text-secondary); text-decoration: underline; }
.cw-wa-link:hover { color: var(--text-primary); }

.cw-bubble-bot {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 4px;
  padding: 10px 13px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
  max-width: 88%;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.cw-bubble-user {
  background: var(--gray-950);
  color: #FFFFFF;
  border: none;
  border-radius: 12px 12px 4px 12px;
  padding: 10px 13px;
  font-size: 13px;
  line-height: 1.55;
  max-width: 88%;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

[hidden] { display: none !important; }
