/* Layout: black brand band on top, one 960px reading column below. Tokens from the approved archive design. */
:root {
  --bg: #f2f1ee; --surface: #ffffff; --open: #f8f7f4; --line: #dcd9d2; --line-soft: #e8e6e1;
  --ink: #141414; --ink-2: #47443f; --ink-3: #6b675f;
  --accent: #ff5000; --accent-ink: #c23c00; --on-accent: #000000;
  --band: #0b0b0b; --band-ink: #f4f2ee; --band-ink-2: #b6b0a6; --band-line: #2c2a27;
  --field-line: #8a857b;
  --ok: #1f7a3a; --ok-bg: #e6f3ea; --warn: #8a5a00; --warn-bg: #fbf0d9; --err: #b3261e; --err-bg: #fbe9e7;
  --shadow: 0 1px 0 rgba(20,20,20,.04), 0 6px 18px -8px rgba(20,20,20,.18);
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 3px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0b; --surface: #161514; --open: #1c1b19; --line: #2c2a27; --line-soft: #242220;
    --ink: #f4f2ee; --ink-2: #d2ccc2; --ink-3: #a59f95; --accent-ink: #ff7a3d;
    --band: #000000; --field-line: #726c63;
    --ok: #7fd49a; --ok-bg: #12261a; --warn: #f0c060; --warn-bg: #2a2110; --err: #ff8a80; --err-bg: #2c1412;
    --shadow: 0 1px 0 rgba(0,0,0,.4), 0 6px 18px -8px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sheet {
    --surface: #ffffff; --open: #f8f7f4; --line: #2c2a27; --line-soft: #e8e6e1;
    --ink: #141414; --ink-2: #47443f; --ink-3: #6b675f; --accent-ink: #c23c00;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }   /* filtering the list must not shift the page when the scrollbar comes and goes */
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.6; }
a { color: var(--accent-ink); }
a:hover { color: var(--ink); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--ink); }
.wrap { max-width: 960px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* brand band */
.band { position: relative; isolation: isolate; overflow: hidden; background: var(--band); border-top: 6px solid var(--accent); color: var(--band-ink); }
.band .wrap { padding-block: 26px 40px; display: flex; flex-direction: column; gap: 32px; }
.band.slim .wrap { padding-block: 22px 32px; gap: 24px; }
.band-top { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; }
.logo { height: 56px; width: auto; display: block; }
@media (max-width: 560px) { .logo { height: 44px; } }
.band-tag { font-size: 13px; color: var(--band-ink-2); letter-spacing: .02em; }
.band-tag a { color: var(--band-ink-2); text-decoration: none; }
.band-tag a:hover { color: var(--band-ink); }
.band h1 { margin: 0; font-size: clamp(2rem, 1.4rem + 2.6vw, 3.5rem); line-height: 1.1; font-weight: 600; letter-spacing: -.035em; text-wrap: balance; overflow-wrap: anywhere; max-width: 20ch; }
.band.slim h1 { font-size: clamp(1.625rem, 1.3rem + 1.4vw, 2.375rem); letter-spacing: -.03em; max-width: 28ch; }
.band p { margin: 8px 0 0; color: var(--band-ink-2); max-width: 600px; }
.crumb { display: inline-flex; gap: 8px; align-items: center; color: var(--band-ink-2); text-decoration: none; font-size: 14px; min-height: 44px; }
.crumb:hover { color: var(--band-ink); }
.crumb svg { color: var(--accent); }
.when { margin: 10px 0 0; font-size: 14px; color: var(--band-ink-2); font-variant-numeric: tabular-nums; }
.acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.act { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid var(--band-line); border-radius: var(--r); background: rgba(11,11,11,.55); color: var(--band-ink); font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: border-color .15s ease, background-color .15s ease; }
.act svg { color: var(--accent); flex: 0 0 auto; }
.act:hover { border-color: var(--accent); background: rgba(255,80,0,.12); color: var(--band-ink); }
.act[hidden] { display: none; }
.print-only { display: none; }

main.wrap { padding-block: 32px 64px; display: flex; flex-direction: column; gap: 32px; }

/* list */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 280px; max-width: 420px; }
.label { font-size: 12px; font-weight: 500; color: var(--ink-2); letter-spacing: .05em; text-transform: uppercase; }
input[type="search"], input[type="password"], input[type="text"] { height: 44px; padding: 0 14px; border: 1px solid var(--field-line); caret-color: var(--accent); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; width: 100%; }
.count { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.note { margin: 0; color: var(--ink-2); }
.groups { display: flex; flex-direction: column; gap: 32px; min-height: 60vh; }   /* a short result list doesn't yank the footer up */
.year { display: flex; flex-direction: column; gap: 20px; scroll-margin-top: 24px; }
.sec-title { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.sec-title::before { content: ''; flex: 0 0 100%; height: 6px; margin-bottom: 10px; background: linear-gradient(var(--ink), var(--ink)) left / 2.25rem 100% no-repeat; }
.sec-title .y { font-size: clamp(1.625rem, 1.3rem + 1.4vw, 2.375rem); line-height: 1.1; font-weight: 600; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.sec-title .n { font-size: 15px; color: var(--ink-3); }
.list { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); box-shadow: var(--shadow); }
.mail { position: relative; }
.mail + .mail { border-top: 1px solid var(--line-soft); }
.mail::before { content: ''; position: absolute; left: 0; right: 0; top: -1px; height: 3px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease-out); z-index: 1; pointer-events: none; }
.mail:first-child::before { display: none; }
.mail:hover::before, .mail:focus-within::before { transform: scaleX(1); }
.mail h3 { margin: 0; font: inherit; }
.head { width: 100%; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; padding: 18px 20px; background: var(--surface); text-align: left; color: inherit; text-decoration: none; }
.head:hover { background: var(--open); color: inherit; }
.head:focus-visible { outline-offset: -2px; }   /* the list clips its corners; keep the ring inside the row */
.date { flex: 0 0 92px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ttl { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.subj { font-size: 16px; font-weight: 600; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 2px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.chev { flex: 0 0 auto; color: var(--accent-ink); transition: transform .2s ease; }
.head:hover .chev { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }

/* message */
.sheet { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px 20px 28px; }
.msg { max-width: 640px; margin: 0 auto; padding-top: 16px; display: flex; flex-direction: column; }
.msg .xh4 { margin: 22px 0 10px; font-size: 21px; line-height: 1.3; font-weight: 600; text-wrap: balance; }
.msg .xh5 { margin: 18px 0 8px; font-size: 15px; line-height: 1.4; font-weight: 600; }
.msg p { margin: 0 0 12px; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }
.msg strong { color: var(--ink); font-weight: 600; }
.li { display: flex; gap: 10px; margin: 0 0 7px; color: var(--ink-2); }
.li .m { flex: 0 0 22px; color: var(--ink-3); font-weight: 600; }
.li .t { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; white-space: pre-line; }
.msg img { display: block; width: 100%; height: auto; margin: 8px auto 18px; border-radius: var(--r); }
.btn-mail { align-self: flex-start; display: inline-block; margin: 8px 0 18px; padding: 12px 22px; background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none; border-radius: var(--r); }
.btn-mail:hover { color: var(--on-accent); filter: brightness(1.06); }
.meta { max-width: 640px; margin: 24px auto 0; padding-top: 16px; border-top: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; font-size: 13px; color: var(--ink-3); }
.meta a { font-weight: 500; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pager a { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--ink); min-width: 0; }
.pager a:hover { background: var(--open); }
.pager .dir { font-size: 12px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--accent-ink); }
.pager .pt { font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.pager .next { grid-column: 2; text-align: right; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager .next { grid-column: 1; text-align: left; } }

/* footer */
footer.band2 { background: var(--band); }
.ftr-beam { height: 6px; background: repeating-linear-gradient(90deg, transparent 0 calc(12.5% - 2px), var(--band) calc(12.5% - 2px) 12.5%), var(--accent); }
footer.band2 .wrap { padding-block: 32px 36px; display: grid; grid-template-columns: auto 1fr; gap: 14px 32px; align-items: center; }
.logo.logo--sm { height: 40px; }
footer .slogan { margin: 0; color: var(--band-ink); font-size: 15px; justify-self: end; text-align: right; }
footer .slogan strong { font-weight: 600; }
footer .addr { margin: 0; grid-column: 1 / -1; padding-top: 14px; border-top: 1px solid var(--band-line); color: var(--band-ink-2); font-size: 12px; }
footer .addr a { color: var(--band-ink); text-decoration: none; }
footer .addr a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
@media (max-width: 640px) { footer.band2 .wrap { grid-template-columns: 1fr; } footer .slogan { justify-self: start; text-align: left; } }
@media (max-width: 520px) { .date { flex-basis: auto; } }

/* admin */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--open); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; }
.sync { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; }
.sync h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.sync p { margin: 0; font-size: 14px; color: var(--ink-2); }
.flash { padding: 14px 16px; border-radius: var(--r); font-size: 14px; border: 1px solid transparent; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash.err { background: var(--err-bg); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.flash ul { margin: 6px 0 0; padding-left: 18px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); font-size: 14px; background: var(--surface); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tabs .n { font-variant-numeric: tabular-nums; opacity: .75; }
.bulk { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bulk .sel { font-size: 14px; color: var(--ink-2); margin-right: 4px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 28px 92px minmax(0, 1fr) auto; gap: 6px 16px; align-items: center; padding: 14px 20px; }
.row + .row { border-top: 1px solid var(--line-soft); }
.row.off .r-subj { color: var(--ink-3); }
.row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.r-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.r-subj { font-weight: 600; line-height: 1.4; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.r-subj:hover { color: var(--accent-ink); }
.r-path { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-3); min-width: 0; }
.r-path code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy { flex: none; white-space: nowrap; appearance: none; border: 0; background: none; min-height: 32px; padding: 6px 10px; margin: -6px 0; color: var(--accent-ink); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; border-radius: var(--r); }
.copy:hover { background: var(--open); }
.r-act { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.on { background: var(--ok-bg); color: var(--ok); }
.pill.off { background: var(--warn-bg); color: var(--warn); }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
@media (max-width: 720px) {
  .row { grid-template-columns: 28px minmax(0, 1fr); }
  .row .date { grid-column: 2; }
  .r-main, .r-act { grid-column: 2; }
  .r-act { justify-content: flex-start; flex-wrap: wrap; }
}
.login { max-width: 400px; display: flex; flex-direction: column; gap: 16px; }
.login .field { max-width: none; flex: none; }
.preview-bar { background: var(--warn-bg); color: var(--warn); font-size: 14px; text-align: center; padding: 10px 16px; }


/* ---------- key visual: greyscale photo, live orange network, shade ---------- */
.band__media { position: absolute; inset: 0; z-index: -1; }
.band__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .42; filter: grayscale(.85) contrast(1.1); }
.band__media canvas { position: absolute; inset: 0; }
.band__shade { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(11,11,11,.94) 0%, rgba(11,11,11,.7) 45%, rgba(11,11,11,.25) 100%),
              linear-gradient(0deg, rgba(11,11,11,.95) 0%, rgba(11,11,11,0) 40%); }
.band.slim .band__media img { opacity: .3; }
.band--media .wrap { padding-bottom: 48px; }
.band--media:has(.hero__beam) > .wrap { padding-bottom: 40px; }

/* hero */
.hero { display: grid; justify-items: start; gap: 18px; padding-top: 28px; }
.hero__lead { margin: 0 !important; font-size: clamp(1.125rem, 1rem + .5vw, 1.375rem); font-weight: 300; line-height: 1.45; color: var(--band-ink) !important; max-width: 36ch !important; }
.hero__search { width: 100%; max-width: 460px; display: grid; gap: 8px; margin-top: 14px; }
.hero__search .label { color: var(--band-ink-2); }
.hero__search input[type="search"] { height: 52px; padding: 0 16px; background: rgba(244,242,238,.06); color: var(--band-ink); border: 0; box-shadow: inset 0 0 0 1px #8a857b; border-radius: var(--r); font-size: 16px; transition: box-shadow .2s var(--ease-out), background-color .2s; }
.hero__search input[type="search"]::placeholder { color: #a59f95; }
.hero__search input[type="search"]:hover { box-shadow: inset 0 0 0 1px var(--band-ink-2); }
.hero__search input[type="search"]:focus { outline: none; background: rgba(244,242,238,.1); box-shadow: inset 0 0 0 1.5px var(--band-ink), inset 0 -3px 0 var(--accent); }
.hero .count { margin: 0; color: var(--band-ink-2); font-size: 14px; }

/* the beam: an orange rail with bolt heads carrying the newest mailings as plates */
.hero__beam { padding-bottom: 0 !important; }
.beam { position: relative; }
.beam__rail { height: 6px; background: var(--accent); position: relative; }
.beam__rail::before, .beam__rail::after { content: ''; position: absolute; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--band); box-shadow: inset 0 0 0 2px #ff6a24; }
.beam__rail::before { left: 0; }
.beam__rail::after { right: 0; }
.beam__bays { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(15rem, 78%); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.beam__bays::-webkit-scrollbar { display: none; }
.beam__bay { scroll-snap-align: start; border-right: 1px solid var(--band-line); position: relative; }
.beam__bay:first-child { border-left: 1px solid var(--band-line); }
.plate, .slot { display: block; height: 100%; min-height: 8rem; text-decoration: none; color: var(--band-ink); }
.plate { display: grid; grid-template-rows: auto 1fr auto; gap: 10px; padding: 14px 16px 16px; background: #161514; transition: background-color .25s var(--ease-out); }
.plate:hover { background: color-mix(in srgb, #161514 88%, var(--accent)); color: var(--band-ink); }
.code { font-size: .6875rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; font-variant-numeric: tabular-nums; line-height: 1; }
.plate .code { color: var(--band-ink-2); }
.plate__title, .slot__title { font-weight: 500; font-size: 15px; line-height: 1.3; align-self: end; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.plate__arrow { color: var(--accent); opacity: 0; transform: translateX(-6px); transition: opacity .25s, transform .3s var(--ease-out); line-height: 0; }
.plate:hover .plate__arrow, .plate:focus-visible .plate__arrow { opacity: 1; transform: none; }
@media (hover: none) { .plate__arrow { opacity: 1; transform: none; } }
.beam__bay--missing { background: repeating-linear-gradient(-45deg, transparent 0 7px, rgba(244,242,238,.07) 7px 8px); }
.slot { position: relative; overflow: hidden; }
.slot__ghost { position: absolute; inset: 10px; display: grid; place-items: center; border: 1.5px dashed rgba(255,80,0,.75); border-radius: 2px; color: var(--accent); animation: slot-pulse 1.8s var(--ease-out) infinite; }
.slot__plate { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; gap: 10px; padding: 14px 16px 16px; background: var(--accent); color: #000; transform: translateY(-115%); transition: transform .75s cubic-bezier(0.22, 1, 0.36, 1); box-shadow: 0 12px 24px -12px rgba(255,80,0,.6); }
.slot__plate .code { color: rgba(0,0,0,.65); }
.slot__title { font-weight: 600; }
.slot__arrow { line-height: 0; transition: transform .3s var(--ease-out); }
.beam.is-set .slot__plate, .slot:hover .slot__plate, .slot:focus-visible .slot__plate { transform: none; }
.beam.is-set .slot__ghost { animation: none; opacity: 0; }
.slot:hover .slot__arrow { transform: translateX(4px); }
.slot:focus-visible, .plate:focus-visible { outline-offset: -3px; }
.beam-seen .slot__plate { transform: none; transition: none; }
.beam-seen .slot__ghost { animation: none; opacity: 0; }
@keyframes slot-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media (max-width: 1023px) { .hero__beam { padding-right: 0 !important; } }
@media (min-width: 1024px) { .beam__bays { grid-auto-columns: 1fr; overflow: visible; } }

/* rack rail: 3px orange on light racks, bolt heads at both ends */
.rail { position: relative; border-top: 3px solid var(--accent) !important; }
.rail::before, .rail::after { content: ''; position: absolute; top: -6.5px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px var(--accent); z-index: 2; pointer-events: none; }
.rail::before { left: -5px; }
.rail::after { right: -5px; }
.sheet.rail { border-radius: 0 0 var(--r) var(--r); }

/* ---------- motion ----------
   Focal moment: opening a mailing unfolds it. The list row opens downward into the message
   sheet, hinged at its top edge like a folded letter, while the subject rises into the headline.
   Going back folds the sheet up into its row again. Everything else is feedback. */
:root { --ease-out: cubic-bezier(0.16, 1, 0.3, 1); --ease-fold: cubic-bezier(0.65, 0, 0.35, 1); }
.band-top .logo { view-transition-name: brand; }
.pager { view-transition-name: pager; }   /* glides to the new letter's foot instead of flashing twice */
::view-transition-group(pager) { animation-duration: .5s; animation-timing-function: var(--ease-out); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .24s; }

/* the subject line travels between list row / pager and the page headline */
::view-transition-group(subject) { animation-duration: .5s; animation-timing-function: var(--ease-out); }
::view-transition-old(subject), ::view-transition-new(subject) {
  width: 100%; height: 100%; object-fit: contain; object-position: left top;   /* scale the line, never stretch it */
}
::view-transition-old(subject) { animation-duration: .18s; }
::view-transition-new(subject) { animation-duration: .3s; animation-delay: .08s; }

/* the row ↔ sheet: the box grows from the row's height to the sheet's, and only what has
   opened so far is shown, so the content is uncovered from the top edge downward */
::view-transition-group(sheet) { animation-duration: .62s; animation-timing-function: var(--ease-fold); overflow: clip; }
::view-transition-image-pair(sheet) { overflow: clip; perspective: 1400px; }
::view-transition-old(sheet), ::view-transition-new(sheet) { transform-origin: 50% 0; backface-visibility: hidden; }

html:active-view-transition-type(unfold)::view-transition-old(sheet) { animation: fold-away .2s ease-in both; }
html:active-view-transition-type(unfold)::view-transition-new(sheet) { animation: unfold .62s var(--ease-fold) both; }
html:active-view-transition-type(fold)::view-transition-group(sheet) { animation-duration: .5s; }
html:active-view-transition-type(fold)::view-transition-old(sheet) { animation: fold-up .5s var(--ease-fold) both; }
html:active-view-transition-type(fold)::view-transition-new(sheet) { animation: row-settle .3s var(--ease-out) .26s both; }
/* Nowsza / Starsza: the sheet slides like a deck of letters, clipped to the card, title in step.
   Going to an older mailing moves everything left (it enters from the right); newer is the mirror. */
/* the frame jumps straight to the new card, so nothing spills outside it; the letters move inside it.
   No crossfade blending: the incoming letter is opaque paper and simply covers the outgoing one. */
html:active-view-transition-type(slide-older, slide-newer)::view-transition-group(sheet),
html:active-view-transition-type(slide-older, slide-newer)::view-transition-group(subject) { animation: none; }
html:active-view-transition-type(slide-older, slide-newer)::view-transition-old(sheet),
html:active-view-transition-type(slide-older, slide-newer)::view-transition-new(sheet),
html:active-view-transition-type(slide-older, slide-newer)::view-transition-old(subject),
html:active-view-transition-type(slide-older, slide-newer)::view-transition-new(subject) { mix-blend-mode: normal; }
html:active-view-transition-type(slide-older, slide-newer)::view-transition-old(subject),
html:active-view-transition-type(slide-older, slide-newer)::view-transition-new(subject) { width: auto; height: auto; object-fit: fill; }   /* titles keep their own size */
html:active-view-transition-type(slide-older)::view-transition-old(sheet) { animation: slide-out-left .52s var(--ease-out) both; }
html:active-view-transition-type(slide-older)::view-transition-new(sheet) { animation: slide-in-right .52s var(--ease-out) both; box-shadow: -18px 0 36px -18px rgba(20,20,20,.35); }
html:active-view-transition-type(slide-newer)::view-transition-old(sheet) { animation: slide-out-right .52s var(--ease-out) both; }
html:active-view-transition-type(slide-newer)::view-transition-new(sheet) { animation: slide-in-left .52s var(--ease-out) both; box-shadow: 18px 0 36px -18px rgba(20,20,20,.35); }
html:active-view-transition-type(slide-older)::view-transition-old(subject) { animation: nudge-out-left .16s cubic-bezier(0.4, 0, 1, 1) both; }
html:active-view-transition-type(slide-older)::view-transition-new(subject) { animation: nudge-in-right .4s var(--ease-out) .14s both; }
html:active-view-transition-type(slide-newer)::view-transition-old(subject) { animation: nudge-out-right .16s cubic-bezier(0.4, 0, 1, 1) both; }
html:active-view-transition-type(slide-newer)::view-transition-new(subject) { animation: nudge-in-left .4s var(--ease-out) .14s both; }
@keyframes slide-out-left  { to   { transform: translateX(-30%); opacity: .2; } }
@keyframes slide-out-right { to   { transform: translateX(30%);  opacity: .2; } }
@keyframes slide-in-right  { from { transform: translateX(100%); } }
@keyframes slide-in-left   { from { transform: translateX(-100%); } }
@keyframes nudge-out-left  { to   { transform: translateX(-56px); opacity: 0; } }
@keyframes nudge-out-right { to   { transform: translateX(56px);  opacity: 0; } }
@keyframes nudge-in-right  { from { transform: translateX(72px);  opacity: 0; } }
@keyframes nudge-in-left   { from { transform: translateX(-72px); opacity: 0; } }
@keyframes unfold {
  0%   { transform: rotateX(-82deg); opacity: .4; filter: brightness(.82); }
  55%  { opacity: 1; }
  100% { transform: none; opacity: 1; filter: none; }
}
@keyframes fold-up { to { transform: rotateX(-82deg); opacity: 0; filter: brightness(.82); } }
@keyframes fold-away { to { opacity: 0; } }
@keyframes row-settle { from { opacity: 0; } }

.flash { animation: flash-in .26s var(--ease-out); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } }

.row { scroll-margin-top: 24px; }
.row.just-changed { animation: row-ack 1.8s var(--ease-out); }
@keyframes row-ack { from { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); } to { background: var(--surface); } }

.sync { position: relative; overflow: hidden; }
.sync.is-busy::before {
  content: ''; position: absolute; top: 0; left: 0; width: 38%; height: 3px; background: var(--accent);
  animation: beam-run 1.15s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes beam-run { from { transform: translateX(-100%); } to { transform: translateX(265%); } }

@media (prefers-reduced-motion: reduce) {
  /* no travel, no fold: the mailing simply appears inside a short crossfade */
  ::view-transition-group(subject), ::view-transition-old(subject), ::view-transition-new(subject),
  ::view-transition-group(sheet), html:active-view-transition-type(unfold, fold, slide-older, slide-newer)::view-transition-new(sheet),
  html:active-view-transition-type(slide-older, slide-newer)::view-transition-new(subject) { animation: none; }
  html:active-view-transition-type(slide-older, slide-newer)::view-transition-old(sheet) { display: none; }
  ::view-transition-old(subject), html:active-view-transition-type(unfold, fold)::view-transition-old(sheet) { display: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .15s; }
  .flash { animation-name: fade-in; }
  .slot__ghost { animation: none; }
  .slot__plate, .mail::before { transition: none; }
  .sync.is-busy::before { width: 100%; animation: beam-breathe 1.6s ease-in-out infinite alternate; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes beam-breathe { from { opacity: .35; } to { opacity: 1; } }

/* print: just the letter on white paper, with its link so the page can be found again */
@media print {
  @page { margin: 14mm 16mm; }
  :root, :root:not([data-theme="light"]) { --bg: #fff; --surface: #fff; --ink: #000; --ink-2: #222; --ink-3: #555; --line-soft: #ccc; color-scheme: light; }
  body { background: #fff !important; color: #000; }
  .band__media, .band-top, .crumb, .acts, .pager, footer, .preview-bar, .meta a { display: none !important; }
  .band { background: none !important; color: #000; border-top: 0; overflow: visible; }
  .band .wrap, .band.slim .wrap { padding: 0 0 14px; gap: 0; }
  .band h1, .band.slim h1 { color: #000; max-width: none; font-size: 20pt; }
  .band .when { color: #555; }
  .wrap { max-width: none; padding: 0 !important; }
  .sheet { border: 0 !important; box-shadow: none; padding: 0; }
  .rail::before, .rail::after { display: none; }
  .msg, .meta { max-width: none; }
  .msg img { max-width: 100%; break-inside: avoid; }
  .msg .xh4, .msg .xh5 { break-after: avoid; }
  .print-only { display: inline; }
}
