/*
NanoBlogger - Rusoblanco Theme
Based on the classic rusoblanco.com design
Modernized with CSS Grid, Custom Properties, and responsive design
*/

/* CSS Custom Properties for consistent theming */
:root {
  --color-bg: #F3F3F3;
  --color-banner-bg: #111111;
  --color-banner-text: #FFF;
  --color-text: #1a1a1a;
  --color-text-light: #666;
  --color-text-dark: #222;
  --color-black: #000;
  --color-gray: #999;
  --color-gray-light: #CCC;
  --color-gray-lighter: #EEE;
  --color-border: #999;
  --color-border-light: #BBB;
  --color-white: #FFF;
  --color-success: #90EE90;
  --color-success-border: #6B8E23;
  --color-blockquote-bg: #f5f5f5;
  --color-linenum-bg: #f5f5f5;
  --color-button-bg: #f5f5f5;
  --color-link-posted: #003366;
  --color-calendar-day: #AA0000;
  
  --spacing-xs: 2px;
  --spacing-sm: 10px;
  --spacing-md: 15px;
  --spacing-lg: 20px;
  --spacing-xl: 25px;
  
  --font-family: verdana, arial, sans-serif;
  --font-size-xxs: 11px;
  --font-size-xs: 13px;
  --font-size-sm: 15px;
  --font-size-md: 18px;
  --font-size-lg: 20px;
  
  --border-dotted: 1px dotted var(--color-border);
  --border-solid: 1px solid var(--color-border);
}

[data-theme="dark"] {
  --color-bg: #121212;
  --color-banner-bg: #000000;
  --color-banner-text: #FFFFFF;
  --color-text: #F3F3F3;
  --color-text-light: #999;
  --color-text-dark: #FFF;
  --color-black: #FFF;
  --color-gray: #666;
  --color-gray-light: #444;
  --color-gray-lighter: #222;
  --color-border: #666;
  --color-border-light: #444;
  --color-white: #FFF;
  --color-success: #3CB371;
  --color-success-border: #2E8B57;
  --color-blockquote-bg: #222;
  --color-linenum-bg: #222;
  --color-button-bg: #222;
  --color-link-posted: #93B1CC;
  --color-calendar-day: #FF5C5C;
}

/* Modern box-sizing for all elements */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  font-family: var(--font-family);
  width: 100%;
  overflow-x: hidden;
  transition: background-color 0.3s, color 0.3s;
}

/* Link styles */
a { 
  color: var(--color-text-dark); 
  text-decoration: none; 
}

a:link { 
  color: var(--color-black); 
  text-decoration: underline; 
  font-weight: bold; 
}

a:visited { 
  color: var(--color-text-dark); 
  text-decoration: underline; 
  font-weight: bold; 
}

a:active { 
  color: var(--color-gray); 
  text-decoration: underline; 
  font-weight: bold; 
}

a:hover { 
  color: var(--color-gray); 
  text-decoration: underline; 
  font-weight: bold; 
}

/* Headings */
h1, h2, h3 {
  padding: 0;
}

h4, h5, h6 {
  font-size: var(--font-size-xs);
}

/* Block elements */
blockquote {
  background-color: var(--color-blockquote-bg);
  padding: 1.2em;
  border-left: 5px solid var(--color-border-light);
  max-width: 100%;
  overflow-x: auto;
  margin: 1.5em 0;
  border-radius: 4px;
}

pre {
  overflow-x: auto;
  padding: 1.2em;
  border: 2px solid var(--color-banner-bg);
  position: relative;
  max-width: 100%;
  white-space: pre;
  word-wrap: normal;
  margin: 1.5em 0;
}

/* Code block with line numbers */
.highlight {
  position: relative;
  margin: 1.5em 0;
  z-index: 1;
  max-width: 100%;
  overflow-x: auto;
  border: 2px solid var(--color-banner-bg);
  border-radius: 0;
}

.highlight > div {
  position: relative;
  max-width: 100%;
}

.highlight pre {
  padding: 1.2em;
  overflow-x: auto;
  margin: 0;
  border: none;
  max-width: 100%;
  white-space: pre;
  word-wrap: normal;
  font-size: var(--font-size-sm);
}

/* Line numbers styling - inline mode */
.highlight .ln {
  margin-right: 0.8em;
  padding-right: 0.8em;
  color: var(--color-text-light);
  user-select: none;
  -webkit-user-select: none;
  display: inline-block;
  text-align: right;
  min-width: 2em;
  border-right: 1px solid var(--color-gray-light);
}

/* Hide line numbers in reader mode (Firefox) */
@media print {
  .highlight .ln {
    display: none;
  }
}

/* Line numbers styling - table mode for better reader compatibility */
.highlight .lntable {
  border-spacing: 0;
  padding: 0;
  margin: 0;
  border: 0;
  width: 100%;
  max-width: 100%;
  display: table;
  overflow-x: auto;
}

.highlight .lntd {
  padding: 0;
  margin: 0;
  border: 0;
  vertical-align: top;
}

.highlight .lnt,
.highlight .ln {
  margin-right: 0.4em;
  padding: 0 0.4em;
  color: var(--color-text-light);
  user-select: none;
  -webkit-user-select: none;
}

.highlight .lntd:first-child {
  width: 1%;
  min-width: 50px;
  background-color: var(--color-linenum-bg);
  border-right: 1px solid var(--color-gray-light);
}

.highlight .lntd:first-child pre {
  background-color: var(--color-linenum-bg);
}

/* Hide line numbers column for accessibility and reader modes */
.highlight .lntd:first-child {
  /* Use aria-hidden to signal this is decorative */
  visibility: visible;
}

.highlight .lntd:first-child[aria-hidden="true"],
.highlight .lntd:first-child > * {
  -moz-user-select: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Copy button styling */
.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  font-size: 10px;
  font-family: var(--font-family);
  background: var(--color-button-bg);
  border: var(--border-solid);
  border-radius: 3px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
  z-index: 10;
}

.copy-button:hover {
  opacity: 1;
  background: #e5e5e5;
}

.copy-button:active {
  background: #d5d5d5;
}

.copy-button.copied {
  background: var(--color-success);
  border-color: var(--color-success-border);
}

/* Line numbers toggle button */
.linenums-button {
  position: absolute;
  top: 8px;
  right: 60px;
  padding: 4px 8px;
  font-size: 10px;
  font-family: var(--font-family);
  background: var(--color-button-bg);
  border: var(--border-solid);
  border-radius: 3px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
  z-index: 10;
}

.linenums-button:hover {
  opacity: 1;
  background: #e5e5e5;
}

.linenums-button:active {
  background: #d5d5d5;
}

.linenums-button.active {
  background: var(--color-gray-light);
  border-color: var(--color-text-dark);
}

/* Code block wrapper for dual versions */
.code-block-wrapper {
  position: relative;
  margin: 1em 0;
}

.code-block-wrapper .code-version {
  position: relative;
}

/* Line numbers styling - table mode */
.highlight .lntable {
  border-spacing: 0;
  padding: 0;
  margin: 0;
  border: 0;
  width: 100%;
  max-width: 100%;
  display: table;
  overflow-x: auto;
}

.highlight .lntd {
  padding: 0;
  margin: 0;
  border: 0;
  vertical-align: top;
}

.highlight .lnt,
.highlight .ln {
  margin-right: 0.4em;
  padding: 0 0.4em;
  color: var(--color-text-light);
  user-select: none;
  -webkit-user-select: none;
}

.highlight .lntd:first-child {
  width: 1%;
  min-width: 50px;
  background-color: var(--color-linenum-bg);
  border-right: 1px solid var(--color-gray-light);
}

.highlight .lntd:first-child pre {
  background-color: var(--color-linenum-bg);
}

/* Banner - full width */
#banner {
  font-family: var(--font-family);
  background-color: var(--color-banner-bg);
  font-size: var(--font-size-lg);
  font-weight: normal;
  text-align: left;
  padding: var(--spacing-md);
  border-top: var(--border-dotted);
  border-bottom: var(--border-dotted);
  width: 100%;
  position: relative;
  z-index: 1;
}

#banner h1 {
  margin: 0;
  padding: 0;
  display: inline;
}

#banner a,
#banner a:link,
#banner a:visited,
#banner a:active,
#banner a:hover {
  font-family: var(--font-family);
  font-size: var(--font-size-lg);
  color: var(--color-banner-text);
  text-decoration: none;
  font-weight: normal;
}

.description {
  font-family: var(--font-family);
  color: var(--color-banner-text);
  font-size: var(--font-size-sm);
  font-weight: bold;
  text-transform: lowercase;
  margin: 0;
  display: block;
}

/* Grid-based layout - content left, sidebar right */
#container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 60px;
  width: 100%;
  min-height: 100vh;
  position: relative;
}

#content {
  padding-bottom: var(--spacing-sm);
  min-width: 0; /* Prevents grid blowout */
  order: 1;
}

#links {
  padding: 0;
  border-left: var(--border-dotted);
  border-bottom: var(--border-dotted);
  order: 2;
  width: 300px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
}

.sidebar-content {
  overflow-y: auto;
  flex: 1;
  padding: 0 21px var(--spacing-lg) var(--spacing-md);
}

/* Blog content */
.blog {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: var(--spacing-md) 60px var(--spacing-md) 60px;
  overflow-x: hidden;
}

.item {
  margin-bottom: 2em;
  max-width: 100%;
  overflow-x: hidden;
}

article.item header {
  margin-bottom: 1em;
}

article.item footer {
  margin-top: 1em;
}

.blogbody {
  font-family: var(--font-family);
  color: var(--color-text);
  font-size: var(--font-size-md);
  font-weight: normal;
  line-height: 1.7;
  max-width: 100%;
  overflow-x: hidden;
  text-align: justify;
}

.blogbody p {
  margin-top: 0;
  margin-bottom: 1em;
}

.blogbody h2,
.blogbody h3,
.blogbody h4,
.blogbody h5,
.blogbody h6 {
  text-align: left;
  border-bottom: none;
  text-decoration: none;
}

.blogbody h2 {
  margin-top: 2em;
  margin-bottom: 0.5em;
  font-size: 2em;
  font-weight: bold;
  color: var(--color-text-dark);
}

.blogbody h3 {
  margin-top: 1.8em;
  margin-bottom: 0.5em;
  font-size: 1.6em;
  font-weight: bold;
  color: var(--color-text-dark);
}

.blogbody h4 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-size: 1.35em;
  font-weight: bold;
  color: var(--color-text);
}

.blogbody h5,
.blogbody h6 {
  margin-top: 1.2em;
  margin-bottom: 0.5em;
  font-size: 1.15em;
  font-weight: bold;
}

.blogbody a,
.blogbody a:link,
.blogbody a:visited,
.blogbody a:active,
.blogbody a:hover {
  font-weight: normal;
  text-decoration: underline;
}

.title {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  color: var(--color-text-dark);
  margin-bottom: var(--spacing-md);
  border-bottom: none;
  text-decoration: none;
}

.title a,
.title a:link,
.title a:visited {
  text-decoration: none;
  color: var(--color-text-dark);
}

.title a:hover,
.title a:active {
  color: var(--color-gray);
  text-decoration: none;
}

article.item h1.title {
  font-size: 2.4em;
  margin-top: 0;
  margin-bottom: var(--spacing-md);
  font-weight: bold;
  border-bottom: none;
  text-decoration: none;
}

article.item h2.title {
  font-size: 1.8em;
  margin-top: 0;
  margin-bottom: 0.5em;
  font-weight: bold;
  border-bottom: none;
  text-decoration: none;
}

.date {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  border-bottom: var(--border-solid);
  margin-bottom: var(--spacing-sm);
  font-weight: bold;
  display: block;
}

time.date {
  display: block;
}

#menu,
.menu {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  margin-bottom: var(--spacing-md);
  text-align: center;
}

.menu a[href="#top"] {
  display: inline-block;
  padding: 8px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-dark);
  text-decoration: none;
  font-weight: bold;
  font-size: var(--font-size-sm);
}

.menu a[href="#top"]:hover {
  background: var(--color-gray-lighter);
  color: var(--color-text-dark);
}

.menu a[href="#top"]::after {
  content: " Top";
}

.posted {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  margin-bottom: var(--spacing-xl);
}

.posted a,
.posted a:link,
.posted a:visited {
  color: var(--color-link-posted);
  text-decoration: underline;
  font-weight: bold;
}

.posted a:hover,
.posted a:active {
  color: var(--color-gray);
}

/* Calendar widget */
.calendar {
  font-family: var(--font-family);
  color: var(--color-text-dark);
  font-size: var(--font-size-xs);
  font-weight: normal;
  line-height: 150%;
  padding: var(--spacing-xs);
  margin-bottom: var(--spacing-md);
  width: 100%;
  display: block;
  min-width: 200px;
}

.calendar table {
  margin: 0 auto;
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
}

.calendar td,
.calendar th {
  padding: 2px 4px;
  text-align: center;
}

.calendar span {
  display: inline;
}

.calendar a,
.calendar a:link,
.calendar a:active,
.calendar a:hover {
  font-weight: bold;
  text-decoration: underline;
}

.calendarhead {
  font-family: var(--font-family);
  color: var(--color-text-dark);
  font-size: var(--font-size-sm);
  font-weight: bold;
  padding: var(--spacing-xs);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
  border-bottom: var(--border-solid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendarday {
  font-weight: bold;
  text-align: center;
  color: var(--color-calendar-day);
}

/* Calendar navigation */
.calendar-widget {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--spacing-md);
  margin-top: var(--spacing-sm);
}

.calendar-widget .calendar-month {
  flex: 0 1 auto;
}

.calendar-nav {
  display: contents;
}

.calendar-prev,
.calendar-next {
  font-family: var(--font-family);
  font-size: 14px;
  background: var(--color-gray-lighter);
  border: none;
  padding: 0;
  margin: 0 4px;
  cursor: pointer;
  color: var(--color-text-light);
  text-decoration: none;
  width: 12px;
  flex-shrink: 0;
  line-height: 1;
  transition: all 0.2s;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-prev:hover,
.calendar-next:hover {
  color: var(--color-text-dark);
  background: var(--color-gray-light);
}

.calendar-prev:disabled,
.calendar-next:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.calendar-prev:disabled:hover,
.calendar-next:disabled:hover {
  background: var(--color-gray-lighter);
}

/* Sidebar styles */
.side {
  font-family: var(--font-family);
  color: var(--color-text);
  font-size: var(--font-size-xs);
  font-weight: normal;
  line-height: 150%;
  padding: var(--spacing-xs);
}

ul.side {
  list-style-type: disc;
  list-style-position: outside;
  padding-left: 20px;
  margin: 0;
  color: var(--color-text);
}

ul.side li {
  margin-bottom: 0;
  line-height: 150%;
}

ul.side a,
ul.side a:link {
  font-weight: bold;
  text-decoration: underline;
  color: var(--color-black);
}

ul.side a:visited {
  font-weight: bold;
  text-decoration: underline;
  color: var(--color-text-dark);
}

ul.side a:active,
ul.side a:hover {
  font-weight: bold;
  text-decoration: underline;
  color: var(--color-gray);
}

.sidetitle {
  font-family: var(--font-family);
  color: var(--color-text-dark);
  font-size: var(--font-size-sm);
  font-weight: normal;
  padding: var(--spacing-xs);
  margin-top: var(--spacing-sm);
  letter-spacing: 0.1em;
  border-bottom: var(--border-dotted);
  text-align: center;
  text-transform: lowercase;
}

.syndicate {
  font-family: var(--font-family);
  font-size: var(--font-size-xxs);
  line-height: 150%;
  padding: var(--spacing-xs);
  margin-top: var(--spacing-sm);
  text-align: center;
  background: var(--color-gray-lighter);
  color: var(--color-text);
}

.syndicate a {
  color: var(--color-text-dark);
  font-weight: bold;
}

.contact-email {
  text-align: center;
}

.powered {
  font-family: var(--font-family);
  color: var(--color-text-light);
  font-size: var(--font-size-xxs);
  font-weight: bold;
  border-top: 1px solid var(--color-gray-light);
  border-bottom: 1px solid var(--color-gray-light);
  line-height: 150%;
  text-transform: uppercase;
  padding: var(--spacing-xs);
  margin-top: var(--spacing-sm);
  text-align: center;
  letter-spacing: 0.2em;
}

.intro {
  font-family: var(--font-family);
  border-bottom: 1px solid var(--color-text-dark);
  background: var(--color-white);
  color: var(--color-text);
  font-size: var(--font-size-xs);
  font-weight: normal;
  line-height: 140%;
  padding: var(--spacing-sm);
  margin-bottom: 45px;
}

.intro a,
.intro a:link,
.intro a:visited,
.intro a:active,
.intro a:hover {
  font-weight: normal;
  text-decoration: underline;
  color: var(--color-text);
}

.archives {
  padding: var(--spacing-md);
}

.archives h2 {
  color: var(--color-text-dark);
  text-align: left;
  margin-bottom: 1em;
  font-size: var(--font-size-lg);
  border-bottom: 2px solid var(--color-banner-bg);
  padding-bottom: 0.5em;
}

.archives #menu {
  margin-bottom: 2em;
  padding: var(--spacing-sm);
  background: var(--color-gray-lighter);
  border: var(--border-solid);
  text-align: center;
}

.archives strong {
  color: var(--color-text-dark);
  display: block;
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 1.5em;
  margin-bottom: 0.75em;
  border-bottom: var(--border-dotted);
  padding-bottom: 0.5em;
}

.archives > div:not(#menu):not(.menu) {
  margin-left: var(--spacing-md);
  line-height: 1.8;
}

.archives .entry-line {
  padding: 0.3em 0;
  border-bottom: 1px dotted var(--color-gray-light);
}

.archives .entry-line:hover {
  background: var(--color-gray-lighter);
  padding-left: 0.5em;
  margin-left: -0.5em;
}

.archives .entry-date {
  color: var(--color-text-light);
  font-family: monospace;
  font-size: var(--font-size-xs);
  margin-right: 0.5em;
}

.archives .entry-count {
  color: var(--color-text-light);
  font-size: var(--font-size-xs);
}

/* Comments */
.comments-body {
  font-family: var(--font-family);
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
  font-weight: normal;
  line-height: 120%;
  padding-bottom: var(--spacing-sm);
  padding-top: var(--spacing-sm);
  border-bottom: var(--border-dotted);
}

.comments-post {
  font-family: var(--font-family);
  color: var(--color-text-light);
  font-size: var(--font-size-xs);
  font-weight: normal;
}

.comments-head {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  border-bottom: var(--border-solid);
  margin-top: var(--spacing-lg);
  font-weight: bold;
}

/* Responsive table container */
.table-container {
  overflow-x: auto;
  margin: 1.5em 0;
}

/* Retro table styling */
.blogbody table,
.item-description table {
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  border-collapse: collapse;
  border: 2px solid var(--color-banner-bg);
  background: var(--color-white);
  width: 100%;
}

.blogbody table th,
.item-description table th {
  background: var(--color-banner-bg);
  color: var(--color-white);
  font-weight: bold;
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--color-banner-bg);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: var(--font-size-xs);
}

.blogbody table td,
.item-description table td {
  padding: 6px 12px;
  border: var(--border-solid);
  background: var(--color-gray-lighter);
}

.blogbody table tr:nth-child(even) td,
.item-description table tr:nth-child(even) td {
  background: var(--color-bg);
}

.blogbody table tr:hover td,
.item-description table tr:hover td {
  background: var(--color-gray-light);
}

/* Alternate retro style: dotted borders */
.blogbody table.dotted,
.item-description table.dotted {
  border: 2px dotted var(--color-text-light);
}

.blogbody table.dotted th,
.item-description table.dotted th {
  background: var(--color-text-light);
  border: 1px dotted var(--color-gray);
}

.blogbody table.dotted td,
.item-description table.dotted td {
  border: 1px dotted var(--color-border-light);
}

/* Compact table style */
.blogbody table.compact,
.item-description table.compact {
  font-size: var(--font-size-xs);
}

.blogbody table.compact th,
.blogbody table.compact td,
.item-description table.compact th,
.item-description table.compact td {
  padding: 4px 8px;
}

/* Mobile menu toggle button */
.menu-toggle {
  display: none;
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
  background: var(--color-banner-bg);
  border: var(--border-solid);
  border-radius: 4px;
  padding: 8px;
  cursor: pointer;
  width: 44px;
  height: 44px;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}

.menu-icon {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--color-white);
  transition: all 0.3s ease;
  border-radius: 2px;
}

.menu-toggle.active .menu-icon:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active .menu-icon:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active .menu-icon:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Desktop sidebar collapse button */
.sidebar-collapse {
  display: flex;
  position: absolute;
  top: 10px;
  left: 0;
  transform: translateX(-100%);
  z-index: 10;
  background: var(--color-banner-bg);
  color: var(--color-white);
  border: var(--border-solid);
  border-right: none;
  border-radius: 4px 0 0 4px;
  padding: 8px 6px;
  cursor: pointer;
  font-size: 20px;
  font-weight: bold;
  line-height: 1;
  align-items: center;
  justify-content: center;
}

.sidebar-collapse:hover {
  background: var(--color-text-dark);
}

/* Desktop sidebar expand button */
.sidebar-expand {
  display: none;
  position: absolute;
  top: 10px;
  right: 0;
  z-index: 100;
  background: var(--color-banner-bg);
  color: var(--color-white);
  border: var(--border-solid);
  border-right: none;
  border-radius: 4px 0 0 4px;
  padding: 8px 6px;
  cursor: pointer;
  font-size: 20px;
  font-weight: bold;
  line-height: 1;
  align-items: center;
  justify-content: center;
}

.sidebar-expand:hover {
  background: var(--color-text-dark);
}

/* Collapsed sidebar state */
#links.collapsed {
  display: none;
}

#container.sidebar-collapsed {
  grid-template-columns: 1fr;
}

/* Initial sidebar state from localStorage - prevents flash */
html.sidebar-collapsed-init #links {
  display: none !important;
}

html.sidebar-collapsed-init #container {
  grid-template-columns: 1fr;
}

#links {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Responsive design - tablet and mobile */
@media screen and (max-width: 1024px) {
  /* Smaller sidebar on tablets */
  #container {
    grid-template-columns: 1fr 250px;
    gap: 40px;
  }
  
  #links {
    width: 250px;
  }
  
  .blog {
    max-width: 750px;
    padding: var(--spacing-sm);
  }
}

@media screen and (max-width: 768px) {
  /* Hide desktop collapse button on mobile */
  .sidebar-collapse,
  .sidebar-expand {
    display: none !important;
  }
  
  /* Show menu toggle button */
  .menu-toggle {
    display: flex;
  }
  
  /* Hide sidebar by default on mobile */
  #links {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: var(--color-bg);
    border-left: var(--border-solid);
    border-bottom: none;
    overflow-y: auto;
    z-index: 999;
    padding: var(--spacing-md);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
  }
  
  /* Show sidebar when toggle is active */
  #links.show-mobile {
    display: block;
  }
  
  /* Single column layout */
  #container {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .blog {
    width: 100%;
    max-width: 100%;
    padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-lg);
  }
  
  /* Adjust banner for mobile */
  #banner {
    padding: var(--spacing-sm);
    font-size: var(--font-size-md);
  }
  
  #banner a,
  #banner a:link,
  #banner a:visited,
  #banner a:active,
  #banner a:hover {
    font-size: var(--font-size-md);
  }
    
  /* Code blocks */
  pre,
  .highlight pre {
    overflow-x: auto;
  }
  
  /* Ensure code block buttons stay aligned on mobile */
  .copy-button,
  .linenums-button {
    top: 4px;
    padding: 3px 6px;
    font-size: 9px;
  }
  
  .copy-button {
    right: 4px;
  }
  
  .linenums-button {
    right: 50px;
  }
}

/* Very small screens */
@media screen and (max-width: 480px) {
  #banner {
    padding: 8px;
    font-size: var(--font-size-sm);
  }
  
  #banner a,
  #banner a:link,
  #banner a:visited,
  #banner a:active,
  #banner a:hover {
    font-size: var(--font-size-sm);
  }
  
  .blog {
    padding: 8px var(--spacing-md) 8px var(--spacing-md);
  }
  
  .copy-button {
    font-size: 9px;
    padding: 3px 6px;
    top: 4px;
    right: 4px;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-toggle-container {
  margin-top: var(--spacing-sm);
}

.theme-selector {
  padding: var(--spacing-xs);
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  color: var(--color-text);
  line-height: 150%;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.theme-option {
  display: inline-block;
  cursor: pointer;
  font-weight: normal;
}

.theme-option input[type="radio"] {
  margin-right: 4px;
  cursor: pointer;
  accent-color: var(--color-banner-bg);
}

/* Custom rule to match code block background to banner */
.chroma {
  background-color: var(--color-banner-bg) !important;
}

[data-theme="dark"] .sidebar-collapse:hover {
  background: var(--color-gray-lighter);
  color: var(--color-white);
}

[data-theme="dark"] .sidebar-expand:hover {
  background: var(--color-gray-lighter);
  color: var(--color-white);
}

