/* Developer-friendly monospace fonts - SF Mono, Monaco, Cascadia Code with Dark/Light support */
:root{
  --bg:#fefdf0; --text:#2c2c2c; --muted:#6b6b6b; --border:#d4c4a8;
  --accent:#6d5ef6; --card:#f5f0e0;
}
:root[data-theme="dark"]{
  --bg:#000000; --text:#ffffff; --muted:#b0b0b0; --border:#333333;
  --accent:#8b5cf6; --card:#111111;
}
* { box-sizing: border-box; }
html, body {
  margin:0; padding:0;
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", "Source Code Pro", "Fira Code", "JetBrains Mono", Consolas, "Courier New", monospace;
  background: var(--bg); color: var(--text); line-height: 1.65; font-size: 17px;
}
.container { width: min(1200px, 95%); margin-inline: auto; padding: 0 16px; }

/* Mobile-first responsive design */
@media (max-width: 768px) {
  html, body { font-size: 16px; }
  .container { width: 100%; padding: 0 12px; }
}

/* Header */
.page-header { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; align-items: center; justify-content: space-between; padding: 24px 0; }
.brand-centered { display: flex; flex-direction: column; align-items: center; text-align: center; flex: 1; }
h1 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); margin: 0; letter-spacing: -0.01em; font-weight: 600; }
.subtitle { margin: 6px 0 0; color: var(--muted); font-size: 1rem; font-weight: 400; line-height: 1.4; }
.header-links { margin: 16px 0 0; display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.header-links a { text-decoration: none; font-size: 0.95rem; font-weight: 500; transition: all 0.2s; padding: 8px 12px; border-radius: 6px; min-height: 44px; display: flex; align-items: center; }
.header-links a:hover { background: var(--card); transform: translateY(-1px); }
.header-right { display: flex; align-items: center; gap: 12px; }

/* Mobile header adjustments */
@media (max-width: 768px) {
  .header-row { padding: 20px 0; flex-direction: row; justify-content: space-between; align-items: flex-start; }
  .brand-centered { order: 1; flex: 1; text-align: left; }
  .header-right { order: 2; margin-left: 16px; }
  h1 { font-size: clamp(1.4rem, 4vw, 1.8rem); }
  .subtitle { font-size: 0.85rem; margin: 4px 0 0; }
  .header-links { margin: 8px 0 0; gap: 8px; justify-content: flex-start; }
  .header-links a { font-size: 0.85rem; padding: 8px 12px; min-height: 44px; }
}
.pdf-download { 
  border: 1px solid var(--border); 
  background: var(--card); 
  color: var(--text); 
  border-radius: 999px; 
  padding: 8px 14px; 
  text-decoration: none;
  font-size: 16px;
  transition: all 0.2s;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pdf-download:hover { 
  background: var(--accent); 
  color: white; 
  transform: scale(1.05);
}
.toggle { 
  border: 1px solid var(--border); 
  background: var(--card); 
  color: var(--text); 
  border-radius: 999px; 
  padding: 10px 14px; 
  cursor: pointer; 
  font-size: 18px; 
  min-width: 48px; 
  min-height: 48px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  transition: all 0.2s; 
  touch-action: manipulation;
}
.toggle:hover { 
  background: var(--accent); 
  color: white; 
  transform: scale(1.05); 
}
.toggle:active { 
  transform: scale(0.95); 
}

/* Mobile button adjustments */
@media (max-width: 768px) {
  .pdf-download { 
    padding: 10px 16px; 
    font-size: 15px; 
    min-height: 44px; 
  }
  .toggle { 
    min-width: 52px; 
    min-height: 52px; 
    font-size: 20px; 
    padding: 12px 16px; 
  }
}

/* Content */
.content { padding: 32px 0; }
section { margin: 32px 0; }
h2 { font-size: 1.3rem; margin: 0 0 16px; font-weight: 600; color: var(--text); }
h3 { font-size: 1.1rem; margin: 0 0 8px; font-weight: 600; }
h4 { font-weight: 600; margin: 0 0 8px; color: var(--text); font-size: 1.05rem; }
p { margin: 0 0 12px; line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Mobile content adjustments */
@media (max-width: 768px) {
  .content { padding: 24px 0; }
  section { margin: 20px 0; }
  h2 { font-size: 1.15rem; margin: 0 0 12px; }
  h3 { font-size: 1rem; margin: 0 0 6px; }
  h4 { font-size: 0.95rem; margin: 0 0 6px; }
  p { margin: 0 0 8px; line-height: 1.5; }
}

/* Lists & rows */
.links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px 14px; }
.links li { display: inline; }

.row { display: grid; grid-template-columns: 180px 1fr; gap: 24px; padding: 24px 0; border-top: 1px solid var(--border); }
.row:first-of-type { border-top: none; }
.row-meta { color: var(--text); white-space: nowrap; font-size: 1rem; font-weight: 600; padding-right: 8px; }
.row-body { min-width: 0; padding-left: 4px; }
.dim { color: var(--muted); line-height: 1.5; }

/* Mobile row adjustments */
@media (max-width: 768px) {
  .row { 
    grid-template-columns: 1fr; 
    gap: 8px; 
    padding: 16px 0; 
  }
  .row-meta { 
    font-size: 0.85rem; 
    padding-right: 0; 
    padding-bottom: 2px; 
    border-bottom: 1px solid var(--border); 
    margin-bottom: 6px; 
  }
  .row-body { 
    padding-left: 0; 
  }
}

.tags { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 12px 0 0; list-style: none; }
.tags li { 
  font-size: 0.85rem; 
  padding: 8px 14px; 
  border-radius: 20px; 
  border: 1px solid var(--border); 
  background: var(--card); 
  color: var(--text); 
  font-weight: 500; 
  transition: all 0.2s; 
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tags li:hover { 
  background: var(--accent); 
  color: white; 
  transform: translateY(-1px); 
}

/* Mobile tags adjustments */
@media (max-width: 768px) {
  .tags { 
    gap: 6px; 
    margin: 8px 0 0; 
  }
  .tags li { 
    font-size: 0.75rem; 
    padding: 8px 12px; 
    min-height: 36px; 
  }
}

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 16px 0 28px; color: var(--muted); }

/* Mobile footer adjustments */
@media (max-width: 768px) {
  .footer { padding: 12px 0 20px; }
}

/* Additional mobile improvements */
@media (max-width: 480px) {
  .container { padding: 0 8px; }
  .header-row { padding: 12px 0; }
  .content { padding: 20px 0; }
  section { margin: 20px 0; }
  .row { padding: 16px 0; }
  h1 { font-size: clamp(1.3rem, 5vw, 1.8rem); }
  .header-links a { padding: 10px 14px; min-height: 48px; font-size: 0.85rem; }
  .toggle { min-width: 56px; min-height: 56px; font-size: 22px; }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .header-links a:hover,
  .tags li:hover,
  .toggle:hover,
  .pdf-download:hover {
    transform: none;
  }
  .header-links a:active,
  .tags li:active,
  .toggle:active,
  .pdf-download:active {
    transform: scale(0.95);
  }
}

/* Blog-specific mobile improvements */
@media (max-width: 768px) {
  /* Code blocks and pre elements */
  pre {
    font-size: 0.85rem !important;
    padding: 12px !important;
    margin: 12px 0 !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Article headers */
  article header h1 {
    font-size: clamp(1.4rem, 4vw, 1.8rem) !important;
    line-height: 1.3 !important;
  }
  
  /* Navigation breadcrumbs */
  nav a {
    font-size: 0.9rem;
    padding: 8px 12px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

@media (max-width: 480px) {
  /* Extra small screens */
  pre {
    font-size: 0.8rem !important;
    padding: 10px !important;
  }
  
  article header h1 {
    font-size: clamp(1.2rem, 5vw, 1.6rem) !important;
  }
}
