@layer components {
  /* Prep — three stacked bands inside the beige board:
     1. Identity (gathering, dates, hosts, travel placeholders)
     2. Todos    (accordion on lined-paper bg)
     3. Folders  (simple labeled tiles)
     Cohort sits below folders, gated on @show_cohort. */

  /* ── 1. Identity band ─────────────────────────────── */
  .prep-identity { margin-bottom: var(--space-8); }

  /* Title is the headline; the meta row (your stay · dates · countdown)
     sits beneath it as a smaller, calmer sub-line. */
  .prep-identity-title {
    font-size: 36px;
    line-height: 1.05;
    margin: 0 0 12px;
    color: var(--ink);
  }
  .prep-identity-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
  }
  .prep-identity-divider {
    width: 1px;
    height: 14px;
    background: rgba(0,0,0,0.18);
  }

  .prep-dates {
    font-family: var(--display);
    color: var(--ink);
    line-height: 1.1;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  .prep-dates-range {
    font-family: var(--sans);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
  }
  .prep-dates-countdown {
    display: inline-block;
    padding: 3px 9px;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--sans);
    font-size: 10px;
    letter-spacing: 0.06em;
    font-weight: var(--weight-semibold);
    border-radius: 999px;
    text-transform: none;
    white-space: nowrap;
  }

  .prep-hosts {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: var(--space-6);
  }
  .prep-hosts-avatars { display: flex; gap: -8px; }
  .prep-host {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--paper-edge);
    border: 2px solid var(--paper);
    margin-left: -8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; letter-spacing: 0.1em;
    color: var(--ink-soft);
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  }
  .prep-host:first-child { margin-left: 0; }
  .prep-hosts-label {
    font-size: 13px;
    color: var(--ink-soft);
    font-family: var(--display);
  }

  .prep-travel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
  /* Each travel card is its own standalone object with its own paper,
     shadow, and color stripe — not a panel within a band. */
  .prep-travel-card {
    position: relative;
    display: block;
    padding: 24px 26px 26px;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    background: var(--paper);
    box-shadow:
      0 1px 0 rgba(0,0,0,0.04),
      0 2px 5px rgba(40, 25, 5, 0.07);
    transition: transform .12s ease, box-shadow .12s ease;
  }
  .prep-travel-card:hover {
    transform: translateY(-1px);
    box-shadow:
      0 1px 0 rgba(0,0,0,0.04),
      0 4px 8px rgba(40, 25, 5, 0.10);
  }
  .prep-travel-card.arrive { background: var(--arrive-paper); }
  .prep-travel-card.depart { background: var(--depart-paper); }

  /* Inner printed-paper frame — same idea as the modal card frame. */
  .prep-travel-card::before {
    content: '';
    position: absolute;
    top: 8px; right: 8px; bottom: 8px; left: 8px;
    border: 1px solid currentColor;
    border-radius: 3px;
    pointer-events: none;
    color: rgba(0,0,0,0.10);
  }
  .prep-travel-card.arrive::before { color: var(--arrive-line); }
  .prep-travel-card.depart::before { color: var(--depart-line); }
  .prep-cabin-card::before { color: rgba(0,0,0,0.14); }

  .prep-travel-card-head {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }
  .prep-travel-tag {
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: var(--weight-bold);
  }
  .prep-travel-card.arrive .prep-travel-tag { color: var(--arrive); }
  .prep-travel-card.depart .prep-travel-tag { color: var(--depart); }
  .prep-travel-edit {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-left: auto;
  }

  /* Setup-step badge — number on the card while incomplete, filled
     check when done. Lives inside .prep-travel-card-head. */
  .prep-step-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    color: var(--ink-soft);
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: var(--weight-semibold);
    line-height: 1;
    flex-shrink: 0;
  }
  .prep-travel-card.arrive .prep-step-badge { color: var(--arrive); }
  .prep-travel-card.depart .prep-step-badge { color: var(--depart); }
  .prep-step-badge--done {
    background: currentColor;
    border-color: currentColor;
  }
  .prep-step-badge--done .prep-step-check {
    width: 12px;
    height: 12px;
    color: var(--paper);
  }

  /* Intro line above the three setup cards. */
  .prep-setup-intro {
    margin: 18px 0 14px;
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.5;
  }

  /* Inline CTA pill at the bottom of an incomplete setup card. The card
     itself is the navigation target — this is a visual nudge, not a
     separate link. Tone matches the card it sits in. */
  .prep-card-cta {
    display: inline-flex;
    align-items: center;
    margin-top: 14px;
    padding: 9px 16px;
    border-radius: 999px;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: var(--weight-bold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    background: var(--ink);
    text-decoration: none;
    transition: transform .12s ease, box-shadow .12s ease;
  }
  .prep-travel-card:hover .prep-card-cta {
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
  }
  .prep-card-cta--arrive { background: var(--arrive); }
  .prep-card-cta--depart { background: var(--depart); }
  .prep-card-cta--about  { background: var(--ink); }

  /* Inline variant — sits at the right edge of the preview row on
     desktop, drops below on narrow screens. Used by "About your stay". */
  .prep-card-cta--inline {
    margin-top: 0;
    margin-left: auto;
    align-self: center;
    flex-shrink: 0;
  }
  @media (max-width: 640px) {
    .prep-card-cta--inline {
      margin-left: 0;
      margin-top: 12px;
      align-self: flex-start;
    }
  }

  .prep-travel-summary {
    font-family: var(--display);
    font-style: italic;
    font-size: 19px;
    line-height: 1.25;
    color: var(--ink);
  }
  .prep-travel-meta {
    font-size: 11px;
    color: var(--ink-soft);
    margin-top: 4px;
    letter-spacing: 0.04em;
  }
  .prep-travel-empty {
    font-family: var(--display);
    font-style: italic;
    font-size: 16px;
    color: var(--ink-faint);
  }

  /* Cabin card — same treatment as arrive/depart, neutral paper. */
  .prep-cabin-card,
  .prep-stay-info-card {
    margin-top: 18px;
    background: var(--paper-warm);
  }
  .prep-travel-tag--cabin { color: var(--ink-soft); }

  /* ── 2. Todos band ────────────────────────────────── */
  .prep-todos {
    margin: var(--space-7) calc(-1 * var(--space-5));
    padding: var(--space-6) var(--space-5);
    background-color: #fbf6e7;
    background-image:
      repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 31px,
        rgba(74, 124, 78, 0.09) 31px,
        rgba(74, 124, 78, 0.09) 32px
      );
    border-radius: 4px;
    box-shadow: inset 0 1px 0 rgba(0,0,0,0.04);
  }
  .prep-todos-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    padding-left: 4px;
  }
  .prep-todos-title {
    font-family: var(--display);
    font-style: italic;
    font-size: 22px;
    color: var(--ink);
  }
  .prep-todos-count {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }

  .prep-todo { /* no dividers — the lined paper provides rhythm */ }
  .prep-todo-link {
    display: block;
    text-decoration: none;
    color: inherit;
  }
  .prep-todo-link:hover .prep-todo-title { color: var(--ink); }
  .prep-todo-link:hover .prep-todo-chevron { color: var(--ink); transform: translateX(2px); }
  .prep-todo-chevron { transition: transform .12s ease, color .12s ease; }

  .prep-todo-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 4px;
    flex-wrap: wrap;
    cursor: pointer;
    user-select: none;
  }
  .prep-todo-check {
    width: 18px; height: 18px;
    border: 1.5px solid var(--ink-soft);
    border-radius: 3px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.6);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; line-height: 1; color: var(--ink);
  }
  .prep-todo.done .prep-todo-check::before { content: "✓"; }
  .prep-todo.done .prep-todo-title {
    text-decoration: line-through;
    color: var(--ink-faint);
  }

  .prep-todo-title {
    flex: 1;
    font-size: 14px;
    color: var(--ink);
    font-weight: var(--weight-medium);
  }
  .prep-todo-due {
    font-family: var(--display);
    font-style: italic;
    font-size: 15px;
    color: var(--ink);
    flex-shrink: 0;
    font-weight: var(--weight-semibold);
  }
  .prep-todo.due .prep-todo-due { color: var(--required); font-weight: var(--weight-bold); }
  .prep-todo.done .prep-todo-due { color: var(--ink-faint); text-decoration: line-through; }
  .prep-todo-chevron {
    width: 14px;
    color: var(--ink-faint);
    transition: transform .15s ease;
    flex-shrink: 0;
  }
  .prep-todo.expanded .prep-todo-chevron { transform: rotate(90deg); }

  .prep-todo-body {
    display: none;
    padding: 4px 4px 16px 30px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--ink-soft);
  }
  .prep-todo.expanded .prep-todo-body { display: block; }
  .prep-todo-body p { margin: 0 0 10px; }

  /* ── 3. Resources band — flat files with optional host note. ── */
  .prep-files { margin-top: var(--space-8); }
  .prep-files-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--space-4);
  }
  .prep-files-title {
    font-family: var(--display);
    font-style: italic;
    font-size: 22px;
    color: var(--ink);
  }
  .prep-files-list { list-style: none; padding: 0; margin: 0; }
  .prep-file {
    border-top: 1px solid rgba(0,0,0,0.06);
  }
  .prep-file:first-child { border-top: none; }
  .prep-file-link {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 4px;
    text-decoration: none;
    color: inherit;
    transition: background 0.12s ease;
  }
  .prep-file-link:hover { background: rgba(0,0,0,0.025); }
  .prep-file-icon {
    width: 26px;
    text-align: center;
    font-size: 18px;
    line-height: 1.2;
    color: var(--ink-soft);
    flex-shrink: 0;
    padding-top: 2px;
  }
  .prep-file-title {
    font-size: 15px;
    font-weight: var(--weight-semibold);
    color: var(--ink);
  }
  .prep-file-out {
    margin-left: 6px;
    font-size: 11px;
    color: var(--ink-faint);
    font-weight: var(--weight-medium);
  }
  .prep-file-note {
    font-size: 12.5px;
    color: var(--ink-soft);
    font-style: italic;
    line-height: 1.5;
    margin-top: 4px;
    max-width: 60ch;
  }

  /* ── Cohort (below folders, gated by @show_cohort) ── */
  .prep-cohort { margin-top: var(--space-8); padding-top: var(--space-5); border-top: 1px dashed rgba(0,0,0,0.12); }
  .prep-cohort-title {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 10px;
  }
  .cohort {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
  }
  .cohort-photo {
    width: 38px; height: 38px;
    border-radius: 50%;
    font-size: 10px;
  }
  .cohort-photo.more {
    background: transparent;
    border: 1px dashed rgba(0,0,0,0.3);
    color: var(--ink);
  }
  .cohort-note {
    font-size: 11px;
    color: var(--ink-faint);
    margin-top: 10px;
    font-style: italic;
  }

  /* ── Logistics modal — whole-card-tinted layout ── */
  .logistics-direction-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 32px;
  }
  .logistics-direction-title {
    font-family: var(--display);
    font-style: italic;
    font-size: 52px;
    font-weight: 500;
    line-height: 0.95;
    margin: 0;
    letter-spacing: -0.01em;
  }
  .logistics-direction-title--arrive { color: var(--arrive); }
  .logistics-direction-title--depart { color: var(--depart); }
  .logistics-direction-title--sm { font-size: 32px; line-height: 1.1; }
  .logistics-direction-date {
    text-align: right;
    font-family: var(--display);
  }
  .logistics-direction-date-num {
    font-size: 32px;
    font-weight: 500;
    line-height: 1;
    margin: 4px 0;
  }
  .logistics-direction-date--arrive .logistics-direction-date-num { color: var(--arrive); }
  .logistics-direction-date--depart .logistics-direction-date-num { color: var(--depart); }

  .logistics-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 22px;
    margin-bottom: 22px;
  }
  .logistics-field { min-width: 0; }

  .logistics-upload { margin: 0 0 26px; cursor: pointer; }
  .logistics-upload--depart {
    border-color: rgba(47, 72, 88, 0.45);
    background: rgba(255,255,255,0.45);
    color: var(--depart);
  }
  .logistics-upload--arrive {
    background: rgba(255,255,255,0.45);
  }
  .logistics-form { margin-bottom: 24px; }

  /* ── Todo modal (lined-paper card) ── */
  .todo-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
  }
  .todo-head-main { flex: 1; min-width: 0; }
  /* Title row carries the done checkbox so the modal mirrors the
     checklist row's vocabulary — checkbox + title — just bigger. */
  .todo-head-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 6px;
  }
  .todo-check {
    width: 22px; height: 22px;
    border: 1.5px solid var(--ink-soft);
    border-radius: 3px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.6);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; line-height: 1; color: var(--ink);
    margin-top: 8px;
  }
  .todo-check--done {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
  }
  .todo-title {
    font-family: var(--display);
    font-style: italic;
    font-size: 30px;
    line-height: 1.15;
    margin: 0;
    color: var(--ink);
    flex: 1;
    min-width: 0;
  }
  .todo-title--done {
    text-decoration: line-through;
    color: var(--ink-faint);
  }
  .todo-due-stamp {
    text-align: right;
    flex-shrink: 0;
    padding: 6px 12px;
    border: 1.5px solid currentColor;
    border-radius: 3px;
    color: var(--ink-soft);
    transform: rotate(2deg);
    align-self: flex-start;
    margin-top: 4px;
  }
  .todo-due-stamp--due  { color: var(--required); }
  .todo-due-stamp--done { color: var(--ink-faint); }
  .todo-due-stamp-date {
    font-family: var(--display);
    font-weight: var(--weight-bold);
    font-size: 18px;
    line-height: 1;
    margin-top: 2px;
  }
  .todo-body {
    font-size: 15px;
    line-height: 1.75;
    color: var(--ink);
    margin-bottom: 24px;
  }
  .todo-body p { margin: 0; }
  .todo-answer { margin-bottom: 28px; }

  .logistics-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
  }
  .logistics-save {
    appearance: none;
    border: none;
    cursor: pointer;
    padding: 12px 28px;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: var(--weight-bold);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 2px;
    transition: transform .12s ease, box-shadow .12s ease;
  }
  .logistics-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    text-decoration: none;
    color: #fff;
  }
  .logistics-save.arrive { background: var(--arrive); }
  .logistics-save.depart { background: var(--depart); }

  /* Split row used on the todo modal: a draft "Save" alongside the
     primary "Save and mark done" — both right-aligned with a gap. */
  .logistics-actions--split { gap: 12px; }

  /* Outline variant — same shape and rhythm as .logistics-save, but
     reads as the secondary action. Used for the draft "Save" on the
     todo modal next to the filled "Save and mark done". */
  .logistics-save--outline {
    background: transparent;
    color: var(--ink);
    box-shadow: inset 0 0 0 1.5px var(--ink);
  }
  .logistics-save--outline:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--ink);
  }


  /* ── Mobile (≤ 768px) ── */
  @media (max-width: 768px) {
    /* Whole meta row stays on one line — letterhead · | · dates · pill —
       wrapping naturally if the screen is too narrow. */
    .prep-identity-meta {
      gap: 12px;
      flex-wrap: wrap;
    }
    .prep-identity-title { font-size: 28px; line-height: 1.15; }
    .prep-dates { gap: 10px; font-size: 12px; }
    .prep-dates-range { font-size: 12px; letter-spacing: 0.12em; }
    .prep-dates-countdown { font-size: 10px; padding: 3px 8px; }

    .prep-travel { grid-template-columns: 1fr; gap: 12px; }
    .prep-travel-summary { font-size: 18px; }

    .prep-folders-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

    .prep-todos { margin-left: -10px; margin-right: -10px; padding: 18px 12px; }
    .prep-todo-due { font-size: 13px; }

    /* Logistics modal — title smaller, fields stack one per line. */
    .logistics-direction-title { font-size: 36px; }
    .logistics-direction-date-num { font-size: 26px; }
    .logistics-direction-head { margin-bottom: 22px; }
    .logistics-fields { grid-template-columns: 1fr; gap: 16px; }
    .logistics-upload { font-size: 13px; }

    /* Todo modal head — also stack-friendly. */
    .todo-head { gap: 14px; }
    .todo-title { font-size: 24px; }
    .todo-due-stamp { padding: 5px 10px; }
    .todo-due-stamp-date { font-size: 16px; }
  }

  /* ── Empty state (no host has published anything) ── */
  .prep-empty {
    padding: 80px var(--space-5);
    text-align: center;
  }
  .prep-empty-headline {
    font-family: var(--display);
    font-style: italic;
    font-size: 24px;
    line-height: 1.4;
    color: var(--ink-soft);
  }
  .prep-empty-sub {
    margin-top: 14px;
    font-size: 13px;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    color: var(--ink-faint);
  }
}
