/* Base reset and defaults */
html {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    color: #2d3748;
    line-height: 1.6;
}

h1 {
    font-size: 26px;
    color: #1a202c;
    font-weight: bold;
    margin-top: 20px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #3182ce;
}

h2 {
    font-size: 21px;
    color: #3182ce;
    font-weight: bold;
    margin-top: 25px;
    margin-bottom: 12px;
}

h3 {
    font-size: 18px;
    font-weight: bold;
    margin-top: 20px;
    margin-bottom: 10px;
    color: #1a202c;
}

h4 {
    font-size: 16px;
    color: #e53e3e;
    font-weight: bold;
    margin: 15px 0 10px;
}

h5 {
    font-size: 14px;
    color: #718096;
    font-weight: bold;
    margin: 5px 0 12px;
}

p {
    font-size: 16px;
    color: #2d3748;
    margin: 0 0 16px;
    line-height: 1.6;
}

li {
    margin-bottom: 6px;
    line-height: 1.6;
}

a {
    color: #3182ce;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #2b6cb0;
    text-decoration: underline;
}

a:visited {
    color: #3182ce;
}

a.lined-link,
a.lined-link:visited {
    text-decoration: underline;
}

/* Nav rail links */
a.menu-anchor,
a.menu-anchor:visited {
    display: block;
    color: #1a202c;
    font-weight: 600;
    padding: 8px 12px 8px 16px;
    border-left: 3px solid #3182ce;
    margin: 4px 0;
    background-color: #edf2f7;
    border-radius: 0 4px 4px 0;
    transition: all 0.2s;
    text-decoration: none;
}

a.menu-anchor:hover {
    color: #2b6cb0;
    border-left-color: #2b6cb0;
    background-color: #e2e8f0;
    transform: translateX(4px);
}

/* Nav section headers */
.menu-heading {
    font-size: 14px;
    color: #fff;
    background-color: #1a202c;
    font-weight: bold;
    padding: 8px 12px;
    margin: 10px 0 6px;
    border: none;
    border-radius: 4px;
}

/* Nav cells */
.menu-slot {
    background-color: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.menu-slot:hover {
    background-color: transparent;
}

/* Layout panels */
.card-outline {
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.logo-cell {
    background-color: #1a202c;
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #cbd5e0;
}

.logo-cell img {
    border-radius: 8px;
    width: 84px;
    height: 84px;
}

.masthead-strip .masthead-row img {
    width: 84px;
    height: 84px;
    display: inline-block !important;
}

.masthead-strip {
    background-color: #1a202c;
    color: white;
    padding: 16px;
    text-align: center;
    border-bottom: 1px solid #cbd5e0;
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.menu-column {
    padding: 20px 0;
    background-color: #f7fafc;
    border-right: 1px solid #e2e8f0;
    width: 186px;
}

.article-body {
    background-color: #ffffff;
    padding: 24px;
    border-bottom: none;
    font-size: 16px;
}

.article-body table {
    margin-bottom: 20px;
    width: 100%;
}

/* Footer */
.site-footnote {
    padding: 14px;
    font-size: 13px;
    color: #718096;
    background-color: #1a202c;
    text-align: center;
    border-top: 1px solid #2d3748;
}

.site-footnote a {
    color: #e2e8f0;
    text-decoration: underline;
    font-size: 13px;
}

.site-footnote a:hover {
    color: #3182ce;
}

/* Utilities */
.topic-mark {
    font-size: 18px;
    color: #3182ce;
    font-weight: bold;
}

.fact-card {
    background-color: #edf2f7;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0;
}

.hidden { display: none; }
.visible { display: block; }
.space-above { margin-top: 16px; }

a.mute-link,
a.mute-link:visited,
a.mute-link:hover {
    color: #2d3748;
}

/* Layout shell */
.site-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.core-column {
    flex: 1;
    min-width: 300px;
    display: block;
    float: none;
    margin: 0;
}

.rail-west, .rail-east {
    display: none;
}

@media screen and (min-width: 1400px) {
    .rail-west {
        display: block;
        width: 180px;
        padding: 10px;
    }
    .rail-east {
        display: block;
        width: 180px;
        padding: 10px;
        position: sticky;
        top: 20px;
        align-self: flex-start;
    }
}

/* Cookie banner */
.notice-strip {
    background: #fffaf0;
    color: #5d4037;
    border: 1px solid #fbd38d;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    font-family: 'Segoe UI', sans-serif;
    font-size: 14px;
    padding: 12px 16px;
    z-index: 9001;
}

.notice-strip .notice-ok {
    background-color: #ed8936;
    color: #000;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.notice-strip .notice-ok:hover {
    background-color: #dd6b20;
}

.notice-strip a {
    color: #1a365d;
    font-weight: bold;
}

@keyframes slideUp {
    from { transform: translateY(40px); }
    to { transform: translateY(0); }
}
.notice-strip {
    animation: slideUp 0.6s ease-out;
}

.masthead-strip {
    background-color: #1a202c;
    padding: 20px 0;
    text-align: center;
    border-bottom: 3px solid #3182ce;
}

.masthead-strip .masthead-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.masthead-strip h1 {
    margin: 0;
    font-size: 28px;
    color: white;
    font-weight: bold;
    letter-spacing: 1px;
}

.masthead-strip hr {
    border: 0;
    border-top: 1px solid #3182ce;
    width: 80%;
    margin: 10px auto;
}

.masthead-strip p {
    margin: 0;
    font-size: 16px;
    color: #e2e8f0;
    font-style: italic;
}

/* Floating download button */
.grab-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #3182ce 0%, #2b6cb0 100%);
    color: #fff !important;
    font-weight: bold;
    font-size: 15px;
    text-decoration: none !important;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(49, 130, 206, 0.45);
    transition: transform 0.2s, box-shadow 0.2s;
}
.grab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(49, 130, 206, 0.5);
    color: #fff !important;
    text-decoration: none !important;
}
.grab-btn:visited {
    color: #fff !important;
}

/* Capability icons grid */
.perk-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0 24px;
    justify-content: center;
}
.perk-tile {
    padding: 0;
    border: 2px solid #a0aec0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.perk-tile:hover {
    border-color: #3182ce;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
    transform: scale(1.03);
}
.perk-tile img {
    display: block;
    width: 120px;
    height: 90px;
    object-fit: cover;
    vertical-align: middle;
}

/* Media viewer (lightbox) */
.lightbox-layer {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.lightbox-layer[hidden] {
    display: none !important;
}
.lightbox-pane {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.lightbox-pane img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 4px;
}
.lightbox-label {
    margin: 12px 0 0;
    color: #e2e8f0;
    font-size: 14px;
    text-align: center;
}
.lightbox-x {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}
.lightbox-x:hover {
    background: rgba(255, 255, 255, 0.25);
}
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Preview grids (themes, screenshots, products) */
.glance-mosaic {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0 24px;
    justify-content: center;
}
.glance-tile {
    padding: 0;
    border: 2px solid #a0aec0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.glance-tile:hover {
    border-color: #3182ce;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
    transform: scale(1.03);
}
.glance-tile img {
    display: block;
    width: 120px;
    height: 90px;
    object-fit: cover;
    vertical-align: middle;
}

.folio-mosaic {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0 24px;
    justify-content: center;
}
.folio-tile {
    padding: 0;
    border: 2px solid #a0aec0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.folio-tile:hover {
    border-color: #3182ce;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
    transform: scale(1.03);
}
.folio-tile img {
    display: block;
    width: 120px;
    height: 90px;
    object-fit: cover;
    vertical-align: middle;
}

.snap-mosaic {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0 24px;
    justify-content: center;
}
.snap-tile {
    padding: 0;
    border: 2px solid #a0aec0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.snap-tile:hover {
    border-color: #3182ce;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
    transform: scale(1.03);
}
.snap-tile img {
    display: block;
    width: 120px;
    height: 90px;
    object-fit: cover;
    vertical-align: middle;
}

/* Code boxes */
.snippet-panel {
    background: #1a202c;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 16px 0;
    position: relative;
}
.snippet-panel pre {
    margin: 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.5;
}
.snippet-panel code {
    font-family: 'Consolas', 'Monaco', monospace;
}
.clip-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #3182ce;
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}
.clip-btn:hover {
    background: #2b6cb0;
}

/* Scroll reveal */
.rise-in {
    opacity: 1 !important;
    transform: none !important;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.js-active .rise-in.awaiting {
    opacity: 0 !important;
    transform: translateY(30px) !important;
}

/* Language Specific Overrides */

/* Chinese: Adjust letter spacing */
html[lang="zh-CN"] body {
    letter-spacing: 0.05em;
}
html[lang="zh-CN"] .menu-column a {
    letter-spacing: 0.1em;
}

/* Russian: Increase button padding */
html[lang="ru"] .notice-ok,
html[lang="ru"] .grab-btn,
html[lang="ru"] .menu-anchor,
html[lang="ru"] button,
html[lang="ru"] .btn {
    padding-left: 20px !important;
    padding-right: 20px !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}

/* Arabic: RTL Support */
html[lang="ar"] {
    direction: rtl;
    text-align: right;
}
html[lang="ar"] .menu-column {
    border-right: none;
    border-left: 1px solid #e2e8f0;
}
html[lang="ar"] a.menu-anchor {
    border-left: none;
    border-right: 3px solid #3182ce;
    border-radius: 4px 0 0 4px;
    padding: 8px 16px 8px 12px;
    text-align: right;
}
html[lang="ar"] a.menu-anchor:hover {
    border-right-color: #2b6cb0;
    transform: translateX(-4px);
}
html[lang="ar"] .grab-btn {
    right: auto;
    left: 24px;
}
html[lang="ar"] .masthead-row {
    flex-direction: row-reverse;
}


/* Semantic wrappers added during layout refactor */
.cta-dock { display: contents; }
.menu-stack { display: block; }
.story-flow { display: block; }
.mark-frame { margin: 0; display: inline-block; }
.lightbox-x {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
}
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
}
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-pane { max-width: 90vw; max-height: 85vh; }
.lightbox-label { margin: 12px 0 0; color: #e2e8f0; font-size: 14px; text-align: center; }
