/* ============================================================
   site.css — Blog-specific styles for www.oldlane17.com
   Loaded AFTER main.css, topnav.css, footer.css.
   All colours come from CSS variables — no hard-coded hex
   outside the variable definitions below.
   ============================================================ */

/* ----------------------------------------------------------
   1. DESIGN TOKENS
   ---------------------------------------------------------- */
:root {
  /* Four canonical colours (fixed by owner) */
  --bg-color:       #ffffff;
  --text-color:     #1a1a1a;
  --hover-color:    #182a69;
  --grey-accent:    #423B3A;

  /* Derived tokens */
  --footer-bg:      #02133e;    /* matches footer.css .footer-row-1 in light mode */
  --surface-color:  color-mix(in srgb, var(--bg-color) 94%, var(--text-color) 6%);
  --border-color:   color-mix(in srgb, var(--hover-color) 14%, transparent);
  --muted-color:    color-mix(in srgb, var(--text-color) 60%, transparent);

  /* Sleek Subnav & Button Tokens (Light Mode - high visibility & style) */
  --subnav-bg:         rgba(255, 255, 255, 0.94);
  --subnav-border:     color-mix(in srgb, var(--hover-color) 16%, transparent);
  --subnav-shadow:     0 4px 18px rgba(24, 42, 105, 0.08);

  --chip-bg:           color-mix(in srgb, var(--hover-color) 7%, transparent);
  --chip-text:         var(--hover-color);
  --chip-border:       color-mix(in srgb, var(--hover-color) 18%, transparent);
  --chip-hover-bg:     var(--hover-color);
  --chip-hover-text:   #ffffff;

  --btn-icon-bg:       color-mix(in srgb, var(--hover-color) 6%, transparent);
  --btn-icon-border:   color-mix(in srgb, var(--hover-color) 22%, transparent);
  --btn-icon-color:    var(--hover-color);

  /* Layout measurements — updated from topnav.css analysis */
  --topnav-offset:  10px;
  --topnav-height:  77px;
  --subnav-height:  52px;

  /* highlight.js theme tokens — light */
  --hljs-bg:        #f4f6fa;
  --hljs-color:     #24292e;
  --hljs-keyword:   #182a69;
  --hljs-string:    #187240;
  --hljs-comment:   #6a737d;
  --hljs-number:    #b85c00;
  --hljs-attr:      #0073a8;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg-color:       #02133e;
  --text-color:     #ffffff;
  --footer-bg:      var(--hover-color);
  --surface-color:  color-mix(in srgb, var(--bg-color) 88%, var(--text-color) 12%);
  --border-color:   color-mix(in srgb, var(--text-color) 18%, transparent);
  --muted-color:    color-mix(in srgb, var(--text-color) 65%, transparent);

  /* Sleek Subnav & Button Tokens (Dark Mode) */
  --subnav-bg:         rgba(2, 19, 62, 0.94);
  --subnav-border:     rgba(255, 255, 255, 0.14);
  --subnav-shadow:     0 4px 22px rgba(0, 0, 0, 0.45);

  --chip-bg:           rgba(255, 255, 255, 0.08);
  --chip-text:         #e2e8f8;
  --chip-border:       rgba(255, 255, 255, 0.16);
  --chip-hover-bg:     #7eb8f7;
  --chip-hover-text:   #02133e;

  --btn-icon-bg:       rgba(255, 255, 255, 0.08);
  --btn-icon-border:   rgba(255, 255, 255, 0.2);
  --btn-icon-color:    #ffffff;

  /* highlight.js theme tokens — dark */
  --hljs-bg:        #0d1f44;
  --hljs-color:     #e8eaf0;
  --hljs-keyword:   #7eb8f7;
  --hljs-string:    #7ecf9e;
  --hljs-comment:   #6a7fa3;
  --hljs-number:    #f4a361;
  --hljs-attr:      #64bde8;

  color-scheme: dark;
}

/* ----------------------------------------------------------
   2. BASE OVERRIDES (undo main.css hard-coded dark body)
   ---------------------------------------------------------- */
body {
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Font stack for code */
pre, code, kbd, samp {
  font-family: 'Roboto Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
  font-size: 0.9em;
}

/* Override main.css global button (which uses hard-coded #182a69 background) */
button, .btn {
  background-color: var(--grey-accent);
  color: #fff;
  border: none;
  padding: 12px 24px;
  font-size: 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s ease;
}
button:hover, .btn:hover {
  background-color: var(--hover-color);
}

/* Icon-only button (theme toggle, search, arrows) — resets default padding */
/* Icon-only button (theme toggle, search, arrows, hamburger) */
.icon-btn {
  background: var(--btn-icon-bg);
  border: 1px solid var(--btn-icon-border);
  border-radius: 9px;
  padding: 8px 10px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--btn-icon-color);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.icon-btn:hover {
  background: var(--hover-color);
  border-color: var(--hover-color);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(24, 42, 105, 0.25);
}
:root[data-theme="dark"] .icon-btn:hover {
  background: #7eb8f7;
  border-color: #7eb8f7;
  color: #02133e;
  box-shadow: 0 4px 14px rgba(126, 184, 247, 0.3);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ----------------------------------------------------------
   3. LAYOUT OFFSETS (avoid content hidden under fixed bars)
   ---------------------------------------------------------- */
#header-placeholder {
  min-height: calc(var(--topnav-height) + var(--subnav-height));
}

.container {
  padding-top: calc(var(--topnav-height) + var(--subnav-height) + 32px);
  max-width: 900px;
  line-height: 1.75;
}

/* ----------------------------------------------------------
   4. FOOTER VARIABLE OVERRIDE
   ---------------------------------------------------------- */
.footer-row-1 {
  background-color: var(--footer-bg);
}

/* ----------------------------------------------------------
   5. BLOG SUB-NAV (Sleek Glassmorphic Bar)
   ---------------------------------------------------------- */
.blog-subnav {
  position: fixed;
  top: var(--topnav-height);
  left: 0;
  right: 0;
  height: var(--subnav-height);
  z-index: 900;
  background: var(--subnav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--subnav-border);
  box-shadow: var(--subnav-shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  transition: top 0.3s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* When the topnav hides (.nav-up), sub-bar slides up and stays visible */
.topnav.nav-up + .blog-subnav,
.blog-subnav.nav-up-companion {
  top: 0;
}

/* Blog hamburger button (left of sub-bar) */
.blog-hamburger {
  flex-shrink: 0;
  position: relative;
}

/* Language strip wrapper (centre, flex:1) */
.lang-strip-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-width: 0;
}

/* Subtle fade masks at edges */
.lang-strip-wrapper::before,
.lang-strip-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.2s;
}
.lang-strip-wrapper::before {
  left: 0;
  background: linear-gradient(to right, var(--bg-color), transparent);
}
.lang-strip-wrapper::after {
  right: 0;
  background: linear-gradient(to left, var(--bg-color), transparent);
}

/* Scroll arrow buttons */
.lang-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: all 0.2s ease;
  font-weight: bold;
}
.lang-arrow-left  { left: 2px; }
.lang-arrow-right { right: 2px; }
.lang-arrow[hidden], .lang-arrow.hidden { display: none !important; }
.lang-arrow:hover  {
  background: var(--hover-color);
  color: #fff;
  border-color: var(--hover-color);
  transform: translateY(-50%) scale(1.08);
}
:root[data-theme="dark"] .lang-arrow:hover {
  background: #7eb8f7;
  color: #02133e;
  border-color: #7eb8f7;
}

/* The scrollable strip itself */
.lang-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 0 42px; /* room for arrow buttons */
  align-items: center;
  -webkit-overflow-scrolling: touch;
  cursor: default;
  user-select: none;
}
.lang-strip::-webkit-scrollbar { display: none; }
.lang-strip.is-dragging { cursor: grabbing; }

/* Language chips — sleek modern pills with high contrast */
.lang-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 15px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--chip-text);
  border: 1px solid var(--chip-border);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 600;
  scroll-snap-align: start;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}
.lang-chip:hover {
  background: var(--chip-hover-bg);
  color: var(--chip-hover-text);
  border-color: var(--chip-hover-bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(24, 42, 105, 0.2);
}
:root[data-theme="dark"] .lang-chip:hover {
  box-shadow: 0 4px 12px rgba(126, 184, 247, 0.25);
}
.lang-chip[aria-current="page"] {
  background: var(--chip-hover-bg);
  color: var(--chip-hover-text);
  border-color: var(--chip-hover-bg);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(24, 42, 105, 0.25);
}

/* Sub-nav right icons */
.subnav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   6. HAMBURGER — Always Visible Override
   topnav.css sets .hamburger.b-container { display: none } as default
   and only shows it at ≤901px. We override here to always show it
   so the sidenav is accessible on all screen sizes.
   ---------------------------------------------------------- */
.hamburger.b-container {
  display: block !important;
}

/* When nav-right links are visible on desktop, hide them since
   hamburger now handles navigation. Keep space-aware layout. */
@media (min-width: 902px) {
  /* Keep nav-right links — they provide quick access on wide screens.
     The hamburger gives access to the full menu + extras like RSS, Privacy. */
  .hamburger.b-container {
    display: block !important;
    /* Ensure it sits at the correct z-index to float over topnav */
    z-index: 2005 !important;
  }
}

/* ----------------------------------------------------------
   6b. SIDENAV OVERRIDES — Clean Blog Layout
   Override shared chess sidenav to remove auth-UI whitespace.
   The blog sidenav has no guest-ui / user-ui elements.
   ---------------------------------------------------------- */

/* Remove any top padding that was reserved for auth buttons */
#mySidenav .sidenav-content {
  padding-top: 8px !important;
}

/* Suppress any hidden auth-placeholder divs adding space */
#mySidenav #guest-ui,
#mySidenav #user-ui,
#mySidenav #side-guest-ui,
#mySidenav #side-user-ui,
#mySidenav .sidenav-divider:first-child {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 0 !important;
}

/* Style sidenav links cleanly for the blog */
#mySidenav a:not(.closebtn) {
  font-size: 1.05rem;
  padding: 12px 28px;
  transition: background 0.18s ease, padding-left 0.18s ease;
}
#mySidenav a:not(.closebtn):hover {
  padding-left: 38px;
}

/* Close button position */
#mySidenav .closebtn {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 2rem;
  line-height: 1;
}

/* Sidenav header: Old Lane branding strip */
#mySidenav::before {
  content: 'Old Lane';
  display: block;
  padding: 22px 28px 18px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 8px;
}

/* Remove the blog menu drawer and overlay — no longer used */
#blogMenu,
#blog-menu-overlay { display: none !important; }



/* ----------------------------------------------------------
   7. SEARCH OVERLAY
   ---------------------------------------------------------- */
#search-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: 600px;
  width: calc(100% - 32px);
  background: var(--surface-color);
  color: var(--text-color);
  box-shadow: 0 16px 48px rgba(0,0,0,0.35);
  position: fixed;
  top: 15vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
}
#search-dialog::backdrop {
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(3px);
}
.search-inner { padding: 20px; }
.search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.search-input-row svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: var(--muted-color);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1.1rem;
  color: var(--text-color);
  outline: none;
  font-family: var(--main-font);
}
#search-input::placeholder { color: var(--muted-color); }
#search-close-btn {
  background: none;
  border: none;
  color: var(--muted-color);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: normal;
}
#search-close-btn:hover { background: var(--border-color); }

#search-status {
  font-size: 0.8rem;
  color: var(--muted-color);
  margin-bottom: 8px;
  min-height: 1.2em;
}
#search-results {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
}
.search-result-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-color);
  transition: background 0.15s ease;
}
.search-result-item:hover,
.search-result-item.focused {
  background: var(--surface-color);
  outline: 2px solid var(--hover-color);
}
.search-result-title {
  font-weight: 600;
  font-size: 1rem;
}
.search-result-meta {
  font-size: 0.78rem;
  color: var(--muted-color);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.search-result-excerpt {
  font-size: 0.82rem;
  color: var(--muted-color);
  margin-top: 4px;
}
mark {
  background: color-mix(in srgb, var(--hover-color) 25%, transparent);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ----------------------------------------------------------
   8. POST CARDS (home & list pages)
   ---------------------------------------------------------- */
.posts-grid {
  display: grid;
  gap: 24px;
}

.post-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px 24px;
  text-decoration: none;
  color: var(--text-color);
  display: block;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.post-card:hover {
  border-color: var(--hover-color);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.post-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.post-card-date {
  font-size: 0.8rem;
  color: var(--muted-color);
}
.post-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.35;
}
.post-card-desc {
  font-size: 0.9rem;
  color: var(--muted-color);
  line-height: 1.6;
}
.post-card-tags {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ----------------------------------------------------------
   9. LANGUAGE CHIPS (in cards, meta lines, etc.)
   ---------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--grey-accent);
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease;
}
.chip:hover { background: var(--hover-color); }
.chip.chip-tag {
  background: color-mix(in srgb, var(--grey-accent) 50%, transparent);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}
.chip.chip-tag:hover { background: var(--hover-color); color: #fff; border-color: var(--hover-color); }

/* ----------------------------------------------------------
   10. POST PAGE
   ---------------------------------------------------------- */
.post-hero {
  margin-bottom: 32px;
}
.post-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.25;
  margin: 12px 0 16px;
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--muted-color);
  margin-bottom: 16px;
}
.post-cover {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 24px;
  object-fit: cover;
  max-height: 420px;
}

/* Prose styles */
.post-content h1, .post-content h2, .post-content h3,
.post-content h4, .post-content h5, .post-content h6 {
  margin: 2em 0 0.6em;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text-color);
  scroll-margin-top: calc(var(--topnav-height) + var(--subnav-height) + 16px);
}
.post-content h2 { font-size: 1.5rem; }
.post-content h3 { font-size: 1.2rem; }

.post-content p { margin: 0 0 1.2em; }
.post-content ul, .post-content ol { margin: 0 0 1.2em 1.4em; }
.post-content li { margin-bottom: 0.4em; }

.post-content a { color: var(--hover-color); }
:root[data-theme="dark"] .post-content a { color: #7eb8f7; }
.post-content a:hover { text-decoration: underline; }

.post-content blockquote {
  border-left: 4px solid var(--hover-color);
  margin: 1.5em 0;
  padding: 12px 16px;
  background: var(--surface-color);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--muted-color);
}

/* Table wrapper (scrollable on mobile) */
.table-wrapper { overflow-x: auto; margin: 1.5em 0; }
.post-content table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}
.post-content th, .post-content td {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  text-align: left;
}
.post-content th {
  background: var(--surface-color);
  font-weight: 600;
}

/* ----------------------------------------------------------
   11. CODE BLOCKS
   ---------------------------------------------------------- */
.code-block {
  position: relative;
  margin: 1.5em 0;
}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--hljs-bg);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 6px 12px;
}
.code-block-lang {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-color);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.copy-btn {
  font-size: 0.75rem;
  padding: 4px 10px;
  background: var(--grey-accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}
.copy-btn:hover { background: var(--hover-color); }
.copy-btn.copied { background: #187240; }

.code-block pre {
  background: var(--hljs-bg);
  color: var(--hljs-color);
  border: 1px solid var(--border-color);
  border-radius: 0 0 8px 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.6;
}
.code-block pre code { background: none; color: inherit; padding: 0; }

/* highlight.js token colours driven by CSS variables */
.hljs-keyword, .hljs-selector-tag  { color: var(--hljs-keyword); font-weight: bold; }
.hljs-string, .hljs-attribute      { color: var(--hljs-string); }
.hljs-comment, .hljs-quote         { color: var(--hljs-comment); font-style: italic; }
.hljs-number, .hljs-literal        { color: var(--hljs-number); }
.hljs-attr, .hljs-selector-attr    { color: var(--hljs-attr); }
.hljs-built_in, .hljs-class .hljs-title { color: var(--hljs-keyword); }

/* Inline code */
.post-content :not(pre) > code {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.85em;
}

/* ----------------------------------------------------------
   12. HEADING ANCHORS
   ---------------------------------------------------------- */
.header-anchor {
  opacity: 0;
  text-decoration: none;
  margin-left: 6px;
  font-size: 0.85em;
  transition: opacity 0.2s;
}
.post-content h2:hover .header-anchor,
.post-content h3:hover .header-anchor,
.post-content h4:hover .header-anchor {
  opacity: 1;
}

/* ----------------------------------------------------------
   13. PAGINATION
   ---------------------------------------------------------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 40px 0 24px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 7px 14px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-color);
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
  transition: background 0.2s, border-color 0.2s;
}
.pagination a:hover { background: var(--surface-color); border-color: var(--hover-color); }
.pagination .current { background: var(--hover-color); color: #fff; border-color: var(--hover-color); }
.pagination .disabled { opacity: 0.45; pointer-events: none; }

/* ----------------------------------------------------------
   14. PREV/NEXT NAVIGATION
   ---------------------------------------------------------- */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}
.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: var(--text-color);
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: border-color 0.2s;
}
.post-nav-item:hover { border-color: var(--hover-color); }
.post-nav-item.next { text-align: right; }
.post-nav-label { font-size: 0.78rem; color: var(--muted-color); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.post-nav-title { font-weight: 600; font-size: 0.95rem; line-height: 1.35; }

/* ----------------------------------------------------------
   15. LANGUAGE / TAG LISTING PAGES
   ---------------------------------------------------------- */
.lang-listing {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.lang-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text-color);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.lang-card:hover {
  border-color: var(--hover-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.lang-card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.lang-card-count { font-size: 0.82rem; color: var(--muted-color); }

/* ----------------------------------------------------------
   16. ARCHIVE PAGE
   ---------------------------------------------------------- */
.archive-year {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
}
.archive-month {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted-color);
  margin: 18px 0 8px;
}
.archive-list {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}
.archive-list li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
}
.archive-list li:last-child { border-bottom: none; }
.archive-date { font-size: 0.8rem; color: var(--muted-color); white-space: nowrap; }
.archive-list a { color: var(--text-color); text-decoration: none; font-weight: 500; }
.archive-list a:hover { color: var(--hover-color); text-decoration: underline; }

/* ----------------------------------------------------------
   17. STATIC PAGES
   ---------------------------------------------------------- */
.page-content h1 { font-size: 2rem; font-weight: 800; margin-bottom: 24px; }
.page-content h2 { font-size: 1.4rem; font-weight: 700; margin: 2em 0 0.6em; }
.page-content p  { margin: 0 0 1.2em; }
.page-content a  { color: var(--hover-color); }
:root[data-theme="dark"] .page-content a { color: #7eb8f7; }
.page-content ul, .page-content ol { margin: 0 0 1.2em 1.4em; }

/* ----------------------------------------------------------
   18. HOME PAGE STATIC LANGUAGE LIST (for no-JS users)
   ---------------------------------------------------------- */
.noscript-lang-list {
  display: none;
}
noscript .noscript-lang-list {
  display: block;
  margin: 24px 0;
}
.static-lang-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 12px 0;
}

/* ----------------------------------------------------------
   19. READING TIME & POST INFO LINE
   ---------------------------------------------------------- */
.reading-time { font-size: 0.8rem; color: var(--muted-color); }

/* ----------------------------------------------------------
   20. PAGE TITLE / SECTION HEADERS
   ---------------------------------------------------------- */
.page-header {
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}
.page-header h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; margin-bottom: 6px; }
.page-header p  { color: var(--muted-color); font-size: 1rem; }

/* ----------------------------------------------------------
   21. ACCESSIBILITY: FOCUS VISIBLE
   ---------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--hover-color);
  outline-offset: 2px;
}
:root[data-theme="dark"] :focus-visible {
  outline-color: #7eb8f7;
}

/* ----------------------------------------------------------
   22. LINKS
   ---------------------------------------------------------- */
a { color: var(--hover-color); }
:root[data-theme="dark"] a { color: #7eb8f7; }

/* Nav links (chips, pagination) override to avoid blue on dark bg */
.chip, .lang-chip, .post-nav-item, .post-card, .archive-list a,
.blog-menu-nav a, .lang-card { color: var(--text-color); }

/* ----------------------------------------------------------
   23. SELF-HOSTED ROBOTO FONT
   ---------------------------------------------------------- */
@font-face {
  font-family: 'Roboto';
  src: url('/assets/fonts/roboto-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('/assets/fonts/roboto-bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('/assets/fonts/roboto-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ----------------------------------------------------------
   24. PREFERS-REDUCED-MOTION
   ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ----------------------------------------------------------
   25. PRINT STYLES
   ---------------------------------------------------------- */
@media print {
  #header-placeholder,
  .blog-subnav,
  #footer-placeholder,
  #blogMenu,
  #blog-menu-overlay,
  #search-dialog,
  .pagination,
  .post-nav {
    display: none !important;
  }
  .container { padding-top: 0 !important; max-width: 100%; }
  body { background: #fff !important; color: #000 !important; }
}

/* ----------------------------------------------------------
   26. MOBILE RESPONSIVE
   ---------------------------------------------------------- */
@media (max-width: 640px) {
  .post-nav { grid-template-columns: 1fr; }
  .lang-listing { grid-template-columns: 1fr 1fr; }
  .post-card { padding: 16px; }
  .code-block pre { font-size: 0.82rem; }
}

/* ----------------------------------------------------------
   27. W3SCHOOLS-STYLE TUTORIAL SYSTEM
   ---------------------------------------------------------- */
.container.tutorial-container {
  max-width: 1340px;
  padding-left: 20px;
  padding-right: 20px;
}

.tutorial-wrapper {
  width: 100%;
}

/* Mobile Curriculum Toggle Bar */
.tutorial-mobile-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 20px;
}
.tutorial-mobile-bar button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--hover-color);
  color: #fff;
  border: none;
  cursor: pointer;
}
.tutorial-mobile-current {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted-color);
}

.tutorial-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  position: relative;
  width: 100%;
}

/* Left Sidebar (Curriculum Table of Contents) */
.tutorial-sidebar {
  width: 250px;
  flex-shrink: 0;
}

.tutorial-sidebar-sticky {
  position: sticky;
  top: calc(var(--topnav-height) + var(--subnav-height) + 16px);
  max-height: calc(100vh - var(--topnav-height) - var(--subnav-height) - 32px);
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}
.tutorial-sidebar-sticky::-webkit-scrollbar {
  width: 4px;
}
.tutorial-sidebar-sticky::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.tutorial-sidebar-header {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}
.tutorial-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--hover-color);
  color: #fff;
  margin-bottom: 6px;
}
:root[data-theme="dark"] .tutorial-badge {
  background: #7eb8f7;
  color: #02133e;
}
.tutorial-sidebar-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-color);
}

.sidebar-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-color);
  margin-bottom: 8px;
  padding-left: 10px;
}

.tutorial-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tutorial-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-color);
  text-decoration: none;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}
.tutorial-nav-item:hover {
  background: var(--surface-color);
  color: var(--hover-color);
  transform: translateX(3px);
}
:root[data-theme="dark"] .tutorial-nav-item:hover {
  color: #7eb8f7;
}
.tutorial-nav-item.active {
  background: var(--hover-color);
  color: #ffffff;
  font-weight: 700;
}
:root[data-theme="dark"] .tutorial-nav-item.active {
  background: #7eb8f7;
  color: #02133e;
}
.post-count-pill {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hover-color) 12%, transparent);
  color: var(--hover-color);
  font-weight: 700;
}
.tutorial-nav-item.active .post-count-pill {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Main Content Area */
.tutorial-main-content {
  flex: 1;
  min-width: 0;
  background: var(--bg-color);
}

.tutorial-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted-color);
  margin-bottom: 16px;
}
.tutorial-breadcrumbs a {
  color: var(--muted-color);
  text-decoration: none;
}
.tutorial-breadcrumbs a:hover {
  color: var(--hover-color);
  text-decoration: underline;
}
.breadcrumb-sep {
  opacity: 0.5;
}

.tutorial-article-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}
.tutorial-article-title {
  font-size: clamp(1.6rem, 3.5vw, 2.3rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 8px;
}
.tutorial-article-desc {
  font-size: 1.05rem;
  color: var(--muted-color);
  line-height: 1.6;
  margin: 0;
}

/* Right Rail (Ads & Quick Practice) */
.tutorial-right-rail {
  width: 270px;
  flex-shrink: 0;
}
.right-rail-sticky {
  position: sticky;
  top: calc(var(--topnav-height) + var(--subnav-height) + 16px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Ad Slots */
.ad-slot {
  margin: 28px 0;
  background: var(--surface-color);
  border: 1px dashed var(--border-color);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.ad-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-color);
  margin-bottom: 6px;
}
.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--border-color) 40%, transparent);
  border-radius: 6px;
  color: var(--muted-color);
  font-size: 0.8rem;
  font-weight: 600;
}
.in-article-placeholder {
  min-height: 90px;
}
.sidebar-placeholder {
  min-height: 250px;
  width: 100%;
}

/* Right Rail Cards */
.right-rail-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px 18px;
}
.right-rail-heading {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text-color);
}
.right-rail-text {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted-color);
  margin: 0;
}
.right-rail-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.right-rail-links a {
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--text-color);
  display: block;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}
.right-rail-links a:hover {
  background: color-mix(in srgb, var(--hover-color) 10%, transparent);
  color: var(--hover-color);
}

/* Interactive Quiz Component */
.interactive-quiz {
  background: var(--surface-color);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  margin: 36px 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
.quiz-question {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text-color);
  line-height: 1.4;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-color);
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--text-color);
  transition: all 0.15s ease;
}
.quiz-option:hover {
  border-color: var(--hover-color);
  background: color-mix(in srgb, var(--hover-color) 4%, var(--bg-color));
}
.quiz-option input[type="radio"] {
  cursor: pointer;
  accent-color: var(--hover-color);
  width: 18px;
  height: 18px;
}
.quiz-option.correct-choice {
  border-color: #187240 !important;
  background: rgba(24, 114, 64, 0.1) !important;
  font-weight: 600;
}
.quiz-option.wrong-choice {
  border-color: #d32f2f !important;
  background: rgba(211, 47, 47, 0.1) !important;
}
.quiz-check-btn {
  padding: 10px 20px;
  font-size: 0.9rem;
}
.quiz-feedback {
  margin-top: 14px;
  font-size: 0.92rem;
  font-weight: 600;
  display: none;
  padding: 10px 14px;
  border-radius: 6px;
}
.quiz-feedback.is-correct {
  display: block;
  background: rgba(24, 114, 64, 0.12);
  color: #187240;
  border: 1px solid rgba(24, 114, 64, 0.3);
}
.quiz-feedback.is-incorrect {
  display: block;
  background: rgba(211, 47, 47, 0.12);
  color: #d32f2f;
  border: 1px solid rgba(211, 47, 47, 0.3);
}

/* Lesson Prev / Next Navigation */
.tutorial-lesson-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 36px 0;
  padding: 20px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}
.lesson-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  background: var(--surface-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}
.lesson-nav-btn:hover {
  background: var(--hover-color);
  color: #fff;
  border-color: var(--hover-color);
  transform: translateY(-1px);
}
.lesson-nav-btn.primary {
  background: var(--hover-color);
  color: #fff;
  border-color: var(--hover-color);
}

/* Enlisted Posts Section */
.tutorial-posts-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid var(--border-color);
}
.tutorial-posts-header {
  margin-bottom: 20px;
}
.tutorial-posts-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--text-color);
}
.tutorial-posts-subtitle {
  font-size: 0.9rem;
  color: var(--muted-color);
  margin: 0;
}

/* Responsive adjustments */
@media (max-width: 1180px) {
  .tutorial-right-rail {
    display: none;
  }
}

@media (max-width: 860px) {
  .tutorial-mobile-bar {
    display: flex;
  }
  .tutorial-layout {
    flex-direction: column;
    gap: 0;
  }
  .tutorial-sidebar {
    width: 100%;
    display: none;
    margin-bottom: 24px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
  }
  .tutorial-sidebar.is-open {
    display: block;
  }
  .tutorial-sidebar-sticky {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

