/*
 * Morning Lecture — design system: "the morning paper's front page".
 *
 * Hand-written rather than a CDN framework: the app must open instantly on a
 * phone and work with no network, which rules out an in-browser CSS compiler.
 *
 * One neutral ramp tinted toward ink, opaque surfaces separated by hairlines.
 * --brand (ink blue) is the only accent in the chrome: primary action,
 * selection, the "several newsletters" signature dots. --gold marks "majeur"
 * items and the weekly catch-up, --danger destructive actions only. The color
 * lives in the day banners' photos, not in the chrome.
 *
 * Glass (backdrop-filter) is kept on the floating tab bar only — decision of
 * 11 nov. 2026, narrowing the "liquid glass" theme of 13 août: glass panels
 * over content made text read through the bar and every surface compete.
 * One deliberate exception: the backdrop behind the reading cards is
 * blurred, so the page behind never distracts from the card.
 *
 * Headlines use ui-serif (New York on iOS, Georgia elsewhere): native, no
 * font file, no CDN. The interface stays on the system sans.
 *
 * Every color below is re-declared under prefers-color-scheme: dark — the app
 * follows the phone's system theme, there is no in-app toggle.
 *
 * Diverges intentionally from the digest email's plain cream palette — see
 * CLAUDE.md, decision updated 13 août 2026.
 */

:root {
  --paper: #f5f7fa;
  --card-solid: #ffffff;
  --raised: #eceff4;
  --rule: rgba(17, 24, 39, 0.08);
  --rule-strong: rgba(17, 24, 39, 0.14);

  --ink: #111827;
  --ink-soft: #4b5565;
  --muted: #5f687a;

  --brand: #1d4ed8;
  --brand-fill: #1d4ed8;
  --brand-fill-hover: #1e40af;
  --brand-soft: rgba(29, 78, 216, 0.08);

  --danger: #c81e1e;
  --danger-fill: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);

  --gold: #a34a07;
  --gold-soft: rgba(180, 83, 9, 0.1);

  --good: #16a34a;

  --nav-bg: rgba(245, 247, 250, 0.92);
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-float: 0 8px 24px rgba(17, 24, 39, 0.08);

  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Helvetica, Arial, sans-serif;
  --serif: ui-serif, 'New York', Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --gap: 16px;
  --radius-sm: 6px;
  --radius-control: 10px;
  --radius: 16px;
  --radius-panel: 20px;
  --nav-h: 56px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 150ms;
  --enter: 320ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b0d14;
    --card-solid: #11141c;
    --raised: #1a1e28;
    --rule: rgba(238, 240, 245, 0.08);
    --rule-strong: rgba(238, 240, 245, 0.14);

    --ink: #eef0f5;
    --ink-soft: #a3a9b8;
    --muted: #858da2;

    --brand: #8ab0ff;
    --brand-fill: #2b5be0;
    --brand-fill-hover: #3a68ea;
    --brand-soft: rgba(138, 176, 255, 0.12);

    --danger: #ef6b6f;
    --danger-fill: #dc2626;
    --danger-soft: rgba(229, 72, 77, 0.12);

    --gold: #e0a33a;
    --gold-soft: rgba(224, 163, 58, 0.12);

    --good: #4cc38a;

    --nav-bg: rgba(17, 20, 28, 0.92);
    --shadow-sm: none;
    --shadow-float: 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  /* iOS Safari auto-boosts small text in narrow columns to "improve readability",
     which made the same day-block-title font-size render at different visual
     sizes depending on headline length/line count. Force it off everywhere. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* none, not contain: contain still lets the browser run its own native
     pull-to-refresh on top of the app's (brief.js), which showed two
     spinners for a single relève. */
  overscroll-behavior-y: none;
}

body {
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/24px var(--sans);
  -webkit-font-smoothing: antialiased;
  /* Respect the iPhone notch and home indicator when installed. */
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 20px) + 48px);
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.5;
  display: block;
  flex: none;
}

/* ------------------------------------------------------------------ layout */

.shell {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 12px var(--gap) calc(var(--nav-h) + env(safe-area-inset-bottom, 20px) + 64px);
}

.app-brand-header {
  padding: 8px 0 16px;
  display: flex;
  align-items: center;
}

.brand-logo {
  height: 32px;
  width: auto;
  border-radius: 8px;
  display: block;
}

/* Floating tab bar — the one glass surface left in the app. */
.nav {
  position: fixed;
  bottom: max(24px, calc(env(safe-area-inset-bottom, 0px) + 16px));
  left: 20px;
  right: 20px;
  z-index: 40;
  display: flex;
  gap: 4px;
  background: var(--nav-bg);
  border: 1px solid var(--rule);
  border-radius: 20px;
  box-shadow: var(--shadow-float);
  padding: 4px;
  max-width: 380px;
  margin: 0 auto;
  backdrop-filter: blur(32px) saturate(160%);
  -webkit-backdrop-filter: blur(32px) saturate(160%);
}

.nav button {
  flex: 1;
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 12px/16px var(--sans);
  padding: 8px 4px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}

.nav button:hover {
  color: var(--ink);
}

.nav button[aria-current='true'] {
  color: var(--brand);
  background: var(--brand-soft);
}

.nav-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.nav-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.5;
  display: block;
}

.nav .badge {
  position: absolute;
  top: -4px;
  left: 12px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger-fill);
  color: #fff;
  font: 600 10px/16px var(--sans);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

@media (min-width: 700px) {
  body {
    padding-bottom: 88px;
  }

  .shell {
    padding: 24px var(--gap) 96px;
  }

  .nav {
    top: auto;
    bottom: 20px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: 480px;
    width: calc(100% - 40px);
  }

  .nav button {
    height: 40px;
    flex-direction: row;
    font-size: 14px;
    padding: 0 16px;
    gap: 8px;
  }
}

/* -------------------------------------------------------------------- text */

h1 {
  font: 500 24px/32px var(--serif);
  margin: 16px 0 0;
}

.meta {
  font-size: 13px;
  line-height: 20px;
  color: var(--muted);
}

.hint {
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.hint code {
  font: 400 13px var(--mono);
  color: var(--ink);
}

.empty {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}

.empty strong {
  display: block;
  color: var(--ink);
  font: 500 17px/24px var(--serif);
  margin-bottom: 8px;
}

/* ------------------------------------------------------------------- items */

/* The newsletter's name, set like a press byline. */
.source {
  font: 500 13px/16px var(--sans);
  color: var(--ink-soft);
}

.pill {
  /* A fixed box with flex-centred content: line-height 1 left the digit's
     position to each engine's font metrics, and iOS drew some counts off
     the line of the others. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  background: var(--raised);
  color: var(--ink-soft);
  font: 500 12px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pill.hot {
  color: var(--gold);
  background: var(--gold-soft);
}

.pill-read {
  color: var(--good);
}

/* Signature: one dot per newsletter that reported the same item. Several
   sources is a signal of importance, so it is shown, not hidden. */
.echo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 400 12px/16px var(--sans);
  color: var(--muted);
}

.echo-dots {
  display: inline-flex;
  gap: 4px;
}

.echo-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.linkish {
  appearance: none;
  border: 0;
  background: none;
  padding: 14px 8px;
  color: var(--muted);
  font: 400 13px/16px var(--sans);
  cursor: pointer;
  transition: color var(--fast) var(--ease);
}

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

/* --------------------------------------------------------------- accordion */

.accordion {
  background: var(--card-solid);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  overflow: hidden;
}

.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: transparent;
  border: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: background-color var(--fast) var(--ease);
}

.accordion-trigger:hover {
  background: var(--raised);
}

.accordion-header-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.accordion-header-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.accordion-title {
  font: 500 15px/20px var(--sans);
  color: var(--ink);
  margin: 0;
}

.accordion-desc {
  font: 400 13px/20px var(--sans);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status beside a section title: quiet text, not a pill. */
.accordion-badge {
  font: 400 13px/20px var(--sans);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.accordion-chevron {
  flex: none;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: transform var(--fast) var(--ease);
}

.accordion-chevron-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.5;
  display: block;
}

.accordion.open .accordion-chevron {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--rule);
}

/* ------------------------------------------------------------------- forms */

label {
  display: block;
  margin-bottom: 12px;
  font: 500 13px/20px var(--sans);
  color: var(--ink-soft);
}

/* Always opaque: never glass under editable text. */
input,
select,
textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  padding: 8px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/24px var(--sans);
  transition: border-color var(--fast) var(--ease);
}

textarea {
  min-height: 120px;
  resize: vertical;
  font: 400 13px/20px var(--mono);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.row > * {
  flex: 1 1 160px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--brand-fill);
  color: #fff;
  border-radius: var(--radius-control);
  height: 44px;
  padding: 0 20px;
  font: 500 15px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease),
    color var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.btn:hover {
  background: var(--brand-fill-hover);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.btn.ghost {
  background: var(--card-solid);
  color: var(--ink);
  border-color: var(--rule-strong);
}

.btn.ghost:hover {
  background: var(--raised);
}

/* Opaque even when disabled: over the swipe overlay a faded button let the
   page behind show through its label. */
.btn.ghost:disabled,
.btn.ghost:disabled:hover {
  opacity: 1;
  background: var(--card-solid);
  color: var(--muted);
  border-color: var(--rule);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 14px;
}

.btn.danger {
  background: none;
  border-color: var(--danger);
  color: var(--danger);
}

.btn.danger:hover {
  background: var(--danger-soft);
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}

.btn-row-end {
  margin: 20px 0 32px;
}

/* Login: one narrow column, no tab bar under it. */
.shell.login {
  max-width: 400px;
  padding-bottom: 48px;
}

.shell.login h1 {
  margin-bottom: 24px;
}

.pull-indicator {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 0;
  transition: height 0.15s ease-out;
  font: 400 13px/1 var(--sans);
  color: var(--muted);
}

/* ----------------------------------------------------------------- sources */

.src-list {
  border-top: 1px solid var(--rule);
  padding-top: 8px;
}

.src-list-gap {
  margin-top: 16px;
}

.src {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
}

.src:first-of-type {
  border-top: 0;
}

.src-main {
  min-width: 0;
  flex: 1;
}

.src-title {
  font: 500 15px/20px var(--sans);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.src.off .src-title {
  color: var(--muted);
  text-decoration: line-through;
}

.src-menu-btn {
  flex: 0 0 auto;
  appearance: none;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  min-width: 44px;
  padding: 12px 8px;
  cursor: pointer;
}

.form-gap {
  margin-bottom: 16px;
}

/* --------------------------------------------------------------- feedback */

.banner {
  border: 1px solid var(--rule);
  background: var(--card-solid);
  padding: 12px 16px;
  border-radius: var(--radius-control);
  font-size: 14px;
  line-height: 20px;
  margin: 12px 0;
}

/* Status is a small dot before the text (busy already has its spinner). */
.banner.ok::before,
.banner.bad::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: 1px;
}

.banner.ok::before {
  background: var(--good);
}

.banner.bad::before {
  background: var(--danger);
}

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid var(--rule-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -1px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2s;
  }
}

.skeleton {
  height: 12px;
  background: var(--rule);
  border-radius: 4px;
  margin: 8px 0;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

/* --------------------------------------------------------------- card stack */

.stack {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
}

.stack-card {
  /* Opaque — this element is dragged via transform during the swipe gesture,
     and combining a live transform with backdrop-filter on the same element
     is a known iOS Safari rendering bug (a white banding/flicker seam during
     the drag). The card is also the app's primary reading surface. */
  background: var(--card-solid);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-float);
  /* Fills the 90% column. The photo absorbs the spare height, so a short
     summary never leaves a dead band; a long one scrolls. */
  flex: 1;
  min-height: 0;
  /* The card owns vertical drags (turning pages); only the summary pans. */
  touch-action: none;
  display: flex;
  flex-direction: column;
  /* Without this, a long summary would visually spill past the fixed height
     above instead of being clipped by card-summary-wrap — flex columns don't
     shrink children below their content size unless the container clips. */
  overflow: hidden;
  transition: transform 280ms var(--ease);
}

/* Follows the finger 1:1 while dragged; the transition is for the release. */
.stack-card.is-dragging {
  transition: none;
}

/* The incoming card rises from the side the last one left by. */
.stack-card.enter-up {
  animation: card-enter-up var(--enter) var(--ease);
}

.stack-card.enter-down {
  animation: card-enter-down var(--enter) var(--ease);
}

@keyframes card-enter-up {
  from {
    transform: translateY(48px);
    opacity: 0;
  }
}

@keyframes card-enter-down {
  from {
    transform: translateY(-48px);
    opacity: 0;
  }
}

@keyframes card-fade {
  from {
    opacity: 0;
  }
}

/* Reduced motion: no travel, the new card simply fades in. */
@media (prefers-reduced-motion: reduce) {
  .stack-card {
    transition: none;
  }

  .stack-card.enter-up,
  .stack-card.enter-down {
    animation: card-fade 200ms var(--ease);
  }
}

.stack-card-end {
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  padding: 40px 16px;
}

.skeleton-card {
  background: var(--rule);
  opacity: 0.4;
}

.card-body {
  position: relative;
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  /* Flexbug #1: a flex column child defaults to min-height:auto, i.e. it
     refuses to shrink below its own content size — which silently defeated
     the fixed height above whenever a card's content ran long. */
  min-height: 0;
}

/* Round icon button — closes a sheet. Neutral: closing is not destructive. */
.card-close {
  flex: none;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--raised);
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--fast) var(--ease);
}

.card-close:hover {
  color: var(--ink);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-source-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.source-logo {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
  flex: none;
  background: var(--raised);
}

.card-source-wrap .source {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-date {
  font: 400 13px/16px var(--sans);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  flex: none;
  white-space: nowrap;
}

.card-title {
  font: 500 20px/26px var(--serif);
  margin: 12px 0 0;
}

.card-summary-wrap {
  flex: 0 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  position: relative;
  margin-top: 8px;
}

/* Set by brief.js only while text remains below the fold. */
.card-summary-wrap.is-clipped {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent);
}

.card-summary {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font: 400 15px/24px var(--sans);
}

.card-summary strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.card-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
}

.card-image {
  display: block;
  width: 100%;
  /* Grows into the card's spare height, gives way first to a long summary. */
  flex: 1 4 160px;
  min-height: 120px;
  /* Cover, not contain: no grey bars. The lightbox shows the whole image. */
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--raised);
  margin-bottom: 16px;
}

/* No photo: the headline carries the page, set larger like a front page,
   and headline + summary sit centered between the byline and the footer —
   a composed page rather than text with a void under it. */
.card-body-text .card-title {
  font-size: 28px;
  line-height: 36px;
  margin-top: auto;
}

.card-body-text .card-foot {
  margin-top: auto;
}

.card-cta {
  flex: none;
  display: flex;
  padding-top: 16px;
}

.card-cta a.btn {
  flex: 1;
}

/* -------------------------------------------------------- category chips bar */

.category-chips-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  /* 6px of room above and below so the chips' 44px hit area isn't clipped
     by the scroll box; the negative margin keeps the visual rhythm. */
  padding: 6px 0 10px;
  margin: -6px 0 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-chips-bar::-webkit-scrollbar {
  display: none;
}

.category-chip {
  appearance: none;
  border: 1px solid var(--rule-strong);
  background: var(--card-solid);
  color: var(--ink-soft);
  font: 500 14px/1 var(--sans);
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-control);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease),
    border-color var(--fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.category-chip:hover {
  background: var(--raised);
  color: var(--ink);
}

.category-chip.active {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand);
}

.category-chip .chip-count {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.category-chip.active .chip-count {
  color: inherit;
}

/* --------------------------------------------------------------- day block */

.day-block-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 16px 0;
  background: var(--card-solid);
  width: 100%;
  max-width: 100%;
  transition: border-color var(--fast) var(--ease);
}

@media (min-width: 700px) {
  .day-block-wrap:hover {
    border-color: var(--rule-strong);
  }
}

.day-block-delete-action {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 1;
}

.day-block-delete-btn {
  width: 92px;
  border: none;
  background: var(--danger-fill);
  color: #fff;
  font: 500 14px/20px var(--sans);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  text-align: center;
}

.day-block {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  text-align: left;
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  z-index: 2;
  transition: transform 0.15s ease-out;
}

.day-block:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

/* Front-page banner: the day's photo, the headline set in serif over a
   neutral scrim. No border-radius here on purpose: this element lives inside
   the moving `.day-block` during swipe-to-delete, while `.day-block-wrap`
   (fixed, never translated) already clips everything to a rounded rect.
   Rounding this element too would make its own corners float in the middle
   of the red delete panel once slid left. */
.day-block-hero {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 20px 20px;
  color: #ffffff;
  background-color: #11141c;
  background-size: cover;
  background-position: center;
  width: 100%;
  max-width: 100%;
}

@media (min-width: 500px) {
  .day-block-hero {
    min-height: 260px;
    padding: 20px 24px 24px;
  }
}

.day-block-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.day-block-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(7, 8, 13, 0.92) 0%,
    rgba(7, 8, 13, 0.6) 50%,
    rgba(7, 8, 13, 0.1) 100%
  );
  pointer-events: none;
}

.day-block-hero-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.day-block-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

/* The day label reads first, like a dateline above the headline. */
.day-block-hero-bottom {
  order: -1;
}

.day-block-label-hero {
  font: 500 13px/16px var(--sans);
  color: rgba(255, 255, 255, 0.72);
}

/* `.day-block-hero-title` and `.day-block-title` are h2s — the day's
   headline, set in serif, sentence case as the model wrote it. */
.day-block-hero-title {
  font: 500 22px/28px var(--serif);
  color: #ffffff;
  margin: 0;
  overflow-wrap: break-word;
}

@media (min-width: 500px) {
  .day-block-hero-title {
    font-size: 26px;
    line-height: 32px;
  }
}

.day-block-hero-quip {
  font: 400 14px/20px var(--sans);
  color: rgba(255, 255, 255, 0.82);
  margin: 0;
  overflow-wrap: break-word;
}

/* Count over the photo: a quiet dark tag, legible on any image. */
.pill-glass {
  background: rgba(7, 8, 13, 0.5);
  color: #ffffff;
}

/* Banner without a photo */
.day-block-standard {
  padding: 20px;
}

.day-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.day-block-label {
  font: 500 13px/16px var(--sans);
  color: var(--brand);
}

.day-block-label span {
  color: var(--muted);
}

.day-block-title {
  font: 500 22px/28px var(--serif);
  color: var(--ink);
  margin: 12px 0 0;
}

.day-block-quip {
  font: 400 14px/20px var(--sans);
  color: var(--ink-soft);
  margin: 8px 0 0;
}

/* Weekly catch-up: same banner, set apart in gold. */
.day-block-weekly {
  background: var(--gold-soft);
}

.day-block-weekly .day-block-label {
  color: var(--gold);
}

/* Fixed light gold: it always sits on the dark photo scrim. */
.day-block-wrap-weekly .day-block-label-hero {
  color: #f0b54a;
}

.day-block.skeleton-card {
  margin: 16px 0;
  padding: 20px;
  border-radius: var(--radius);
}

/* ----------------------------------------------------------- swipe overlay */

/* Blurred, not just dimmed: the Brief behind the card dissolves into a soft
   field, so nothing behind competes with the text being read (Ethan's
   request, 11 nov. 2026). The blur sits on this fixed backdrop, never on the
   dragged .stack-card — transform + backdrop-filter on one element is the
   iOS Safari seam bug noted there. */
.swipe-overlay {
  position: fixed;
  /* Past the viewport: backdrop blur thins out within ~20px of its own edge,
     which left the page's last line legible at the bottom of the screen. */
  inset: -48px;
  background: rgba(7, 8, 13, 0.6);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  z-index: 60;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 64px;
  animation: sheet-fade-in var(--fast) var(--ease);
}

/* The card takes 90% of the screen height (Ethan, 11 nov. 2026); the 5%
   above holds the counter and close button, the 5% below the gesture hint. */
.swipe-overlay-inner {
  position: relative;
  width: 100%;
  max-width: 460px;
  height: 90vh;
  height: 90dvh;
  display: flex;
  flex-direction: column;
}

.stack-bar {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 5vh;
  height: 5dvh;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stack-count {
  font: 500 13px/16px var(--sans);
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.72);
}

.stack-hint {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 5vh;
  height: 5dvh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 400 13px/16px var(--sans);
  color: rgba(255, 255, 255, 0.72);
}

.hint-pointer {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .hint-touch {
    display: none;
  }

  .hint-pointer {
    display: inline;
  }
}

/* In the bar above the card, not inside it — `.stack-card` has its own
   overflow:hidden and moves with the gesture. */
.stack-close {
  position: relative;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--fast) var(--ease);
}

.stack-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* The 460px / 640px card was sized for a phone screen. On a desktop viewport
   that leaves most of the window empty and squeezes the summary into a tall,
   narrow column — so the reading card grows with the window. */
@media (min-width: 700px) {
  .swipe-overlay-inner {
    max-width: 620px;
  }



  .card-body {
    padding: 24px;
  }

  .card-title {
    font-size: 24px;
    line-height: 32px;
  }

  .card-summary {
    font-size: 17px;
    line-height: 28px;
  }
}

/* --------------------------------------------------------- categories sheet */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 8, 13, 0.5);
  z-index: 55;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: sheet-fade-in var(--fast) var(--ease);
}

.sheet {
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--card-solid);
  border: 1px solid var(--rule);
  border-bottom: 0;
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  box-shadow: var(--shadow-float);
  padding: 8px 20px 32px;
  animation: sheet-slide-up var(--enter) var(--ease);
  transition: transform 0.2s ease-out;
}

@media (min-width: 700px) {
  .sheet-backdrop {
    align-items: center;
    padding: 24px 16px;
  }

  .sheet {
    border-bottom: 1px solid var(--rule);
    border-radius: var(--radius-panel);
    max-height: 80vh;
    padding: 20px 24px 24px;
    animation: sheet-fade-in var(--fast) var(--ease);
  }

  .sheet-drag-zone {
    display: none;
  }
}

/* No transition while the finger is down: it must track the touch 1:1, the
   transition is only for the snap-back once the drag ends. */
.sheet-dragging {
  transition: none;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--rule-strong);
  margin: 0 auto 12px;
}

/* Bigger than the visible handle bar itself, so the drag-down-to-dismiss
   gesture has a real touch target. */
.sheet-drag-zone {
  padding: 8px 0;
  margin: -8px 0 4px;
  touch-action: none;
}

.sheet .modal-head .source {
  font: 500 15px/20px var(--sans);
  color: var(--ink);
}

/* Category rows: one height, one radius, one gap. */
.sheet-row {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  appearance: none;
  background: var(--card-solid);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-control);
  padding: 0 16px;
  margin-bottom: 8px;
  font: 400 15px/20px var(--sans);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.sheet-row:hover {
  background: var(--raised);
}

.sheet-row:active {
  transform: scale(0.99);
}

.sheet-row-title {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Counts in a row are plain figures, right-aligned. */
.sheet-row .pill {
  flex: none;
  height: auto;
  padding: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
}

/* "Voir tout": the primary row, the accent's one place in the sheet. */
.sheet-row-all {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand);
  font-weight: 500;
  margin-bottom: 16px;
}

.sheet-row-all:hover {
  background: var(--brand-soft);
}

.sheet-row-all .pill {
  color: var(--brand);
}

/* A category fully read goes quiet, its count turns green. */
.sheet-row-read,
.sheet-row-read:hover {
  background: var(--card-solid);
  border-color: var(--rule);
  color: var(--muted);
}

.sheet-row-read .pill {
  color: var(--good);
}

.sheet-row-danger {
  color: var(--danger);
  border-color: transparent;
  background: var(--danger-soft);
}

.sheet-row-danger:hover {
  background: var(--danger-soft);
}

.sheet-row-gap {
  margin-top: 24px;
}

/* Day sub-header inside the weekly catch-up sheet, above that day's rows. */
.sheet-day-label {
  font: 500 13px/16px var(--sans);
  color: var(--gold);
  margin: 20px 0 8px;
}

.sheet-day-label::first-letter {
  text-transform: uppercase;
}

.sheet-day-group:first-of-type .sheet-day-label {
  margin-top: 8px;
}

@keyframes sheet-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes sheet-slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .sheet-backdrop,
  .swipe-overlay,
  .image-lightbox-backdrop {
    animation: none;
  }
}

/* -------------------------------------------------- in-app image lightbox */

.card-image {
  cursor: zoom-in;
}

.image-lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 8, 13, 0.94);
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  animation: sheet-fade-in var(--fast) var(--ease);
}

.image-lightbox-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
}

.image-lightbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-control);
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}

.image-lightbox-title {
  color: #ffffff;
  font: 500 14px/20px var(--sans);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-lightbox-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.image-lightbox-btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  height: 32px;
  padding: 0 12px;
  font: 500 13px/1 var(--sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color var(--fast) var(--ease);
}

.image-lightbox-btn .icon {
  width: 16px;
  height: 16px;
}

.image-lightbox-btn:hover,
.image-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.image-lightbox-close {
  appearance: none;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color var(--fast) var(--ease);
}

.image-lightbox-scroll {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px 0;
  cursor: zoom-in;
  touch-action: pan-x pan-y pinch-zoom;
}

.image-lightbox-scroll.is-zoomed {
  cursor: zoom-out;
  align-items: flex-start;
}

.image-lightbox-img {
  max-width: 95vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius-control);
  transition: transform 0.25s var(--ease);
}

.image-lightbox-img.zoomed-in {
  max-width: none;
  max-height: none;
  width: auto;
  transform: scale(1.5);
  margin: auto;
}

.image-lightbox-hint {
  text-align: center;
  padding: 8px;
  color: rgba(255, 255, 255, 0.6);
  font: 400 13px/16px var(--sans);
}

/* ------------------------------------------------------- touch & semantics */

/* Touch targets: these controls stay visually compact, their hit area
   reaches 44px (Apple HIG) through an invisible pseudo-element. */
.category-chip,
.btn-sm,
.card-close,
.image-lightbox-btn,
.image-lightbox-close {
  position: relative;
}

.category-chip::after,
.btn-sm::after {
  content: '';
  position: absolute;
  inset: -6px 0;
}

.card-close::after,
.stack-close::after,
.image-lightbox-btn::after,
.image-lightbox-close::after {
  content: '';
  position: absolute;
  inset: -6px;
}

/* Accordion pattern: the h2 carries the outline, the button inside it the
   action — a heading inside a button would be flattened by screen readers. */
.accordion-heading {
  margin: 0;
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Admin invitations list (Réglages → Invitations) */
.invite-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}
.invite-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--rule);
}

/* Two-way switch (Sources: Mon fil / Catalogue) */
.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: var(--gap);
  background: var(--raised);
  border-radius: var(--radius-control);
}
.segmented button {
  flex: 1;
  min-height: 44px;
  border: 0;
  border-radius: calc(var(--radius-control) - 2px);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
}
.segmented button[aria-selected='true'] {
  background: var(--card-solid);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Reader Sources: plain sections, checkbox lists */
.card-block {
  background: var(--card-solid);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: var(--gap);
  box-shadow: var(--shadow-sm);
}
.card-block h2 {
  font-family: var(--serif);
  font-size: 1.15rem;
  margin: 0 0 4px;
}
.check-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.check-list label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  border-top: 1px solid var(--rule);
}
.inbox-address {
  word-break: break-all;
}
.check-list input[type='checkbox'] {
  width: 22px;
  height: 22px;
  flex: none;
  margin: 0;
  accent-color: var(--brand);
}

/* Login: Google first, code by email below */
.google-btn {
  display: flex;
  justify-content: center;
  text-decoration: none;
  margin-bottom: 8px;
}
.hint.or {
  text-align: center;
  margin: 8px 0 16px;
}
