/* ================================================================
   styles.css — ClawDrive site + markdown‑rendered content
   ================================================================ */

/* ── Reset & Base ────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
                 sans-serif;
    line-height: 1.7;
    color: #1a1a2e;
    background: #f7f8fa;
}

/* ── Site Header ─────────────────────────────────────────────────── */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 2rem;
    background: #ffffff;
    border-bottom: 1px solid #e4e6eb;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* FIX: image-based logos now render properly */
.logo-icon img {
    width: 1.6rem;
    height: 1.6rem;
    object-fit: contain;
    display: block;
}

.logo-text {
    font-size: 1.35rem;
    font-weight: 800;
    color: #ff6b35;
}

/* FIX: nav container pushes everything to the right */
.site-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links a {
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a1a2e;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.nav-links a:hover {
    color: #ff6b35;
    background: rgba(255, 107, 53, 0.06);
}

.btn{padding:.6rem 1.35rem;border-radius:8px;font-weight:600;font-size:.9rem;border:none;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:.35rem;transition:all .2s}
.btn-primary{background:var(--grad);color:#fff;box-shadow:0 4px 20px rgba(255,82,82,.2)}
.btn-primary:hover{transform:translateY(-1px);box-shadow:0 6px 28px rgba(255,82,82,.3)}
.btn-secondary{background:var(--surface);color:var(--text);border:1px solid var(--border)}
.btn-secondary:hover{border-color:#444;background:var(--surface2)}
.btn-launch {
    display: inline-block;
    padding: 0.55rem 1.6rem;
    background: #ff6b35;
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.btn-launch:hover {
    background: #e5552a;
    transform: translateY(-1px);
}
/* Hide hamburger menu by default on desktop */
.menu-toggle {
    display: none;
}

/* ── Loading / Error ─────────────────────────────────────────────── */
.loading {
    text-align: center;
    padding: 5rem 1rem;
    color: #999;
    font-size: 1.1rem;
}

.error {
    text-align: center;
    padding: 3rem 1rem;
    color: #c0392b;
}

/* ── Markdown Content Container ──────────────────────────────────── */
.md-content {
    max-width: 880px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 5rem;
}

/* ================================================================
   Heading Wrappers  (requirement 3.1)
   ================================================================ */
.h1_wrapper {
    margin-bottom: 1.75rem;
}
.h1_wrapper h1 {
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1.15;
    color: #1a1a2e;
    letter-spacing: -0.02em;
}

.h2_wrapper {
    margin-bottom: 1rem;
}
.h2_wrapper h2 {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.25;
    color: #16213e;
    padding-bottom: 0.3rem;
    border-bottom: 3px solid #ff6b35;
    display: inline-block;
}

.h3_wrapper {
    margin-bottom: 0.75rem;
}
.h3_wrapper h3 {
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.35;
    color: #0f3460;
}

.h4_wrapper {
    margin-bottom: 0.5rem;
}
.h4_wrapper h4 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #333;
}

.h5_wrapper h5 {
    font-size: 1rem;
    font-weight: 600;
    color: #444;
}

.h6_wrapper h6 {
    font-size: 0.875rem;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ================================================================
   Paragraph Wrapper  (requirement 3.1)
   ================================================================ */
.p_wrapper {
    margin-bottom: 1.25rem;
}
.p_wrapper p {
    font-size: 1.05rem;
    line-height: 1.85;
    color: #2d2d2d;
}

/* ================================================================
   Image Wrapper
   ================================================================ */
.img_wrapper {
    margin: 1.75rem 0;
    text-align: center;
}
.img_wrapper img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
}

.inline-image {
    max-width: 100%;
    border-radius: 8px;
    vertical-align: middle;
}

/* ================================================================
   Code Wrapper
   ================================================================ */
.code_wrapper {
    margin: 1.5rem 0;
}
.code_wrapper pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 1.25rem 1.5rem;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.65;
}
.code_wrapper pre code {
    font-family: "Fira Code", "Cascadia Code", "JetBrains Mono",
                 "Source Code Pro", monospace;
}

.inline-code {
    background: #eef0f5;
    padding: 0.15em 0.45em;
    border-radius: 5px;
    font-size: 0.88em;
    font-family: "Fira Code", "Cascadia Code", monospace;
    color: #c0392b;
}

/* ================================================================
   List Wrapper
   ================================================================ */
.list_wrapper {
    margin: 1rem 0 1.25rem;
}
.list_wrapper ul,
.list_wrapper ol {
    padding-left: 1.75rem;
}
.list_wrapper li {
    margin-bottom: 0.4rem;
    font-size: 1.05rem;
    line-height: 1.75;
    color: #2d2d2d;
}
.list_wrapper ul li::marker {
    color: #ff6b35;
}

/* ================================================================
   Blockquote Wrapper
   ================================================================ */
.blockquote_wrapper {
    margin: 1.5rem 0;
}
.blockquote_wrapper blockquote {
    border-left: 4px solid #ff6b35;
    padding: 0.85rem 1.25rem;
    background: #fff8f4;
    border-radius: 0 10px 10px 0;
    font-style: italic;
    color: #555;
    line-height: 1.75;
}

/* ================================================================
   Table Wrapper
   ================================================================ */
.table_wrapper {
    margin: 1.5rem 0;
    overflow-x: auto;
}
.table_wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.table_wrapper th,
.table_wrapper td {
    padding: 0.65rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e4e6eb;
}
.table_wrapper th {
    background: #f0f2f5;
    font-weight: 700;
    color: #1a1a2e;
}
.table_wrapper tbody tr:hover {
    background: #fafbfd;
}

/* ================================================================
   HR Wrapper
   ================================================================ */
.hr_wrapper {
    margin: 2.5rem 0;
}
.hr_wrapper hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
}

/* ================================================================
   Section Wrappers  (requirement 3.2)
   ================================================================ */
.section_lv2_wrapper {
    margin: 3.5rem 0;
    padding: 0;
}
.section_lv2_wrapper:first-child {
    margin-top: 0;
}

.section_lv3_wrapper {
    margin: 2rem 0;
    padding: 0;
}

.section_lv4_wrapper {
    margin: 1.5rem 0;
    padding: 0;
}

/* ================================================================
   Card Wrapper  (requirement 3.3)
   ================================================================ */
.card-wrapper {
    background: #ffffff;
    border: 1px solid #e4e6eb;
    border-radius: 14px;
    padding: 1.5rem 1.75rem;
    margin: 1.25rem 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-wrapper:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

/* keep inner spacing tighter inside cards */
.card-wrapper .h3_wrapper,
.card-wrapper .h4_wrapper {
    margin-bottom: 0.5rem;
}
.card-wrapper .p_wrapper:last-child {
    margin-bottom: 0;
}

/* ================================================================
   Links & Inline Elements
   ================================================================ */
.md-content a {
    color: #ff6b35;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}
.md-content a:hover {
    border-bottom-color: #ff6b35;
}

.md-content strong {
    font-weight: 700;
    color: #1a1a2e;
}

.md-content em {
    font-style: italic;
}

.md-content del {
    color: #999;
}

/* ================================================================
   Responsive
   ================================================================ */
@media (max-width: 768px) {
    .site-header {
        padding: 0.65rem 1rem;
    }

    .site-nav {
        gap: 0.5rem;
    }

    .nav-links {
        gap: 0.35rem;
    }

    .nav-links a {
        font-size: 0.8rem;
        padding: 0.25rem 0.35rem;
    }

    .md-content {
        padding: 1.5rem 1rem 3rem;
    }

    .h1_wrapper h1 { font-size: 2rem;  }
    .h2_wrapper h2 { font-size: 1.5rem; }
    .h3_wrapper h3 { font-size: 1.2rem; }

    .card-wrapper {
        padding: 1.25rem 1rem;
    }
}

@media (max-width: 480px) {
    .h1_wrapper h1 { font-size: 1.65rem; }
    .h2_wrapper h2 { font-size: 1.3rem;  }

    .btn-launch {
        padding: 0.45rem 1rem;
        font-size: 0.85rem;
    }

    .nav-links {
        display: none;
    }
}

/* ================================================================
   Theme Switcher Dropdown
   ================================================================ */
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.theme-label {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.7;
  white-space: nowrap;
}

.theme-dropdown {
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(128, 128, 128, 0.12);
  color: inherit;
  border: 1px solid rgba(128, 128, 128, 0.25);
  border-radius: 8px;
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='gray' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

.theme-dropdown:hover {
  border-color: rgba(128, 128, 128, 0.45);
}

.theme-dropdown:focus {
  outline: none;
  border-color: #e05a2b;
  box-shadow: 0 0 0 3px rgba(224, 90, 43, 0.15);
}

.theme-dropdown option {
  background: #fff;
  color: #1a1a1a;
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .theme-label {
    display: none;
  }
  .theme-dropdown {
    font-size: 0.8rem;
    padding: 0.35rem 1.8rem 0.35rem 0.6rem;
  }
}

@media (max-width: 768px) {
/* 1. Header Layout */
    .site-header { 
        padding: 1rem 5%; 
        display: flex; 
        justify-content: space-between; 
        align-items: center; 
    }
    
    .site-nav {
        gap: 0.5rem; /* Reduce gap to fit elements nicely */
    }

    /* 2. Theme Switcher Formatting */
    .theme-label {
        display: none;
    }
    .theme-dropdown {
        font-size: 0.8rem;
        padding: 0.35rem 1.8rem 0.35rem 0.6rem;
        margin-right: 0.5rem !important; /* Overrides the inline HTML style */
    }

    /* 3. Hide the Launch button from the main header row */
    .btn-launch {
        display: none;
    }

    /* 4. The Dropdown Container (Hamburger Menu) */
    .nav-links { 
        display: none; 
        flex-direction: column;
        position: absolute;
        top: 100%;
        right: 5%;
        background: #ffffff;
        border: 1px solid #f0f0f0;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
        padding: 1rem;
        /* Add extra padding at bottom to make room for the Launch button */
        padding-bottom: 4.5rem; 
        width: 220px;
        z-index: 1000;
        border-radius: 12px;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        margin: 0;
    }

    /* 5. Visually insert the Launch button inside the open dropdown */
    #navLinks.open ~ .btn-launch {
        display: flex;
        position: absolute;
        /* Position exactly beneath the CMS nav link */
        top: calc(100% + 3.5rem); 
        /* Align cleanly inside the dropdown box */
        right: calc(5% + 1rem); 
        width: calc(220px - 2rem);
        z-index: 1001;
        justify-content: center;
        text-align: center;
        box-sizing: border-box;
    }

    /* 6. Hamburger Menu Toggle Button */
    .menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.8rem;
        color: #333333;
        cursor: pointer;
        padding: 0.25rem;
        margin-left: 0.25rem;
    }
}