/* ============================================================
   news.css - News (news.php) and its admin (manage_news.php) in
   the pg design language. Loaded after css/pg-core.css (tokens
   and the shared components). Every rule is scoped under
   .pg-news*; anchors are qualified (.pg-news a...) because the
   site's global "a, a:hover" rule would otherwise win on hover.
   ============================================================ */

/* ---- Page widths: detail-page width for lists, hero width to read ---- */
#site_content.pg-page.pg-news { max-width: 1280px; }
.pg-news .pg-news-article { max-width: 760px; margin: 0 auto; }

/* ---- Small shared pieces ---- */
.pg-news .pg-news-date {
    display: block;
    color: var(--pg-faint);
    font: 600 11px/1.4 var(--pg-font);
    letter-spacing: .08em;
    text-transform: uppercase;
}
.pg-news .pg-news-lede {
    margin: 0;
    padding: 0;
    color: var(--pg-muted);
    font: 400 15px/1.55 var(--pg-font);
    text-shadow: none;
}
.pg-news a.pg-btn { text-decoration: none; }
.pg-news a.pg-btn-solid,
.pg-news a.pg-btn-solid:hover { color: #fff; }
.pg-news a.pg-btn-quiet { color: var(--pg-muted); }
.pg-news a.pg-btn-quiet:hover,
.pg-news a.pg-btn-line,
.pg-news a.pg-btn-line:hover { color: var(--pg-ink); }
.pg-news .pg-btn-quiet:hover .pg-ico { transform: translateX(3px); }
.pg-news .pg-news-back:hover .pg-ico { transform: translateX(-3px); }
.pg-news-tag,
.pg-news-status {
    display: inline-block;
    padding: 6px 12px;
    background: var(--pg-tint);
    border-radius: 999px;
    color: var(--pg-muted);
    font: 600 12px/1 var(--pg-font);
    white-space: nowrap;
}
.pg-news-tag,
.pg-news-status.is-live { background: var(--pg-sky-soft); color: var(--pg-navy); }
/* A fact in place of an action that cannot be taken yet. */
.pg-news-fact {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 4px;
    color: var(--pg-muted);
    font: 500 13px/1 var(--pg-font);
    white-space: nowrap;
}
.pg-news .pg-news-hero:focus-visible,
.pg-news .pg-news-card:focus-visible,
.pg-news .pg-news-page:focus-visible,
.pg-news .pg-news-td-title a:focus-visible,
.pg-news .pg-news-textarea:focus-visible,
.pg-news .pg-news-file:focus-within {
    outline: 2px solid var(--pg-sky);
    outline-offset: 2px;
}

/* ---- Image tile: cover photo, or the newspaper icon ---- */
.pg-news-img {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: linear-gradient(160deg, #F5F8FC, #E7EDF5);
}
.pg-news-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .7s var(--pg-ease);
}
.pg-news-img-none { display: grid; place-items: center; color: var(--pg-navy-2); }
.pg-news-img-none .pg-ico { width: 54px; height: 54px; stroke-width: 1.5; opacity: .45; }
/* Newsletter issues: the GEM R YOU logo (white JPEG) on white, never cropped. */
.pg-news-img-logo { background: #fff; }
/* Centred by inset + auto margins: an absolute box sizes its % height from
   the tile itself, which a stretched or aspect-ratio tile does not give a
   static child on every browser. */
.pg-news .pg-news-img-logo img { position: absolute; inset: 0; margin: auto; width: auto; height: 46%; }
.pg-news-card .pg-news-img-logo { border-bottom: 1px solid var(--pg-line); }

/* ---- List: the newest as a hero card ---- */
.pg-news a.pg-news-hero {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    overflow: hidden;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 22px;
    box-shadow: 0 1px 2px rgba(14, 27, 46, .04), 0 10px 30px rgba(14, 27, 46, .05);
    color: var(--pg-ink);
    text-decoration: none;
    transition: transform .35s var(--pg-ease), box-shadow .35s, border-color .2s;
    animation: pg-rise .6s var(--pg-ease) backwards;
}
.pg-news a.pg-news-hero:hover {
    transform: translateY(-3px);
    border-color: var(--pg-line-strong);
    box-shadow: 0 16px 36px rgba(0, 43, 92, .13);
    color: var(--pg-ink);
}
/* The text column sets the height; the photo fills the tile beside it. */
.pg-news-hero .pg-news-img { aspect-ratio: auto; min-height: 240px; }
.pg-news-hero .pg-news-img img { position: absolute; inset: 0; }
.pg-news-hero .pg-news-img-logo { border-right: 1px solid var(--pg-line); }
.pg-news-hero-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 30px 30px 26px;
}
.pg-news-hero-title { color: var(--pg-ink); font: 600 24px/1.25 var(--pg-font); letter-spacing: -.01em; }
.pg-news-read {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    color: var(--pg-navy);
    font: 600 14px/1 var(--pg-font);
}
.pg-news-read .pg-ico { width: 16px; height: 16px; transition: transform .25s var(--pg-ease); }
.pg-news-hero:hover .pg-news-read .pg-ico { transform: translateX(3px); }
.pg-news-hero:hover .pg-news-img img,
.pg-news-card:hover .pg-news-img img { transform: scale(1.05); }

/* ---- List: the rest as cards ---- */
.pg-news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.pg-news a.pg-news-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 16px;
    color: var(--pg-ink);
    text-decoration: none;
    transition: transform .35s var(--pg-ease), box-shadow .35s, border-color .2s;
    animation: pg-rise .5s var(--pg-ease) backwards;
    animation-delay: calc(var(--i, 0) * 24ms + 70ms);
}
.pg-news a.pg-news-card:hover {
    transform: translateY(-4px);
    border-color: var(--pg-line-strong);
    box-shadow: 0 18px 38px rgba(0, 43, 92, .13);
    color: var(--pg-ink);
}
.pg-news-card-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.pg-news-card-title { color: var(--pg-ink); font: 600 15px/1.35 var(--pg-font); letter-spacing: -.005em; }
.pg-news-card-summary {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: var(--pg-muted);
    font: 400 13px/1.45 var(--pg-font);
}

/* ---- Pagination ---- */
.pg-news-pages {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 28px 0 0;
}
.pg-news .pg-news-page {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 999px;
    color: var(--pg-ink);
    font: 500 13px/1 var(--pg-font);
    text-decoration: none;
    transition: border-color .18s, background .18s, color .18s;
}
.pg-news a.pg-news-page:hover { border-color: var(--pg-navy); color: var(--pg-navy); }
.pg-news .pg-news-page.is-current { background: var(--pg-navy); border-color: var(--pg-navy); color: #fff; font-weight: 600; }
.pg-news .pg-news-page.is-gap { background: none; border-color: transparent; color: var(--pg-faint); }

/* ---- Article ---- */
.pg-news .pg-news-back { margin: 0 0 14px -12px; }
.pg-news-head { margin-bottom: 22px; animation: pg-rise .6s var(--pg-ease) backwards; }
.pg-news-head .pg-news-tag { margin-bottom: 12px; }
.pg-news .pg-news-title {
    margin: 10px 0 0;
    padding: 0;
    color: var(--pg-ink);
    font: 600 26px/1.2 var(--pg-font);
    letter-spacing: -.02em;
    text-shadow: none;
}
.pg-news-head .pg-news-lede { margin-top: 10px; }
.pg-news-frame {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 18px;
    animation: pg-rise .6s var(--pg-ease) .05s backwards;
}
/* js/news.js sets the real height once the issue has loaded. */
.pg-news-iframe { display: block; width: 100%; height: 1400px; border: 0; }
.pg-news-media {
    overflow: hidden;
    margin-bottom: 16px;
    background: linear-gradient(160deg, #F5F8FC, #E7EDF5);
    border: 1px solid var(--pg-line);
    border-radius: 22px;
    animation: pg-rise .6s var(--pg-ease) .05s backwards;
}
.pg-news-media img { display: block; width: 100%; height: auto; max-height: min(72vh, 720px); object-fit: contain; }
.pg-news-body {
    padding: 26px;
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 18px;
    animation: pg-rise .6s var(--pg-ease) .1s backwards;
}
.pg-news .pg-news-body p {
    margin: 0 0 14px;
    padding: 0;
    color: var(--pg-ink);
    font: 400 15px/1.65 var(--pg-font);
}
.pg-news .pg-news-body p:last-child { margin-bottom: 0; }
.pg-news-article > .pg-empty,
.pg-news-article > .pg-news-gate { margin-top: 8px; }
.pg-news .pg-empty a.pg-btn { color: var(--pg-ink); }

/* Members-only article, visitor: the gate in place of the body. */
.pg-news-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 44px 26px 40px;
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 18px;
    animation: pg-rise .6s var(--pg-ease) .05s backwards;
}
.pg-news-gate-ico {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    background: var(--pg-tint);
    border-radius: 50%;
    color: var(--pg-navy);
}
.pg-news .pg-news-gate-title {
    margin: 0;
    padding: 0;
    color: var(--pg-ink);
    font: 600 19px/1.3 var(--pg-font);
    letter-spacing: -.01em;
}
.pg-news-gate-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }

/* ---- Admin: table ---- */
.pg-news-table-wrap {
    box-sizing: border-box;
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 16px;
}
.pg-news-table { width: 100%; border-collapse: collapse; }
.pg-news .pg-news-table th {
    padding: 14px 16px;
    background: none;
    border-bottom: 1px solid var(--pg-line);
    color: var(--pg-faint);
    font: 600 11px/1 var(--pg-font);
    letter-spacing: .07em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
.pg-news .pg-news-table td {
    padding: 12px 16px;
    background: none;
    border-bottom: 1px solid #EEF2F7;
    color: var(--pg-ink);
    font: 400 13px/1.4 var(--pg-font);
    vertical-align: middle;
    transition: background .15s;
}
.pg-news .pg-news-table tbody tr { cursor: pointer; animation: pg-fade .4s ease backwards; animation-delay: calc(var(--i, 0) * 14ms); }
.pg-news .pg-news-table tbody tr:last-child td { border-bottom: 0; }
.pg-news .pg-news-table tbody tr:hover td { background: var(--pg-tint); }
.pg-news .pg-news-td-title a { color: var(--pg-ink); font-weight: 600; text-decoration: none; }
.pg-news .pg-news-td-title a:hover { color: var(--pg-navy); }
.pg-news .pg-news-td-title .pg-news-fact { height: auto; margin-left: 8px; font-size: 12px; }
.pg-news .pg-news-td-muted { color: var(--pg-muted); white-space: nowrap; }

/* ---- Admin: editor ---- */
.pg-news-states { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.pg-news-states .pg-news-fact { height: auto; }
.pg-news-form {
    display: flex;
    flex-direction: column;
    padding: 26px;
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(14, 27, 46, .04), 0 12px 32px rgba(14, 27, 46, .06);
    animation: pg-rise .6s var(--pg-ease) .05s backwards;
}
.pg-news .pg-news-label {
    display: block;
    margin: 18px 0 9px;
    color: var(--pg-muted);
    font: 600 11px/1 var(--pg-font);
    letter-spacing: .08em;
    text-transform: uppercase;
}
.pg-news .pg-news-label.is-first { margin-top: 0; }
.pg-news .pg-news-field { width: auto; box-sizing: border-box; }
.pg-news .pg-news-textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 280px;
    padding: 12px 14px;
    resize: vertical;
    background: #fff;
    border: 1px solid var(--pg-line-strong);
    border-radius: 12px;
    outline: 0;
    color: var(--pg-ink);
    font: 400 15px/1.65 var(--pg-font);
    transition: border-color .18s, box-shadow .18s;
}
.pg-news .pg-news-textarea:focus { border-color: var(--pg-navy); box-shadow: 0 0 0 3px rgba(0, 43, 92, .12); }
.pg-news-form .pg-news-frame { animation: none; }
.pg-news-cover { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.pg-news-cover-preview {
    display: grid;
    place-items: center;
    width: 128px;
    height: 72px;
    overflow: hidden;
    background: linear-gradient(160deg, #F5F8FC, #E7EDF5);
    border: 1px solid var(--pg-line);
    border-radius: 12px;
    color: var(--pg-navy-2);
}
.pg-news-cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.pg-news-cover-preview .pg-ico { opacity: .45; }
.pg-news-cover-preview.pg-news-pop { animation: pg-pop .35s var(--pg-spring); }
.pg-news-file { position: relative; overflow: hidden; }
.pg-news-file input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.pg-news .pg-news-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--pg-muted);
    font: 500 13px/1 var(--pg-font);
    cursor: pointer;
}
.pg-news-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--pg-line);
}
.pg-news-actions-side { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pg-news-actions-side:first-child { margin-left: -12px; }

/* Visibility: a two-way segmented switch (the 3.8 toggle, with words). */
.pg-news-seg { display: inline-flex; align-self: flex-start; padding: 3px; background: #E7ECF3; border-radius: 999px; }
.pg-news-seg-opt { position: relative; cursor: pointer; }
.pg-news-seg-opt input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.pg-news-seg-opt span {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 18px;
    border-radius: 999px;
    color: var(--pg-muted);
    font: 500 14px/1 var(--pg-font);
    transition: background .2s, color .2s, box-shadow .2s;
}
.pg-news-seg-opt:hover span { color: var(--pg-ink); }
.pg-news-seg-opt input:checked + span { background: #fff; color: var(--pg-navy); font-weight: 600; box-shadow: 0 1px 3px rgba(14, 27, 46, .16); }
.pg-news-seg-opt input:focus-visible + span { outline: 2px solid var(--pg-sky); outline-offset: 2px; }

/* ---- Admin: confirm dialog ---- */
.pg-news-dialog {
    width: min(420px, calc(100vw - 28px));
    box-sizing: border-box;
    margin: auto;               /* the site CSS zeroes the browser's centring margin */
    padding: 26px 26px 20px;
    background: #fff;
    border: 1px solid var(--pg-line);
    border-radius: 22px;
    box-shadow: 0 1px 2px rgba(14, 27, 46, .04), 0 12px 32px rgba(14, 27, 46, .06);
    color: var(--pg-ink);
}
.pg-news-dialog[open] { animation: pg-pop .35s var(--pg-ease); }
.pg-news-dialog::backdrop { background: rgba(14, 27, 46, .32); }
.pg-news .pg-news-dialog-q {
    margin: 0;
    padding: 0;
    color: var(--pg-ink);
    font: 600 19px/1.35 var(--pg-font);
    letter-spacing: -.01em;
}
.pg-news-n { font-variant-numeric: tabular-nums; }
.pg-news-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

/* ---- Small screens ---- */
@media (max-width: 900px) {
    .pg-news a.pg-news-hero { grid-template-columns: 240px minmax(0, 1fr); }
    .pg-news-hero .pg-news-img { min-height: 200px; }
    .pg-news-hero-body { padding: 20px 18px 18px; }
    .pg-news-hero-title { font-size: 20px; }
    .pg-news-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
    .pg-news .pg-news-title { font-size: 22px; }
    .pg-news-body,
    .pg-news-form { padding: 20px 18px; }
}
@media (max-width: 560px) {
    /* Phones: the hero stacks, its picture kept short. */
    .pg-news a.pg-news-hero { grid-template-columns: 1fr; }
    .pg-news-hero .pg-news-img { aspect-ratio: 16 / 9; min-height: 0; max-height: 200px; }
    .pg-news-hero .pg-news-img-logo { border-right: 0; border-bottom: 1px solid var(--pg-line); }
    .pg-news-actions-side { width: 100%; }
    .pg-news-actions-side:first-child { margin-left: 0; }
    .pg-news-actions-side:last-child { justify-content: flex-end; }
}
