/* ---------------------------------------------------------------------------
   E-Gazete archive shelf — design ids 5a (desktop) and 8a (phone).
   Mobile-first: base rules are the phone layout.

   Covers are portrait (~375×570 mm, aspect 0.658) and are always matted,
   never cropped — see docs/issue-pdf-reference.md. Matting uses a flex
   container with a definite height; do not switch to grid + height:100% +
   object-fit:contain on the image — percentage height resolves cyclic and
   silently crops.
   --------------------------------------------------------------------------- */

.shelf {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 0 var(--gutter) var(--space-8);
}

/* --- Header ---------------------------------------------------------------- */

.shelf__header {
    padding: 18px 0 16px;
    border-bottom: var(--rule-hairline) solid var(--rule);
}

.shelf__breadcrumb {
    margin: 0;
    font: 400 var(--text-kicker) / 1.4 var(--font-sans);
    color: var(--meta);
}

.shelf__breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.shelf__breadcrumb a:hover,
.shelf__breadcrumb a:focus-visible {
    color: var(--accent);
    text-decoration: underline;
}

.shelf__title {
    margin: 10px 0 0;
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.shelf__intro {
    margin: 9px 0 0;
    max-width: 560px;
    font: 400 15px / 1.55 var(--font-serif);
    color: var(--body);
}

.shelf__search-block {
    margin-top: 14px;
}

/* 5a/8a: 1.5px ink box with the magnifier inside, no visible button (Enter
   submits; a visually hidden submit stays for assistive technology). */
.shelf__search {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: var(--rule-medium) solid var(--ink);
}

.shelf__search-icon {
    flex: none;
    color: var(--ink);
}

.shelf__search-input {
    /* A long placeholder ends in "…" rather than mid-word on a narrow phone (backlog #52). */
    text-overflow: ellipsis;
    flex: 1 1 auto;
    min-width: 0;
    min-height: var(--input-height);
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-family: var(--font-sans);
}

.shelf__search-input::placeholder {
    color: var(--meta);
}

.shelf__search-hint {
    margin: 8px 0 0;
    font: 400 var(--text-kicker) / 1.5 var(--font-sans);
    color: var(--meta);
}

/* --- Language chips -------------------------------------------------------- */

.shelf__languages {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 16px 0;
    padding-bottom: var(--space-1);
    overflow-x: auto;
    scrollbar-width: none;
}

.shelf__languages::-webkit-scrollbar {
    display: none;
}

.shelf__languages-label {
    flex: none;
    font: 600 var(--text-meta) / 1 var(--font-sans);
    color: var(--ink);
}

.shelf__language {
    flex: none;
    display: inline-flex;
    align-items: center;
    min-height: var(--target-min);
    padding: 7px 12px;
    border: var(--rule-hairline) solid var(--rule);
    font: 400 var(--text-kicker) / 1 var(--font-sans);
    color: var(--body);
    text-decoration: none;
    white-space: nowrap;
}

.shelf__language:hover {
    border-color: var(--ink);
}

.shelf__language--active {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--on-ink);
    font-weight: 600;
}

.shelf__languages-count {
    flex: none;
    margin-left: auto;
    padding-left: var(--space-3);
    font: 400 var(--text-meta) / 1 var(--font-sans);
    color: var(--meta);
    white-space: nowrap;
}

/* --- Empty states ---------------------------------------------------------- */

.shelf__empty {
    padding: var(--space-6) 0;
    border-top: var(--rule-strong) solid var(--ink);
}

.shelf__empty-message {
    margin: 0 0 var(--space-3);
    font-size: var(--text-lead);
    color: var(--body);
}

.shelf__empty-action {
    margin: 0;
    font: 600 var(--text-ui) / 1.4 var(--font-sans);
}

.shelf__empty-action a {
    color: var(--accent);
}

/* --- Year shelves ---------------------------------------------------------- */

.shelf__year {
    padding-top: 12px;
    border-top: var(--rule-strong) solid var(--ink);
}

.shelf__year + .shelf__year {
    margin-top: 18px;
}

.shelf__year-summary {
    display: flex;
    align-items: baseline;
    gap: 10px;
    cursor: pointer;
    list-style: none;
}

.shelf__year-summary::-webkit-details-marker {
    display: none;
}

.shelf__year-label {
    font: 700 26px / 1 var(--font-serif);
    color: var(--ink);
}

.shelf__year-count {
    font: 400 var(--text-kicker) / 1 var(--font-sans);
    color: var(--meta);
}

.shelf__year-rule {
    flex: 1;
    align-self: center;
    height: var(--rule-hairline);
    background: var(--rule);
}

/* "gizle ▲" while open (meta), "göster ▼" while closed (accent), per 8a. */
.shelf__year-toggle {
    font: 400 var(--text-kicker) / 1 var(--font-sans);
    white-space: nowrap;
}

.shelf__year-toggle--hide {
    display: none;
    color: var(--meta);
}

.shelf__year-toggle--show {
    color: var(--accent);
}

.shelf__year[open] .shelf__year-toggle--hide {
    display: inline;
}

.shelf__year[open] .shelf__year-toggle--show {
    display: none;
}

.shelf__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 16px 0 var(--space-2);
}

.shelf__card {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Definite height — flex-centres the portrait cover inside the mat without
 * the cyclic-percentage trap that grid + object-fit:contain causes. */
.shelf__cover-mat {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 230px;
    padding: 8px;
    background: var(--mat);
}

.shelf__cover-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    filter: var(--shadow-paper);
}

.shelf__cover-fallback {
    font-family: var(--font-serif);
    font-size: var(--text-h1);
    font-weight: 700;
    line-height: var(--leading-tight);
    color: var(--meta);
}

.shelf__cover-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 7px;
    background: var(--ink);
    color: var(--on-ink);
    font: 600 9px / 1 var(--font-sans);
    letter-spacing: 0.06em;
    text-transform: uppercase; /* D2: the msgid is sentence case; casing is CSS */
}

.shelf__card-title {
    margin: 8px 0 0;
    font: 700 15px / 1.2 var(--font-serif);
    color: var(--ink);
}

.shelf__card-date {
    margin: 2px 0 0;
    font: 400 var(--text-kicker) / 1.4 var(--font-sans);
    color: var(--meta);
}

.shelf__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 7px 0 0;
    padding: 0;
    list-style: none;
}

/* Language chips (5a): outlined ink when the reader can open the file, muted
   rule border plus a padlock when it is locked. */
.shelf__badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px 7px;
    border: var(--rule-hairline) solid var(--rule);
    font: 600 9.5px / 1 var(--font-sans);
    letter-spacing: 0.02em;
    color: var(--meta);
    text-decoration: none;
}

.shelf__badge--open {
    border-color: var(--ink);
    color: var(--ink);
}

.shelf__badge--open:hover,
.shelf__badge--open:focus-visible,
.shelf__badge--locked:hover,
.shelf__badge--locked:focus-visible {
    color: var(--accent);
}

/* Inline SVG, not the 🔒 emoji the badge used to carry: README §Glyphs — no
   emoji anywhere, and the webfonts do not carry it. */
.shelf__badge-lock {
    flex: none;
    display: block;
}

/* Supplements sit under the language chips (owner 2026-09-30). The label is
   "Ek: <title>" in the template; this only gives the line a place. */
.shelf__supplements {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.shelf__supplement {
    margin: 0;
    font: 400 12px / 1.4 var(--font-sans);
    color: var(--meta);
}

.shelf__supplement a {
    color: var(--ink);
    text-decoration: underline;
}

/* --- Rail ------------------------------------------------------------------ */

/* Phones (8a): a tint panel under the shelf, opened by a 2.5px ink rule. */
.shelf__rail {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin: var(--space-6) calc(var(--gutter) * -1) 0;
    padding: 18px var(--gutter);
    border-top: var(--rule-strong) solid var(--ink);
    background: var(--tint);
}

.shelf__rail-label {
    margin: 0 0 10px;
    font: 700 var(--text-kicker-small) / 1.2 var(--font-sans);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink);
}

.shelf__rail-text {
    margin: 0;
    font: 400 15px / 1.6 var(--font-serif);
    color: var(--body);
}

.shelf__rail-files {
    margin: 0;
    padding: 0;
    list-style: none;
}

.shelf__rail-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 0;
    border-bottom: var(--rule-hairline) solid var(--rule);
}

.shelf__rail-file-name {
    flex: 1;
    min-width: 0;
    font: 400 13px / 1.3 var(--font-sans);
    color: var(--ink);
}

.shelf__rail-file-action {
    font: 600 12px / 1 var(--font-sans);
    color: var(--accent);
    text-decoration: none;
}

.shelf__rail-file-action:hover,
.shelf__rail-file-action:focus-visible {
    text-decoration: underline;
}

.shelf__rail-file-locked {
    padding: 4px 7px;
    background: var(--ink);
    color: var(--on-ink);
    font: 600 9.5px / 1 var(--font-sans);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.shelf__rail-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin-top: 12px;
    padding: 12px;
    font: 600 13px / 1.2 var(--font-sans);
    text-align: center;
    text-decoration: none;
}

/* White on #1A73A8 is 5.2:1. */
.shelf__rail-cta--primary {
    background: var(--accent);
    color: var(--on-ink);
}

.shelf__rail-cta--secondary {
    min-height: var(--target-min);
    margin-top: 8px;
    border: var(--rule-medium) solid var(--ink);
    color: var(--ink);
}

.shelf__rail-cta--primary:hover {
    background: var(--ink);
}

.shelf__rail-cta--secondary:hover {
    background: var(--ink);
    color: var(--on-ink);
}

.shelf__rail-link {
    font: 400 15px / 1.5 var(--font-serif);
    color: var(--ink);
    text-decoration: none;
}

.shelf__rail-link:hover,
.shelf__rail-link:focus-visible {
    color: var(--accent);
    text-decoration: underline;
}

/* --- 640px ------------------------------------------------------------------ */

@media (min-width: 640px) {
    .shelf__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* --- 900px: 5a — header row, shelf beside a tint rail --------------------- */

@media (min-width: 900px) {
    .shelf__header {
        padding: 30px 0 26px;
    }

    .shelf__breadcrumb {
        margin-bottom: 14px;
        font-size: var(--text-meta);
    }

    .shelf__header-row {
        display: flex;
        align-items: flex-end;
        gap: 34px;
    }

    .shelf__header-text {
        flex: 1;
        min-width: 0;
    }

    .shelf__title {
        margin-top: 0;
        font-size: 44px;
        line-height: 1.08;
    }

    .shelf__intro {
        margin-top: 12px;
        font-size: 17px;
        line-height: 1.6;
    }

    .shelf__search-block {
        flex: none;
        width: 380px;
        margin-top: 0;
    }

    .shelf__body {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 350px;
    }

    .shelf__main {
        min-width: 0;
        padding: 26px 30px 34px 0;
    }

    .shelf__languages {
        flex-wrap: wrap;
        margin-top: 0;
        margin-bottom: 20px;
        overflow: visible;
    }

    .shelf__language {
        min-height: 0;
        padding: 6px 13px;
        font-size: var(--text-meta);
    }

    .shelf__year {
        padding-top: 16px;
    }

    .shelf__year-label {
        font-size: 30px;
    }

    .shelf__year-count,
    .shelf__year-toggle {
        font-size: var(--text-meta);
    }

    .shelf__cover-mat {
        height: 200px;
        padding: 10px;
    }

    .shelf__card-title {
        margin-top: 10px;
        font-size: 17px;
    }

    .shelf__card-date {
        margin-top: 3px;
        font-size: var(--text-meta);
    }

    .shelf__badges {
        margin-top: 9px;
        gap: 5px;
    }

    .shelf__badge {
        font-size: 10px;
    }

    /* 5a: tint rail column with a 1px rule between it and the shelf. */
    .shelf__rail {
        margin: 0;
        padding: 26px 30px 30px;
        border-top: 0;
        border-left: var(--rule-hairline) solid var(--rule);
        gap: 0;
    }

    .shelf__rail-block {
        padding-top: 14px;
        border-top: var(--rule-strong) solid var(--ink);
    }

    .shelf__rail-block + .shelf__rail-block {
        margin-top: 24px;
    }

    .shelf__rail-label {
        margin-bottom: 12px;
        font-size: var(--text-kicker);
        letter-spacing: 0.16em;
    }
}

/* --- 1100px: 5a's five covers per row -------------------------------------- */

@media (min-width: 1100px) {
    .shelf__grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 22px;
        margin-top: 20px;
    }
}

/* --- Single-issue PDF purchase (UX audit B4) -------------------------------
   The checkout chrome itself comes from css/membership.css, which this page
   also loads; only the issue summary is here. Same mat/fallback treatment as
   the shelf card above, at thumbnail size. */

.issue-purchase__header {
    margin-top: var(--space-5);
}

.issue-purchase__kicker {
    margin: 0;
    font: 700 var(--text-kicker-small) / 1 var(--font-sans);
    letter-spacing: var(--tracking-kicker);
    color: var(--accent);
    text-transform: uppercase; /* D2: the msgid is sentence case; casing is CSS */
}

.issue-purchase__title {
    margin: var(--space-2) 0 0;
    font: 700 var(--text-h2) / var(--leading-headline) var(--font-serif);
    letter-spacing: var(--tracking-headline);
    color: var(--ink);
}

.issue-purchase__item {
    display: flex;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.issue-purchase__cover-mat {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 92px;
    height: 128px;
    padding: 6px;
    background: var(--mat);
}

.issue-purchase__cover-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    filter: var(--shadow-paper);
}

.issue-purchase__cover-fallback {
    font: 700 var(--text-h3) / var(--leading-tight) var(--font-serif);
    color: var(--meta);
}

.issue-purchase__facts {
    margin: 0;
    font: 400 var(--text-ui) / 1.5 var(--font-sans);
}

.issue-purchase__fact {
    display: flex;
    gap: var(--space-3);
    justify-content: space-between;
}

.issue-purchase__fact + .issue-purchase__fact {
    margin-top: var(--space-2);
}

.issue-purchase__fact dt {
    color: var(--meta);
}

.issue-purchase__fact dd {
    margin: 0;
    text-align: right;
    color: var(--ink);
}

.issue-purchase__after {
    margin: var(--space-3) 0 0;
    padding-left: 18px;
    font: 400 var(--text-ui) / 1.6 var(--font-sans);
    color: var(--body);
}

.issue-purchase__after li + li {
    margin-top: var(--space-2);
}

@media (min-width: 900px) {
    .issue-purchase__title {
        font-size: var(--text-h1);
    }

    .issue-purchase__cover-mat {
        width: 128px;
        height: 178px;
    }

    .issue-purchase__facts {
        flex: 1 1 auto;
        max-width: 340px;
    }
}

/* Phone touch targets (design-principles section 6: hit targets at least 44px).
   Found under 44px by the 2026-11-02 UI audit at 390px; from 900px the old
   compact sizes stand (pointer, and the utility bar is fixed at 34px there). */
@media (max-width: 899px) {
    .shelf__badges {
        gap: 8px;
    }

    .shelf__badge {
        min-width: var(--target-min);
        min-height: var(--target-min);
        justify-content: center;
    }

    .shelf__rail-link,
    .shelf__rail-file-action {
        display: inline-flex;
        align-items: center;
        min-height: var(--target-min);
    }

    .shelf__year-summary {
        align-items: center;
        min-height: var(--target-min);
    }
}
