/* =============================================================================
 * iuno-theme.css — Blog Theme
 *
 * A warm dark theme with amber/gold accents on a deep brown-black background.
 * 
 * Usage:
 *   <link rel="stylesheet" href="iuno-theme.css">
 *
 * Dependencies:
 *   - Google Fonts: Inter (300, 400, 500, 600)
 *
 * Sections:
 *   1. Font Imports
 *   2. Design Tokens (CSS Variables)
 *   3. Base / Reset
 *   4. Typography (Headings, Paragraphs, Links)
 *   5. Layout (Cards, Grid)
 *   6. Tables
 *   7. Tags & Badges
 *   8. Navigation
 *   9. Post Meta & Content
 *  10. Pagination
 *  11. Footer
 *  12. Utility Classes
 *  13. Table of Contents
 *  14. Responsive Breakpoints
 * ============================================================================= */


/* =============================================================================
 * 1. Font Imports
 *    Inter for UI/body text.
 * ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');


/* =============================================================================
 * 2. Design Tokens (CSS Custom Properties)
 *    Central palette and spacing tokens. Override these to re-theme.
 *
 *    Background scale: --bg (darkest) → --bg-card
 *    Text scale: --text (primary) → --text-muted (secondary)
 *    Accent: --accent (primary amber/gold), --accent-dim (muted variant)
 *    Semantic: --green (success), --blue (info), --purple (accent)
 * ============================================================================= */

:root {
  /* Background colors (warm dark palette) */
  --bg: #1a1612;
  --bg-card: #231f1a;

  /* Borders */
  --border: #3d3529;

  /* Text */
  --text: #e8dfd4;
  --text-muted: #9e9285;

  /* Accent — primary interactive/highlight color */
  --accent: #c49a6c;
  --accent-dim: #8b6d4a;

  /* Code backgrounds */
  --bg-code: #241f19;

  /* Semantic colors */
  --green: #7a9e7e;
  --green-dim: #5a7a5e;
  --blue: #6c8ea4;
  --purple: #9e7aaa;
}


/* =============================================================================
 * 3. Base / Reset
 *    Minimal reset and body defaults.
 * ============================================================================= */

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  line-height: 1.7;
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
  transition: margin-right 0.2s ease;
}


/* =============================================================================
 * 4. Lists
 *    Hanging indent: markers sit at the left edge, text is indented.
 * ============================================================================= */

ul, ol {
  padding-left: 1.5em;
  margin: 0.5rem 0;
}

li {
  margin: 0.25rem 0;
}

li > ul, li > ol {
  margin: 0;
}


/* =============================================================================
 * 5. Typography
 *    Headings, body text, links.
 * ============================================================================= */

h1 {
  font-size: 2rem;
  font-weight: 300;
  color: var(--accent);
  margin-bottom: 0.25rem;
  letter-spacing: 0.02em;
}

h1 a {
  border-bottom: none;
}

h1 a:hover {
  border-bottom: 1px solid var(--accent);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
}

h2 {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--accent);
  margin: 1.75rem 0 1rem;
  position: relative;
  padding-left: 0;
}

.card h2 {
  margin: 0 0 0.5rem;
}

.card h2::before {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 1.1em;
  background: var(--accent-dim);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.2s;
}

.card h2:hover::before {
  opacity: 1;
}

.heading-anchor {
  opacity: 0;
  position: absolute;
  left: -1.2rem;
  top: 0.15em;
  font-size: 0.8em;
  color: inherit;
  text-decoration: none;
  border-bottom: none;
  transition: opacity 0.2s;
  padding: 0.5rem;
  margin: -0.5rem;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor {
  opacity: 1;
}

.heading-anchor:hover {
  color: var(--accent);
}

h3 {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--accent);
  margin: 1rem 0 0.5rem;
  position: relative;
}

h4 {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--accent);
  margin: 1rem 0 0.5rem;
}

p {
  margin: 0.75rem 0;
}

blockquote {
  border-left: 3px solid var(--accent-dim);
  background: var(--bg-card);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
  border-radius: 0 4px 4px 0;
}

.note {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--border);
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
  transition: border-color 0.2s;
}

a:hover {
  border-color: var(--accent);
}

code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  background: var(--bg-code);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.code-block {
  position: relative;
  margin: 1rem 0;
}

.code-block pre {
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 0.85rem;
  right: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, border-color 0.2s;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.code-block:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.copy-btn .check-icon {
  color: var(--green);
}


/* =============================================================================
 * 5. Layout — Cards & Grid
 *    Reusable card containers and responsive grid layouts.
 * ============================================================================= */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: var(--accent-dim);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.grid .card {
  margin: 0;
}


/* =============================================================================
 * 6. Tables
 *    Styled data tables with hover states and accent-colored headers.
 * ============================================================================= */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

th {
  text-align: left;
  color: var(--accent);
  font-weight: 500;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--border);
}

td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:hover td {
  background: var(--bg-card);
}


/* =============================================================================
 * 7. Tags & Badges
 *     Inline labels for categories and status indicators.
 * ============================================================================= */

.tag {
  font-size: 0.8rem;
  color: var(--accent-dim);
  transition: color 0.2s;
}

.tag:hover {
  color: var(--accent);
}

.tag-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.tag-card h3 {
  margin: 0;
}

.tag-count {
  color: var(--text-muted);
  font-weight: 300;
}


/* =============================================================================
 * 8. Navigation
 * ============================================================================= */

nav {
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

nav a.active {
  color: var(--accent);
}

.nav-sep {
  color: var(--text-muted);
  margin: 0 0.25rem;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.site-header nav {
  margin-bottom: 0;
}


/* =============================================================================
 * 9. Post Meta & Content
 * ============================================================================= */

.post-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 0;
}

.date-link {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: none;
}

.date-link:hover {
  color: var(--accent);
}

.post-title-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: none;
}

.post-desc {
  margin-top: 0.5rem;
}

.post-content {
  margin-top: 2rem;
}


/* =============================================================================
 * 10. Pagination
 * ============================================================================= */

.pagination {
  margin-top: 2rem;
  text-align: center;
}

.pagination-prev {
  margin-right: 1rem;
}

.pagination-next {
  margin-left: 1rem;
}

.pagination-num {
  margin: 0 0.5rem;
}

.pagination-current {
  margin: 0 0.5rem;
  color: var(--accent);
  font-weight: 500;
}


/* =============================================================================
 * 11. Footer
 * ============================================================================= */

footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}


/* =============================================================================
 * 12. Utility Classes
 * ============================================================================= */

.text-muted {
  color: var(--text-muted);
}


/* =============================================================================
 * 13. Table of Contents
 *     Sidebar ToC with toggle button, drag-to-resize, active heading highlight.
 * ============================================================================= */

.toc-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 200;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
  line-height: 1;
  padding: 0;
}

.toc-toggle:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.toc-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 260px;
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 3.5rem 1rem 1rem;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  z-index: 100;
  overscroll-behavior: contain;
}

.toc-sidebar.open {
  transform: translateX(0);
}

.toc-drag {
  position: absolute;
  left: 0;
  top: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  z-index: 102;
}

.toc-drag::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 0;
  width: 21px;
  height: 100%;
}

.toc-drag:hover,
.toc-drag.active {
  background: var(--accent-dim);
}

.toc-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.toc-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin: 0;
}

.toc-list a {
  display: block;
  padding: 0.2rem 0 0.2rem 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: none;
  font-size: 0.82rem;
  line-height: 1.4;
  border-left: 2px solid transparent;
  transition: color 0.15s;
}

.toc-list a:hover,
.toc-list a.active {
  color: var(--accent);
}

.toc-list a.active {
  border-left-color: var(--accent);
}

.toc-list .toc-h3 {
  padding-left: 1.25rem;
}


/* =============================================================================
 * 14. Responsive Breakpoints
 * ============================================================================= */

@media (max-width: 600px) {
  body {
    padding: 1rem;
    margin-right: 0 !important;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .toc-sidebar {
    width: 80vw;
    max-width: 300px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
  }
}
