/* ==========================================================================
   Rosé Pine Dawn — a simple, light, text-first Ghost theme
   Palette: Rosé Pine Dawn (https://rosepinetheme.com/palette)
   ========================================================================== */

/* --- tokens ------------------------------------------------------------- */

:root {
    color-scheme: light;

    /* Rosé Pine Dawn */
    --rp-base: #faf4ed;
    --rp-surface: #fffaf3;
    --rp-overlay: #f2e9e1;
    --rp-muted: #9893a5;
    --rp-subtle: #797593;
    --rp-text: #575279;
    --rp-love: #b4637a;
    --rp-gold: #ea9d34;
    --rp-rose: #d7827e;
    --rp-pine: #286983;
    --rp-foam: #56949f;
    --rp-iris: #907aa9;
    --rp-highlight-low: #f4ede8;
    --rp-highlight-med: #dfdad9;
    --rp-highlight-high: #cecacd;

    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
        "Liberation Mono", monospace;

    --measure: 46rem;
    --measure-text: 42rem;

    --hairline: 1px solid var(--rp-overlay);
}

/* --- reset -------------------------------------------------------------- */

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background-color: var(--rp-base);
    color: var(--rp-text);
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.7;
    font-kerning: normal;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
video {
    max-width: 100%;
    height: auto;
}

::selection {
    background-color: var(--rp-highlight-med);
    color: var(--rp-text);
}

:focus-visible {
    outline: 2px solid var(--rp-pine);
    outline-offset: 2px;
    border-radius: 2px;
}

/* --- helpers ------------------------------------------------------------ */

.container {
    width: 100%;
    max-width: var(--measure);
    margin-inline: auto;
    padding-inline: 1.5rem;
}

.dot {
    color: var(--rp-highlight-high);
    padding-inline: 0.35em;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--rp-surface);
    color: var(--rp-text);
    padding: 0.5rem 1rem;
    z-index: 10;
}

.skip-link:focus {
    left: 0;
}

.empty {
    color: var(--rp-subtle);
    padding: 2rem 0;
}

/* --- links -------------------------------------------------------------- */

a {
    color: var(--rp-pine);
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    text-decoration-color: var(--rp-highlight-high);
}

a:hover {
    text-decoration-color: var(--rp-pine);
    color: var(--rp-iris);
}

/* --- header ------------------------------------------------------------- */

.site-header {
    border-bottom: var(--hairline);
    padding-block: 1.75rem 1.25rem;
}

.site-header__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
}

.site-title {
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--rp-text);
    text-decoration: none;
}

.site-title:hover {
    color: var(--rp-pine);
    text-decoration: none;
}

.site-nav ul {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.9375rem;
}

.site-nav li {
    margin: 0;
}

.site-nav a {
    color: var(--rp-subtle);
    text-decoration: none;
}

.site-nav a:hover,
.site-nav .nav-current > a {
    color: var(--rp-text);
    text-decoration: underline;
    text-decoration-color: var(--rp-highlight-high);
}

.site-description {
    margin: 0.5rem 0 0;
    color: var(--rp-subtle);
    font-size: 0.9375rem;
    max-width: var(--measure-text);
}

/* --- main / post list --------------------------------------------------- */

.site-main {
    padding-block: 2.5rem 4rem;
}

.post-list {
    display: flex;
    flex-direction: column;
}

.post-card {
    padding-block: 1.75rem;
    border-bottom: var(--hairline);
}

.post-card:first-child {
    padding-top: 0;
}

.post-card__title {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.3;
    letter-spacing: -0.012em;
    font-weight: 600;
}

.post-card__title a {
    color: var(--rp-text);
    text-decoration: none;
}

.post-card__title a:hover {
    color: var(--rp-pine);
    text-decoration: underline;
    text-decoration-color: var(--rp-highlight-high);
}

.post-card__meta {
    margin: 0.4rem 0 0;
    font-size: 0.875rem;
    color: var(--rp-subtle);
}

.post-card__excerpt {
    margin: 0.6rem 0 0;
    color: var(--rp-text);
    max-width: var(--measure-text);
}

/* --- single post -------------------------------------------------------- */

.post-header {
    padding-bottom: 1.5rem;
}

.post-title {
    margin: 0;
    font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 650;
}

.post-meta {
    margin: 0.9rem 0 0;
    font-size: 0.875rem;
    color: var(--rp-subtle);
}

.post-tag {
    color: var(--rp-iris);
    text-decoration: none;
}

.post-tag:hover {
    text-decoration: underline;
}

.post-content {
    max-width: var(--measure-text);
}

.post-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: var(--hairline);
    font-size: 0.9375rem;
}

.post-footer__tags {
    margin: 0 0 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border: 1px solid var(--rp-overlay);
    border-radius: 999px;
    background: var(--rp-surface);
    color: var(--rp-subtle);
    font-size: 0.8125rem;
    text-decoration: none;
}

.tag:hover {
    color: var(--rp-pine);
    border-color: var(--rp-highlight-high);
    text-decoration: none;
}

.post-footer__back {
    margin: 0;
}

.post-footer__back a {
    text-decoration: none;
}

/* --- content typography ({{{content}}}) --------------------------------- */

.post-content p,
.post-content ul,
.post-content ol,
.post-content dl,
.post-content blockquote,
.post-content table,
.post-content .kg-card {
    margin-block: 0 1.35em;
}

.post-content > p:first-child {
    margin-top: 0;
}

.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    margin: 2.2em 0 0.6em;
    line-height: 1.25;
    letter-spacing: -0.01em;
    font-weight: 600;
}

.post-content h2 {
    font-size: 1.5rem;
}

.post-content h3 {
    font-size: 1.25rem;
}

.post-content h4 {
    font-size: 1.1rem;
}

.post-content h5,
.post-content h6 {
    font-size: 1rem;
    color: var(--rp-subtle);
}

.post-content ul,
.post-content ol {
    padding-left: 1.35em;
}

.post-content li {
    margin-block: 0.4em;
}

.post-content li > ul,
.post-content li > ol {
    margin-block: 0.4em;
}

.post-content strong {
    font-weight: 650;
    color: var(--rp-text);
}

.post-content em {
    font-style: italic;
}

.post-content hr {
    border: 0;
    border-top: 1px solid var(--rp-highlight-med);
    width: 5rem;
    margin: 3rem auto;
}

.post-content blockquote {
    border-left: 3px solid var(--rp-iris);
    padding-left: 1.25rem;
    color: var(--rp-subtle);
}

.post-content blockquote p:last-child {
    margin-bottom: 0;
}

.post-content a {
    text-decoration-thickness: 1px;
}

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--rp-surface);
    border: 1px solid var(--rp-overlay);
    border-radius: 4px;
    padding: 0.12em 0.35em;
    word-break: break-word;
}

.post-content pre {
    background: var(--rp-surface);
    border: 1px solid var(--rp-overlay);
    border-radius: 6px;
    padding: 1.1rem 1.25rem;
    overflow-x: auto;
    line-height: 1.6;
    font-size: 0.9375rem;
    margin-block: 0 1.35em;
}

.post-content pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: 1em;
    color: var(--rp-text);
}

.post-content pre.line-numbers,
.post-content .kg-code-card pre {
    margin-bottom: 0;
}

.post-content .kg-code-card {
    border: 1px solid var(--rp-overlay);
    border-radius: 6px;
    background: var(--rp-surface);
    overflow: hidden;
}

.post-content .kg-code-card pre {
    border: 0;
    border-radius: 0;
}

.post-content .kg-code-card figcaption,
.post-content figcaption {
    font-size: 0.8125rem;
    color: var(--rp-subtle);
    padding: 0.5rem 1.25rem 1rem;
    text-align: left;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.post-content th,
.post-content td {
    border-bottom: var(--hairline);
    padding: 0.6rem 0.75rem;
    text-align: left;
}

.post-content th {
    background: var(--rp-surface);
    font-weight: 600;
}

.post-content img,
.post-content iframe,
.post-content video {
    max-width: 100%;
    border-radius: 6px;
}

.post-content figure {
    margin: 0 0 1.35em;
}

.post-content figure img {
    display: block;
    width: 100%;
}

.post-content .footnotes {
    font-size: 0.875rem;
    color: var(--rp-subtle);
    border-top: var(--hairline);
    margin-top: 3rem;
    padding-top: 1rem;
}

/* Ghost content cards: wide/full bleed out of the text measure */
.post-content .kg-width-wide {
    width: min(calc(100% + 10rem), calc(100vw - 3rem));
    max-width: none;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

.post-content .kg-width-full {
    width: calc(100vw - 3rem);
    max-width: none;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

.post-content .kg-embed-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.post-content .kg-embed-card iframe {
    width: 100%;
}

/* bookmark card */
.kg-bookmark-card a.kg-bookmark-container {
    display: flex;
    border: 1px solid var(--rp-overlay);
    border-radius: 6px;
    background: var(--rp-surface);
    text-decoration: none;
    overflow: hidden;
}

.kg-bookmark-content {
    padding: 1rem 1.25rem;
    flex: 1 1 auto;
}

.kg-bookmark-title {
    font-weight: 600;
    color: var(--rp-text);
}

.kg-bookmark-description {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--rp-subtle);
}

.kg-bookmark-metadata {
    margin-top: 0.6rem;
    font-size: 0.8125rem;
    color: var(--rp-subtle);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kg-bookmark-icon {
    width: 18px;
    height: 18px;
    margin: 0;
}

.kg-bookmark-thumbnail {
    flex: 0 0 30%;
    overflow: hidden;
}

.kg-bookmark-thumbnail img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    border-radius: 0;
}

/* callout card */
.kg-callout-card {
    display: flex;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--rp-overlay);
    border-left: 3px solid var(--rp-gold);
    border-radius: 6px;
    background: var(--rp-surface);
}

.kg-callout-emoji {
    font-size: 1.15rem;
    line-height: 1.6;
}

.kg-callout-card div.kg-callout-text {
    margin: 0;
}

.kg-callout-card p:last-child {
    margin-bottom: 0;
}

/* toggle card */
.kg-toggle-card {
    border: 1px solid var(--rp-overlay);
    border-radius: 6px;
    background: var(--rp-surface);
    padding: 0.9rem 1.25rem;
}

.kg-toggle-heading {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    cursor: pointer;
}

.kg-toggle-card-icon {
    color: var(--rp-subtle);
    font-size: 0.8125rem;
}

.kg-toggle-heading-text {
    font-weight: 600;
}

.kg-toggle-content p:last-child {
    margin-bottom: 0;
}

/* button card */
.kg-button-card a.kg-btn {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    background: var(--rp-pine);
    color: var(--rp-base);
    font-weight: 550;
    text-decoration: none;
}

.kg-button-card a.kg-btn:hover {
    background: var(--rp-iris);
    color: var(--rp-base);
}

.kg-button-card,
.kg-signup-card {
    text-align: left;
}

/* gallery card */
.kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kg-gallery-row {
    display: flex;
    gap: 0.5rem;
}

.kg-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* audio / video / file cards: keep them plain and readable */
.kg-video-card video,
.kg-audio-card audio {
    width: 100%;
}

.kg-file-card a.kg-file-card-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--rp-overlay);
    border-radius: 6px;
    background: var(--rp-surface);
    text-decoration: none;
}

.kg-file-card-title {
    font-weight: 600;
    color: var(--rp-text);
}

.kg-file-card-caption {
    font-size: 0.8125rem;
    color: var(--rp-subtle);
}

/* --- pagination --------------------------------------------------------- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: var(--hairline);
    font-size: 0.9375rem;
}

.pagination__link {
    text-decoration: none;
}

.pagination__info {
    color: var(--rp-subtle);
    font-size: 0.875rem;
}

/* --- archive headers (tag / author) ------------------------------------- */

.archive-header {
    padding-bottom: 1.75rem;
    border-bottom: var(--hairline);
    margin-bottom: 0.5rem;
}

.archive-title {
    margin: 0;
    font-size: 1.75rem;
    letter-spacing: -0.015em;
}

.archive-description {
    margin: 0.6rem 0 0;
    color: var(--rp-text);
    max-width: var(--measure-text);
}

.archive-meta {
    margin: 0.6rem 0 0;
    font-size: 0.875rem;
    color: var(--rp-subtle);
}

/* --- footer / subscribe ------------------------------------------------- */

.site-footer {
    border-top: var(--hairline);
    padding-block: 2rem 2.5rem;
    font-size: 0.9375rem;
}

.subscribe {
    background: var(--rp-surface);
    border: 1px solid var(--rp-overlay);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
}

.subscribe__heading {
    margin: 0;
    font-weight: 600;
}

.subscribe__text {
    margin: 0.35rem 0 0.9rem;
    color: var(--rp-subtle);
    font-size: 0.9375rem;
}

.button {
    display: inline-block;
    padding: 0.5rem 1.1rem;
    border-radius: 6px;
    background: var(--rp-pine);
    color: var(--rp-base);
    font-weight: 550;
    font-size: 0.9375rem;
    text-decoration: none;
}

.button:hover {
    background: var(--rp-iris);
    color: var(--rp-base);
    text-decoration: none;
}

.site-footer__meta {
    margin: 0;
    color: var(--rp-subtle);
}

.site-footer__meta a {
    color: var(--rp-subtle);
}

.site-footer__meta a:hover {
    color: var(--rp-pine);
}

/* --- error page --------------------------------------------------------- */

.error-page {
    padding: 3rem 0;
}

.error-page__code {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    color: var(--rp-rose);
}

.error-page__title {
    margin: 0.4rem 0 1rem;
    font-size: 1.6rem;
    letter-spacing: -0.015em;
}

/* --- responsive --------------------------------------------------------- */

@media (max-width: 640px) {
    body {
        font-size: 1rem;
    }

    .site-header {
        padding-block: 1.25rem 1rem;
    }

    .site-main {
        padding-block: 2rem 3rem;
    }

    .post-card {
        padding-block: 1.35rem;
    }

    .post-card__title {
        font-size: 1.3rem;
    }

    .post-title {
        font-size: 1.8rem;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .subscribe {
        padding: 1rem 1.15rem;
    }
}

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

/* --- Ghost's own card stylesheet ----------------------------------------
   Ghost 6 injects /public/cards.min.css AFTER this file and it hardcodes
   surfaces (#fff) and text (#222/#151515) for several cards. It is layout-only
   for plain post elements, so it is kept (better card fidelity) and only the
   palette-critical properties are re-asserted here, scoped under .post-content
   so this wins on specificity rather than order. */

.post-content .kg-bookmark-card a.kg-bookmark-container,
.post-content .kg-file-card a.kg-file-card-container,
.post-content .kg-toggle-card {
    background: var(--rp-surface);
    border-color: var(--rp-overlay);
    color: var(--rp-text);
}

.post-content .kg-bookmark-title,
.post-content .kg-file-card-title,
.post-content .kg-toggle-heading-text {
    color: var(--rp-text);
}

.post-content .kg-bookmark-description,
.post-content .kg-file-card-caption,
.post-content .kg-bookmark-metadata,
.post-content .kg-toggle-card-icon {
    color: var(--rp-subtle);
}

.post-content .kg-callout-card {
    background: var(--rp-surface);
    border-color: var(--rp-overlay);
    border-left: 3px solid var(--rp-gold);
    color: var(--rp-text);
}

.post-content .kg-button-card a.kg-btn {
    background-color: var(--rp-pine);
    color: var(--rp-base);
}

.post-content .kg-button-card a.kg-btn:hover {
    background-color: var(--rp-iris);
    color: var(--rp-base);
}

.post-content .kg-embed-card iframe {
    border: 0;
}
