/*
 * A secret friend's page (groups/draws/show): a ticket on top (its group,
 * name, date, price and steps; past the tear line, the countdown), then what
 * the viewer does now (the stage card: joining, the envelope with who they
 * drew, who drew whom), the owner's decision, their own list, and beside it
 * who takes part. The secret friend's colour is --fourth, as its steps on
 * Grupos. The stages, side cards and people rows come from friends.css and
 * groups.css.
 */
.app {
  /* The ticket */
  .draw-ticket { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 190px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); }
  .ticket-main { display: grid; gap: 10px; padding: 22px 26px; min-width: 0; }
  .ticket-main .crumb { justify-self: start; }
  .ticket-group { display: flex; align-items: center; font-size: 14px; font-weight: 700; color: var(--muted); }
  .ticket-main h1 { font-size: clamp(30px, 4vw, 44px); overflow-wrap: anywhere; }
  .ticket-main .facts-row { margin-top: 0; font-size: 15px; }
  .ticket-main .facts-row b { color: var(--ink); }
  .ticket-main .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 620px; }
  .ticket-stub { display: grid; place-content: center; justify-items: center; gap: 2px; padding: 20px; text-align: center; border-left: 2px dashed var(--line);
    border-radius: 0 var(--radius) var(--radius) 0; background: color-mix(in srgb, var(--fourth) 8%, var(--paper)); }
  .ticket-stub b { font: 800 46px/1 var(--serif, inherit); color: var(--fourth); font-variant-numeric: tabular-nums; }
  .ticket-stub small { font-size: 13px; font-weight: 700; color: var(--muted); }
  .ticket-stub svg.icon { width: 40px; height: 40px; color: var(--ok); }
  /* The ticket's notches, on the tear line */
  .draw-ticket::before, .draw-ticket::after { content: ""; position: absolute; right: 181px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); }
  .draw-ticket::before { top: -10px; clip-path: inset(50% 0 0 0); }
  .draw-ticket::after { bottom: -10px; clip-path: inset(0 0 50% 0); }
  .ticket-settings { position: absolute; top: 16px; right: 206px; }
  .draw-ticket + .people-below { margin-top: 22px; }

  /* What the viewer does now */
  .draw-stage { display: grid; gap: 12px; justify-items: start; border-color: color-mix(in srgb, var(--fourth) 30%, var(--line)); background: color-mix(in srgb, var(--fourth) 6%, var(--paper)); }
  .draw-stage .eyebrow, .draw-decision .eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
  .draw-stage .eyebrow { color: color-mix(in srgb, var(--fourth) 80%, var(--ink)); }
  .draw-stage h2 { font-size: 26px; }
  .draw-stage > p { color: var(--muted); max-width: 62ch; }
  .draw-stage .btn-row .button_to { margin: 0; }
  .draw-decision { display: grid; gap: 10px; justify-items: start; border: 2px solid var(--danger); background: color-mix(in srgb, var(--danger) 6%, var(--paper)); }
  .draw-decision .eyebrow { color: var(--danger); }

  /* The envelope: who the viewer drew, theirs only */
  .envelope { width: 100%; }
  .envelope > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 20px; align-items: center; }
  .envelope > summary::-webkit-details-marker { display: none; }
  .envelope:not([open]) .when-open, .envelope[open] .when-closed { display: none; }
  .envelope-text { display: grid; gap: 4px; justify-items: start; }
  .envelope-text > span:not(.btn) { display: grid; gap: 4px; justify-items: start; }
  .envelope-text b { font-size: 22px; }
  .envelope-text .drew { font-size: 34px; line-height: 1.1; }
  .envelope-text small { color: var(--muted); font-size: 14px; }
  .envelope-text .btn { margin-top: 8px; }
  .envelope-drawing { width: 120px; height: 90px; overflow: visible; }
  .envelope-drawing .body { fill: var(--paper); stroke: var(--line); stroke-width: 1.5; }
  .envelope-drawing .flap { fill: color-mix(in srgb, var(--fourth) 18%, var(--paper)); stroke: var(--line); stroke-width: 1.5; }
  .envelope-drawing .seal { fill: var(--fourth); }
  .envelope:not([open]) .opened, .envelope[open] .sealed { display: none; }
  .envelope h3 { margin: 18px 0 12px; font-size: 18px; }

  /* Who drew whom */
  .pairs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; width: 100%; }
  .pairs li { display: grid; grid-template-columns: 28px minmax(0, 1fr) 20px 28px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 12px;
    border-radius: var(--radius-sm); background: var(--paper); border: 1px solid var(--line); font-weight: 700; overflow-wrap: anywhere; }
  .pairs .arrow { color: var(--muted); }

  /* The viewer's own list */
  .draw-own-list { display: grid; gap: 12px; }
  .draw-own-list .section-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; justify-content: space-between; }
  .draw-own-list h2 { font-size: 22px; }
  .add-item a { display: grid; place-content: center; justify-items: center; gap: 6px; height: 100%; min-height: 180px; border-radius: var(--radius); border: 1.5px dashed var(--line);
    color: var(--muted); font-weight: 700; text-decoration: none; }
  .add-item a:hover { border-color: var(--fourth); color: var(--ink); }

  /* Who takes part */
  .draw-participants ul.people li { flex-wrap: nowrap; padding: 8px 0; }
  .draw-participants .name { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
  .draw-participants .state { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 1px 8px; border-radius: 999px; background: var(--soft-bg); color: var(--muted); }
  .draw-participants .state.in { background: color-mix(in srgb, var(--ok) 14%, var(--paper)); color: var(--ok); }
  .draw-participants .not-joined { opacity: .65; }

  /* In the modals: going back from the create form to the lists */
  .picker-switch { padding: 12px 22px 0; }
}

@media (max-width: 900px) {
  /* The stage and the list first, who takes part after them */
  .app .people-side.draw-side { order: 0; }
}

@media (max-width: 700px) {
  .app {
    .draw-ticket { grid-template-columns: minmax(0, 1fr); }
    .ticket-main { padding: 18px 16px; }
    .ticket-stub { grid-auto-flow: column; align-items: baseline; gap: 10px; padding: 12px 16px; border-left: 0; border-top: 2px dashed var(--line); border-radius: 0 0 var(--radius) var(--radius); }
    .ticket-stub b { font-size: 28px; }
    .draw-ticket::before, .draw-ticket::after { display: none; }
    .ticket-settings { right: 16px; }
    .envelope > summary { grid-template-columns: minmax(0, 1fr); }
    .pairs li { grid-template-columns: 24px minmax(0, 1fr) 14px 24px minmax(0, 1fr); gap: 6px; padding: 8px; }
  }
}
