/* ============================================================
   BASE — tiny global rules needed on every page (not header/
   footer/single-specific enough to belong in their own files).
   ============================================================ */

html {
    scroll-behavior: smooth;
}

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

/* Without this the document falls back to the UA defaults — a serif
   face and an 8px body margin, which breaks the full-bleed sections. */
body {
    margin: 0;
    background: var(--c-bg);
    color: var(--c-ink-soft);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

/* Chunky, unmissable keyboard focus */
a:focus-visible {
    outline: 3px solid var(--c-accent);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ------------------------------------------------------------
   Skip link / screen-reader-only text
   ------------------------------------------------------------ */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link.screen-reader-text:focus {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
    width: auto;
    height: auto;
    clip: auto;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    background: var(--c-accent);
    color: #fff;
    font-family: var(--font-body);
    font-weight: 700;
    text-decoration: none;
}

/* ------------------------------------------------------------
   Category chip + byline strip — shared primitives. The front page,
   single-post.php and the generic single.php all use them, so they
   live here instead of being repeated per template stylesheet.
   The chip's one square corner is the Benqu shape signature.
   ------------------------------------------------------------ */
.cat-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: var(--radius-badge);
    background: var(--c-accent);
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.cat-badge:hover {
    filter: brightness(1.1);
}

/* Separators are drawn in CSS so the markup stays a list of spans. */
.entry-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 0;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--c-ink-faint);
}

.entry-meta span + span::before {
    content: "\2022";
    margin-right: 10px;
}

/* ------------------------------------------------------------
   Category tile — solid block in the term's own colour. The front
   page grids them five across, archive.php's sidebar two across,
   so only the tile lives here; each file brings its own grid.
   The hue arrives as an inline --card-color per instance.
   ------------------------------------------------------------ */
.category-tile {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 4px;
    min-height: 92px;
    padding: 18px 16px;
    border-radius: var(--radius-md);
    background: var(--card-color, var(--c-accent));
    color: #fff;
    text-align: center;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.category-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px -18px var(--c-shadow);
}

/* ------------------------------------------------------------
   With a picture on it (template-parts/category-tile.php).

   The colour is not replaced by the picture, it stays underneath:
   it is what shows while the image loads, if the file has been
   deleted from the library, and on every category nobody has
   uploaded one for. A half-finished set degrades to the tile this
   always was rather than to a hole.
   ------------------------------------------------------------ */
.category-tile--photo {
    position: relative;
    overflow: hidden;
    align-content: end;
    justify-items: start;
    aspect-ratio: 3 / 2;
    min-height: 140px;
    text-align: left;
    /* A band of the category colour survives the photo, so a tile still
       answers "which category" without reading the label. */
    box-shadow: inset 0 -4px 0 0 var(--card-color, var(--c-accent));
}

.category-tile__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* The scrim. Without it a white label on a bright sky is unreadable,
   and how bright the sky is is not something the CSS can know. */
.category-tile--photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 13, 18, 0.1) 0%, rgba(10, 13, 18, 0.45) 55%, rgba(10, 13, 18, 0.78) 100%);
}

.category-tile--photo .category-tile__name,
.category-tile--photo .category-tile__count {
    position: relative;
    z-index: 1;
}

.category-tile__name {
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.2;
}

.category-tile__count {
    font-family: var(--font-body);
    font-size: 0.74rem;
    font-weight: 600;
    opacity: 0.85;
}

/* ------------------------------------------------------------
   Section title — centered heading with a rule running out to
   both edges. Front page, plus the suggestion blocks on search
   results and 404.
   ------------------------------------------------------------ */
.section-title {
    max-width: 1480px;
    margin: 0 auto;
    padding: 0 clamp(20px, 4vw, 56px);
    display: flex;
    align-items: center;
    gap: clamp(16px, 3vw, 32px);
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 2.4vw, 1.9rem);
    font-weight: 700;
    letter-spacing: 0;
    color: var(--c-ink);
}

.section-title::before,
.section-title::after {
    content: "";
    flex: 1 1 0;
    height: 1px;
    background: var(--c-border-strong);
}

/* ------------------------------------------------------------
   Breadcrumb bar — the light strip Benqu puts above both single
   posts and archives. Shared because single-post.php and
   archive.php render the same band; the archive adds its title
   inside it (see archive.css).
   ------------------------------------------------------------ */
.breadcrumb-bar {
    background: var(--c-surface-tint);
    border-bottom: 1px solid var(--c-border);
}

.breadcrumb-bar__inner {
    max-width: 1480px;
    margin: 0 auto;
    padding: 18px clamp(20px, 4vw, 56px) 20px;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--c-ink-faint);
}

.breadcrumb a {
    color: var(--c-ink);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--c-accent);
}

/* Separators are drawn here rather than sitting in the markup, so
   hiding a crumb takes its separator with it. */
.breadcrumb > * + *::before {
    content: "/";
    margin-right: 10px;
    color: var(--c-border-strong);
}

/* On a single post the last crumb is the full headline, which wraps
   onto four lines at phone width — a lot of room for a secondary cue,
   and the h1 repeats it two elements further down. Dropped there only:
   on an archive the last crumb is a short term name worth keeping, or
   the trail would read as a bare "Начало". */
@media (max-width: 639px) {
    .single-post .breadcrumb__current {
        display: none;
    }
}

/* ------------------------------------------------------------
   Tag chip — outlined version of the badge shape, on light
   surfaces. Used under an article (single-post.php) and in the
   archive sidebar; the footer has its own dark variant.
   ------------------------------------------------------------ */
/* Chip row. Shared: the article tag list (single-post.php) and the
   feature groups on a place (single-place.php). Decoration that belongs
   to only one of them is scoped there, not added here. */
.tag-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-chip {
    display: inline-block;
    padding: 6px 18px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-badge);
    color: var(--c-ink-soft);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.tag-chip:hover {
    background: var(--c-accent);
    border-color: var(--c-accent);
    color: #fff;
}

/* ------------------------------------------------------------
   Social icon row — shared chrome: header.php renders it in the
   top bar, footer.php in the brand column, so the base lives here
   rather than in either file. Variants: .socials--footer.
   ------------------------------------------------------------ */
.socials {
    display: flex;
    align-items: center;
    gap: 12px;
}

.socials__label {
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.socials__list {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.socials__list a {
    display: block;
    transition: color 0.18s ease;
}

.socials__list svg {
    display: block;
    width: 16px;
    height: 16px;
}

/* ------------------------------------------------------------
   Save toggle — "Моят списък"

   Here rather than in a per-template file because the same button
   rides on cards in archive.css, front-page.css and
   archive-place.css, and inline in the article header.

   It overlays the card media, which is what keeps it free: no row
   in the card grid, so no reflow when the state changes and no
   height added to a listing that is already dense.
   ------------------------------------------------------------ */
.archive-item,
.place-item,
.post-card {
    /* The containing block for the absolute .save-btn below. .post-card
       already sets this for its badge; stated for all three so the button
       cannot escape a card whose own file changes. */
    position: relative;
}

.save-btn {
    position: absolute;
    z-index: 2;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--c-ink);
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.save-btn svg {
    width: 17px;
    height: 17px;
    /* Outline until saved, solid after — the fill switch is the whole
       state change, so it carries no color meaning on its own. */
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linejoin: round;
}

.save-btn:hover {
    transform: scale(1.08);
    background: #fff;
}

.save-btn.is-saved {
    background: var(--c-accent);
    color: #fff;
}

.save-btn.is-saved svg {
    fill: currentColor;
}

/* Inline in the article header, where there is no media to sit on.
   Two buttons now, so the paragraph is the row that holds them. */
.entry-save {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.entry-save .save-btn {
    position: static;
    width: auto;
    height: auto;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
}

.entry-save .save-btn .screen-reader-text {
    /* The label is the point of this variant, so it comes back out of the
       screen-reader-only box that the icon-only version keeps it in. */
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: nowrap;
}

/* ------------------------------------------------------------
   Share button — the Web Share sheet, or a copied link.

   Two variants share one base, the same way .save-btn does: the
   inline one next to the save button in an article header, and
   --wide on /spisak/, where it stands alone under the description.
   Both arrive hidden; assets/js/share.js unhides them.
   ------------------------------------------------------------ */
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    color: var(--c-ink);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.share-btn[hidden] {
    /* The attribute alone loses to display:inline-flex above. */
    display: none;
}

.share-btn svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.share-btn:hover {
    border-color: var(--c-accent);
    color: var(--c-accent);
}

/* The confirmation after a copy. Held for a couple of seconds by the
   script, so it needs to read as a state and not as a hover. */
.share-btn.is-flashing {
    border-color: var(--c-accent);
    background: var(--c-accent);
    color: #fff;
}

.share-btn--wide {
    margin-top: 18px;
}

/* The wrapper is only here to be the menu's containing block. */
.share {
    position: relative;
    display: inline-flex;
}

.share-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    left: 0;
    min-width: 190px;
    padding: 6px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    box-shadow: 0 18px 40px rgba(10, 18, 51, 0.16);
}

.share-menu[hidden] {
    display: none;
}

/* Right-aligned when the button is near the right edge of the viewport;
   the script does not measure, so this is the one place a menu can run
   off screen on a narrow phone. Full width below the small breakpoint
   is the simpler fix. */
@media (max-width: 480px) {
    .share-menu {
        left: auto;
        right: 0;
    }
}

.share-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--c-ink);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

/* The brand dot. A coloured mark rather than a logo: a logo means
   shipping seven trademarked SVGs, and the name already identifies the
   destination. */
.share-menu__item::before {
    content: "";
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--share-color, var(--c-ink-faint));
}

.share-menu__item:hover,
.share-menu__item:focus-visible {
    background: var(--c-surface-tint);
    color: var(--c-ink);
}

.share-menu__item--copy::before,
.share-menu__item--more::before {
    background: none;
    border: 1.5px solid var(--c-ink-faint);
}

.share-menu__item.is-flashing {
    color: var(--c-accent);
}

/* ------------------------------------------------------------
   Location marker — region > settlement, under the article meta.
   ------------------------------------------------------------ */
.entry-location {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 7px;
    margin: 12px 0 0;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--c-ink-soft);
}

.entry-location__pin {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    fill: none;
    stroke: var(--c-accent);
    stroke-width: 1.7;
    stroke-linejoin: round;
}

.entry-location__link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--c-border-strong);
    transition: color 0.18s ease, border-color 0.18s ease;
}

a.entry-location__link:hover {
    color: var(--c-accent);
    border-color: var(--c-accent);
}

.entry-location__sep {
    color: var(--c-ink-faint);
}

/* Sits tight against the term before it, unlike the chevron. */
.entry-location__break {
    margin-left: -5px;
}

/* ------------------------------------------------------------
   Saved list shell — /spisak/ (template-saved.php)
   ------------------------------------------------------------ */
.saved-layout {
    max-width: 1480px;
    margin: 0 auto;
    padding: clamp(24px, 4vw, 48px) clamp(20px, 4vw, 56px);
}

.saved-note {
    max-width: 60ch;
    margin: 0 0 24px;
    color: var(--c-ink-faint);
}

.saved-note[hidden] {
    display: none;
}

/* ------------------------------------------------------------
   Saved counter in the nav
   ------------------------------------------------------------ */
.saved-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-md);
    color: var(--c-ink);
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.saved-link:hover {
    border-color: var(--c-accent);
    color: var(--c-accent);
}

.saved-link svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linejoin: round;
}

.saved-link__count {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--c-accent);
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.72rem;
    text-align: center;
}

.saved-link__count[hidden] {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .socials__list a,
    .category-tile,
    .tag-chip,
    .save-btn,
    .share-btn,
    .entry-location__link {
        transition: none;
    }

    .save-btn:hover {
        transform: none;
    }
}
