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

:root {
  /* Joshua Hoo brand palette — Black + Gold + Ivory + Crimson */
  --deep-black: #050505;
  --charcoal: #1A1A1A;
  --slate: #2B2B2B;
  --antique-gold: #C8A24A;
  --soft-gold: #E6C675;
  --warm-ivory: #F4E9D0;
  --muted-ivory: #D8CBB1;
  --deep-crimson: #9B1C31;

  /* Semantic aliases */
  --bg: var(--deep-black);
  --sidebar-bg: var(--charcoal);
  --card-bg: var(--charcoal);
  --text: var(--warm-ivory);
  --text-muted: var(--muted-ivory);
  --accent: var(--antique-gold);
  --accent-hover: var(--soft-gold);
  --accent-light: rgba(200, 162, 74, 0.1);
  --border: var(--slate);
  --input-bg: var(--slate);
  --input-border: #3a3a3a;
  --input-focus: var(--antique-gold);

  --sidebar-w: 220px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
}

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Sidebar ─── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 1.25rem;
  z-index: 100;
  overflow-y: auto;
}

.identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.identity-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--warm-ivory);
}

.identity-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-link svg {
  flex-shrink: 0;
  opacity: 0.5;
}

.nav-link:hover svg {
  opacity: 1;
}

/* Active nav state */
.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-link.active svg {
  opacity: 1;
}

.sidebar-bottom {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  opacity: 0.5;
  margin-bottom: 0.5rem;
  padding-left: 0.6rem;
}

.social-links {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.social-links .nav-link {
  font-size: 0.8rem;
}

/* ─── Mobile header ─── */
.mobile-header {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

/* ─── Main content ─── */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
}

/* ─── Content card (deadmoney page) ─── */
.content-card {
  display: flex;
  align-items: center;
  gap: 3.5rem;
  max-width: 900px;
  width: 100%;
}

.card-image {
  flex: 0 0 auto;
}

.book-cover {
  display: block;
  max-width: 320px;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 0 60px rgba(200, 162, 74, 0.06);
  transition: transform 0.3s ease;
}

.book-cover:hover {
  transform: scale(1.02);
}

.card-body {
  flex: 1 1 420px;
}

.headline {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1rem;
  color: var(--warm-ivory);
}

.title-accent {
  font-style: italic;
  color: var(--antique-gold);
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  line-height: 1.7;
  opacity: 0.8;
}

/* ─── Form ─── */
.download-form {
  margin-top: 0.5rem;
}

.hp-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  pointer-events: none;
}

.form-inline {
  display: flex;
  gap: 0.5rem;
}

.form-input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-family: var(--font-body);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  color: var(--warm-ivory);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.form-input:focus {
  border-color: var(--antique-gold);
  box-shadow: 0 0 0 3px rgba(200, 162, 74, 0.15);
}

.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--deep-black);
  background: var(--antique-gold);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.btn-download:hover:not(:disabled) {
  background: var(--soft-gold);
  transform: translateY(-1px);
}

.btn-download:active:not(:disabled) {
  transform: translateY(0);
}

.btn-download:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-icon {
  flex-shrink: 0;
}

.btn-spinner[hidden] { display: none; }

.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(5,5,5,0.3);
  border-top-color: var(--deep-black);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Messages ─── */
.success-message {
  text-align: center;
  padding: 2rem 1rem;
}

.success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(200, 162, 74, 0.12);
  color: var(--antique-gold);
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.success-message h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
  color: var(--warm-ivory);
}

.success-message p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.error-message {
  background: rgba(155, 28, 49, 0.1);
  border: 1px solid rgba(155, 28, 49, 0.3);
  color: #e05a6b;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* ─── Homepage ─── */
.home-content {
  max-width: 680px;
  width: 100%;
}

.home-hero {
  text-align: center;
  margin-bottom: 3rem;
}

.home-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  border: 3px solid var(--antique-gold);
  box-shadow: 0 4px 20px rgba(200, 162, 74, 0.15);
}

.home-name {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--warm-ivory);
}

.home-tagline {
  font-size: 0.95rem;
  color: var(--antique-gold);
  margin-bottom: 1rem;
  font-weight: 500;
}

.home-bio {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 500px;
  margin: 0 auto;
  opacity: 0.8;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--antique-gold);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.resource-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.resource-card:hover {
  border-color: var(--antique-gold);
  box-shadow: 0 4px 20px rgba(200, 162, 74, 0.08);
  transform: translateY(-2px);
}

.resource-image {
  flex: 0 0 auto;
}

.resource-thumb {
  width: 80px;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.resource-info {
  flex: 1;
}

.resource-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--warm-ivory);
}

.resource-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

.resource-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--antique-gold);
  background: rgba(200, 162, 74, 0.1);
  border: 1px solid rgba(200, 162, 74, 0.2);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

/* ─── Footer ─── */
.footer {
  margin-top: 3rem;
}

.footer p {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.35;
  text-align: center;
}

.footer-socials {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.footer-socials a {
  color: var(--text-muted);
  opacity: 0.3;
  transition: opacity 0.2s, color 0.2s;
}

.footer-socials a:hover {
  opacity: 1;
  color: var(--antique-gold);
}

/* ─── Responsive ─── */
@media (max-width: 960px) {
  .content-card {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
  }

  .book-cover {
    max-width: 280px;
  }

  .headline {
    font-size: 1.8rem;
  }

  .form-inline {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.4);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  .sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--charcoal);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 80;
  }

  .menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--warm-ivory);
  }

  .mobile-identity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .mobile-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--antique-gold);
  }

  .mobile-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--warm-ivory);
  }

  .main {
    margin-left: 0;
    padding: 2rem 1rem;
  }

  .book-cover {
    max-width: 240px;
  }

  .headline {
    font-size: 1.5rem;
  }
}
