/* Discovery newsletter. Page-specific styles; every colour comes from the shared tokens in ../shared/site.css. */
.nl-head{padding-bottom:.75rem}
.nl-head .lead{margin-top:.4rem}
.builder{padding-top:.25rem}
.builder-grid{display:grid;gap:1rem;align-items:start}
@media (min-width:900px){.builder-grid{grid-template-columns:360px minmax(0,1fr);gap:2rem}.prefs-card{position:sticky;top:72px;max-height:calc(100vh - 88px);overflow:auto}}

/* preferences: a one-line summary with "Change" on phones, the full form on wide screens */
.prefs-card{padding:1rem 1.1rem}
.prefs-top{display:flex;align-items:center;justify-content:space-between;gap:.75rem}
.prefs-title{font-size:1.15rem;margin:0}
.prefs-line{font-size:.9rem;color:var(--ink-2);margin-top:.15rem;line-height:1.4}
.prefs-toggle{flex:none}
.prefs-body{margin-top:1rem}
@media (max-width:899px){.prefs-card[data-collapsed="true"] .prefs-body{display:none}}
@media (min-width:900px){.prefs-toggle{display:none}.prefs-line{display:none}}
fieldset{border:0;min-width:0}
legend,.sub-label{font-weight:700;font-size:.9rem;display:block;margin-bottom:.35rem;padding:0}
.sub-label{margin-top:.75rem}
.field .hint{margin-top:.35rem}
.hint{font-size:.84rem;color:var(--ink-3);margin-top:.35rem}
.chips-col{flex-direction:column;align-items:stretch}
.chip{position:relative;min-height:44px}
.chip input{position:absolute;opacity:0;width:1px;height:1px;margin:0;pointer-events:none}
.chip:has(input:checked){background:var(--teal-soft);border-color:var(--teal);color:var(--teal-2)}
.chip:has(input:focus-visible){outline:3px solid var(--focus);outline-offset:2px}
.chip small{font-weight:500;color:var(--ink-3);font-size:.78rem}
.chip:has(input:checked) small{color:var(--ink-2)}
.chips-col .chip{display:grid;grid-template-columns:1fr;gap:.1rem;padding:.5rem .8rem;border-radius:var(--radius-s);text-align:left}
.chips-col .chip > span::before{content:"";display:inline-block;width:14px;height:14px;border-radius:4px;border:2px solid var(--field-line);margin-right:.5rem;vertical-align:-2px;background:var(--card)}
.chips-col .chip:has(input:checked) > span::before{background:var(--teal);border-color:var(--teal);box-shadow:inset 0 0 0 2px var(--card)}
.chips-col .chip small{line-height:1.35}
/* region counts are written into the HTML at build time; tabular figures keep the chip widths stable */
#region-chips .chip small{font-variant-numeric:tabular-nums}
#region-chips .chip small::before{content:"· "}
.has-countries #region-chips{opacity:.55}
.country-row{display:flex;gap:.5rem;flex-wrap:wrap;align-items:center}
.country-row select{flex:1 1 12rem;min-width:0}
.country-chips:not(:empty){margin-top:.6rem}
.chip-country small{text-decoration:underline}
.map-box{margin-top:.75rem}
/* budget: a free number with the dollar sign drawn in, and its error right under the field */
.budget-row{display:flex;align-items:center;gap:.4rem}
.budget-sign{font-weight:700;color:var(--ink-3);flex:none}
.budget-row input{flex:1 1 auto;min-width:0;max-width:12rem;font-variant-numeric:tabular-nums}
.budget-row input[aria-invalid="true"]{border-color:var(--bad)}
.err{color:var(--bad);font-size:.88rem;font-weight:700;margin-top:.35rem}
.err:empty{display:none}

/* the issue */
.issue-head{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:.6rem 1rem;margin-bottom:.75rem}
.issue-head h2{font-size:1.5rem;margin:0}
.issue-actions{display:flex;flex-wrap:wrap;gap:.5rem}
.chosen{margin-bottom:.9rem;line-height:1.5}
.chosen .retry{margin-left:.5rem}
.email-frame{background:var(--paper);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;min-height:320px;position:relative}
.email-frame iframe{display:block;width:100%;border:0;min-height:320px;background:var(--paper)}
.email-frame[aria-busy="true"] iframe{opacity:.35}
.frame-skeleton{display:grid;gap:1rem;padding:1.5rem;max-width:600px;margin:0 auto}
.frame-skeleton[hidden],.email-frame iframe[hidden]{display:none}
.next-step{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;margin-top:1rem;padding:.8rem 1rem;background:var(--card);border:1px solid var(--line);border-radius:var(--radius-s)}
.next-step[hidden]{display:none}
.next-label{font-weight:700;font-size:.84rem;letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3);margin-right:.25rem;width:100%}
@media (min-width:560px){.next-label{width:auto}}

/* save, see, delete */
#subscribe{border-top:1px solid var(--line)}
.sub-grid{display:grid;gap:1.5rem;align-items:start}
@media (min-width:900px){.sub-grid{grid-template-columns:minmax(0,1fr) 420px;gap:3rem}}
.sub-side{display:grid;gap:1rem}
.sub-card{padding:1.2rem}
.sub-card h3{font-size:1.1rem;margin-bottom:.35rem}
.privacy{margin:1rem 0;display:grid;gap:.15rem .9rem;max-width:68ch;font-size:.95rem}
.privacy dt{font-weight:700;color:var(--ink);margin-top:.55rem}
.privacy dd{color:var(--ink-2);margin:0}
@media (min-width:640px){.privacy{grid-template-columns:9rem minmax(0,1fr)}.privacy dt{margin-top:.55rem}.privacy dd{margin-top:.55rem}}
.consent{display:flex;gap:.7rem;align-items:flex-start;font-weight:500;font-size:.92rem;color:var(--ink-2);margin:.2rem 0 1rem;cursor:pointer}
.consent input{width:22px;height:22px;flex:none;margin-top:.1rem;accent-color:var(--teal)}
.sub-status{margin-top:.75rem;font-size:.92rem;min-height:1.4em;overflow-wrap:anywhere}
.sub-status.ok{color:var(--ok)}.sub-status.bad{color:var(--bad)}
.sub-status .btn{margin-left:.35rem;vertical-align:middle}
.del-actions{display:flex;flex-wrap:wrap;gap:.5rem}
.delete-card .field{margin-bottom:.75rem}

#weekly{border-top:1px solid var(--line)}
.steps{margin:1rem 0 0 1.2rem;display:grid;gap:.8rem;max-width:72ch}
.steps li{color:var(--ink-2);font-size:.97rem}
.steps b{color:var(--ink)}
code{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.86em;background:var(--line-2);padding:.1em .35em;border-radius:4px;word-break:break-all}

/* phones: the issue comes straight after the preferences line; its buttons follow the issue */
@media (max-width:899px){
  .issue-col{display:flex;flex-direction:column}
  .issue-head{display:contents}
  .issue-head h2{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  .chosen{order:1;margin-top:.25rem}
  .email-frame{order:2}
  /* While the picks load, the frame holds a screen's height, so the buttons below it start below the fold and the
     email (always taller than the skeleton) does not push them through the viewport (CLS 0.14 on a phone, 10 Nov 2026). */
  .email-frame[aria-busy="true"]{min-height:100vh;min-height:100dvh}
  .issue-actions{order:3;margin-top:1rem}
  .next-step{order:4}
  .nl-head{padding-top:1.5rem}
}
.delete-card summary{cursor:pointer;font-weight:700;min-height:44px;display:flex;align-items:center;color:var(--ink)}
.delete-card[open] summary{margin-bottom:.5rem}
.delete-card form > p{margin-bottom:.75rem}
#subscribe h2 + .lead{margin-top:.6rem}
.chosen[hidden]{display:none}
.map-box{min-height:44px}
.next-step.pending{visibility:hidden}
/* reserve the shared top bar's height until Lab.mount() swaps it in, so the page does not jump (CLS) */
#lab-bar{height:57px}
@media (max-width:560px){#lab-bar{height:53px}}
.frame-loading{color:var(--ink-2);font-size:.95rem;margin:0;font-weight:600}
/* How we work this out: closed by default, plain words. */
.method{margin-top:2rem;border-top:1px solid var(--line);padding-top:.4rem;max-width:72ch}
.method summary{cursor:pointer;font-weight:700;color:var(--accent-ink);min-height:44px;display:flex;align-items:center;gap:.4rem;list-style:none}
.method summary::-webkit-details-marker{display:none}
.method summary::after{content:"";width:.45rem;height:.45rem;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg) translateY(-2px);margin-left:.2rem}
.method[open] summary::after{transform:rotate(-135deg) translateY(-1px)}
.method-body{font-size:.9rem;color:var(--ink-2);padding:.2rem 0 .6rem}
.prefs-done{width:100%;margin-top:.25rem}
@media (min-width:900px){.prefs-done{display:none}}
.email-frame,.chosen,#issue-title{scroll-margin-top:72px}
/* The sticky preferences card is a stacking context: while the map picker inside it is full screen, drop the sticky so
   the fixed panel covers the whole page (the issue preview was painted over it on desktop). */
.prefs-card:has(.cm-full){position:static;max-height:none;overflow:visible}

/* wave 6: next week, previewed */
.preview{margin-top:1.1rem;border:1px solid var(--line);border-radius:var(--radius);background:var(--card);padding:.9rem 1rem 1rem}
.preview[hidden]{display:none}
.preview-head h3{font-size:1.05rem;margin:0 0 .15rem}
.preview-sub{font-size:.86rem;color:var(--ink-3);margin:0 0 .7rem}
.preview-list{list-style:none;margin:0 0 .8rem;padding:0 2px .3rem;display:flex;gap:.6rem;overflow-x:auto;scrollbar-width:thin;-webkit-overflow-scrolling:touch}
.preview-list li{flex:0 0 9.5rem;display:grid;gap:.2rem;min-width:0}
.preview-list img{display:block;width:100%;aspect-ratio:4/3;height:auto;object-fit:cover;border-radius:10px;background:var(--line-2)}
.pv-name{font-weight:700;font-size:.88rem;line-height:1.25;overflow-wrap:anywhere}
.pv-where{font-size:.78rem;color:var(--ink-3)}
@media (min-width:860px){.preview-list{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));overflow:visible}.preview-list li{flex:none}}
.builder-grid>.issue-col{min-width:0}
.preview{min-width:0;max-width:100%}
.preview-list{min-width:0;max-width:100%}
.issue-col .preview{order:5}
