/*
 * Cozy Cyber — A warm, readable theme for cybersecurity blogs
 * Dark mode: Deep slate with amber accents
 * Light mode: Warm paper with teal accents
 */

/* ═══════════════════════════════════════════════════════════════
   FONTS & BASE TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Nunito:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

body {
    --font-text-size: 17px;
    --font-small: 14px;
    --font-smaller: 12px;
    --font-smallest: 11px;
    
    --font-interface: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-text: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-monospace: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    
    --normal-weight: 400;
    --bold-weight: 650;
    --link-weight: 500;
    
    line-height: 1.7;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.published-container {
    /* ... CSS variables */
    --page-width: 100%;
    --footer-display: none;
    --logo-width: 5rem;
  }
  
  .site-body-left-column-site-name {
    text-align: center;
  }
  
  .site-body-left-column-site-logo {
    margin: 0 auto 1rem auto;
  }

  @media screen and (min-width: 1280px) {
    /* ... rules and variables for screens larger than tablet */
    .published-container {
      --page-side-padding: 7rem; /* This is the padding I.E. width for the central page content */
    }
  }
  
  @media screen and (max-width: 1280px) {
    .published-container {
      --sidebar-left-width: 230px;
      --sidebar-right-width: 250px;
      --graph-height: 200px;
    }
  }
  @media screen and (max-width: 750px) {
    /* ... rules and variables for mobile devices and smaller */
  }

/* ═══════════════════════════════════════════════════════════════
   DARK MODE — Deep Slate & Amber
   ═══════════════════════════════════════════════════════════════ */

.theme-dark {
    /* Core palette */
    --bg-base: #0f1419;
    --bg-surface: #151a21;
    --bg-elevated: #1c232d;
    --bg-overlay: #242d3a;
    
    /* Text colors */
    --text-normal: #d4d4d8;
    --text-muted: #8b929e;
    --text-faint: #565d6b;
    
    /* Accent — warm amber */
    --accent-primary: #f59e0b;
    --accent-hover: #fbbf24;
    --accent-muted: rgba(245, 158, 11, 0.15);
    
    /* Semantic colors */
    --link-color: #60a5fa;
    --link-hover: #93c5fd;
    --bold-color: #fcd34d;
    --italic-color: #d4d4d8;
    --highlight-bg: rgba(245, 158, 11, 0.2);
    --selection-bg: rgba(96, 165, 250, 0.3);
    
    /* Navigation active states */
    --nav-active-text: #f5f5f5;
    
    /* Borders & dividers */
    --border-color: #2a3441;
    --border-hover: #3d4a5c;
    --divider: #1e2530;
    
    /* Code blocks */
    --code-bg: #1a1f27;
    --code-border: #2a3441;
    --code-text: #d4d4d8;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    
    /* Map to Obsidian variables */
    --background-primary: var(--bg-base);
    --background-primary-alt: var(--bg-surface);
    --background-secondary: var(--bg-surface);
    --background-secondary-alt: var(--bg-elevated);
    --background-modifier-border: var(--border-color);
    --background-modifier-border-hover: var(--border-hover);
    --interactive-accent: var(--accent-primary);
    --interactive-accent-hover: var(--accent-hover);
    --text-accent: var(--link-color);
    --text-accent-hover: var(--link-hover);
    --text-selection: var(--selection-bg);
    --text-highlight-bg: var(--highlight-bg);
    --outline-heading-color-active: var(--nav-active-text);
}

/* ═══════════════════════════════════════════════════════════════
   LIGHT MODE — Warm Paper & Teal
   ═══════════════════════════════════════════════════════════════ */

.theme-light {
    /* Core palette — warm paper tones */
    --bg-base: #faf8f5;
    --bg-surface: #f5f2ed;
    --bg-elevated: #edeae4;
    --bg-overlay: #e5e1da;
    
    /* Text colors — warm grays */
    --text-normal: #2c2c2c;
    --text-muted: #5c5c5c;
    --text-faint: #8c8c8c;
    
    /* Accent — deep teal */
    --accent-primary: #0d9488;
    --accent-hover: #14b8a6;
    --accent-muted: rgba(13, 148, 136, 0.12);
    
    /* Semantic colors */
    --link-color: #a74b05;
    --link-hover: #9d6840;
    --bold-color: #b45309;
    --italic-color: #2c2c2c;
    --highlight-bg: rgba(250, 204, 21, 0.35);
    --selection-bg: rgba(13, 148, 136, 0.2);
    
    /* Navigation active states */
    --nav-active-text: #1a1a1a;
    
    /* Borders & dividers */
    --border-color: #ddd8d0;
    --border-hover: #c9c3b8;
    --divider: #e8e4dc;
    
    /* Code blocks */
    --code-bg: #f0ece5;
    --code-border: #ddd8d0;
    --code-text: #2c2c2c;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
    
    /* Map to Obsidian variables */
    --background-primary: var(--bg-base);
    --background-primary-alt: var(--bg-surface);
    --background-secondary: var(--bg-surface);
    --background-secondary-alt: var(--bg-elevated);
    --background-modifier-border: var(--border-color);
    --background-modifier-border-hover: var(--border-hover);
    --interactive-accent: var(--accent-primary);
    --interactive-accent-hover: var(--accent-hover);
    --text-accent: var(--link-color);
    --text-accent-hover: var(--link-hover);
    --text-selection: var(--selection-bg);
    --text-highlight-bg: var(--highlight-bg);
    --outline-heading-color-active: var(--nav-active-text);
}

/* ═══════════════════════════════════════════════════════════════
   SHARED VARIABLES
   ═══════════════════════════════════════════════════════════════ */

.theme-dark,
.theme-light {
    --radius-xs: 3px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    
    --content-width: 750px;
    --image-radius: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   HEADINGS
   ═══════════════════════════════════════════════════════════════ */

.markdown-preview-view h1,
.markdown-preview-view h2,
.markdown-preview-view h3,
.markdown-preview-view h4,
.markdown-preview-view h5,
.markdown-preview-view h6,
.markdown-rendered h1,
.markdown-rendered h2,
.markdown-rendered h3,
.markdown-rendered h4,
.markdown-rendered h5,
.markdown-rendered h6 {
    font-family: var(--font-interface);
    font-weight: 600;
    line-height: 1.3;
    margin-top: 2em;
    margin-bottom: 0.75em;
    color: var(--text-normal);
}

.markdown-preview-view h1,
.markdown-rendered h1 {
    font-size: 2em;
    font-weight: 700;
    letter-spacing: -0.03em;
    padding-bottom: 0.3em;
    border-bottom: 2px solid var(--accent-muted);
}

.markdown-preview-view h2,
.markdown-rendered h2 {
    font-size: 1.5em;
    letter-spacing: -0.02em;
}

.markdown-preview-view h3,
.markdown-rendered h3 {
    font-size: 1.25em;
    letter-spacing: -0.01em;
}

.markdown-preview-view h4,
.markdown-rendered h4 {
    font-size: 1.1em;
    font-weight: 600;
}

.markdown-preview-view h5,
.markdown-rendered h5 {
    font-size: 0.95em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.markdown-preview-view h6,
.markdown-rendered h6 {
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-muted);
}

/* Page title */
.page-header {
    margin-bottom: 2em;
    padding-bottom: 1.5em;
    border-bottom: 1px solid var(--divider);
}

.page-title {
    font-family: var(--font-interface);
    font-size: 2.5em;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

/* ═══════════════════════════════════════════════════════════════
   BODY TEXT & PARAGRAPHS
   ═══════════════════════════════════════════════════════════════ */

.markdown-preview-view,
.markdown-rendered {
    font-family: var(--font-text);
    font-size: var(--font-text-size);
    color: var(--text-normal);
}

.markdown-preview-view p,
.markdown-rendered p {
    margin-bottom: 0.65em;
}

/* Bold */
.markdown-preview-view strong,
.markdown-rendered strong {
    font-weight: var(--bold-weight);
    color: var(--bold-color);
}

/* Italic */
.markdown-preview-view em,
.markdown-rendered em {
    font-style: italic;
}

/* Links */
.markdown-preview-view a,
.markdown-rendered a {
    color: var(--link-color);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: all var(--transition-fast);
}

.markdown-preview-view a:hover,
.markdown-rendered a:hover {
    color: var(--link-hover);
    text-decoration-color: var(--link-hover);
}

/* Highlight / mark */
.markdown-preview-view mark,
.markdown-rendered mark {
    background: var(--highlight-bg);
    padding: 0.1em 0.3em;
    border-radius: var(--radius-xs);
}

/* Selection */
::selection {
    background: var(--selection-bg);
}

/* ═══════════════════════════════════════════════════════════════
   CODE — Inline & Blocks
   ═══════════════════════════════════════════════════════════════ */

/* Inline code */
.markdown-preview-view code,
.markdown-rendered code {
    font-family: var(--font-monospace);
    font-size: 0.85em;
    color: var(--code-text);
    background: var(--code-bg);
    padding: 0.2em 0.45em;
    border-radius: var(--radius-xs);
    border: 1px solid var(--code-border);
}

/* Code blocks */
.markdown-preview-view pre,
.markdown-rendered pre {
    font-family: var(--font-monospace);
    font-size: 0.9em;
    line-height: 1.6;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: var(--radius-md);
    padding: 1.25em 1.5em;
    margin: 1em 0;
    overflow-x: auto;
}

.markdown-preview-view pre code,
.markdown-rendered pre code {
    background: transparent;
    border: none;
    padding: 0;
    font-size: inherit;
    color: var(--text-normal);
}

/* ═══════════════════════════════════════════════════════════════
   BLOCKQUOTES
   ═══════════════════════════════════════════════════════════════ */

.markdown-preview-view blockquote,
.markdown-rendered blockquote {
    margin: 0.8em 0;
    padding: 0.85em 1.25em;
    border-left: 4px solid var(--accent-primary);
    background: var(--accent-muted);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-muted);
    font-style: italic;
}

.markdown-preview-view blockquote p:last-child,
.markdown-rendered blockquote p:last-child {
    margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════════
   LISTS
   ═══════════════════════════════════════════════════════════════ */

.markdown-preview-view ul,
.markdown-preview-view ol,
.markdown-rendered ul,
.markdown-rendered ol {
    padding-left: 1.5em;
    margin-bottom: 0.65em;
}

.markdown-preview-view li,
.markdown-rendered li {
    margin-bottom: 0.25em; /* This determines the vertical spacing between list items */
}

.markdown-preview-view ul > li::marker,
.markdown-rendered ul > li::marker {
    color: var(--text-muted);
}

.markdown-preview-view ol > li::marker,
.markdown-rendered ol > li::marker {
    color: var(--text-muted);
    font-weight: 500;
}

/* Task lists */
.markdown-preview-view input[type="checkbox"],
.markdown-rendered input[type="checkbox"] {
    accent-color: var(--accent-primary);
    width: 1.1em;
    height: 1.1em;
    margin-right: 0.5em;
}

/* ═══════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════ */

.markdown-preview-view table,
.markdown-rendered table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.8em 0;
    font-family: var(--font-interface);
    font-size: 0.9em;
}

.markdown-preview-view th,
.markdown-rendered th {
    background: var(--bg-elevated);
    font-weight: 600;
    text-align: left;
    padding: 0.9em 1em;
    border-bottom: 2px solid var(--border-color);
}

.markdown-preview-view td,
.markdown-rendered td {
    padding: 0.8em 1em;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.markdown-preview-view tr:hover td,
.markdown-rendered tr:hover td {
    background: var(--accent-muted);
}

/* ═══════════════════════════════════════════════════════════════
   IMAGES
   ═══════════════════════════════════════════════════════════════ */

.markdown-preview-view img,
.markdown-rendered img {
    max-width: 100%;
    height: auto;
    border-radius: var(--image-radius);
    margin: 0.55em 0;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.markdown-preview-view img:hover,
.markdown-rendered img:hover {
    box-shadow: var(--shadow-lg);
}

/* Image width helpers */
img[alt*="w90"] { width: 90%; }
img[alt*="w80"] { width: 80%; }
img[alt*="w70"] { width: 70%; }
img[alt*="w60"] { width: 60%; }
img[alt*="w50"] { width: 50%; }
img[alt*="w45"] { width: 45%; }
img[alt*="w40"] { width: 40%; }
img[alt*="w35"] { width: 35%; }
img[alt*="w30"] { width: 30%; }
img[alt*="w25"] { width: 25%; }
img[alt*="w20"] { width: 20%; }
img[alt*="w15"] { width: 15%; }
img[alt*="w10"] { width: 10%; }

/* Image positioning */
img[alt*="center"], img[alt*="centre"] {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

img[alt*="left"] {
    float: left;
    margin-right: 1.5em;
    margin-bottom: 0.5em;
}

img[alt*="right"] {
    float: right;
    margin-left: 1.5em;
    margin-bottom: 0.5em;
}

/* ═══════════════════════════════════════════════════════════════
   HORIZONTAL RULE
   ═══════════════════════════════════════════════════════════════ */

.markdown-preview-view hr,
.markdown-rendered hr {
    border: none;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--border-color) 20%,
        var(--border-color) 80%,
        transparent
    );
    margin: 1.8em 0;
}

/* ═══════════════════════════════════════════════════════════════
   TAGS
   ═══════════════════════════════════════════════════════════════ */

.markdown-preview-view .tag,
.markdown-rendered .tag {
    background: var(--accent-muted);
    color: var(--accent-primary);
    font-family: var(--font-interface);
    font-size: 0.8em;
    font-weight: 500;
    padding: 0.25em 0.65em;
    border-radius: 2em;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.markdown-preview-view .tag:hover,
.markdown-rendered .tag:hover {
    border-color: var(--accent-primary);
    background: transparent;
}

/* ═══════════════════════════════════════════════════════════════
   CALLOUTS / ADMONITIONS
   ═══════════════════════════════════════════════════════════════ */

.callout {
    border-radius: var(--radius-md);
    padding: 1em 1.25em;
    margin: 0.8em 0;
    border-left: 4px solid var(--callout-color, var(--accent-primary));
    background: var(--accent-muted);
}

.callout-title {
    font-family: var(--font-interface);
    font-weight: 600;
    font-size: 0.95em;
    margin-bottom: 0.5em;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

/* ═══════════════════════════════════════════════════════════════
   NAVIGATION & SIDEBAR
   ═══════════════════════════════════════════════════════════════ */

.site-body-left-column {
    background: var(--bg-surface);
    border-right: 1px solid var(--divider);
}

.nav-view-outer {
    font-family: var(--font-interface);
    font-size: 1em;
}

.tree-item-self {
    padding: 0.4em 0.8em;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.tree-item-self:hover {
    background: var(--accent-muted);
}

.tree-item-self.is-active {
    background: var(--accent-muted);
    color: var(--nav-active-text);
    font-weight: 500;
}

/* Table of Contents / Outline */
.outline-item.is-active,
.outline-item-self.is-active,
.outline-item.is-active .outline-item-self,
.outline-item-self.is-active .outline-item-self {
    color: var(--nav-active-text) !important;
    font-weight: 500;
}

/* Additional TOC selectors for Obsidian Publish */
.published-container .outline-item.is-active,
.published-container .outline-item-self.is-active {
    color: var(--nav-active-text) !important;
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════ */

.site-footer {
    border-top: 1px solid var(--divider);
    padding: 2em 0;
    font-family: var(--font-interface);
    font-size: 0.85em;
    color: var(--text-faint);
}

.site-footer a {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 5px;
    border: 2px solid var(--bg-surface);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-faint);
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    body {
        --font-text-size: 16px;
    }
    
    .page-title {
        font-size: 2em;
    }
    
    .markdown-preview-view h1,
    .markdown-rendered h1 {
        font-size: 1.75em;
    }
    
    .markdown-preview-view h2,
    .markdown-rendered h2 {
        font-size: 1.35em;
    }
    
    .markdown-preview-view pre,
    .markdown-rendered pre {
        padding: 1em;
        font-size: 0.85em;
    }
    
    img[alt*="left"],
    img[alt*="right"] {
        float: none;
        margin: 1em auto;
        display: block;
    }
}

/* ═══════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════ */

@media print {
    body {
        background: white;
        color: black;
    }
    
    .site-body-left-column,
    .site-footer {
        display: none;
    }
    
    .markdown-preview-view pre,
    .markdown-rendered pre {
        border: 1px solid #ddd;
        background: #f9f9f9;
    }
}

/* ═══════════════════════════════════════════════════════════════
   TOOLTIP (hidden)
   ═══════════════════════════════════════════════════════════════ */

.tooltip {
    display: none;
}
