:root {
    --ct-page-max: 1680px;
    --ct-page-pad: 40px;

    --shell-bg: #071019;
    --shell-text: #e9eef5;
    --shell-border: #1c2a39;
    --shell-border-soft: rgba(255, 255, 255, 0.07);
    --accent: #1ed6ff;
    --accent-2: #00c27a;

    --article-bg: #0b1420;
    --article-card: #0f1a29;
    --article-card-2: #0c1725;
    --article-text: #e6edf6;
    --article-muted: #97a6ba;
    --article-border: #263448;

    --light-page: #f6f8fb;
    --light-card: #ffffff;
    --light-text: #111827;
    --light-muted: #5b677a;
    --light-border: #d7dfeb;

    --warning-bg-dark: #2a1b07;
    --warning-border: #f59e0b;

    --note-bg-dark: #082131;
    --note-border: #38bdf8;

    --success-bg-dark: #092514;
    --success-border: #22c55e;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.6;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    overflow-x: clip;
}

body {
    overflow-x: visible;
}

img,
svg {
    max-width: 100%;
}

img {
    height: auto;
}

a {
    text-decoration: none;
}

h1,
h2,
h3,
h4,
.ct-brand-title,
.hero h1,
.ct-step-title,
.search-modal-title,
.search-result-title {
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

/* =========================
   SHARED PAGE WIDTH + HEADER
   Use this same header structure on home.php and article.php:
   .ct-site-header > .ct-page-inner.ct-header-inner > .ct-brand + .ct-site-nav
   ========================= */

.ct-page-inner {
    width: 100%;
    max-width: var(--ct-page-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--ct-page-pad);
    padding-right: var(--ct-page-pad);
}

/* Prevent article content overflow */
.ct-article-content,
.ct-article-content * {
    min-width: 0;
}

.ct-article-content img,
.ct-article-content video,
.ct-article-content iframe,
.ct-article-content table {
    max-width: 100%;
}

.ct-article-content pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre;
}

.ct-article-content code {
    word-break: break-word;
}

.ct-article-content table {
    display: block;
    overflow-x: auto;
}

.ct-article-content a,
.ct-article-content p,
.ct-article-content li,
.ct-article-content span {
    overflow-wrap: anywhere;
}

.ct-article-content .ct-step,
.ct-article-content .ct-message,
.ct-article-content .ct-code-block,
.ct-article-content .ct-card {
    max-width: 100%;
}

.ct-site-header {
    width: 100%;
}

.ct-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding-top: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ct-brand {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
    flex-shrink: 0;
    color: inherit;
}

.ct-brand-logo {
    width: 76px;
    height: 76px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.ct-brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ct-brand-title {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.075em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ct-brand-subtitle {
    margin-top: 7px;
    font-size: 14px;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: 0.025em;
    color: #17d8c5;
    white-space: nowrap;
}

.ct-site-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 24px;
    min-width: 0;
    color: #c7d4e1;
    font-weight: 700;
}

.ct-site-nav a {
    color: #c7d4e1;
    font-size: 15px;
    font-weight: 700;
}

.ct-site-nav a:hover {
    color: #ffffff;
}

.site-shell {
    min-height: 100vh;
}

.site-inner {
    width: 100%;
    padding-bottom: 48px;
}

/* =========================
   ARTICLE HERO
   ========================= */

.hero,
.hero-grid,
.hero-image-wrap {
    min-width: 0;
}

.hero-image-wrap {
    overflow: hidden;
}

.hero-image-wrap img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.hero {
    border: 1px solid;
    border-radius: 18px;
    padding: 34px;
    margin-top: 30px;
    margin-bottom: 28px;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 34px;
    align-items: center;
}

.hero--no-image .hero-grid {
    grid-template-columns: 1fr;
}

.hero-copy {
    max-width: 740px;
}

.hero-badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.hero h1 {
    margin: 0 0 14px;
    font-size: 54px;
    line-height: 1.02;
    letter-spacing: -0.03em;
}

.hero-summary {
    margin: 0 0 18px;
    font-size: 21px;
    max-width: 680px;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 14px;
    margin-bottom: 18px;
    align-items: center;
}

.hero-meta span {
    white-space: nowrap;
}

.meta-category-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-badge,
.sidebar-card-kicker,
.ct-step-badge,
.meta-category-pill {
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.meta-difficulty {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
}

.meta-difficulty-beginner {
    color: #00C27A;
}

.meta-difficulty-intermediate {
    color: #3B82F6;
}

.meta-difficulty-advanced {
    color: #F4B942;
}

.meta-read-time,
.meta-updated {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.meta-inline-icon {
    width: 14px;
    height: 14px;
}

.hero-image-wrap img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
    border: 1px solid;
}

/* =========================
   ARTICLE LAYOUT
   ========================= */

.toc-mobile-card {
    display: none;
    margin-bottom: 24px;
}

.toc-mobile-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}

.toc-mobile-select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid;
    font-size: 15px;
    background: transparent;
    outline: none;
}

.article-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) 280px;
    gap: 24px;
    align-items: start;
}

.article-sidebar {
    position: sticky;
    top: 120px;
    align-self: start;
}

.article-main {
    min-width: 0;
}

.article-content {
    border: 1px solid;
    border-radius: 18px;
    padding: 34px;
}

.article-content a {
    color: #6CCBFF;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(108,203,255,.35);
    text-underline-offset: 3px;
}

.article-content a:hover {
    color: #9BE4FF;
}

.article-content > * + * {
    margin-top: 22px;
}

.article-content p,
.article-content li {
    font-size: 18px;
}

.article-content p {
    max-width: 820px;
}

.article-content h2 {
    font-size: 34px;
    line-height: 1.12;
    margin: 8px 0 8px;
    letter-spacing: -0.02em;
}

.article-content h3 {
    font-size: 28px;
    line-height: 1.18;
    margin: 8px 0 8px;
    letter-spacing: -0.02em;
}

.article-content h4 {
    font-size: 22px;
    line-height: 1.22;
    margin: 8px 0 8px;
}

/* =========================
   SIDEBARS
   ========================= */

.sidebar-card {
    border: 1px solid;
    border-radius: 16px;
    padding: 20px;
}

.sidebar-card + .sidebar-card {
    margin-top: 18px;
}

.sidebar-card-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-card-title {
    margin: 0 0 14px;
    font-size: 18px;
    line-height: 1.2;
}

.sidebar-card-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
}

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

.sidebar-list li + li {
    margin-top: 12px;
}

.sidebar-list a,
.sidebar-feature-link a {
    font-size: 15px;
    line-height: 1.5;
}

.sidebar-feature-link a {
    font-weight: 600;
}

.sidebar-toc-list a {
    display: block;
    padding: 6px 10px;
    border-radius: 10px;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-toc-list a.is-active {
    font-weight: 700;
}

/* =========================
   CONTENT BLOCKS
   ========================= */

.ct-step {
    position: relative;
    overflow: hidden;
}

.ct-step,
.ct-warning,
.ct-note,
.ct-success,
.ct-code {
    border-radius: 16px;
    border: 1px solid;
    padding: 24px;
}

.ct-step-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    margin-bottom: 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
}

.ct-step-badge-label {
    opacity: 0.92;
}

.ct-step-badge-number {
    font-size: 12px;
    letter-spacing: 0.12em;
}

.ct-step-title {
    margin: 0 0 12px;
    font-size: 24px;
    line-height: 1.18;
}

.ct-step-body {
    margin: 0 0 12px;
}

.ct-step-helper {
    margin-top: 12px;
    font-size: 15px;
    line-height: 1.6;
    color: #98aabd;
}

.ct-code {
    --code-accent: var(--ct-category-accent);
    border-top: 2px solid var(--code-accent);
}

.ct-code-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.ct-code-label {
    color: var(--code-accent);
    border-color: color-mix(in srgb, var(--code-accent) 24%, transparent);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.8;
}

.ct-copy-btn {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

.ct-copy-btn:disabled {
    cursor: default;
    opacity: 0.75;
}

.ct-code pre {
    margin: 0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 15px;
    line-height: 1.65;
    font-family: "Cascadia Code", "JetBrains Mono", Consolas, Monaco, monospace;
}

.ct-code-type-php { --code-accent: #777BB4; }
.ct-code-type-javascript { --code-accent: #F7DF1E; }
.ct-code-type-html { --code-accent: #E34F26; }
.ct-code-type-css { --code-accent: #1572B6; }
.ct-code-type-sql { --code-accent: #14B8A6; }
.ct-code-type-json { --code-accent: #F59E0B; }
.ct-code-type-apache { --code-accent: #A61B1B; }
.ct-code-type-httpdconf { --code-accent: #B22222; }
.ct-code-type-htaccess { --code-accent: #7F1D1D; }
.ct-code-type-phpini { --code-accent: #64748B; }
.ct-code-type-myini { --code-accent: #5B7C69; }
.ct-code-type-hosts { --code-accent: #475569; }
.ct-code-type-bash,
.ct-code-type-cmd { --code-accent: #22C55E; }
.ct-code-type-default { --code-accent: var(--ct-category-accent); }

.ct-message-title {
    margin: 0 0 10px;
    font-size: 22px;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.ct-message-inline {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.ct-message-inline .ct-icon {
    margin-top: 6px;
    flex-shrink: 0;
}

.ct-message-inline .ct-message-text {
    margin: 0;
}

.ct-inline-icon-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ct-message-head {
    margin-bottom: 10px;
}

.ct-message-head .ct-message-title {
    margin: 0;
}

/* ==========================================
   INLINE TOKEN HIGHLIGHTING
   ========================================== */

.ct-inline-path,
.ct-inline-file {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 7px;
    font-family: "Cascadia Code", "JetBrains Mono", Consolas, Monaco, monospace;
    font-size: 0.92em;
    line-height: 1.45;
    vertical-align: baseline;
    white-space: nowrap;
}

.ct-inline-path {
    background: rgba(108, 203, 255, 0.08);
    border: 1px solid rgba(108, 203, 255, 0.18);
    color: #8FD8FF;
}

.ct-inline-file {
    background: rgba(255, 216, 122, 0.08);
    border: 1px solid rgba(255, 216, 122, 0.18);
    color: #FFD87A;
}

.ct-inline-action {
    font-weight: 700;
    color: #ffffff;
}

@media (max-width: 600px) {
    .ct-inline-file,
    .ct-inline-path {
        white-space: normal;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

/* =========================
   ICONS
   ========================= */

.ct-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    vertical-align: middle;
    stroke: currentColor;
}

.ct-icon-xs {
    width: 15px;
    height: 15px;
}

.ct-icon-sm {
    width: 18px;
    height: 18px;
}

.ct-icon svg,
.ct-icon path,
.ct-icon line,
.ct-icon polyline,
.ct-icon rect,
.ct-icon circle,
.ct-icon ellipse,
.ct-icon polygon {
    vector-effect: non-scaling-stroke;
}

.ct-icon-category {
    color: var(--ct-category-accent);
}

/* =========================
   SEARCH
   ========================= */

.search-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid;
    background: transparent;
    color: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.search-trigger-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.search-trigger-icon {
    width: 15px;
    height: 15px;
    opacity: 0.92;
}

.search-trigger-shortcut {
    font-size: 11px;
    opacity: 0.8;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
}

.search-overlay.is-open {
    display: block;
}

.search-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 12, 0.72);
    backdrop-filter: blur(8px);
}

.search-modal {
    position: relative;
    width: min(760px, calc(100vw - 32px));
    margin: 80px auto 0;
    border: 1px solid;
    border-radius: 20px;
    padding: 20px;
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.search-modal-title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
}

.search-modal-subtitle {
    margin-top: 4px;
    font-size: 14px;
}

.search-close-btn {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid;
    background: transparent;
    color: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.search-input-wrap {
    margin-bottom: 16px;
}

.search-overlay-input {
    width: 100%;
    border: 1px solid;
    border-radius: 14px;
    padding: 16px 18px;
    font-size: 18px;
    outline: none;
    background: transparent;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
}

.search-empty-state {
    padding: 24px 8px;
    font-size: 15px;
}

.search-result-item,
.recent-search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    width: 100%;
    border: 1px solid;
    border-radius: 14px;
    padding: 14px 16px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.search-result-item.is-selected,
.recent-search-item.is-selected {
    transform: translateY(-1px);
}

.search-result-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

.search-result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    font-size: 13px;
}

.search-result-meta > span,
.search-result-meta > div,
.search-result-meta > a {
    display: inline-flex;
    align-items: center;
}

.search-result-arrow,
.recent-search-item-arrow {
    font-size: 18px;
    flex-shrink: 0;
}

body.search-overlay-open {
    overflow: hidden;
}

.search-result-category-pill,
.search-result-category-pill-inner {
    display: inline-flex;
    align-items: center;
}

.search-result-category-pill {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.search-result-category-pill-inner {
    gap: 6px;
}

.search-result-category-icon {
    width: 12px;
    height: 12px;
    display: inline-block;
    flex-shrink: 0;
    background: currentColor;
    -webkit-mask-image: var(--search-icon);
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-image: var(--search-icon);
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

.search-highlight {
    padding: 0 2px;
    border-radius: 4px;
    font-weight: 700;
}

.search-result-excerpt {
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.5;
}

.recent-searches-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.recent-searches-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.recent-searches-clear-btn {
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid;
    background: transparent;
    color: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.recent-searches-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recent-search-item-text {
    font-size: 15px;
    font-weight: 600;
}

.search-result-difficulty {
    font-weight: 700;
}

.search-section + .search-section {
    margin-top: 18px;
}

/* =========================
   READING PROGRESS + TOAST
   ========================= */

.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    z-index: 10000;
    transition: width 0.08s linear;
}

.ct-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 10001;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid;
    font-size: 14px;
    font-weight: 700;
    transform: translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ct-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 1180px) {
    .article-layout {
        grid-template-columns: 1fr;
    }

    .article-sidebar {
        position: static;
    }

    .article-sidebar-left,
    .article-sidebar-right {
        order: 2;
    }

    .article-main {
        order: 1;
    }

    .toc-mobile-card {
        display: block;
    }

    .article-sidebar-left .sidebar-card:first-child {
        display: none;
    }
}

@media (max-width: 980px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 42px;
    }

    .article-content {
        padding: 24px;
    }
}

@media (max-width: 900px) {
    :root {
        --ct-page-pad: 24px;
    }

    .ct-header-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 22px;
    }

    .ct-site-nav {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 14px;
    }
}

@media (max-width: 640px) {
    :root {
        --ct-page-pad: 18px;
    }

    .ct-brand {
        gap: 14px;
    }

    .ct-brand-logo {
        width: 64px;
        height: 64px;
    }

    .ct-brand-title {
        font-size: 22px;
    }

    .ct-brand-subtitle {
        font-size: 13px;
        line-height: 1.35;
    }

    .ct-site-nav .search-trigger-btn {
        width: 100%;
        justify-content: space-between;
    }

    .hero {
        padding: 22px;
    }

    .hero h1 {
        font-size: 34px;
    }

    .hero-summary {
        font-size: 18px;
    }

    .hero-meta {
        gap: 10px;
    }

    .article-content {
        padding: 20px;
    }

    .article-content p,
    .article-content li {
        font-size: 17px;
    }

    .ct-step,
    .ct-warning,
    .ct-note,
    .ct-success,
    .ct-code {
        padding: 20px;
    }
}

