/* Base + design tokens for the wago plugins registry. The screens render with
   inline styles (ported from the design), so this file only owns the document
   shell: fonts, background, scrollbars, selection. Dark-only by design. */

:root {
    color-scheme: dark;

    /* Surfaces */
    --bg: #1a1547;
    --bg-deep: #161043;
    --panel: #221c52;
    --panel-2: #25205a;
    --line: #2c2566;
    --line-2: #443a8c;

    /* Text */
    --text: #f3effd;
    --dim: #b9add9;
    --soft: #b3a6e0;
    --muted: #7d72b0;
    --faint: #6f64a8;

    /* Accents */
    --lilac: #c3a8ff;
    --green: #74e0ad;
    --pink: #ff9ec4;
    --violet: #5a3ff0;
    --ink: #1a1547;

    --sans: "Outfit", system-ui, -apple-system, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--lilac);
    color: var(--ink);
}

a {
    color: inherit;
}

input,
textarea,
button {
    font-family: inherit;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 10px;
}

/* The app renders into a centered column, matching the design container. */
#app {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    min-height: 100vh;
}

/* Subtle hover affordances the inline styles don't cover. */
[data-act="open"]:hover,
[data-act="cat"]:hover,
.ext-card:hover {
    border-color: var(--line-2);
}

button {
    transition:
        border-color 0.15s ease,
        background 0.15s ease;
}

/* Rendered Markdown (sanitized) for comment + review bodies. Kept compact to
   sit inside cards, matching the dark palette. */
.md {
    font-size: 14px;
    line-height: 1.65;
    color: var(--soft);
    word-break: break-word;
    overflow-wrap: anywhere;
}
.md > :first-child {
    margin-top: 0;
}
.md > :last-child {
    margin-bottom: 0;
}
.md p {
    margin: 0 0 10px;
}
.md h1,
.md h2,
.md h3,
.md h4,
.md h5,
.md h6 {
    color: var(--text);
    line-height: 1.3;
    margin: 16px 0 8px;
    font-weight: 700;
}
.md h1 {
    font-size: 1.35em;
}
.md h2 {
    font-size: 1.2em;
}
.md h3 {
    font-size: 1.08em;
}
.md a {
    color: var(--lilac);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.md ul,
.md ol {
    margin: 0 0 10px;
    padding-left: 22px;
}
.md li {
    margin: 2px 0;
}
.md code {
    font-family: var(--mono);
    font-size: 0.88em;
    background: var(--bg-deep);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 1px 5px;
}
.md pre {
    position: relative;
    background: var(--bg-deep);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    overflow-x: auto;
    margin: 0 0 10px;
}

/* Copy icon button, injected top-right of every code block (enhanceCodeBlocks).
   No background at rest; it lights up on hover, and turns green on copy. */
.md pre .code-copy {
    position: absolute;
    top: 6px;
    right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--muted);
    background: transparent;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    opacity: 0.65;
    transition:
        opacity 0.12s ease,
        color 0.12s ease,
        background 0.12s ease;
}
.md pre:hover .code-copy,
.md pre .code-copy:focus-visible {
    opacity: 1;
}
.md pre .code-copy:hover {
    background: var(--panel-2);
    color: var(--text);
}
.md pre .code-copy.copied {
    color: var(--green);
    opacity: 1;
    background: transparent;
}
.md pre .code-copy svg {
    width: 15px;
    height: 15px;
    display: block;
}
/* Install command (package page): the whole box is click-to-copy. A muted copy
   icon sits at rest (like the readme code blocks), brightens on hover, and turns
   green as it flashes a checkmark on copy. */
.install-box:hover {
    border-color: var(--line-2);
}
.install-box:hover .install-copy {
    color: var(--text);
}
.install-box.copied {
    border-color: var(--green);
}
.install-box.copied .install-copy {
    color: var(--green);
}
.install-copy {
    color: var(--muted);
    transition: color 0.12s ease;
}
.install-copy svg {
    width: 14px;
    height: 14px;
    display: block;
}
.md pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 12.5px;
    color: #e7e0ff;
}
.md blockquote {
    margin: 0 0 10px;
    padding: 2px 14px;
    border-left: 3px solid var(--line-2);
    color: var(--dim);
}
.md table {
    border-collapse: collapse;
    margin: 0 0 10px;
    display: block;
    overflow-x: auto;
    max-width: 100%;
}
.md th,
.md td {
    border: 1px solid var(--line);
    padding: 6px 10px;
    text-align: left;
}
.md th {
    background: var(--panel-2);
    color: var(--text);
}
.md hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 14px 0;
}
.md img {
    max-width: 100%;
}

/* README rendering — a fuller, GitHub-style document (roomier than the compact
   comment `.md` above), adapted to the dark palette. */
.readme .md {
    font-size: 15px;
    line-height: 1.7;
    color: var(--dim);
}
.readme .md h1,
.readme .md h2,
.readme .md h3,
.readme .md h4 {
    margin: 24px 0 16px;
    font-weight: 700;
    line-height: 1.25;
}
.readme .md h1 {
    font-size: 1.9em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--line);
}
.readme .md h2 {
    font-size: 1.45em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--line);
}
.readme .md h3 {
    font-size: 1.2em;
}
.readme .md h4 {
    font-size: 1.02em;
}
.readme .md > :first-child {
    margin-top: 0;
}
.readme .md p,
.readme .md blockquote,
.readme .md ul,
.readme .md ol,
.readme .md table,
.readme .md pre {
    margin: 0 0 16px;
}
.readme .md ul,
.readme .md ol {
    padding-left: 2em;
}
.readme .md li + li {
    margin-top: 4px;
}
.readme .md li.task-list-item {
    list-style: none;
}
.readme .md li.task-list-item > input,
.readme .md input[type="checkbox"] {
    margin: 0 6px 0 -1.4em;
    vertical-align: middle;
    accent-color: var(--lilac);
}
.readme .md a {
    color: var(--lilac);
    text-decoration: none;
}
.readme .md a:hover {
    text-decoration: underline;
}
.readme .md code {
    font-size: 0.85em;
    background: color-mix(in srgb, var(--lilac) 12%, transparent);
    border: none;
    padding: 0.2em 0.4em;
    border-radius: 6px;
}
.readme .md pre {
    background: var(--bg-deep);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px;
    font-size: 13px;
    line-height: 1.5;
}
.readme .md pre code {
    font-size: inherit;
    /* Must override the inline-code pill above (equal-or-higher specificity),
       else the inline background paints behind every line inside the block. */
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
}
.readme .md blockquote {
    padding: 0 1em;
    border-left: 4px solid var(--line-2);
    color: var(--muted);
}
.readme .md table {
    display: block;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}
.readme .md th,
.readme .md td {
    border: 1px solid var(--line);
    padding: 7px 13px;
}
.readme .md tr:nth-child(2n) {
    background: color-mix(in srgb, var(--panel) 55%, transparent);
}
.readme .md img {
    max-width: 100%;
    border-radius: 6px;
}
.readme .md hr {
    height: 1px;
    border: none;
    background: var(--line);
    margin: 24px 0;
}
.readme .md kbd {
    font-family: var(--mono);
    font-size: 0.82em;
    background: var(--panel-2);
    border: 1px solid var(--line-2);
    border-bottom-width: 2px;
    border-radius: 6px;
    padding: 2px 6px;
}
.readme .md details {
    margin: 0 0 16px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}
.readme .md summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
}

/* Prism token theme — dark, matched to the palette. Scoped to READMEs. */
.readme .md .token.comment,
.readme .md .token.prolog,
.readme .md .token.doctype,
.readme .md .token.cdata {
    color: var(--muted);
    font-style: italic;
}
.readme .md .token.punctuation {
    color: var(--soft);
}
.readme .md .token.keyword,
.readme .md .token.tag,
.readme .md .token.selector,
.readme .md .token.important,
.readme .md .token.atrule,
.readme .md .token.deleted {
    color: var(--pink);
}
.readme .md .token.string,
.readme .md .token.char,
.readme .md .token.attr-value,
.readme .md .token.regex,
.readme .md .token.inserted,
.readme .md .token.url {
    color: var(--green);
}
.readme .md .token.number,
.readme .md .token.boolean,
.readme .md .token.constant,
.readme .md .token.symbol {
    color: #f0b072;
}
.readme .md .token.function,
.readme .md .token.class-name,
.readme .md .token.title {
    color: var(--lilac);
}
.readme .md .token.builtin,
.readme .md .token.property,
.readme .md .token.attr-name,
.readme .md .token.variable,
.readme .md .token.symbol {
    color: #8ec9ff;
}
.readme .md .token.operator,
.readme .md .token.entity {
    color: var(--dim);
}
.readme .md .token.namespace {
    opacity: 0.75;
}
.readme .md .token.italic {
    font-style: italic;
}
.readme .md .token.bold,
.readme .md .token.important {
    font-weight: 700;
}

/* ============================================================================
   Responsive / mobile

   The screens render with desktop-first inline styles, so these rules are the
   single place mobile layout lives. Where a rule must beat an inline style it
   uses !important (scoped to the r-* hooks the render layer adds); everything
   else is a plain override. Breakpoints: 960 (tablet), 760 (nav), 600 (phone).
   ========================================================================== */

@media (max-width: 960px) {
    /* Two-column shells (package body, search, account) collapse to one column,
       and their sticky sidebars stop sticking so they read as normal sections. */
    .r-split {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }
    .r-side {
        position: static !important;
        top: auto !important;
    }
    /* 3-up card grids step down to 2-up first. */
    .r-grid3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 900px) {
    /* Nav wraps to two rows: brand + actions, then a full-width search bar. The
       redundant "Browse" link and the "packages" pill drop to save width. */
    .r-nav {
        flex-wrap: wrap !important;
        gap: 12px !important;
    }
    .r-navsearch {
        order: 3;
        /* !important beats the inline `flex:1` (which sets flex-basis:0); a 100%
           basis forces the search onto its own row below the brand + actions. */
        flex-basis: 100% !important;
        max-width: none !important;
    }
    .r-navbrowse,
    .r-navtag {
        display: none !important;
    }
}

@media (max-width: 600px) {
    /* Tighter page gutters reclaim horizontal space on phones. */
    #app {
        padding: 0 14px;
    }
    /* Everything single-column at phone width. */
    .r-grid3,
    .r-stats,
    .r-2col {
        grid-template-columns: 1fr !important;
    }
    /* Trim the tall home hero. */
    .r-hero {
        padding-top: 40px !important;
        padding-bottom: 24px !important;
    }
    /* The package action buttons (save/star/repo) wrap onto their own full-width
       row instead of overflowing to the right of the title. */
    .r-pkgactions {
        margin-left: 0 !important;
        width: 100%;
        flex-wrap: wrap !important;
    }
    /* 16px is the threshold below which iOS Safari zooms on input focus. */
    input,
    textarea,
    select {
        font-size: 16px !important;
    }
    /* Package tab bar becomes a swipeable strip instead of wrapping / overflowing;
       the anchored (margin-left:auto) tabs rejoin the normal flow. */
    .r-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        gap: 18px !important;
        scrollbar-width: none;
    }
    .r-tabs::-webkit-scrollbar {
        display: none;
    }
    .r-tabs > * {
        margin-left: 0 !important;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Long unbreakable tokens in rendered Markdown / READMEs (e.g. module paths,
   `wasm32-wasip1`) wrap instead of forcing horizontal page scroll on narrow
   viewports. Applies at every width — it only ever helps. */
.md code,
.readme .md code {
    overflow-wrap: anywhere;
    word-break: break-word;
}
