/* ==============================================
   REAL CAR TIPS - MODERN GUIDE STYLES
   Medium-inspired editorial typography
   ============================================== */

/* Google Fonts - Medium uses Charter, we'll use Lora (similar feel) + clean sans */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=Inter:wght@400;500;600;700&display=swap');

/* ----- CSS Custom Properties ----- */
:root {
  /* Colors - Clean, high contrast like Medium */
  --color-ink: #242424;
  --color-text: #242424;
  --color-text-secondary: #6b6b6b;
  --color-muted: #757575;

  --color-accent: #1a8917;
  --color-accent-dark: #156d12;

  --color-bg: #ffffff;
  --color-bg-subtle: #f9f9f9;
  --color-bg-sidebar: #fafafa;

  --color-border: #e6e6e6;
  --color-border-light: #f2f2f2;

  --color-link: #1a8917;
  --color-link-hover: #156d12;

  /* Typography - Medium-inspired */
  --font-serif: 'Lora', Georgia, Cambria, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;

  /* Layout - Wider content area */
  --sidebar-width: 280px;
  --content-width: 728px;
  --container-max: 1192px;

  /* Effects */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-card: 0 4px 16px rgba(0,0,0,0.06);

  --radius: 4px;
  --radius-lg: 8px;

  --transition: 200ms ease;
}


/* ==============================================
   GUIDE ARTICLE - MAIN LAYOUT (CENTERED)
   ============================================== */

.guide-article {
  background: var(--color-bg);
  min-height: 100vh;
  padding: var(--space-lg) var(--space-md);
}

.guide-article__container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: var(--space-xl);
  max-width: calc(var(--sidebar-width) + var(--content-width) + var(--space-xl));
  margin: 0 auto;
  align-items: start;
}

.guide-article__main {
  justify-self: center;
}

/* Tablet - sidebar + content */
@media (max-width: 1100px) {
  .guide-article__container {
    grid-template-columns: 240px 1fr;
    gap: var(--space-lg);
    max-width: 100%;
    padding: 0 var(--space-md);
  }
  .guide-article__ads {
    display: none;
  }
  .guide-article__main {
    justify-self: start;
  }
}

/* Mobile - single column */
@media (max-width: 800px) {
  .guide-article {
    padding: var(--space-sm);
  }
  .guide-article__container {
    grid-template-columns: 1fr;
    gap: var(--space-md);
    max-width: var(--content-width);
    padding: 0;
  }
  .guide-article__main {
    justify-self: stretch;
  }
}


/* ==============================================
   SIDEBAR NAVIGATION
   ============================================== */

.guide-article__sidebar {
  position: sticky;
  top: var(--space-lg);
  height: calc(100vh - var(--space-lg) - var(--space-lg));
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: var(--space-md);
  align-self: start;

  /* Subtle scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.guide-article__sidebar::-webkit-scrollbar {
  width: 4px;
}
.guide-article__sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.guide-article__sidebar::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

/* Mobile sidebar */
@media (max-width: 800px) {
  .guide-article__sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    max-width: 90vw;
    height: 100vh;
    max-height: 100vh;
    background: var(--color-bg);
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    padding: 0;
  }

  .guide-article__sidebar.is-open {
    transform: translateX(0);
  }
}

/* Overlay */
.guide-article__sidebar.is-open::after {
  content: '';
  position: fixed;
  top: 0;
  left: 100%;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.3);
}


/* ----- Navigation Component ----- */

.guide-nav {
  font-family: var(--font-sans);
}

.guide-nav__header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-subtle);
  border-bottom: 1px solid var(--color-border);
}

.guide-nav__title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-ink);
}

.guide-nav__close {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.guide-nav__close:hover {
  background: var(--color-border-light);
  color: var(--color-ink);
}

@media (max-width: 800px) {
  .guide-nav__header {
    display: flex;
  }
  .guide-nav__sections {
    padding: var(--space-md);
    max-height: calc(100vh - 65px);
    overflow-y: auto;
  }
}

/* ==============================================
   SIDEBAR DESIGN: Clean Minimal with Tree Lines
   ============================================== */

.guide-nav__sections {
  padding-bottom: 60px;
}

.guide-nav__section {
  margin-bottom: 4px;
}

/* Section toggle button (category level) */
.guide-nav__section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.guide-nav__section-toggle:hover {
  background: rgba(0,0,0,0.03);
}

.guide-nav__section-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-ink);
  letter-spacing: -0.01em;
}

.guide-nav__section--active .guide-nav__section-title {
  color: var(--color-ink);
}

/* Chevron rotation */
.guide-nav__chevron {
  color: #999;
  transition: transform var(--transition);
  flex-shrink: 0;
}

.guide-nav__section-toggle.is-expanded .guide-nav__chevron,
.guide-nav__subsection-toggle.is-expanded .guide-nav__chevron {
  transform: rotate(180deg);
}

/* Subsections container - collapsible with vertical line */
.guide-nav__subsections {
  display: none;
  margin-top: 2px;
  margin-left: 12px;
  padding-left: 16px;
  border-left: 1px solid #ddd;
}

.guide-nav__subsections.is-expanded {
  display: block;
}

/* Active category gets black border */
.guide-nav__section--active .guide-nav__subsections {
  border-left-color: var(--color-ink);
}

/* Link for categories without subsections */
.guide-nav__section-link {
  display: block;
  padding: 8px 10px;
  font-size: 13px;
  color: #666;
  text-decoration: none;
}

.guide-nav__section-link:hover {
  color: var(--color-ink);
}

.guide-nav__subsection {
  margin-bottom: 0;
}

/* Add separator line between subsections */
.guide-nav__subsection + .guide-nav__subsection {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid #eee;
}

.guide-nav__subsection-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 10px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.guide-nav__subsection-toggle:hover {
  background: rgba(0,0,0,0.02);
}

/* Subsection titles - more prominent */
.guide-nav__subsection-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--color-ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color var(--transition);
}

/* Active subsection indicator - black left border */
.guide-nav__subsection--active {
  position: relative;
}

.guide-nav__subsection--active::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--color-ink);
  border-radius: 1px;
}

/* Articles wrapper */
.guide-nav__articles-wrapper {
  display: none;
  padding: 4px 0 12px 0;
}

.guide-nav__articles-wrapper.is-expanded {
  display: block;
}

/* Article list with horizontal tree lines */
.guide-nav__articles {
  list-style: none;
  padding: 0;
  margin: 0;
}

.guide-nav__articles li {
  margin-bottom: 0;
  line-height: 1.4;
  position: relative;
}

/* Horizontal line from left border to text - gray for non-active subsections */
.guide-nav__articles li::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 50%;
  width: 12px;
  height: 1px;
  background: #ddd;
}

/* Black horizontal lines for active subsection */
.guide-nav__subsection--active .guide-nav__articles li::before {
  background: var(--color-ink);
}

.guide-nav__articles li a {
  display: block;
  padding: 6px 8px 6px 4px;
  margin-left: -16px;
  padding-left: 20px;
  font-size: 13px;
  color: #666;
  text-decoration: none;
  transition: all var(--transition);
  position: relative;
}

.guide-nav__articles li a:hover {
  background: rgba(0,0,0,0.03);
  color: var(--color-ink);
}

/* Current article - gray background extends to left border */
.guide-nav__articles li.is-current a {
  background: rgba(0,0,0,0.06);
  color: var(--color-ink);
  font-weight: 500;
}

/* Current article line matches background */
.guide-nav__articles li.is-current::before {
  background: rgba(0,0,0,0.06);
}


/* ==============================================
   MOBILE TOC TOGGLE
   ============================================== */

.guide-article__toc-toggle {
  display: none;
  width: 100%;
  padding: 14px 18px;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: var(--space-lg);
  align-items: center;
  justify-content: space-between;
  transition: background var(--transition);
}

.guide-article__toc-toggle:hover {
  background: var(--color-accent-dark);
}

.guide-article__toc-toggle svg {
  opacity: 0.9;
}

@media (max-width: 800px) {
  .guide-article__toc-toggle {
    display: flex;
  }
}


/* ==============================================
   MAIN CONTENT AREA
   ============================================== */

.guide-article__main {
  min-width: 0;
  max-width: var(--content-width);
  width: 100%;
}


/* ----- Breadcrumbs ----- */

.guide-article__breadcrumbs {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-muted);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-article__breadcrumbs a {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.guide-article__breadcrumbs a:hover {
  color: var(--color-accent);
}

.guide-article__breadcrumbs span {
  color: var(--color-border);
}


/* ----- Article Header ----- */

.guide-article__header {
  margin-bottom: var(--space-xl);
}

.guide-article__header h1 {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-ink);
  margin: 0;
  letter-spacing: -0.03em;
}

.guide-article__updated {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-muted);
  margin-top: var(--space-sm);
}


/* ==============================================
   ARTICLE CONTENT - MEDIUM-STYLE TYPOGRAPHY
   ============================================== */

.guide-article__content {
  font-family: var(--font-serif);
  font-size: 21px;
  line-height: 1.8;
  color: var(--color-text);
  letter-spacing: -0.003em;
}

/* Headings */
.guide-article__content h2 {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-ink);
  margin: var(--space-2xl) 0 var(--space-md) 0;
  letter-spacing: -0.02em;
}

.guide-article__content h2:first-child {
  margin-top: 0;
}

.guide-article__content h3 {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 600;
  color: var(--color-ink);
  margin: var(--space-xl) 0 var(--space-sm) 0;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.guide-article__content h4 {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  color: var(--color-ink);
  margin: var(--space-lg) 0 var(--space-sm) 0;
}

/* Paragraphs */
.guide-article__content p {
  margin: 0 0 var(--space-lg) 0;
}

.guide-article__content p:last-child {
  margin-bottom: 0;
}

/* Links */
.guide-article__content a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition);
}

.guide-article__content a:hover {
  color: var(--color-link-hover);
}

/* Emphasis - Medium style */
.guide-article__content em {
  font-style: italic;
  background: linear-gradient(to bottom, transparent 50%, rgba(26, 137, 23, 0.12) 50%);
  padding: 0 2px;
}

.guide-article__content strong {
  font-weight: 600;
  color: var(--color-ink);
}

/* Lists */
.guide-article__content ul,
.guide-article__content ol {
  margin: 0 0 var(--space-lg) 0;
  padding-left: 28px;
}

.guide-article__content li {
  margin-bottom: 12px;
  padding-left: 8px;
}

.guide-article__content li::marker {
  color: var(--color-text-secondary);
}

/* Blockquotes - Medium style */
.guide-article__content blockquote {
  margin: var(--space-xl) 0;
  padding: 0 0 0 var(--space-lg);
  border-left: 3px solid var(--color-ink);
  font-style: italic;
  color: var(--color-text-secondary);
}

.guide-article__content blockquote p {
  margin-bottom: var(--space-sm);
}

.guide-article__content blockquote p:last-child {
  margin-bottom: 0;
}

/* Images */
.guide-article__content img {
  max-width: 100%;
  height: auto;
  margin: var(--space-xl) 0;
  border-radius: var(--radius);
}

/* Horizontal rule */
.guide-article__content hr {
  border: none;
  text-align: center;
  margin: var(--space-2xl) 0;
}

.guide-article__content hr::before {
  content: '...';
  font-family: var(--font-serif);
  font-size: 28px;
  letter-spacing: 0.6em;
  color: var(--color-text-secondary);
}


/* ==============================================
   AUTHOR BOX
   ============================================== */

.guide-article__main .about-box,
.guide-article__main .articleBox {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-top: var(--space-2xl);
}


/* ==============================================
   COMMENTS SECTION
   ============================================== */

.guide-article__comments {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-border);
}

.guide-article__comments h2 {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 600;
  color: var(--color-ink);
  margin: 0 0 var(--space-lg) 0;
}


/* ==============================================
   RELATED ARTICLES
   ============================================== */

.guide-article__related {
  margin-top: var(--space-xl);
  background: var(--color-bg-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--color-border-light);
}

.guide-article__related .relatedTitle {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 var(--space-md) 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
}

.guide-article__related .related {
  background: transparent;
  padding: 0;
  margin: 0;
  border-radius: 0;
}

.guide-article__related ul {
  margin: 0;
  padding-left: 20px;
  list-style: disc;
}

.guide-article__related li {
  margin-bottom: 8px;
  font-family: var(--font-sans);
}

.guide-article__related li::marker {
  color: var(--color-accent);
}

.guide-article__related a {
  color: var(--color-text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition);
}

.guide-article__related a:hover {
  color: var(--color-accent);
}


/* ==============================================
   ADS COLUMN
   ============================================== */

.guide-article__ads {
  position: sticky;
  top: var(--space-lg);
  height: fit-content;
}

@media (max-width: 1100px) {
  .guide-article__ads {
    display: none;
  }
}


/* ==============================================
   UTILITY OVERRIDES
   ============================================== */

/* Override conflicting styles from newcss.css */
.guide-article .article__text {
  line-height: inherit;
}

.guide-article .article__text b {
  background: rgba(26, 137, 23, 0.1);
  color: var(--color-ink);
  padding: 2px 4px;
  border-radius: 2px;
  font-weight: 600;
}

/* Reset old layout */
.page--guide-new .article {
  max-width: none;
  padding: 0;
  margin: 0;
  background: transparent;
  box-shadow: none;
}


/* ==============================================
   SMOOTH INTERACTIONS
   ============================================== */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .guide-article__main {
    animation: fadeIn 400ms ease-out;
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ==============================================
   PRINT STYLES
   ============================================== */

@media print {
  .guide-article {
    background: white;
    padding: 0;
  }

  .guide-article__sidebar,
  .guide-article__ads,
  .guide-article__toc-toggle,
  .guide-article__comments {
    display: none !important;
  }

  .guide-article__container {
    display: block;
  }

  .guide-article__content {
    font-size: 12pt;
  }
}


/* ==============================================
   NEWSLETTER SIGNUP BOX (inline, not a popup)
   ============================================== */

#myModal,
.reveal-modal2 {
  background: #fffde7;
  border: 3px solid #2a4a2a;
  border-radius: 12px;
  padding: 25px 30px;
  margin: 40px 0;
  position: relative;
}

#myModal .modal-header {
  font-size: 22px;
  font-weight: bold;
  color: #8b0000;
  margin-bottom: 12px;
}

#myModal .close {
  display: none;
}

#myModal ul {
  margin: 15px 0 20px 20px;
}

#myModal li {
  font-style: italic;
  margin-bottom: 5px;
}

#myModal img {
  margin-left: 15px;
}
