/* ==========================================================================
   Sellsy — API v2 changelog
   Replaces /api/v2/resources/markdown.css
   Palette: SELLSY-COLORS-GUIDELINES (#02016F, #5C6FFF, #FFA89D, #F6F7FE,
   #FFE252, #7FDECB, #FFFFFF)

   Works on two levels:
   1. CSS only: the raw HTML produced by markdown (h1, h2, h3, ul…) is
      styled directly, with no class to add.
   2. With the template's small script: each version is grouped into a
      block (.release), Minor / Fix types are colored, and
      "Technical optimizations" versions are compacted and hideable.
   ========================================================================== */

:root {
    --navy: #02016f;
    --blue: #5c6fff;
    --salmon: #ffa89d;
    --mist: #f6f7fe;
    --gold: #ffe252;
    --turquoise: #7fdecb;
    --white: #ffffff;

    --ink: var(--navy);
    --ink-soft: #4b4a8c; /* lightened navy, for regular text */
    --ink-faint: #8a8ab3; /* dates, metadata */
    --line: #e2e2ee;

    --font: "Roboto", "Helvetica Neue", Arial, "Liberation Sans", sans-serif;
    --mono: "Roboto Mono", "Source Code Pro", Menlo, Consolas, monospace;

    --header-h: 4rem;
    --content-w: 60rem;
}

/* --- Base --- */

html {
    font-size: 100%;
    overflow-y: scroll;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 1rem);
}

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

body {
    margin: 0;
    background: var(--mist);
    color: var(--ink-soft);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--gold);
    color: var(--navy);
}

a {
    color: var(--blue);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
a:hover {
    color: var(--navy);
}
a:focus-visible,
button:focus-visible,
input:focus-visible + label {
    outline: 3px solid var(--blue);
    outline-offset: 3px;
    border-radius: 4px;
}

img {
    max-width: 100%;
    border: 0;
    vertical-align: middle;
}

p {
    margin: 0 0 1em;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--ink);
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
}

code,
kbd,
samp,
pre {
    font-family: var(--mono);
    font-size: 0.875em;
}
code {
    background: var(--mist);
    color: var(--navy);
    padding: 0.1em 0.4em;
    border-radius: 4px;
}
pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    background: var(--mist);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
}
pre code {
    padding: 0;
    background: none;
}

blockquote {
    margin: 0 0 1em;
    padding-left: 1rem;
    border-left: 3px solid var(--turquoise);
    color: var(--ink-soft);
}

table {
    border-collapse: collapse;
    width: 100%;
}
th {
    text-align: left;
    border-bottom: 2px solid var(--navy);
    color: var(--navy);
}
th,
td {
    padding: 0.5rem 0.75rem;
    vertical-align: top;
}
td {
    border-bottom: 1px solid var(--line);
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 2rem 0;
}

/* --- Header (template) --- */

.sy-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--navy);
    color: var(--white);
}
.sy-header__inner {
    max-width: var(--content-w);
    margin: 0 auto;
    min-height: var(--header-h);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.sy-header__brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    color: var(--white);
    text-decoration: none;
}
.sy-header__brand:hover {
    color: var(--white);
}
.sy-header__logo {
    width: 6.5rem;
    height: auto;
    display: block;
}
.sy-header__product {
    padding-left: 0.875rem;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.9375rem;
    font-weight: 500;
    white-space: nowrap;
}
.sy-header__nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.sy-header__link {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
}
.sy-header__link:hover {
    color: var(--white);
    text-decoration: underline;
}

/* The Sellsy Academy button: the only yellow element on the page */
.sy-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.125rem;
    border-radius: 0.5rem;
    background: var(--gold);
    color: var(--navy);
    font-weight: 700;
    font-size: 0.9375rem;
    text-decoration: none;
    white-space: nowrap;
    transition:
            background-color 0.15s ease,
            transform 0.15s ease;
}
.sy-cta:hover {
    background: var(--white);
    color: var(--navy);
}
.sy-cta:active {
    transform: translateY(1px);
}
.sy-cta svg {
    width: 1rem;
    height: 1rem;
    flex: none;
}
.sy-cta:focus-visible {
    outline-color: var(--gold);
}

/* --- Content --- */

.sy-main {
    max-width: var(--content-w);
    margin: 0 auto;
    padding: 3.5rem 1.5rem 5rem;
}

/* Fallback when content is rendered directly in <body> (old template) */
body > h1,
body > h2,
body > h3,
body > p,
body > ul,
body > hr {
    max-width: var(--content-w);
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* Page title and intro */
.sy-main > h1,
.sy-main h1 {
    font-size: clamp(2.25rem, 5vw, 3.25rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    margin-bottom: 1rem;
}
.sy-main h1 + p {
    font-size: 1.125rem;
    max-width: 38rem;
    margin-bottom: 2rem;
}

/* Toolbar injected by the script */
.sy-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
    margin: 0 0 2.5rem;
    font-size: 0.9375rem;
}
.sy-latest {
    color: var(--ink-soft);
}
.sy-latest strong {
    color: var(--navy);
    font-family: var(--mono);
    font-weight: 600;
}
.sy-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--navy);
    font-weight: 500;
}
.sy-toggle input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--blue);
    margin: 0;
}

/* --- Versions: CSS-only rendering (no script) --- */

h2 {
    font-family: var(--mono);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--navy);
    margin: 2.5rem 0 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--line);
}

h3 {
    display: inline-block;
    margin: 0.75rem 0 0.5rem;
    padding: 0.15rem 0.625rem;
    border-radius: 999px;
    background: var(--white);
    border: 1px solid var(--line);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--navy);
}

ul,
ol {
    margin: 0 0 1rem;
    padding: 0 0 0 1.25rem;
}
li {
    margin: 0.375rem 0;
    padding-left: 0.25rem;
    overflow-wrap: anywhere;
}
li::marker {
    color: var(--blue);
}
li p:last-child {
    margin: 0;
}

/* --- Versions: enriched rendering (with script) --- */

.release {
    display: grid;
    grid-template-columns: 10.5rem minmax(0, 1fr);
    gap: 0 2.5rem;
    background: var(--white);
    border-radius: 12px;
    padding: 1.75rem 2rem;
    margin-bottom: 0.75rem;
}

.release__meta {
    padding-top: 0.125rem;
}
.release__meta h2 {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 1.125rem;
}
.release__meta h2 a {
    color: inherit;
    text-decoration: none;
}
.release__meta h2 a:hover {
    color: var(--blue);
}
.release__date {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--ink-faint);
}

.release__body > :first-child {
    margin-top: 0;
}
.release__body ul:last-child {
    margin-bottom: 0;
}
.release__body li {
    color: var(--ink-soft);
    max-width: 70ch;
}

/* Change types */
.release h3[data-kind="minor"] {
    background: #e3f7f3;
    border-color: var(--turquoise);
}
.release h3[data-kind="fix"] {
    background: #ffedea;
    border-color: var(--salmon);
}
.release h3[data-kind="added"] {
    background: #e8ecff;
    border-color: #b7c3fe;
}
.release h3 + ul {
    margin-top: 0.25rem;
}
.release__body ul {
    margin-bottom: 0;
}
.release ul + h3 {
    margin-top: 1.25rem;
}

/* Breaking changes: highlighted */
li.is-breaking {
    color: var(--navy);
    font-weight: 600;
}
li.is-breaking .breaking {
    background: linear-gradient(transparent 55%, var(--gold) 55%);
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* Versions with no visible change ("Technical optimizations"): compact */
.release.is-technical {
    background: transparent;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0.25rem;
}
.release.is-technical .release__meta h2 {
    font-size: 0.9375rem;
    color: var(--ink-faint);
    font-weight: 500;
}
.release.is-technical .release__date {
    display: inline;
    margin: 0 0 0 0.5rem;
    font-size: 0.8125rem;
}
.release.is-technical .release__meta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
}
.release.is-technical .release__body {
    color: var(--ink-faint);
    font-size: 0.875rem;
    align-self: center;
}
.release.is-technical h3 {
    display: none;
}
.release.is-technical ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.release.is-technical li {
    margin: 0;
    padding: 0;
    color: var(--ink-faint);
}

/* Hide technical-only versions */
main:has(#hide-tech:checked) .is-technical {
    display: none;
}

/* Targeted anchor (shared link to a version) */
.release:target {
    box-shadow: 0 0 0 2px var(--blue);
}

/* --- Footer --- */

.sy-footer {
    max-width: var(--content-w);
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    font-size: 0.875rem;
    color: var(--ink-faint);
    border-top: 1px solid var(--line);
}
.sy-footer a {
    color: var(--ink-soft);
}

/* --- Responsive --- */

@media (max-width: 760px) {
    .sy-header__product,
    .sy-header__link {
        display: none;
    }
    .sy-header__inner {
        padding: 0 1rem;
    }
    .sy-main {
        padding: 2.25rem 1rem 3.5rem;
    }
    .release {
        grid-template-columns: 1fr;
        padding: 1.25rem;
        gap: 0.75rem;
    }
    .release.is-technical {
        padding: 0.5rem 1.25rem;
        gap: 0.125rem;
    }
    .release__meta {
        display: flex;
        align-items: baseline;
        gap: 0.75rem;
        flex-wrap: wrap;
    }
    .release__date {
        margin: 0;
    }
}

@media (max-width: 420px) {
    .sy-cta {
        padding: 0.5rem 0.875rem;
        font-size: 0.875rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

/* --- Print --- */

@media print {
    .sy-header,
    .sy-toolbar,
    .sy-footer {
        display: none;
    }
    body {
        background: #fff;
        color: #000;
    }
    .release {
        background: none;
        padding: 0.75rem 0;
        border-bottom: 1px solid #ccc;
        border-radius: 0;
        break-inside: avoid;
    }
    .release.is-technical {
        display: none;
    }
    a {
        color: #000;
    }
}