/* ==========================================================================
   Info theme styles for scriptor-cms.dev.

   Consumes the Scriptor editor design-system tokens loaded ahead of this
   file (public/editor-assets/css/tokens.css). Anything the editor DS
   does not cover, or where the frontend deviates intentionally, is
   declared in the `:root` override below.

   Single source of truth for color, type, and spacing tokens is
   tokens.css — this file should never introduce raw hex values for
   shared semantics (brand, link, surfaces, borders, …).
   ========================================================================== */

:root {
    /* Frontend-only additions on top of editor-assets/css/tokens.css */
    --color-accent:                #ff4542;        /* sidebar current-marker, "warn" accent */
    --color-brand-hover:           #19599b;        /* button hover — front prefers the lighter blue */
    --color-fg:                    #282828;        /* darker body text than the editor's #555 */

    --info-sidebar-width:          350px;
    --info-prose-line-height:      1.8;
    --info-shadow-soft:            0 1px 1px rgba(0, 0, 0, 0.05);
    --info-code-bg:                #f5f7ff;        /* prose code surface — pale lavender; matches Prism's bundled bg for language-tagged blocks */
    --info-code-border:            #efefef;        /* hairline frame around code blocks + inline code */
}

/* --- Fonts ---------------------------------------------------------------- */

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 400;
    src: local(''),
         url('../fonts/poppins-v20-latin-regular.woff2') format('woff2'),
         url('../fonts/poppins-v20-latin-regular.woff') format('woff');
}

@font-face {
    font-family: 'Poppins';
    font-style: italic;
    font-weight: 400;
    src: local(''),
         url('../fonts/poppins-v20-latin-italic.woff2') format('woff2'),
         url('../fonts/poppins-v20-latin-italic.woff') format('woff');
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 500;
    src: local(''),
         url('../fonts/poppins-v20-latin-500.woff2') format('woff2'),
         url('../fonts/poppins-v20-latin-500.woff') format('woff');
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 600;
    src: local(''),
         url('../fonts/poppins-v20-latin-600.woff2') format('woff2'),
         url('../fonts/poppins-v20-latin-600.woff') format('woff');
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 700;
    src: local(''),
         url('../fonts/poppins-v20-latin-700.woff2') format('woff2'),
         url('../fonts/poppins-v20-latin-700.woff') format('woff');
}

/* --- Base ---------------------------------------------------------------- */

html {
    overflow-y: scroll;
    font-family: var(--font-sans);
    font-size: 1em;
    line-height: var(--info-prose-line-height);
    color: var(--color-fg);
    background: var(--color-surface);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    min-height: 700px;
}

a {
    color: var(--color-link);
    text-decoration: none;
}

a:hover {
    color: var(--color-link-hover);
    text-decoration: none;
}

em {
    font-style: italic;
}

.uk-h1, .uk-h2, .uk-h3, .uk-h4, .uk-h5, .uk-h6,
.uk-heading-2xlarge, .uk-heading-xlarge, .uk-heading-large,
.uk-heading-medium, .uk-heading-small, .uk-heading-primary,
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: var(--font-weight-medium);
    color: var(--color-brand);
    margin: var(--space-8) 0 var(--space-3);
    line-height: var(--line-height-snug);
}

.uk-h2, h2 { font-size: 1.7rem; line-height: 1.3; }
.uk-h3, h3 { font-size: 1.6rem; line-height: 1.8; }
.uk-h4, h4 { font-size: 1.2rem; }

@media (min-width: 960px) {
    .uk-h2, h2 { font-size: 1.9rem; }
}

h1 + *, h2 + *, h3 + *, h4 + *, h5 + *, h6 + * {
    margin-top: var(--space-3);
}

p, ul, ol, dl, blockquote, table {
    margin-top: 0;
    margin-bottom: .95em;
}

ul li {
    line-height: 1.9;
}

img, video, canvas {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

/* --- Code + prose ------------------------------------------------------- */

code, pre {
    font-family: var(--font-mono);
    direction: ltr;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    font-size: 14px;
    line-height: 1.8em;
    text-shadow: 0 1px white;
    vertical-align: middle;
    background: var(--info-code-bg);
    color: inherit;
}

/* Inline `<code>` (anything not inside a `<pre>`). UIkit's stylesheet
 * ships its own `:not(pre)>code, :not(pre)>kbd, :not(pre)>samp` rule
 * with `color: #f0506e; background: #f8f8f8;` — specificity (0,0,2),
 * which would beat a plain `code { … }` selector (0,0,1). Mirroring
 * UIkit's selector lets source order decide instead: styles.css
 * loads after uikit.min.css so this wins. */
:not(pre) > code {
    padding: .2em .35em;
    border: 1px solid var(--info-code-border);
    border-radius: var(--radius-sm);
    color: var(--color-fg-strong);
    background: var(--info-code-bg);
}

pre {
    overflow: auto;
    margin: .5em 0 2em;
    padding: 1em 1.8em;
    border: 1px solid var(--info-code-border);
    border-radius: var(--radius);
    box-shadow: var(--info-shadow-soft);
    color: inherit;
}

/* Specificity boost on the language-tagged variant: Prism's bundled
 * `code[class*="language-"]` rule has specificity (0,1,1) and would
 * otherwise paint the inner code block with its own lavender
 * background + purple text, leaving the outer pre-frame visibly
 * different. The duplicate-but-attribute-selector form gives us
 * (0,1,2), enough to win cleanly. */
pre > code,
pre > code[class*="language-"] {
    display: inline;
    padding: 0;
    background: transparent;
    color: inherit;
}

/* Prism-highlighted blocks (`<pre class="language-…">`) get a slightly
 * wider margin frame, and an explicit background so they don't drift
 * away from plain `<pre>` blocks visually. Selection bg matches the
 * legacy theme. */
pre[class*="language-"] {
    margin: .5em 0 2.5em;
    background: var(--info-code-bg);
}

/* Inline language-tagged code (rare with Parsedown but Prism ships a
 * lavender background for it by default) — pin to the same surface as
 * the rest of the prose code so the inline color stays consistent. */
:not(pre) > code[class*="language-"] {
    background: var(--info-code-bg);
}

pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
    text-shadow: none;
    background: #39f;
}

/* When the editor opens a page body with a heading instead of a
 * paragraph, the default 40px top-margin pushes it too far down inside
 * the content column. Tightens to 20px for that specific case. */
#content > h2:first-child,
#content > h3:first-child,
#content > h4:first-child {
    margin-top: 20px;
}

blockquote {
    margin: 0 0 .95em;
    padding: var(--space-4);
    color: var(--color-fg-strong);
    background-color: var(--color-surface-alt);
    border-left: 4px solid var(--color-border-soft);
}

blockquote code {
    background: var(--color-surface);
}

blockquote mark {
    color: var(--color-fg-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border-quote);
}

mark {
    display: inline-block;
    padding: 0 0.2em;
    background-color: var(--color-surface-mark);
    line-height: 1.7;
}

/* --- Layout: page wrapper + sidebar ------------------------------------- */

#page-wrapper {
    box-sizing: border-box;
    max-width: 100%;
    min-height: 800px;
}

.page-inner {
    box-sizing: border-box;
    position: relative;
}

@media (min-width: 960px) {
    .page-inner {
        margin-right: var(--info-sidebar-width);
    }
}

#page-header h1 {
    margin-top: 100px;
    padding: 0 0 var(--space-4) 0;
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border-row);
    letter-spacing: -1px;
    font-weight: var(--font-weight-bold);
    font-size: 3.1rem;
}

#sidebar-wrapper {
    box-sizing: border-box;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    overflow-x: hidden;
    overflow-y: auto;
    width: var(--info-sidebar-width);
    z-index: 1;
    background-color: var(--color-surface);
}

.sidebar-inner {
    box-sizing: border-box;
    padding: var(--space-7);
}

/* --- Brand-wrapper (logo block at the top of sidebar / offcanvas) -------- */

.brand-wrapper {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5em;
}

.brand-wrapper .brand {
    text-align: center;
    padding: 5px 0;
}

.brand-wrapper .brand a {
    font-size: 1.3em;
    color: var(--color-link);
}

.brand-wrapper .brand a:hover {
    opacity: .8;
}

/* --- Sidebar navigation ------------------------------------------------- */

.sidebar-navi {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: solid 1px var(--color-border-soft);
    border-bottom: solid 1px var(--color-border-soft);
}

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

.sidebar-navi li {
    overflow: hidden;
    border-top: 1px solid var(--color-border-soft);
}

.sidebar-navi > li:first-child {
    border-top: none;
}

.sidebar-navi a {
    box-sizing: border-box;
    display: inline-block;
    width: 100%;
    padding: 10px 20px;
    line-height: 150%;
    color: var(--color-fg-strong);
    font-weight: var(--font-weight-semibold);
    font-size: .9rem;
}

.sidebar-navi a:hover {
    color: var(--color-fg-muted);
    text-decoration: none;
}

.sidebar-navi li.current > a {
    color: var(--color-accent);
    border-left: solid 3px var(--color-accent);
}

.sidebar-navi li.current > ul,
.sidebar-navi li.active > ul {
    display: block;
}

.sidebar-navi li.current > ul li a,
.sidebar-navi li.active > ul li a {
    padding-left: 40px;
    font-weight: var(--font-weight-regular);
}

.sidebar-navi li.active > ul li > ul li a {
    padding-left: 60px;
    font-weight: var(--font-weight-regular);
}

.sidebar-navi li ul {
    display: none;
}

/* --- Mobile offcanvas + toggle ------------------------------------------ */

.toggle-button {
    position: absolute;
    top: 15px;
    right: 15px;
    text-align: right;
    z-index: 2;
}

.toggle-button a {
    display: inline-block;
    color: var(--color-link);
}

#offc .uk-offcanvas-bar {
    background-color: var(--color-surface);
    border-left: solid 1px var(--color-border-soft);
}

#offc .uk-close {
    color: rgba(0, 0, 0, .5);
}

/* --- Scroll-to-top ------------------------------------------------------ */

#stt-button {
    position: fixed;
    display: inline-block;
    width: 45px;
    height: 45px;
    background: var(--color-surface-code) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96'><path fill='%23777' d='M82.6,62.1l-30-36c-2.3-2.5-6.2-2.7-8.8-0.5c-0.2,0.1-0.3,0.3-0.5,0.5l-30,36c-2.1,2.5-1.8,6.3,0.8,8.4c2.5,2.1,6.3,1.8,8.4-0.8l0,0L48,39.3l25.4,30.5c2.1,2.5,5.9,2.9,8.4,0.8C84.4,68.4,84.7,64.7,82.6,62.1z'/></svg>") no-repeat center center;
    background-size: 20px;
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 1px rgba(0, 0, 0, .055);
    text-align: center;
    opacity: 0;
    visibility: hidden;
    z-index: 20;
    cursor: pointer;
    transition: opacity var(--duration-fast) var(--ease-default);
}

#stt-button.show {
    opacity: 1;
    visibility: visible;
}

#stt-button:hover {
    background-color: var(--color-surface-hover);
}

@media (min-width: 1400px) {
    #stt-button {
        right: 320px;
        bottom: 16px;
    }
}

/* --- Footer ------------------------------------------------------------- */

footer {
    margin-top: var(--space-8);
    padding: var(--space-5) 0;
    font-size: .9em;
    border-top: 1px solid var(--color-border-soft);
}

/* Footer subnav on the home hero (©, Legal notice, Data protection).
 * Hits the direct anchor inside each `.uk-subnav` item to override
 * UIkit's larger / uppercase defaults without touching the divider
 * rules. Matches the legacy 1.0 theme's `font-size: .800rem` + muted
 * grey. */
.uk-subnav > * > :first-child {
    font-size: .8rem;
    color: var(--color-fg-muted);
    text-transform: none;
}

/* --- Home (hero) -------------------------------------------------------- */

#home {
    background-color: var(--color-surface);
}

#home .uk-text-large {
    font-size: 1.3rem;
}

#home .lead,
.lead {
    font-size: 1.175em;
    font-weight: var(--font-weight-regular);
}

/* --- Extension cards ---------------------------------------------------- */

.extension-card {
    margin-top: 30px;
    border-radius: var(--radius);
    background-color: var(--color-surface-alt);
    box-shadow: var(--info-shadow-soft);
}

.extension-card:first-child {
    margin-top: 10px;
}

.extension-card .uk-card-title,
.extension-card .uk-article-title {
    color: var(--color-brand);
    line-height: 1.3;
}

.extension-card .uk-card-title {
    font-size: 1.2rem;
}

.extension-card .uk-article-title {
    font-size: 1.6rem;
    padding-top: 0;
    margin-top: 0;
}

.uk-card-default {
    color: var(--color-fg);
}

.uk-text-meta {
    color: var(--color-fg-muted);
}

.uk-label {
    padding: 3px 10px;
    background-color: var(--color-brand-hover);
}

/* --- Tags --------------------------------------------------------------- */

.tags {
    margin-right: 5px;
    padding: 3px 10px;
    border: 1px solid var(--color-brand);
    background-color: var(--color-brand-hover);
    border-radius: var(--radius-sm);
}

.tags a {
    white-space: nowrap;
    color: var(--color-surface);
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
}

.tags a:hover {
    color: var(--color-border-row);
}

/* --- Buttons ------------------------------------------------------------
 *
 * Targets UIkit's `.uk-button` selectors directly (the templates render
 * `class="uk-button uk-button-default"` etc.). `!important` is needed
 * because UIkit's default rules win on specificity otherwise.
 */

.uk-button {
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-semibold);
}

.uk-button-default {
    border: 2px solid var(--color-brand) !important;
    color: var(--color-brand) !important;
    background-color: var(--color-surface) !important;
}

.uk-button-default:hover,
.uk-button-default:focus {
    color: var(--color-surface) !important;
    background-color: var(--color-brand-hover) !important;
}

.uk-button-primary {
    border: 2px solid var(--color-brand) !important;
    color: var(--color-surface) !important;
    background-color: var(--color-brand-hover) !important;
}

.uk-button-primary:hover,
.uk-button-primary:focus {
    background-color: var(--color-brand) !important;
}

/* --- Forms -------------------------------------------------------------- */

.form-stacked input:not([type='checkbox']),
.form-stacked textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 105%;
    line-height: 1.5em;
    color: var(--color-fg);
}

.form-stacked textarea {
    height: 180px;
}

.form-stacked button {
    padding: 10px var(--control-padding-x);
    border: 2px solid var(--color-brand);
    border-radius: var(--radius-sm);
    background-color: var(--color-brand-hover);
    color: var(--color-surface);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
}

.form-stacked button:hover,
.form-stacked button:focus {
    background-color: var(--color-brand);
}

/* --- Alerts ------------------------------------------------------------- */

.alert-success,
.alert-danger {
    padding: var(--space-4);
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
    border: 2px solid;
}

.alert-success {
    color: var(--color-success);
    background-color: var(--color-success-bg);
    border-color: var(--color-success-border);
}

.alert-danger {
    color: var(--color-danger);
    background-color: var(--color-danger-bg);
    border-color: var(--color-danger-border);
}

.alert-success p,
.alert-danger p {
    margin: 0;
    padding: 0;
}

/* --- Helpers ------------------------------------------------------------ */

.text-center {
    text-align: center;
}

.info-layer {
    position: absolute;
    right: 20px;
    bottom: 10px;
    display: inline-block;
    padding: 0 4px;
    background-color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-weight: var(--font-weight-regular);
}
