/* AIpediya — News section: a single vertical news feed styled as a calm digital
   newspaper. Reuses the site tokens (static/site.css) so it matches the catalog
   and both themes. No inline styles (CSP style-src 'self'); images are <img>.
   The reused comment block keeps the catalog's own .cm-* styles from site.css. */

.nw {
  max-width: 760px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 26px);
  padding-block: clamp(14px, 2vw, 26px);
}
.nw .i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Preview environment bar (isolated worktree only) */
.nw-preview-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; padding: 8px 13px; border: 1px solid var(--mint-line); border-radius: var(--r-ctl); background: var(--mint-dim); color: var(--text-soft); font-size: 12.5px; }
.nw-preview-tag { font-weight: 700; letter-spacing: .12em; font-size: 10px; color: var(--mint-text); }
.nw-preview-roles { display: flex; align-items: center; gap: 12px; margin-inline-start: auto; }
.nw-preview-you { padding: 2px 8px; border-radius: 999px; background: rgba(94,234,212,.14); color: var(--mint-text); font-weight: 600; font-size: 11px; }
.nw-preview-guest { background: rgba(150,170,180,.14); color: var(--muted); }
.nw-preview-roles a { color: var(--text-soft); font-size: 12px; }
.nw-preview-roles a:hover { color: var(--text); }

/* Slim masthead */
.nw-topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 14px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.nw-topbar-left { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.nw-wordmark { font-size: 15px; font-weight: 500; letter-spacing: .02em; color: var(--muted); text-transform: uppercase; }
.nw-wordmark b { color: var(--mint-text); font-weight: 700; }
a.nw-wordmark-link:hover { text-decoration: none; }
.nw-topic-pill { font-size: 13px; font-weight: 600; color: var(--text); }
.nw-new { display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--mint-line); background: var(--mint-dim); color: var(--mint-text); font-size: 13px; font-weight: 600; cursor: pointer; }
.nw-new:hover { background: color-mix(in srgb, var(--mint) 16%, transparent); color: var(--text); text-decoration: none; }
.nw-new-plus { font-size: 17px; line-height: 1; margin-top: -1px; }
.nw-new-empty { margin-top: 14px; }

.nw-back { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; margin: 14px 0 2px; }
.nw-back:hover { color: var(--text); text-decoration: none; }
.nw-back .i { width: 15px; height: 15px; transform: rotate(180deg); }

/* Feed */
.nw-feed { display: flex; flex-direction: column; }
.nw-post { padding-block: clamp(22px, 3.5vw, 36px); border-bottom: 1px solid var(--line); scroll-margin-top: 90px; }
.nw-post:last-child { border-bottom: 0; }
.nw-post.is-focused { animation: nw-focus 1.6s ease; }
@keyframes nw-focus { 0% { background: var(--mint-dim); } 100% { background: transparent; } }

.nw-post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.nw-post-meta time { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.nw-post-author { color: var(--text-soft); font-weight: 550; }
.nw-sep { opacity: .5; }
.nw-post-topic { color: var(--mint-text); font-weight: 500; }
.nw-post-topic:hover { text-decoration: underline; }
.nw-badge { font-size: 9.5px; font-weight: 700; letter-spacing: .12em; padding: 2px 6px; border-radius: 4px; color: var(--mint-text); border: 1px solid var(--mint-line); }

.nw-post-title { font-family: Georgia, "Noto Serif", "Times New Roman", serif; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; margin-bottom: 14px; }
.nw-post-title { font-size: clamp(23px, 3.3vw, 30px); }
.nw-post-title a { color: var(--text); }
.nw-post-title a:hover { text-decoration: none; color: var(--mint-text); }
.is-focused .nw-post-title { font-size: clamp(26px, 4vw, 34px); }

.nw-post-media { margin: 0 0 16px; }
.nw-post-media img { width: 100%; max-height: 460px; object-fit: cover; border-radius: var(--r-card); border: 1px solid var(--line); display: block; }
.nw-post-media figcaption { margin-top: 7px; font-size: 12px; color: var(--muted); }

.nw-post-body { font-family: Georgia, "Noto Serif", "Times New Roman", serif; font-size: 17.5px; line-height: 1.75; color: var(--text); overflow-wrap: anywhere; }
.nw-post-body > * + * { margin-top: 1.1em; }
.nw-post-body h2 { font-size: 22px; font-weight: 700; line-height: 1.25; margin-top: 1.5em; }
.nw-post-body h3 { font-size: 19px; font-weight: 700; margin-top: 1.3em; }
.nw-post-body blockquote { margin-inline: 0; padding-inline-start: 18px; border-inline-start: 3px solid var(--mint); color: var(--text-soft); font-style: italic; }
.nw-post-body ul { padding-inline-start: 20px; }
.nw-post-body li + li { margin-top: .45em; }
.nw-post-body a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.nw-post-body.is-clamped { max-height: 11em; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 68%, transparent); mask-image: linear-gradient(to bottom, #000 68%, transparent); }
.nw-post-body.is-expanded { max-height: none; -webkit-mask-image: none; mask-image: none; }

.nw-readmore { display: inline-flex; align-items: center; gap: 5px; margin-top: 12px; padding: 0; border: 0; background: transparent; color: var(--mint-text); font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; }
.nw-readmore:hover { color: var(--text); }
.nw-readmore .i { width: 15px; height: 15px; transition: transform .2s; }

.nw-post-sources { margin-top: 18px; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: color-mix(in srgb, var(--panel) 55%, transparent); }
.nw-sources-label { display: block; font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.nw-post-sources ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.nw-post-sources a { display: inline-flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: 13.5px; }
.nw-post-sources a:hover { color: var(--mint-text); text-decoration: none; }
.nw-post-sources .i { width: 14px; height: 14px; flex: none; color: var(--muted); }

.nw-post-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.nw-act { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--text-soft); font-size: 12.5px; font-weight: 500; cursor: pointer; font-family: inherit; }
.nw-act:hover { color: var(--text); border-color: var(--mint-line); background: var(--mint-dim); text-decoration: none; }
.nw-act .i { width: 15px; height: 15px; }
.nw-act[aria-expanded="true"] { color: var(--mint-text); border-color: var(--mint-line); background: var(--mint-dim); }
.nw-act.is-copied { color: var(--mint-text); border-color: var(--mint-line); }
.nw-act-count { min-width: 17px; height: 17px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--mint-dim); color: var(--mint-text); font-size: 11px; font-weight: 600; }

.nw-post-comments { margin-top: 16px; }
.nw-post-comments[hidden] { display: none; }
/* The reused comment block (.reviews/.cm-*) is styled by site.css; give it room. */
.nw-post-comments .reviews { margin-top: 0; }

.nw-more-wrap { display: flex; justify-content: center; margin-top: 26px; }
.nw-more { display: inline-flex; align-items: center; gap: 7px; padding: 10px 22px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-soft); font-size: 13.5px; font-weight: 500; }
.nw-more:hover { color: var(--text); border-color: var(--mint-line); background: var(--mint-dim); text-decoration: none; }
.nw-more.is-busy { opacity: .6; pointer-events: none; }

.nw-empty { text-align: center; padding: 64px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.nw-empty .i { width: 30px; height: 30px; color: var(--mint-text); }
.nw-empty b { color: var(--text); font-size: 17px; font-weight: 600; }

/* Compose drawer (owner) */
body.nw-lock { overflow: hidden; }
.nw-compose-overlay { position: fixed; inset: 0; z-index: var(--z-sheet, 60); display: flex; justify-content: flex-end; }
.nw-compose-overlay[hidden] { display: none; }
.nw-compose-backdrop { position: absolute; inset: 0; background: rgba(4, 10, 14, .55); backdrop-filter: blur(2px); }
.nw-compose-drawer { position: relative; width: min(540px, 100%); height: 100%; overflow-y: auto; background: var(--panel); border-inline-start: 1px solid var(--line); box-shadow: var(--shadow); padding: 22px clamp(18px, 3vw, 28px) 40px; animation: nw-slide-in .26s ease; }
@keyframes nw-slide-in { from { transform: translateX(24px); opacity: .5; } to { transform: none; opacity: 1; } }
.nw-compose-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 1; padding-top: 2px; }
.nw-compose-drawer-head h2 { font-size: 19px; font-weight: 600; color: var(--text); }
.nw-compose-x { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--text-soft); cursor: pointer; }
.nw-compose-x:hover { color: var(--text); border-color: var(--line-strong); }
.nw-compose-intro { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 8px 0 18px; }

/* Standalone compose fallback (no-JS) */
.nw-compose-standalone { max-width: 680px; }
.nw-compose-header { margin: 10px 0 18px; }
.nw-compose-header h1 { font-size: clamp(22px, 3vw, 28px); font-weight: 600; letter-spacing: -.01em; }
.nw-compose-header p { color: var(--muted); font-size: 14px; margin-top: 8px; }

/* Form */
.nw-compose { display: flex; flex-direction: column; gap: 15px; margin-top: 6px; }
.nw-field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.nw-label, .nw-label-sm { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.nw-label-sm { font-size: 11.5px; color: var(--muted); }
.nw-hint { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.nw-field input[type=text], .nw-field textarea, .nw-field select, .nw-field input[type=file] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--text); font-size: 14px; font-family: inherit; }
.nw-field textarea { resize: vertical; line-height: 1.55; }
.nw-field input:focus, .nw-field textarea:focus, .nw-field select:focus { outline: none; border-color: var(--mint-line); box-shadow: 0 0 0 3px var(--mint-dim); }
.nw-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.nw-field-sm { max-width: 150px; }
.nw-author-field { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 14px; gap: 11px; }
.nw-author-field legend { padding: 0 6px; }
.nw-radio { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); cursor: pointer; }
.nw-radio input { accent-color: var(--mint); width: 16px; height: 16px; }
.nw-radio-tag { font-size: 11px; color: var(--muted); }
.nw-pseudo { margin-top: 2px; }
.nw-compose-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.nw-btn-ghost { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-soft); font-size: 13.5px; background: transparent; cursor: pointer; font-family: inherit; }
.nw-btn-ghost:hover { color: var(--text); border-color: var(--line-strong); text-decoration: none; }
.nw-btn-primary { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border: 0; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--on-mint); background: linear-gradient(135deg, var(--mint), #37c9ec); box-shadow: 0 6px 18px var(--mint-glow); cursor: pointer; font-family: inherit; }
.nw-btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.nw-btn-primary .i { width: 16px; height: 16px; }
.nw-form-error { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; padding: 10px 14px; border: 1px solid var(--danger); border-radius: var(--r-ctl); color: var(--danger); font-size: 13.5px; }
.nw-form-error .i { width: 16px; height: 16px; }

/* Live preview */
.nw-preview-panel { margin-top: 20px; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; background: color-mix(in srgb, var(--panel) 60%, transparent); }
.nw-preview-panel[hidden] { display: none; }
.nw-preview-head { display: flex; align-items: center; gap: 8px; padding: 10px 15px; border-bottom: 1px solid var(--line); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nw-preview-head .i { width: 15px; height: 15px; color: var(--mint-text); }
.nw-preview-post { padding: 18px 20px; border: 0; }
.nw-preview-post .nw-post-title { font-size: 22px; }
.nw-preview-post .nw-post-body { font-size: 16px; line-height: 1.7; }
.nw-preview-standfirst { color: var(--text-soft); font-size: 15px; line-height: 1.5; margin: 6px 0 12px; }
.nw-preview-kickers { display: inline-flex; gap: 8px; }
.nw-preview-kickers .nw-kicker { font-size: 10.5px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--mint-text); }
.nw-preview-figure img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; margin: 10px 0; max-height: 220px; object-fit: cover; }

/* Reader translation note */

/* Advanced section in the editor */
.nw-advanced { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 0 14px; }
.nw-advanced[open] { padding-bottom: 14px; }
.nw-advanced > summary { display: flex; align-items: center; gap: 8px; padding: 12px 2px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-soft); list-style: none; }
.nw-advanced > summary::-webkit-details-marker { display: none; }
.nw-advanced > summary .i { width: 15px; height: 15px; color: var(--mint-text); }
.nw-advanced[open] > summary { color: var(--text); }
.nw-advanced-hint { color: var(--muted); font-size: 11.5px; margin: 0 0 12px; }
.nw-advanced .nw-field { margin-bottom: 12px; }

/* Author one-time setup */
.nw-author-setup { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; padding: 11px; border-radius: var(--r-ctl); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.nw-author-setup[hidden] { display: none; }
.nw-author-setup input[type=text] { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--panel); color: var(--text); font-size: 14px; font-family: inherit; }
.nw-author-setup input:focus { outline: none; border-color: var(--mint-line); box-shadow: 0 0 0 3px var(--mint-dim); }
.nw-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-soft); cursor: pointer; }
.nw-check input { accent-color: var(--mint); width: 15px; height: 15px; flex: none; }
.nw-copy-buffer { position: fixed; inset: 0 auto auto 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; }
.nw-share-box { margin-block: 16px; padding: 16px; border: 1px solid var(--mint-line); border-radius: 12px; background: var(--panel); }
.nw-share-box[hidden], .nw-schedule-box[hidden] { display: none; }
.nw-topbar-actions, .nw-inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.nw-author-page { max-width: 760px; }
.nw-application { padding: 20px; margin-block: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); overflow-wrap: anywhere; }
.nw-application header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px; }
.nw-application header h2 { font-size: 20px; margin: 0; }
.nw-application-message { white-space: pre-wrap; }
.nw-state { font-size: 13px; color: var(--mint-text); }
.nw-account-email, .nw-hint { overflow-wrap: anywhere; }
.nw-schedule-box { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-top: 16px; }
.nw-schedule-box input, .nw-schedule-box select { min-width: 0; max-width: 100%; box-sizing: border-box; }
.nw-share-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.nw-share-heading strong { font-size: 14px; }
.nw-share-box input { box-sizing: border-box; width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.nw-share-copy { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 16px; }
.nw-share-copy .nw-field { flex: 1 1 260px; }
.nw-share-copy .nw-act { min-height: 39px; }
.nw-share-status { margin: 12px 0 0; color: var(--text-soft); font-size: 12.5px; }
.nw-share-status:empty { display: none; }
.nw-share-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nw-share-links a { color: var(--mint-text); min-height: 38px; box-sizing: border-box; padding-inline: 14px; }
.nw-share-box .nw-act:focus-visible { outline: 2px solid var(--mint-text); outline-offset: 3px; }

@media (max-width: 620px) {
  .nw-topbar { flex-wrap: wrap; }
  .nw-field-row { grid-template-columns: 1fr; }
  .nw-preview-roles { width: 100%; margin-inline-start: 0; }
  .nw-compose-drawer { padding-inline: 16px; }
}
.nw-editor-toolbar { display:flex; flex-wrap:wrap; gap:5px; margin:12px 0 6px; }
.nw-editor-toolbar button,.nw-auto-text { border:1px solid var(--line); border-radius:8px; background:transparent; color:inherit; padding:6px 9px; cursor:pointer; font:inherit; }
.nw-editor-toolbar button:hover,.nw-auto-text:hover { background:var(--mint-glow); }
.nw-inline-upload { padding:14px; border:1px solid var(--line); border-radius:12px; margin-bottom:16px; }
.nw-inline-upload[hidden] { display:none; }
.nw-inline-media { margin:20px 0; }
.nw-inline-media img { display:block; width:100%; height:auto; border-radius:12px; }
.nw-inline-media figcaption,.nw-post-media figcaption { display:block; margin-top:7px; font-size:12px; line-height:1.5; opacity:.75; }
.nw-table-scroll { max-width:100%; overflow:auto; margin:16px 0; }
.nw-table-scroll table { width:100%; border-collapse:collapse; }
.nw-table-scroll th,.nw-table-scroll td { border:1px solid var(--line); padding:8px 10px; text-align:start; }
.nw-footnotes,.nw-post-sources { display:block; margin-top:16px; }
.nw-footnotes summary,.nw-post-sources summary,.nw-delete-confirm summary { cursor:pointer; }
.nw-footnotes li { scroll-margin-top:100px; }
.nw-delete-confirm { margin:12px 0; font-size:13px; }
.nw-danger { color:var(--text); border-color:#c35f67; }
.nw-post-body code { white-space:pre-wrap; overflow-wrap:anywhere; }

/* #087: demo ad zones beside the feed, in the style of the catalog placements.
   Diagonal composition: the start rail opens with a 300x250 and continues with a
   300x600; the end rail opens with a 300x600 and closes with a 300x250 at the end
   of the feed. While reading, both 300x600 units stay in view (CSS sticky, no JS),
   so neither side looks empty. The feed keeps its own 760px column; the rails use
   only the free space and appear only when it is wide enough. */
.nw-ad-rail { display: none; }
@media (min-width: 1280px) {
  .news-feed main#main:has(> .nw-ad-rail) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 760px) minmax(0, 1fr); column-gap: 32px; align-items: start; }
  .news-feed main#main:has(> .nw-ad-rail) > .nw { width: 100%; } /* keep the feed's own 760px width inside the grid */
  .nw-ad-rail { display: flex; flex-direction: column; gap: 24px; width: min(300px, 100%); align-self: stretch; padding-block: clamp(14px, 2vw, 26px); }
  .nw-ad-rail--start { justify-self: end; }
  .nw-ad-rail--end { justify-self: start; }
  .nw-ad-track { flex: 1 1 auto; }
  .nw-ad.ad-slot { margin: 0; min-height: 0; padding: 14px; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); }
  .nw-ad .dims { direction: ltr; unicode-bidi: isolate; } /* 300×600 reads the same in RTL */
  .nw-ad--rect { aspect-ratio: 6 / 5; }
  .nw-ad--tall { aspect-ratio: 1 / 2; padding-block: 22px; }
  .nw-ad--tall .ad-label { margin-bottom: auto; }
  .nw-ad--tall .dims { margin-top: auto; }
}
@media (min-width: 1280px) {
  /* #088: house-ads.css gives every ad place position: relative; this more specific
     rule keeps the 300x600 pinned at any window height (sticky also anchors the
     absolutely positioned creative inside it). */
  .nw-ad-track > .nw-ad--tall.ad-slot { position: sticky; top: 16px; }
}
@media (min-width: 1500px) {
  .news-feed main#main:has(> .nw-ad-rail) { max-width: 1520px; }
}
