/* ============================================================
   FasterThemes Docs — Editorial documentation aesthetic
   Sister to the Food Recipes theme — Cormorant Garamond + Jost
   ============================================================ */

:root {
    --paper: #faf7f0;
    --paper-deep: #f5f0e8;
    --ink: #1a1a1a;
    --ink-soft: #444;
    --ink-faint: #777;
    --rule: #e0d8c4;
    --rule-soft: #f0e8d8;
    --accent: #c8522a;
    --accent-deep: #a8431f;
    --accent-soft: #f5e8e0;
    --code-bg: #1a1a1a;
    --code-text: #f5f0e8;
    --code-inline-bg: #f0e8d8;
    --warn-bg: #fff8e8;
    --warn-border: #c89030;
    --warn-text: #6b5418;
    --info-bg: #e8f1f5;
    --info-border: #3a7a9a;
    --info-text: #1a4a66;
    --maxw: 1280px;
    --sidebar-w: 280px;
    --toc-w: 240px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 14px rgba(0,0,0,.08);

    --serif: 'Cormorant Garamond', 'EB Garamond', Georgia, serif;
    --sans: 'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.dx-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(250, 247, 240, 0.92);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--rule);
    height: 64px;
}

.dx-topbar-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 32px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 32px;
}

.dx-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.005em;
    flex-shrink: 0;
}

.dx-brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--ink);
    color: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-style: italic;
    font-weight: 600;
    font-size: 1.15rem;
    line-height: 1;
}

.dx-brand-text { line-height: 1; }
.dx-brand-text small {
    display: block;
    font-size: 0.7rem;
    color: var(--ink-faint);
    font-weight: 400;
    letter-spacing: 0.04em;
    margin-top: 2px;
    text-transform: uppercase;
}

.dx-topbar-search {
    flex: 1;
    max-width: 480px;
    position: relative;
}

.dx-search-input {
    width: 100%;
    height: 38px;
    padding: 0 14px 0 40px;
    background: var(--paper-deep);
    border: 1px solid var(--rule);
    border-radius: 8px;
    color: var(--ink);
    font-family: inherit;
    font-size: 0.92rem;
    transition: all 0.18s ease;
}

.dx-search-input:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.dx-search-input::placeholder { color: var(--ink-faint); }

.dx-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-faint);
    pointer-events: none;
}

.dx-search-shortcut {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 2px 7px;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--ink-faint);
    pointer-events: none;
}

.dx-topbar-nav {
    display: flex;
    gap: 22px;
    align-items: center;
    margin-left: auto;
}

.dx-topbar-nav a {
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: color 0.16s;
}
.dx-topbar-nav a:hover { color: var(--accent); }

.dx-topbar-cta {
    background: var(--ink);
    color: var(--paper) !important;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600 !important;
    transition: all 0.16s !important;
}
.dx-topbar-cta:hover {
    background: var(--accent);
    color: var(--paper) !important;
    transform: translateY(-1px);
}

.dx-mobile-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--rule);
    border-radius: 6px;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ink);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.dx-layout {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 32px;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr var(--toc-w);
    gap: 48px;
    align-items: start;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.dx-sidebar {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    padding: 32px 0 48px;
    scrollbar-width: thin;
    scrollbar-color: var(--rule) transparent;
}
.dx-sidebar::-webkit-scrollbar { width: 6px; }
.dx-sidebar::-webkit-scrollbar-track { background: transparent; }
.dx-sidebar::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }

.dx-sidebar-section {
    margin-bottom: 28px;
}

.dx-sidebar-heading {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 0 0 10px;
    padding-left: 12px;
}

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

.dx-sidebar-list a {
    display: block;
    padding: 7px 12px;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.14s;
    line-height: 1.4;
    border-left: 2px solid transparent;
    margin-left: -2px;
}

.dx-sidebar-list a:hover {
    color: var(--ink);
    background: var(--paper-deep);
}

.dx-sidebar-list a.active {
    color: var(--accent);
    background: var(--accent-soft);
    border-left-color: var(--accent);
    font-weight: 600;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.dx-main {
    min-width: 0;
    padding: 40px 0 96px;
}

.dx-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--ink-faint);
    margin-bottom: 24px;
}
.dx-breadcrumb a { color: var(--ink-faint); text-decoration: none; }
.dx-breadcrumb a:hover { color: var(--accent); }
.dx-breadcrumb-sep { opacity: 0.5; }

.dx-eyebrow {
    display: inline-block;
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.dx-eyebrow::before {
    content: "—— ";
    letter-spacing: -0.05em;
}

.dx-title {
    font-family: var(--serif);
    font-size: clamp(2.4rem, 4.5vw, 3.4rem);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 0 14px;
}

.dx-lede {
    font-family: var(--serif);
    font-size: 1.45rem;
    line-height: 1.45;
    color: var(--ink-soft);
    font-weight: 400;
    margin: 0 0 36px;
    max-width: 60ch;
    font-style: italic;
}

.dx-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--ink-faint);
    margin-bottom: 40px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--rule);
}

.dx-meta-divider { opacity: 0.4; }
.dx-meta a { color: var(--ink-faint); }
.dx-meta a:hover { color: var(--accent); }

/* Article body */
.dx-body {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--ink-soft);
}

.dx-body p {
    margin: 0 0 22px;
}

.dx-body strong { color: var(--ink); font-weight: 600; }

.dx-body h2 {
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--ink);
    margin: 56px 0 20px;
    scroll-margin-top: 80px;
}

.dx-body h2::before {
    content: "";
    display: block;
    width: 38px;
    height: 2px;
    background: var(--accent);
    margin-bottom: 16px;
}

.dx-body h3 {
    font-family: var(--sans);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ink);
    margin: 36px 0 14px;
    letter-spacing: -0.005em;
    scroll-margin-top: 80px;
}

.dx-body h4 {
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 28px 0 10px;
}

.dx-body a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid currentColor;
    transition: all 0.16s;
}
.dx-body a:hover {
    color: var(--accent-deep);
    background: var(--accent-soft);
}

.dx-body ul, .dx-body ol {
    margin: 0 0 22px;
    padding-left: 24px;
}
.dx-body li { margin-bottom: 8px; }

.dx-body ul li::marker { color: var(--accent); }

.dx-body hr {
    border: 0;
    height: 1px;
    background: var(--rule);
    margin: 48px 0;
}

/* Inline code */
.dx-body code {
    font-family: var(--mono);
    font-size: 0.86em;
    background: var(--code-inline-bg);
    color: var(--ink);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Code blocks */
.dx-body pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 22px 26px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 24px 0 32px;
    font-size: 0.86rem;
    line-height: 1.6;
    box-shadow: var(--shadow-md);
    position: relative;
}

.dx-body pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    white-space: pre;
    font-size: inherit;
}

.dx-code-block {
    position: relative;
}
.dx-code-block::before {
    content: attr(data-lang);
    position: absolute;
    top: 8px;
    right: 14px;
    font-family: var(--sans);
    font-size: 0.68rem;
    color: rgba(245, 240, 232, 0.4);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    z-index: 1;
}

.dx-code-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(245, 240, 232, 0.08);
    border: 1px solid rgba(245, 240, 232, 0.15);
    color: rgba(245, 240, 232, 0.6);
    padding: 4px 10px;
    border-radius: 4px;
    font-family: var(--sans);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.16s;
    opacity: 0;
}
.dx-code-block:hover .dx-code-copy { opacity: 1; }
.dx-code-copy:hover {
    background: rgba(245, 240, 232, 0.15);
    color: var(--code-text);
}
.dx-code-copy.copied {
    background: rgba(110, 200, 110, 0.2);
    color: #9ee59e;
    border-color: rgba(110, 200, 110, 0.3);
}

/* Callouts */
.dx-callout {
    margin: 28px 0;
    padding: 18px 22px;
    border-radius: 8px;
    border-left: 3px solid;
    font-size: 0.96rem;
    line-height: 1.65;
}
.dx-callout p:last-child { margin-bottom: 0; }
.dx-callout strong { color: inherit; }

.dx-callout-warn {
    background: var(--warn-bg);
    border-color: var(--warn-border);
    color: var(--warn-text);
}
.dx-callout-info {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: var(--info-text);
}
.dx-callout-tip {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: #6b3318;
}

/* Tables */
.dx-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0 32px;
    font-size: 0.92rem;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.dx-body th, .dx-body td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--rule-soft);
}
.dx-body th {
    background: var(--paper-deep);
    font-weight: 700;
    color: var(--ink);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.dx-body tr:last-child td { border-bottom: 0; }

/* Images */
.dx-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 16px 0;
    display: block;
}

/* Figcaption */
.dx-body figcaption {
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.92rem;
    color: var(--ink-faint);
    text-align: center;
    margin-top: 8px;
}

/* ============================================================
   PAGE NAV (prev/next)
   ============================================================ */
.dx-pagenav {
    margin-top: 64px;
    padding-top: 36px;
    border-top: 1px solid var(--rule);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.dx-pagenav a {
    display: block;
    padding: 18px 22px;
    border: 1px solid var(--rule);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.16s;
    background: #fff;
}
.dx-pagenav a:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: #fff;
}
.dx-pagenav-label {
    display: block;
    font-size: 0.7rem;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}
.dx-pagenav-title {
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
}
.dx-pagenav-prev { text-align: left; }
.dx-pagenav-next { text-align: right; }

/* ============================================================
   TOC (right sidebar)
   ============================================================ */
.dx-toc {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    padding: 40px 0 48px;
    font-size: 0.85rem;
}

.dx-toc-heading {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 0 0 14px;
}

.dx-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 1px solid var(--rule);
}

.dx-toc-list li { line-height: 1.4; }
.dx-toc-list li.indent { padding-left: 14px; }

.dx-toc-list a {
    display: block;
    padding: 6px 0 6px 14px;
    margin-left: -1px;
    color: var(--ink-faint);
    text-decoration: none;
    border-left: 1px solid transparent;
    transition: all 0.14s;
}
.dx-toc-list a:hover {
    color: var(--ink);
}
.dx-toc-list a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 600;
}

/* ============================================================
   HOME PAGE
   ============================================================ */
.dx-home-hero {
    text-align: center;
    padding: 80px 0 64px;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 64px;
}

.dx-home-eyebrow {
    font-family: var(--serif);
    font-style: italic;
    color: var(--accent);
    font-size: 1.1rem;
    margin-bottom: 14px;
    letter-spacing: 0.02em;
}

.dx-home-title {
    font-family: var(--serif);
    font-size: clamp(3rem, 6vw, 4.8rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.025em;
    color: var(--ink);
    margin: 0 0 18px;
}

.dx-home-title em {
    font-style: italic;
    color: var(--accent);
    font-weight: 500;
}

.dx-home-lede {
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--ink-soft);
    max-width: 56ch;
    margin: 0 auto 36px;
}

.dx-home-search {
    max-width: 520px;
    margin: 0 auto;
    position: relative;
}
.dx-home-search .dx-search-input {
    height: 52px;
    font-size: 1rem;
    padding-left: 50px;
}
.dx-home-search .dx-search-icon { left: 18px; }

.dx-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 64px;
}

.dx-card {
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 12px;
    padding: 28px 28px 26px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}
.dx-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.dx-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}
.dx-card-title {
    font-family: var(--serif);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 8px;
    line-height: 1.2;
}
.dx-card-desc {
    color: var(--ink-soft);
    font-size: 0.93rem;
    line-height: 1.55;
    margin: 0 0 18px;
    flex: 1;
}
.dx-card-link {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: gap 0.16s;
}
.dx-card:hover .dx-card-link { gap: 8px; }

.dx-section-title {
    font-family: var(--serif);
    font-size: 2.2rem;
    font-weight: 600;
    line-height: 1.15;
    color: var(--ink);
    margin: 0 0 8px;
    text-align: center;
    letter-spacing: -0.015em;
}
.dx-section-sub {
    text-align: center;
    color: var(--ink-faint);
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.05rem;
    margin: 0 0 36px;
}

/* ============================================================
   SEARCH RESULTS PANEL
   ============================================================ */
.dx-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    max-height: 60vh;
    overflow-y: auto;
    z-index: 100;
    display: none;
}
.dx-search-results.active { display: block; }

.dx-result {
    display: block;
    padding: 14px 18px;
    border-bottom: 1px solid var(--rule-soft);
    text-decoration: none;
    color: inherit;
    transition: background 0.14s;
}
.dx-result:last-child { border-bottom: none; }
.dx-result:hover { background: var(--paper-deep); }
.dx-result-title {
    font-family: var(--serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 4px;
}
.dx-result-excerpt {
    font-size: 0.85rem;
    color: var(--ink-faint);
    line-height: 1.5;
}
.dx-result-empty {
    padding: 24px;
    text-align: center;
    color: var(--ink-faint);
    font-style: italic;
    font-family: var(--serif);
}

mark {
    background: var(--accent-soft);
    color: var(--accent-deep);
    padding: 1px 2px;
    border-radius: 2px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.dx-footer {
    border-top: 1px solid var(--rule);
    padding: 40px 0 56px;
    margin-top: 64px;
    background: var(--paper-deep);
}
.dx-footer-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.dx-footer-brand {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--ink-soft);
}
.dx-footer-links {
    display: flex;
    gap: 22px;
    font-size: 0.88rem;
}
.dx-footer-links a {
    color: var(--ink-soft);
    text-decoration: none;
}
.dx-footer-links a:hover { color: var(--accent); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .dx-layout {
        grid-template-columns: var(--sidebar-w) 1fr;
        gap: 36px;
    }
    .dx-toc { display: none; }
}

@media (max-width: 820px) {
    .dx-topbar-inner { gap: 16px; padding: 0 18px; }
    .dx-topbar-search { max-width: none; }
    .dx-topbar-nav { display: none; }
    .dx-mobile-toggle { display: flex; }

    .dx-layout {
        grid-template-columns: 1fr;
        padding: 0 20px;
        gap: 0;
    }

    .dx-sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--paper);
        border-right: none;
        border-bottom: 1px solid var(--rule);
        padding: 24px 24px 48px;
        z-index: 40;
        max-height: none;
        transform: translateX(-100%);
        transition: transform 0.24s ease;
        overflow-y: auto;
    }
    .dx-sidebar.open { transform: translateX(0); }

    .dx-main { padding: 28px 0 64px; }
    .dx-title { font-size: 2.1rem; }
    .dx-lede { font-size: 1.2rem; }
    .dx-body { font-size: 1rem; }
    .dx-body h2 { font-size: 1.65rem; margin-top: 44px; }

    .dx-home-hero { padding: 48px 0 40px; }
    .dx-home-title { font-size: 2.6rem; }
    .dx-home-lede { font-size: 1.05rem; }

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

    .dx-search-shortcut { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
