/*
 * Quiet Press — theme stylesheet.
 * Sections (fixed order): 1. Layout, 2. Typography, 3. Colour, 4. Spacing, 5. State, 6. Responsive.
 */

/* ==================================================================
   1. Layout
   ================================================================== */

body {
    margin: 0;
}

/* Header bar: 60px, full-width hairline; inner constrained to 720px. */
.qp-header {
    border-bottom: 1px solid var(--qp-border);
}

.qp-header__inner {
    min-height: 60px;
    padding: 0 28px;
    align-items: center;
}

.qp-header__brand {
    align-items: center;
    gap: 10px;
}

.qp-header__brand .wp-block-site-logo img {
    width: 32px;
    height: 32px;
    border-radius: 999px;
}

.qp-header__actions {
    align-items: center;
    gap: 18px;
}

.qp-nav,
.qp-nav .wp-block-navigation__container {
    display: flex;
    gap: 18px;
}

/* Footer: top hairline, 26px/34px vertical padding. */
.qp-footer {
    border-top: 1px solid var(--qp-border);
    margin-top: 52px;
}

.qp-footer-nav,
.qp-footer-nav .wp-block-navigation__container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.qp-footer__inner {
    padding: 26px 28px 34px;
}

/* Theme toggle: 34px circle; glyphs drawn with CSS. */
.qp-theme-toggle,
.qp-search-toggle,
.qp-nav-toggle {
    width: 34px;
    height: 34px;
    border: 1px solid var(--qp-border);
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
}

/* No JS, no toggle: inline-flex above beats the UA [hidden] rule. */
.qp-theme-toggle[hidden] {
    display: none;
}

.qp-theme-toggle::before {
    content: "";
    display: block;
    /* Light mode: moon — circle with an inset crescent shadow. */
    width: 15px;
    height: 15px;
    border-radius: 999px;
    box-shadow: inset -4px -3px 0 0 var(--qp-muted);
}

.qp-nav-toggle {
    display: none;
}

.qp-nav-toggle::before {
    content: "";
    display: block;
    width: 16px;
    height: 1.5px;
    background: var(--qp-muted);
    box-shadow: 0 -5px 0 var(--qp-muted), 0 5px 0 var(--qp-muted);
}

.qp-search-toggle::before {
    content: "";
    width: 12px;
    height: 12px;
    border: 1.5px solid var(--qp-muted);
    border-radius: 999px;
}

.qp-search-toggle::after {
    content: "";
    position: absolute;
    top: 21px;
    left: 20px;
    width: 7px;
    height: 1.5px;
    background: var(--qp-muted);
    transform: rotate(45deg);
    transform-origin: left center;
}

.qp-search-panel {
    display: none;
}

.qp-search-panel.is-open {
    display: flex;
    align-items: center;
}

.qp-search-panel .wp-block-search__inside-wrapper {
    display: flex;
}

.qp-search-panel .wp-block-search__input {
    width: 160px;
    border: 1px solid var(--qp-border);
    border-radius: 999px;
    padding: 6px 14px;
    background: var(--qp-surface);
    color: var(--qp-text);
    font-family: var(--wp--preset--font-family--sans);
    font-size: 14px;
}

.qp-main {
    padding: 0 28px;
}

/* Filter pill row above the feed. */
.qp-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 24px 0 8px;
}

/* Article row: thumbnail left, body right, hairline divider. */
.qp-row {
    display: flex;
    gap: 20px;
    padding: 26px 0;
    border-bottom: 1px solid var(--qp-border);
}

.qp-row__thumb {
    flex: 0 0 116px;
    margin: 0;
}

.qp-row__thumb img {
    display: block;
    width: 116px;
    height: 116px;
    object-fit: cover;
    border-radius: 10px;
    background: var(--qp-thumb-base);
}

.qp-row__body {
    min-width: 0;
}

.qp-row__meta {
    margin: 0 0 8px;
}

.qp-row__title {
    margin: 0 0 6px;
}

.qp-row__excerpt {
    margin: 0;
}

/* Link post: compact card with accent left border. */
.qp-link-card {
    border: 1px solid var(--qp-border);
    border-left: 3px solid var(--qp-accent);
    border-radius: 12px;
    background: var(--qp-surface);
    padding: 18px 20px;
    margin: 14px 0;
}

.qp-link-card__label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
}

.qp-link-card__title {
    margin: 0 0 6px;
}

.qp-link-card__commentary {
    margin: 0 0 8px;
}

.qp-link-card__domain {
    margin: 0;
}

.qp-pagination {
    padding: 26px 0;
}

/* Full-bleed hero under the header. */
.qp-article-hero {
    margin: 0;
}

.qp-article-hero img {
    display: block;
    width: 100%;
    height: 390px;
    object-fit: cover;
}

.qp-article-head {
    padding-top: 42px;
}

.qp-article-meta {
    gap: 8px;
}

.qp-article-meta p {
    margin: 0;
}

/* Inline figures in prose. */
.qp-prose figure.wp-block-image img {
    border-radius: 12px;
    max-width: 100%;
    height: auto;
}

/* Article footer: hairline, tags, prev/next two-up. */
.qp-article-footer {
    border-top: 1px solid var(--qp-border);
    margin-top: 40px;
    padding-top: 26px;
}

.qp-prevnext {
    display: flex;
    gap: 16px;
    margin-top: 22px;
}

.qp-prevnext__card {
    flex: 1 1 0;
    border: 1px solid var(--qp-border);
    border-radius: 12px;
    background: var(--qp-surface);
    padding: 14px 16px;
}

.qp-prevnext__card:empty {
    display: none;
}

.qp-prevnext__card--next {
    text-align: right;
}

.qp-link-notice__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Generic page. */
.qp-page {
    padding-top: 52px;
}

.qp-page-image img {
    display: block;
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: 14px;
}

/* About bio header. */
.qp-about-bio {
    gap: 24px;
    padding: 44px 0 38px;
    border-bottom: 1px solid var(--qp-border);
    margin-bottom: 34px;
}

.qp-about-photo img {
    width: 104px;
    height: 104px;
    object-fit: cover;
    border-radius: 999px;
}

/* About entries and skills. */
.qp-about-entry {
    margin-bottom: 28px;
}

.qp-about-entry__head {
    align-items: baseline;
}

.qp-about-skills {
    gap: 16px;
    margin-bottom: 16px;
}

.qp-about-skills__label {
    flex: 0 0 110px;
    margin: 0;
}

.qp-about-skills__chips {
    gap: 8px;
}

/* Definition list. */
.qp-deflist {
    border: 1px solid var(--qp-border);
    border-radius: 12px;
    overflow: hidden;
}

.qp-deflist__row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--qp-border);
}

.qp-deflist__row:last-child {
    border-bottom: 0;
}

.qp-deflist__label {
    flex: 0 0 120px;
    margin: 0;
}

.qp-deflist__value {
    margin: 0;
}

/* CTA panel. */
.qp-cta {
    background: var(--qp-accent-soft);
    border: 1px solid var(--qp-border);
    border-radius: 14px;
    padding: 26px 28px;
    gap: 20px;
    margin: 40px 0;
}

/* ==================================================================
   2. Typography
   ================================================================== */

/* Meta text (dates, labels, captions) — mono, faint. */
.qp-meta {
    font-family: var(--wp--preset--font-family--mono);
    font-size: var(--wp--preset--font-size--meta);
    color: var(--qp-faint);
}

/* Definition-list values keep full text color despite the .qp-meta utility. */
.qp-deflist__value.qp-meta {
    color: var(--qp-text);
}

/* Site title + nav: Inter. */
.wp-block-site-title,
.wp-block-site-title a {
    font-family: var(--wp--preset--font-family--sans);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    color: var(--qp-text);
}

/*
 * Core's navigation block CSS sets color on the link itself via
 * `.wp-block-navigation-item__content.wp-block-navigation-item__content`
 * (class doubled deliberately by core to raise specificity to (0,2,0))
 * — higher than a plain `.qp-nav a` (0,1,1), so it wins regardless of
 * source order. The doubled-class selectors below match that trick to
 * win the cascade instead of relying on file order.
 */
.qp-nav a,
.qp-nav a.wp-block-navigation-item__content.wp-block-navigation-item__content {
    font-family: var(--wp--preset--font-family--sans);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--qp-muted);
}

.qp-nav a[aria-current="page"],
.qp-nav a.wp-block-navigation-item__content.wp-block-navigation-item__content[aria-current="page"] {
    font-weight: 600;
    color: var(--qp-text);
}

.qp-footer__copy,
.qp-footer-nav a,
.qp-footer-nav a.wp-block-navigation-item__content.wp-block-navigation-item__content {
    color: var(--qp-faint);
    text-decoration: none;
}

.qp-footer-nav a {
    font-family: var(--wp--preset--font-family--mono);
    font-size: var(--wp--preset--font-size--meta);
}

/* "RSS · GitHub · Mastodon" — separators live in CSS so menu edits keep them. */
.qp-footer-nav .wp-block-navigation-item + .wp-block-navigation-item::before {
    content: "·";
    color: var(--qp-faint);
    margin-right: 8px;
}

/* Category tag pill (feed meta rows, article head, tag rows). */
.qp-tag {
    font-family: var(--wp--preset--font-family--mono);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--qp-accent);
    background: var(--qp-accent-soft);
    padding: 3px 8px;
    border-radius: 5px;
    text-decoration: none;
}

/* Filter pills. */
.qp-filter__pill {
    font-family: var(--wp--preset--font-family--mono);
    font-size: var(--wp--preset--font-size--meta);
    padding: 6px 13px;
    border: 1px solid var(--qp-border);
    border-radius: 999px;
    color: var(--qp-muted);
    background: transparent;
    text-decoration: none;
}

.qp-filter__pill--active {
    background: var(--qp-accent);
    border-color: var(--qp-accent);
    color: #ffffff;
}

/* Feed row text. */
.qp-row__title {
    font-family: var(--wp--preset--font-family--sans);
    font-size: var(--wp--preset--font-size--feed-title);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.qp-row__title a {
    color: var(--qp-text);
    text-decoration: none;
}

.qp-row__excerpt {
    font-family: var(--wp--preset--font-family--serif);
    font-size: var(--wp--preset--font-size--excerpt);
    line-height: 1.65;
    color: var(--qp-muted);
}

/* Link card text. */
.qp-link-card__kicker {
    color: var(--qp-accent);
    font-weight: 600;
}

.qp-link-card__title {
    font-family: var(--wp--preset--font-family--sans);
    font-size: 17px;
    font-weight: 600;
}

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

.qp-link-card__commentary {
    font-family: var(--wp--preset--font-family--serif);
    font-size: 15px;
    color: var(--qp-muted);
}

.qp-pagination,
.qp-pagination a {
    font-family: var(--wp--preset--font-family--mono);
    font-size: var(--wp--preset--font-size--meta);
    color: var(--qp-muted);
    text-decoration: none;
}

.qp-empty {
    font-family: var(--wp--preset--font-family--serif);
    color: var(--qp-muted);
}

/* Article title block. */
.qp-article-head h1.wp-block-post-title {
    margin: 12px 0 10px;
    text-wrap: balance;
}

.qp-article-cats a {
    font-family: var(--wp--preset--font-family--mono);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--qp-accent);
    background: var(--qp-accent-soft);
    padding: 3px 8px;
    border-radius: 5px;
    text-decoration: none;
}

/* Prose: lead paragraph, blockquote, inline code, captions. */
.qp-prose > p:first-child {
    font-size: var(--wp--preset--font-size--lead);
    line-height: 1.6;
    color: var(--qp-text);
}

.qp-prose blockquote {
    font-style: italic;
    font-size: var(--wp--preset--font-size--lead);
    color: var(--qp-muted);
    border-left: 3px solid var(--qp-accent);
    margin: 28px 0;
    padding-left: 22px;
}

.qp-prose code {
    font-family: var(--wp--preset--font-family--mono);
    font-size: 0.85em;
    background: var(--qp-accent-soft);
    padding: 2px 5px;
    border-radius: 5px;
}

.qp-prose figcaption {
    font-family: var(--wp--preset--font-family--mono);
    font-size: 11.5px;
    color: var(--qp-faint);
    text-align: center;
}

/* Tag row + prev/next text. */
.qp-article-tags a {
    font-family: var(--wp--preset--font-family--mono);
    font-size: 12.5px;
    color: var(--qp-accent);
    background: var(--qp-accent-soft);
    padding: 3px 8px;
    border-radius: 5px;
    text-decoration: none;
}

.qp-prevnext__card {
    font-family: var(--wp--preset--font-family--sans);
    font-size: 14.5px;
    font-weight: 600;
}

.qp-prevnext__card a {
    color: var(--qp-text);
    text-decoration: none;
}

/* About text. */
.qp-about-name {
    font-size: 30px;
    font-weight: 700;
    margin: 0 0 6px;
}

.qp-about-oneliner {
    font-family: var(--wp--preset--font-family--serif);
    font-size: 17px;
    color: var(--qp-muted);
    margin: 0 0 10px;
}

.qp-about-entry__role {
    font-family: var(--wp--preset--font-family--sans);
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}

.qp-about-entry__period {
    margin: 0;
}

.qp-about-entry__company {
    font-family: var(--wp--preset--font-family--mono);
    font-size: 12.5px;
    color: var(--qp-accent);
    margin: 2px 0 6px;
}

.qp-about-entry__description {
    font-family: var(--wp--preset--font-family--serif);
    font-size: 16px;
    line-height: 1.62;
    color: var(--qp-muted);
    margin: 0;
}

/* Section labels ("Experience", "Education", "Skills") — author applies
   class qp-section-label to an h2 in page content. */
.qp-section-label {
    font-family: var(--wp--preset--font-family--mono);
    font-size: var(--wp--preset--font-size--meta);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--qp-faint);
    margin: 34px 0 22px;
}

/* Skill chips. */
.qp-chip {
    font-family: var(--wp--preset--font-family--mono);
    font-size: 12.5px;
    color: var(--qp-text);
    background: var(--qp-accent-soft);
    border: 1px solid var(--qp-border);
    padding: 5px 11px;
    border-radius: 7px;
    margin: 0;
}

/* Page title. */
.qp-page-title {
    margin: 0 0 22px;
}

/* CTA text + button. */
.qp-cta__kicker {
    color: var(--qp-accent);
    font-weight: 600;
    margin: 0 0 6px;
}

.qp-cta__title {
    font-size: var(--wp--preset--font-size--lead);
    font-weight: 600;
    margin: 0 0 6px;
}

.qp-cta__body {
    font-family: var(--wp--preset--font-family--serif);
    font-size: var(--wp--preset--font-size--excerpt);
    color: var(--qp-muted);
    margin: 0;
}

.qp-cta__button .wp-block-button__link {
    background: var(--qp-accent);
    color: #ffffff;
    border-radius: 999px;
    font-family: var(--wp--preset--font-family--sans);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
}

/* ==================================================================
   3. Colour
   ================================================================== */

:root {
    --qp-background: #faf9f7;
    --qp-surface: #ffffff;
    --qp-text: #2b2825;
    --qp-muted: #6f6862;
    --qp-faint: #9a938c;
    --qp-border: #e9e5df;
    --qp-accent: var(--wp--custom--accent--light, #2f8f83);
    --qp-accent-soft: var(--wp--custom--accent--soft-light, rgba(47, 143, 131, 0.10));
    --qp-thumb-base: #f0ede8;
    --qp-thumb-stripe: #e4ded5;
    --qp-code-bg: #1c1b19;
    --qp-code-border: #2b2926;
    --qp-code-text: #d5d8dc;
    color-scheme: light;
}

/* Explicit visitor choice: dark. */
:root[data-theme="dark"] {
    --qp-background: #1b1a18;
    --qp-surface: #232120;
    --qp-text: #e9e4dc;
    --qp-muted: #a49d93;
    --qp-faint: #726c64;
    --qp-border: #332f2b;
    --qp-accent: var(--wp--custom--accent--dark, #5cb9ac);
    --qp-accent-soft: var(--wp--custom--accent--soft-dark, rgba(92, 185, 172, 0.15));
    --qp-thumb-base: #2a2724;
    --qp-thumb-stripe: #35302b;
    color-scheme: dark;
}

/* OS preference: dark, unless the visitor explicitly chose light. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --qp-background: #1b1a18;
        --qp-surface: #232120;
        --qp-text: #e9e4dc;
        --qp-muted: #a49d93;
        --qp-faint: #726c64;
        --qp-border: #332f2b;
        --qp-accent: var(--wp--custom--accent--dark, #5cb9ac);
        --qp-accent-soft: var(--wp--custom--accent--soft-dark, rgba(92, 185, 172, 0.15));
        --qp-thumb-base: #2a2724;
        --qp-thumb-stripe: #35302b;
        color-scheme: dark;
    }
}

/* Dark mode: sun glyph — filled circle with a ring. */
:root[data-theme="dark"] .qp-theme-toggle::before {
    width: 13px;
    height: 13px;
    background: var(--qp-muted);
    box-shadow: 0 0 0 2.5px var(--qp-background), 0 0 0 4px var(--qp-muted);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .qp-theme-toggle::before {
        width: 13px;
        height: 13px;
        background: var(--qp-muted);
        box-shadow: 0 0 0 2.5px var(--qp-background), 0 0 0 4px var(--qp-muted);
    }
}

/* Code panel: dark in both modes. */
.qp-prose pre.wp-block-code {
    background: var(--qp-code-bg);
    border: 1px solid var(--qp-code-border);
    border-radius: 12px;
    padding: 18px 20px;
    overflow-x: auto;
}

.qp-prose pre.wp-block-code code {
    background: transparent;
    padding: 0;
    color: var(--qp-code-text);
    font-family: var(--wp--preset--font-family--mono);
    font-size: 13.5px;
    line-height: 1.7;
}

/* Prism-compatible syntax palette (highlighter plugin optional). */
.qp-prose .token.keyword { color: #c792ea; }
.qp-prose .token.function { color: #82aaff; }
.qp-prose .token.string { color: #b6d987; }
.qp-prose .token.number { color: #f0a45d; }
.qp-prose .token.comment { color: #6f7681; }

/* ==================================================================
   4. Spacing
   ================================================================== */

/* Prose vertical rhythm: paragraphs 22px bottom margin. */
.entry-content p {
    margin-top: 0;
    margin-bottom: 22px;
}

/* ==================================================================
   5. State
   ================================================================== */

/* Quiet motion: 0.15s ease only. */
a,
button {
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.qp-nav a:hover,
.qp-nav a.wp-block-navigation-item__content.wp-block-navigation-item__content:hover,
.qp-footer-nav a:hover,
.qp-footer-nav a.wp-block-navigation-item__content.wp-block-navigation-item__content:hover {
    color: var(--qp-accent);
    text-decoration: none;
}

.qp-theme-toggle:hover {
    border-color: var(--qp-accent);
}

.qp-filter__pill:hover {
    border-color: var(--qp-accent);
    color: var(--qp-accent);
}

.qp-filter__pill--active:hover {
    color: #ffffff;
}

.qp-row__title a:hover,
.qp-link-card__title a:hover,
.qp-pagination a:hover {
    color: var(--qp-accent);
}

.qp-prevnext__card:hover {
    border-color: var(--qp-faint);
}

.qp-prevnext__card a:hover {
    color: var(--qp-accent);
}

/* Prose links: accent, underline on hover. */
.qp-prose a {
    color: var(--qp-accent);
    text-decoration: none;
}

.qp-prose a:hover {
    text-decoration: underline;
}

/* Visible focus for keyboard users. */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--qp-accent);
    outline-offset: 2px;
}

/* ==================================================================
   6. Responsive
   ================================================================== */

/* Article hero shrinks on small screens. */
@media (max-width: 760px) {
    .qp-article-hero img {
        height: 260px;
    }
}

/* Header nav collapses into a hamburger-triggered dropdown. */
@media (max-width: 760px) {
    .qp-header {
        position: relative;
        z-index: 10;
    }

    .qp-nav-toggle {
        display: inline-flex;
    }

    /*
     * WP's global-styles-inline-css ships "body .is-layout-flex{display:flex}"
     * (specificity 0,1,1) on every page. The nav block carries the
     * .is-layout-flex class, so a plain ".qp-nav{display:none}" (0,1,0) loses
     * regardless of source order. The compound selector below matches the
     * same specificity budget as .qp-nav.is-open further down, so the two
     * stay resolvable by source order while both out-specificity the global rule.
     */
    nav.qp-nav,
    nav.qp-nav.is-layout-flex {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        padding: 12px 28px;
        background: var(--qp-surface);
        border-bottom: 1px solid var(--qp-border);
    }

    nav.qp-nav.is-open {
        display: flex;
    }

    .qp-nav .wp-block-navigation__container {
        flex-direction: column;
        gap: 0;
    }

    .qp-nav a,
    .qp-nav a.wp-block-navigation-item__content.wp-block-navigation-item__content {
        display: block;
        padding: 10px 0;
    }
}

@media (max-width: 560px) {
    /* Feed row thumbnail shrinks; text keeps priority. */
    .qp-row__thumb {
        flex-basis: 88px;
    }

    .qp-row__thumb img {
        width: 88px;
        height: 88px;
    }

    /* About bio stacks, photo above text, left-aligned. */
    .qp-about-bio {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Prev/next stacks to one column. */
    .qp-prevnext {
        flex-direction: column;
    }

    .qp-prevnext__card--next {
        text-align: left;
    }

    /* Skills rows stack label above chips. */
    .qp-about-skills {
        flex-direction: column;
        gap: 8px;
    }

    /* Footer nav stacks to a vertical list; the "·" separator only makes sense inline. */
    .qp-footer-nav,
    .qp-footer-nav .wp-block-navigation__container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .qp-footer-nav .wp-block-navigation-item + .wp-block-navigation-item::before {
        display: none;
    }
}

@media (max-width: 400px) {
    /* Tighter gutters on small phones. Prose stays 18px — never shrink reading text. */
    .qp-main,
    .qp-header__inner,
    .qp-footer__inner {
        padding-left: 20px;
        padding-right: 20px;
    }
}
