/* =============================================================
   Intel Archive: the file grid, the thread (reading) view and
   the editor with its toolbar.
   ============================================================= */

.page-intel { min-height: 100dvh; padding: calc(var(--nav-h) + 72px) 32px 120px; }
.intel-wrap { max-width: 1200px; margin: 0 auto; }
.intel-wrap.narrow { max-width: 760px; }

/* ------------------------------- list ------------------------------- */
.intel-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 56px; }
.intel-hero h1 { font: 400 clamp(56px, 8.4vw, 112px)/.95 var(--serif); letter-spacing: -.025em; margin: 12px 0 20px; }
.intel-hero h1 em { font-style: italic; }
.lede { max-width: 520px; font-size: 19px; line-height: 1.5; letter-spacing: -.012em; color: var(--text-2); }
.intel-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 32px; }
.intel-tools .search { flex: 1 1 260px; max-width: 320px; }
.intel-tools .chips { flex: 1 1 auto; }
.intel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.intel-grid.is-empty { display: block; }

/* a file card: a quiet dark surface that lifts on hover */
.file-card { position: relative; display: grid; cursor: pointer; outline: none; border-radius: 20px; transition: transform .4s var(--ease); -webkit-tap-highlight-color: transparent; }
.intel-grid.enter .file-card { animation: file-rise .6s var(--ease) backwards; animation-delay: calc(var(--i) * 50ms + 80ms); }
@keyframes file-rise { from { opacity: 0; transform: translate3d(0, 20px, 0); } }
.file-card::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; box-shadow: 0 28px 56px -20px rgba(0, 0, 0, .9); opacity: 0; transition: opacity .4s var(--ease); pointer-events: none; }
.file-card:hover, .file-card:focus-visible { transform: translate3d(0, -4px, 0); }
.file-card:hover::after, .file-card:focus-visible::after { opacity: 1; }
.file-card:focus-visible .file-sheet { box-shadow: inset 0 0 0 2px rgba(244, 239, 231, .8); }
.file-card:active { transform: scale(.99); }
.file-tab { position: absolute; left: 20px; top: 20px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px 0 8px; border-radius: 999px; background: rgba(11, 10, 9, .55); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: var(--text); font-size: 12px; font-weight: 500; }
.file-card:not(:has(.file-cover)) .file-tab { background: var(--fill); -webkit-backdrop-filter: none; backdrop-filter: none; }
.file-tab .ico { width: 13px; height: 13px; stroke-width: 2; color: var(--c); }
.file-sheet { position: relative; display: flex; flex-direction: column; min-height: 232px; padding: 64px 24px 20px; overflow: hidden; border-radius: 20px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); transition: background-color .3s var(--ease); }
.file-card:hover .file-sheet { background: var(--surface-2); }
.file-cover { height: 184px; margin: -64px -24px 20px; overflow: hidden; background: var(--surface-3); }
.file-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.file-card:hover .file-cover img { transform: scale(1.03); }
.file-sheet h3 { font: 400 28px/1.1 var(--serif); letter-spacing: -.012em; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.file-sheet p { font-size: 15px; line-height: 1.5; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.file-sheet footer { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 24px; }
.file-by { display: flex; flex-direction: column; min-width: 0; font-size: 13px; font-weight: 500; line-height: 1.3; }
.file-by small { font-size: 12px; font-weight: 400; color: var(--text-3); }
.file-marks { display: flex; gap: 10px; margin-left: auto; color: var(--text-3); }
.file-marks i { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-style: normal; font-variant-numeric: tabular-nums; }
.file-marks .ico { width: 14px; height: 14px; }
.file-tack { position: absolute; right: 20px; top: 20px; z-index: 2; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 13px; }
.file-tack .ico { stroke-width: 1.8; }
/* live: a file someone just added or changed */
.file-card.just-in { animation: file-in .6s var(--ease) backwards; }
.file-card.just-in::before, .file-card.flash::before { content: "Just in"; position: absolute; left: 50%; top: -11px; z-index: 3; height: 22px; padding: 0 10px; border-radius: 999px; background: var(--accent); color: #fff; font: 600 11px/22px var(--sans); transform: translateX(-50%); animation: just-in 4.5s var(--ease) both; pointer-events: none; }
.file-card.flash::before { content: "Updated"; }
@keyframes file-in { from { opacity: 0; transform: translate3d(0, -12px, 0) scale(.97); } }
@keyframes just-in { 0% { opacity: 0; transform: translate3d(-50%, 6px, 0); } 8%, 85% { opacity: 1; transform: translate3d(-50%, 0, 0); } 100% { opacity: 0; transform: translate3d(-50%, 0, 0); } }

/* ------------------------------ thread ------------------------------ */
.thread-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 48px; }
.live-note { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 24px; height: 32px; padding: 0 14px; border-radius: 999px; background: var(--fill); color: var(--text-2); font-size: 13px; animation: enter .45s var(--ease) backwards; }
.dossier { position: relative; }
.dossier.updated { animation: dossier-flash .9s var(--ease); }
@keyframes dossier-flash { from { opacity: .5; } }
.dossier-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.dossier-head h1 { font: 400 clamp(44px, 6.6vw, 80px)/1 var(--serif); letter-spacing: -.025em; margin: 20px 0 24px; overflow-wrap: anywhere; }
.dossier-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding-bottom: 32px; margin-bottom: 40px; border-bottom: 1px solid var(--hairline); font-size: 14px; color: var(--text-3); }
.dossier-meta b { color: var(--text); font-weight: 500; }
.dossier-meta i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.dossier-foot { display: flex; align-items: center; gap: 16px; margin-top: 72px; font-size: 13px; color: var(--text-3); }
.dossier-foot i { flex: 1; height: 1px; background: var(--hairline); }

/* the written body, shared by the thread view and the editor */
.intel-body { font-size: 18px; line-height: 1.65; letter-spacing: -.011em; color: rgba(244, 239, 231, .86); overflow-wrap: anywhere; }
.intel-body p { margin: 0 0 1.1em; }
.intel-body h2 { font: 400 38px/1.1 var(--serif); letter-spacing: -.015em; color: var(--text); margin: 1.5em 0 .45em; }
.intel-body h3 { font: 600 20px/1.3 var(--sans); letter-spacing: -.015em; color: var(--text); margin: 1.6em 0 .4em; }
.intel-body b, .intel-body strong { color: var(--text); font-weight: 600; }
.intel-body a { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent-hi); text-decoration-thickness: 1.5px; text-underline-offset: 4px; transition: color .2s; }
.intel-body a:hover { color: var(--accent-hi); }
.intel-body blockquote { margin: 1.5em 0; padding: 0 0 0 24px; border-left: 2px solid var(--hairline-2); font: 400 28px/1.25 var(--serif); letter-spacing: -.01em; color: var(--text); }
.intel-body ul, .intel-body ol { margin: 0 0 1.1em; padding-left: 1.3em; }
.intel-body li { margin: .3em 0; }
.intel-body li::marker { color: var(--text-3); }
.intel-body hr { height: 1px; margin: 2.4em 0; border: 0; background: var(--hairline-2); }
.intel-body figure { margin: 1.8em 0; }
.intel-figure img { display: block; max-width: 100%; height: auto; border-radius: 16px; }
.dossier-body .intel-figure img { cursor: zoom-in; transition: transform .4s var(--ease), opacity .3s; }
.dossier-body .intel-figure img:hover { transform: scale(1.01); }
.intel-embed { position: relative; overflow: hidden; border-radius: 16px; background: #000; }
.intel-embed.wide { aspect-ratio: 16 / 9; }
.intel-embed.portrait { aspect-ratio: 9 / 16; max-width: 340px; margin-inline: auto; }
.intel-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.intel-video video { display: block; width: 100%; border-radius: 16px; }
.intel-body .hint { color: var(--text-3); }

/* ------------------------------ editor ------------------------------ */
.dossier.composer { padding: 40px; border-radius: 24px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); }
.ed-title { width: 100%; margin-top: 4px; padding: 8px 0 16px; border: 0; border-bottom: 1px solid var(--hairline-2); border-radius: 0; background: none; color: var(--text); font: 400 clamp(32px, 4.6vw, 48px)/1.1 var(--serif); letter-spacing: -.02em; outline: none; transition: border-color .25s var(--ease); }
.ed-title::placeholder { color: var(--text-3); }
.ed-title:focus { border-color: rgba(244, 239, 231, .5); }
.ed-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin: 20px 0; }
.ed-toolbar { position: sticky; top: calc(var(--nav-h) + 12px); z-index: 4; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 4px; border: 1px solid var(--hairline-2); border-radius: 14px; background: rgba(38, 35, 33, .78); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow-1); }
.ed-tool { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--text-2); font: 600 15px/1 var(--sans); transition: background-color .15s, color .15s, transform .2s var(--ease); }
.ed-tool .ico { font-size: 16px; }
.ed-tool:hover { background: var(--fill-2); color: var(--text); }
.ed-tool:active { transform: scale(.92); }
.ed-tool.active { background: var(--text); color: var(--bg); }
.ed-div { width: 1px; height: 20px; margin: 0 6px; background: var(--hairline-2); }
.ed-body { position: relative; min-height: 340px; padding: 28px 0 12px; outline: none; }
.ed-body.empty { max-width: none; margin: 0; padding: 28px 0 12px; text-align: left; }   /* not the generic .empty state */
.ed-body.empty::before { content: attr(data-placeholder); position: absolute; left: 0; top: 28px; color: var(--text-3); pointer-events: none; }
.ed-body .intel-embed { outline: 1px dashed var(--hairline-2); outline-offset: 4px; }
.ed-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 20px; margin-top: 8px; border-top: 1px solid var(--hairline); }
.ed-by { margin-right: auto; font-size: 13px; color: var(--text-3); }
.ed-by b { color: var(--text-2); font-weight: 500; }
.ed-state { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); }
.ed-state.dirty { color: var(--text-2); }
.ed-state.dirty::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-hi); }
.ed-alert { margin-bottom: 16px; }
.ed-alert div { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------- phones ------------------------------- */
@media (max-width: 820px) {
  .page-intel { padding: calc(var(--nav-h) + 40px) 16px 96px; }
  .intel-hero { flex-direction: column; align-items: stretch; gap: 24px; margin-bottom: 40px; }
  .intel-hero h1 { margin: 8px 0 16px; }
  .lede { font-size: 17px; }
  .intel-tools .search { max-width: none; flex-basis: 100%; }
  .intel-tools .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
  .intel-grid { grid-template-columns: 1fr; gap: 16px; }
  .thread-bar { margin-bottom: 32px; }
  .dossier.composer { padding: 24px 16px 20px; border-radius: 20px; }
  .intel-body { font-size: 17px; }
  .intel-body h2 { font-size: 32px; }
  .intel-body blockquote { font-size: 24px; padding-left: 16px; }
  .ed-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ed-tool { flex: none; }
  .thread-bar .btn { height: 34px; padding: 0 12px; font-size: 13px; }
}
