/* ============================================================================
   Responsive — mobile is composed, not collapsed.

   FC1W rewrote this file around the new compositions and around design.md
   section 20: 20 to 24px of side padding, the image before the copy in an
   editorial row, journey cards in one column, the anchor navigation scrolling
   sideways rather than wrapping, a minimum of 16px on body text and 44px on
   anything you can tap.

   The rules that are gone are gone because the compositions they described
   are: the FC1V opening band, the France-by-river spread, the paired-portrait
   image rhythm and the old river and line page heads.
   ========================================================================= */

@media (max-width: 1180px) {
  :root { --canvas: 100%; --canvas-wide: 100%; }
}

@media (max-width: 1080px) {
  :root { --gutter: 26px; }
  .method, .planning, .partners, .cmpfeature, .finderband { gap: 44px; }
  .riverindex-row { grid-template-columns: 100px minmax(0, 5fr) minmax(0, 6fr) auto; gap: 24px; }
  .editorial { grid-template-columns: minmax(0, 1fr) minmax(0, 260px); gap: 44px; }
  .utilitypage { grid-template-columns: 190px minmax(0, 1fr); gap: 44px; }
  .finder { grid-template-columns: 210px minmax(0, 1fr); gap: 48px; }
  .journeygrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tipchart { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- TABLET */
@media (max-width: 1024px) {
  /* Two-column journey cards, two-column seasonal facts, and the editorial
     split holds while the width allows it. */
  .tipgrid, .tipfacts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tipgrid > div:nth-child(3), .tipfacts > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .tipgrid > div:nth-child(-n+2), .tipfacts > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .dnav-track { justify-content: flex-start; }
}

/* ---------------------------------------------------------------- MOBILE */
@media (max-width: 860px) {
  /* Compact under the breadcrumb, and still clearly separated from whatever
     opens the page. The header compositions give back the same 12px. */
  .crumb { padding-top: 16px; padding-bottom: 12px; }

  /* Masthead becomes a single tier with a text menu, not a mega-nav. */
  .utility nav { display: none; }
  .utility .wrap { justify-content: center; }
  .masthead-inner { grid-template-columns: 1fr auto; align-items: center; padding: 16px 0 14px; gap: 16px; }
  .nav { display: none; }
  .menu-toggle {
    display: block; font-family: var(--font-body); font-size: 11.5px; font-weight: 600;
    letter-spacing: .13em; text-transform: uppercase; color: var(--ink);
    background: transparent; border: 1px solid var(--ink); border-radius: 0;
    padding: 11px 18px; min-height: 44px; cursor: pointer;
  }
  .mobilenav { display: block; border-bottom: 1px solid var(--ink-deep); background: var(--chalk); }
  .mobilenav[hidden] { display: none; }
  .mobilenav ul { list-style: none; margin: 0; padding: 4px 0 18px; }
  .mobilenav li { border-bottom: 1px solid var(--rule-hair); }
  .mobilenav a {
    display: flex; align-items: center; padding: 15px 0; min-height: 48px;
    font-family: var(--font-body); font-size: 13px; font-weight: 600;
    letter-spacing: .12em; text-transform: uppercase; color: var(--ink); text-decoration: none;
  }
  .mobilenav .mobilenav-finder a { color: var(--river-deep); }

  /* The mark comes down with the name, so the descriptor keeps its single
     line: at the desktop size the monogram takes enough of a 390px header to
     wrap "Cruising France, compared" onto two, which makes the masthead
     taller than it was. */
  .wordmark { gap: 11px; }
  .wordmark .mark { width: 48px; height: 34px; }
  .wordmark-type { font-size: 24px; }
  .wordmark-sub { font-size: 9px; letter-spacing: .18em; }

  /* The hero caption stacks rather than pushing its two halves apart. */
  .hero-caption { flex-direction: column; gap: 4px; }

  /* design.md section 20: the picture comes before the copy in an editorial
     row, whichever side it sits on at desktop. */
  .efeature { grid-template-columns: 1fr; gap: 26px; }
  .efeature--flip .efeature-art { order: 0; }
  .efeature-copy h3, .efeature-copy p { max-width: none; }

  /* Journey cards go to one column. */
  .journeygrid, .journeygrid--two { grid-template-columns: 1fr; }
  .journey-card-body { padding: 22px 22px 22px; }
  .journey-card-name { font-size: 24px; }

  /* The eyebrow and the headline stay centred; the prose under them does not.
     A centred paragraph is ragged on both edges, and at 390px that costs more
     in readability than the symmetry is worth. */
  .intro p { font-size: 17px; text-align: left; }
  .riverindex-intro, .journeys-intro, .tips-intro { text-align: left; margin-inline: 0; }
  .opener--centred { margin-bottom: 34px; }

  .section { padding: 52px 0; }
  .section--tight { padding: 38px 0; }

  /* River index: stacked ruled entries with a small image cut, never four
     cards. The cut leads the entry and the copy runs the full column width
     under it. */
  .riverindex-intro { margin-bottom: 24px; }
  .riverindex-row { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 20px 0; align-items: start; }
  .riverindex-cut { width: 88px; margin-bottom: 10px; }
  .riverindex-name { font-size: 26px; }
  .riverindex-row--quiet .riverindex-cut { width: 66px; }
  .riverindex-fit { font-size: 16px; margin-top: 4px; }

  .cmpfeature, .finderband { grid-template-columns: 1fr; }
  .cmpfeature-q { max-width: none; }

  .method, .planning, .partners { grid-template-columns: 1fr; gap: 36px; }
  .method-list li { padding-left: 52px; }
  .feature-list { margin-top: 4px; }

  .editorial { grid-template-columns: 1fr; gap: 36px; }
  .editorial aside { position: static; }

  .factstrip { grid-template-columns: 1fr 1fr; border-bottom: 0; }
  .factstrip > div { border-left: 0; border-bottom: 1px solid var(--rule-hair); padding: 14px 0; }
  .factstrip > div:nth-child(even) { padding-left: 22px; border-left: 1px solid var(--rule-hair); }

  .facts > div { grid-template-columns: 1fr; gap: 5px; }

  .linelist-item { grid-template-columns: 1fr; gap: 12px; padding: 22px 0; }
  .linelist-act { text-align: left; }

  .routeline-track { grid-auto-columns: 172px; }
  .months abbr { font-size: 10px; }
  .months div { padding: 10px 2px 12px; }

  /* Comparison page */
  .utilitypage { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .toc { position: static; }
  .toc ol { columns: 2; column-gap: 24px; }
  .toc a { padding: 9px 0; font-size: 13px; }
  .toc li { break-inside: avoid; }
  .verdict { grid-template-columns: 1fr; }
  .verdict > div { padding: 22px 0; border-left: 0; border-top: 1px solid var(--rule-mid); }
  .verdict > div:first-child { border-top: 0; padding-top: 22px; }
  /* 10px here and 12px under the breadcrumb: the 22px this header set on
     its own before FC4B, redistributed rather than added to. */
  .cmphead { padding: 10px 0 4px; }
  .cmphead .h1 { max-width: none; }
  .cmphead .standfirst { font-size: 18.5px; }
  .cmphead-meta { gap: 4px 20px; }
  .glossary > div { grid-template-columns: 1fr; gap: 4px; }
  .snapshot-body { grid-template-columns: 1fr; gap: 20px; }
  .tradeoff { grid-template-columns: 1fr; }
  .tradeoff > div { padding: 16px 0; border-left: 0; border-top: 1px solid var(--rule-hair); }
  .tradeoff > div:first-child { border-top: 0; }
  .partner-actions { grid-template-columns: 1fr; }
  .matrix tbody th {
    position: sticky; left: 0; z-index: 1; width: 132px; min-width: 132px;
    padding-right: 14px; font-size: 13px;
    box-shadow: 1px 0 0 var(--rule-mid);
  }
  .matrix .rowgroup th { position: static; width: auto; min-width: 0; box-shadow: none; }
  .matrix { min-width: 620px; font-size: 14px; }
  .matrix th, .matrix td { padding: 13px 14px; }
  .matrix thead th { font-size: 18px; }

  /* Finder */
  .finder { grid-template-columns: 1fr; gap: 30px; padding: 28px 0 64px; }
  .steps { position: static; border-bottom: 1px solid var(--ink); padding-bottom: 16px; }
  .steps ol { display: flex; gap: 0; border-top: 0; }
  .steps li { display: block; flex: 1; padding: 0; border-bottom: 0; border-top: 3px solid var(--rule-mid); padding-top: 8px; font-size: 0; }
  .steps li::before { display: block; font-size: 11px; }
  .steps li[data-state="current"] { border-top-color: var(--brass); }
  .steps li[data-state="done"] { border-top-color: var(--success); }
  .masthead--tool .masthead-inner { grid-template-columns: 1fr auto; row-gap: 10px; }
  .masthead-tool-label { grid-row: 2; grid-column: 1; padding-left: 0; border-left: 0; }
  .masthead-tool-exit { font-size: 13px; grid-row: 1 / 3; align-self: center; }
  .steps-note { display: none; }
  .fieldrow { gap: 14px; }
  .fieldrow .field { max-width: none; flex: 1 1 140px; margin-bottom: 14px; }
  .choices--two { grid-template-columns: 1fr; }
  .choices--two .choice:nth-child(odd) { border-right: 0; }
  .choice span { padding: 15px 12px 16px 4px; min-height: 60px; }
  .field { max-width: none; }
  /* Tap targets: text links get a 44px box on touch widths while the rule
     stays tight under the words. */
  .textlink { min-height: 44px; align-items: flex-end; padding-bottom: 5px; }
  .masthead--tool .wordmark { min-height: 44px; }
  .question-nav { gap: 14px; }
  .question-nav .act { flex: 1 1 auto; }
  .question-nav .meta { flex-basis: 100%; margin-left: 0; text-align: right; }
  .result-head { gap: 16px; }
  .result-line { font-size: 23px; }
  .result-cols { grid-template-columns: 1fr; gap: 22px; }

  /* Footer: five columns become two, and the brand statement stops being set
     against the right edge of a row it no longer shares. */
  .footer { padding: 56px 0 36px; }
  .footer-brand { grid-template-columns: 1fr; gap: 22px; padding-bottom: 30px; }
  .footer-statement { justify-self: start; text-align: left; max-width: none; }
  .footer-top { grid-template-columns: 1fr 1fr; gap: 30px; padding: 32px 0; }
  .footer-legal { grid-template-columns: 1fr; }
}

/* ------------------------------------------------ TOUCH: targets and size */
/* design.md section 20 and section 21, and the FC1W acceptance list: nothing
   you can tap is under 44px, and no body copy is under 16px.

   The 44px rule is applied by padding rather than by height, so a heading
   link keeps its baseline and only its hit area grows. It deliberately does
   not apply to a link inside a sentence: expanding those would put a 44px box
   around every third word of a paragraph. */
@media (max-width: 768px) {
  .toc a { min-height: 44px; align-items: center; }
  .riverlist-name a,
  .linetable-name a,
  .cmpindex-title a,
  .journeys-group-head a { display: inline-block; padding-block: 10px; }
  .riverlist-name { margin-bottom: 2px; }
  .footer ul a { display: inline-block; padding-block: 12px; }
  .footer ul { line-height: 1.6; }
  .sourcelist a { display: inline-block; padding-block: 12px; }
}

@media (max-width: 640px) {
  /* Seasonal facts go to one column at the narrow end, per design.md
     section 20: two by two first, then stacked. */
  .tipgrid, .tipfacts { grid-template-columns: 1fr; }
  .tipgrid > div, .tipfacts > div { border-left: 0; padding-left: 0; border-bottom: 1px solid var(--border); }
  .tipgrid > div:last-child, .tipfacts > div:last-child { border-bottom: 0; }

  /* The 16px floor for body copy on a phone lives at the end of
     production.css, because production.css is the last sheet in the cascade
     and re-declares several of the selectors it has to beat. */
}

/* Below about 380px the masthead runs out of room between the mark and the
   menu button, and "Cruising France, compared" takes a second line, which
   makes the header taller than it is at any other width. The mark and the
   descriptor both come in a little rather than the line being dropped: the
   descriptor is the only place the masthead says what the site is. */
@media (max-width: 400px) {
  .wordmark { gap: 9px; }
  .wordmark .mark { width: 42px; height: 30px; }
  .wordmark-sub { font-size: 8.5px; letter-spacing: .13em; }
}

@media (max-width: 460px) {
  :root { --gutter: 20px; }
  .section { padding: 44px 0; }
  .riverindex-row { gap: 6px; }
  .riverindex-cut { width: 74px; }
  .riverindex-row--quiet .riverindex-cut { width: 58px; }
  .protobar .wrap, .noticebar .wrap { flex-direction: column; gap: 4px; }
  .masthead--tool .wordmark-type { font-size: 20px; }
  .masthead-tool-exit { white-space: normal; font-size: 12.5px; text-align: right; }
  .actions { gap: 16px; }
  /* Still does not stretch to fill the row, but may now shrink: a button that
     cannot shrink is a button that overflows the viewport when its label is
     long. */
  .actions .act { flex: 0 1 auto; }
  .journey-card-actions { gap: 12px 16px; }
  .journey-card-meta > div { grid-template-columns: 1fr; gap: 2px; }
  .toc ol { columns: 1; }
  .factstrip { grid-template-columns: 1fr; }
  .factstrip > div:nth-child(even) { padding-left: 0; border-left: 0; }
  .result-head { grid-template-columns: 1fr; }
}

@media print {
  .utility, .nav, .menu-toggle, .mobilenav, .protobar, .noticebar, .dnav { display: none; }
  body { background: #fff; font-size: 11pt; }
  .journey-card { break-inside: avoid; }
}
