/* ==========================================================================
   responsive.css  (titanicofficers.com)
   Load LAST, after reset.css, layout.css, style.css and lightbox.css.

   Layout rules are inside media queries, so anything wider than 980px keeps
   the exact current look (the exceptions are the web font, the button fallback
   colour, which only shows while an image is still loading, and the baseline fix
   for italic words in headings).

   Advertising: no rule targets Ezoic containers, ins elements or ad iframes,
   and no ancestor gets new overflow rules.
   ========================================================================== */

/* ---------- All widths: picture tiles always form tidy rows ----------
   The tiles on the home and Articles pages are floated side by side. When a title wraps onto
   two lines the tile is taller than its neighbour, and the next tile snagged underneath it,
   leaving one tile indented and the next pushed down a line (and every row after it shifted).
   Starting each left-hand tile below everything above it keeps the rows tidy, whatever the
   title lengths. When the tiles are the same height nothing changes. */
.col2 .cols:not(.pad_left1) { clear: left; }

/* ---------- All widths: no underline on headings that are links ----------
   style.css underlines every link. Cufon used to draw headings as pictures, which never showed the
   underline; now they are real text, so a linked heading (for example a title wrapped in <a>) would
   show a blue underline under black text. Linked headings go back to looking as they did. */
a:has(> h2), a:has(> h3), a:has(> h4) { text-decoration: none; }

/* ---------- All widths: no logo picture on this site ----------
   style.css asks for images/logo.png, which does not exist here (the badge is part of the banner
   picture), so every page made a request that failed. The invisible "Titanic" link that sits over
   the badge and takes visitors home is kept; it just no longer asks for a missing file. */
#logo { background: none; }

/* ---------- All widths: button fallback colour ----------
   style.css paints buttons azure (#1d77e9) until button_1.gif has loaded, but the image is a deep
   navy gradient, so visitors saw a brief azure flash. This is the average navy of the image, and it
   only shows for the moment before the image arrives. */
.button1 { background-color: #18249e; }

/* ---------- All widths: Cabin web font (replaces the Cufon scripts) ----------
   Two small self-hosted files in the fonts folder: regular and italic. They are
   the same 2011 version of Cabin that Cufon was drawing, so headings keep the
   same shapes and spacing. Cufon only had one weight, so weights are kept at
   400 here too, and italic words in headings now use the real italic. */
@font-face {
  font-family: 'Cabin';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/Cabin-Regular.woff2) format('woff2');
  unicode-range: U+0020-007E,U+00A0-00AE,U+00B0-00FF,U+010C-010D,U+0131,U+0152-0153,U+0160-0161,U+0178,U+017D-017E,U+0192,U+0237,U+02C6,U+02DC,U+2013-2014,U+2018-201A,U+201C-201E,U+2020-2022,U+2026,U+2030,U+2039-203A,U+20AC,U+2122;
}
@font-face {
  font-family: 'Cabin';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/Cabin-Italic.woff2) format('woff2');
  unicode-range: U+0020-007E,U+00A0-00AE,U+00B0-00FF,U+010C-010D,U+0131,U+0152-0153,U+0160-0161,U+0178,U+017D-017E,U+0192,U+0237,U+02C6,U+02DC,U+2013-2014,U+2018-201A,U+201C-201E,U+2020-2022,U+2026,U+2030,U+2039-203A,U+20AC,U+2122;
}
/* Extra letters for translated pages (Polish, Czech, Turkish, Hungarian, Romanian, Vietnamese and
   so on). The 2011 Cabin above lacks them, so they come from the newer Cabin. Browsers only
   download these two small files when a page actually contains one of these characters. */
@font-face {
  font-family: 'Cabin';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/Cabin-Regular-ext.woff2) format('woff2');
  unicode-range: U+0100-010B,U+010E-0130,U+0132-0151,U+0154-015F,U+0162-0177,U+0179-017C,U+018F,U+01A0-01A1,U+01AF-01B0,U+01C4-01CC,U+01E6-01E7,U+01EA-01EB,U+01FA-021B,U+022A-022D,U+0230-0233,U+1E08-1E09,U+1E0C-1E0F,U+1E14-1E17,U+1E1C-1E1D,U+1E20-1E21,U+1E24-1E25,U+1E2A-1E2B,U+1E2E-1E2F,U+1E36-1E37,U+1E3A-1E3B,U+1E42-1E49,U+1E4C-1E53,U+1E5A-1E5B,U+1E5E-1E69,U+1E6C-1E6F,U+1E78-1E7B,U+1E80-1E85,U+1E8E-1E8F,U+1E92-1E93,U+1E97,U+1E9E,U+1EA0-1EF9;
}
@font-face {
  font-family: 'Cabin';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/Cabin-Italic-ext.woff2) format('woff2');
  unicode-range: U+0100-010B,U+010E-0130,U+0132-0151,U+0154-015F,U+0162-0177,U+0179-017C,U+018F,U+01A0-01A1,U+01AF-01B0,U+01C4-01CC,U+01E6-01E7,U+01EA-01EB,U+01FA-021B,U+022A-022D,U+0230-0233,U+1E08-1E09,U+1E0C-1E0F,U+1E14-1E17,U+1E1C-1E1D,U+1E20-1E21,U+1E24-1E25,U+1E2A-1E2B,U+1E2E-1E2F,U+1E36-1E37,U+1E3A-1E3B,U+1E42-1E49,U+1E4C-1E53,U+1E5A-1E5B,U+1E5E-1E69,U+1E6C-1E6F,U+1E78-1E7B,U+1E80-1E85,U+1E8E-1E8F,U+1E92-1E93,U+1E97,U+1E9E,U+1EA0-1EF9;
}
h2, h3, h4, #menu a, #slogan {
  font-family: 'Cabin', Arial, Helvetica, sans-serif;
  font-weight: 400;
}
h2 *, h3 *, h4 *, #menu a * { font-weight: 400; }
/* style.css asks for -1px letter spacing, but Cufon drew these elements about 0.3px
   per character wider than that (measured at both 20px and 26px). -0.7px reproduces
   what Cufon actually drew, so line lengths and wrapping stay the same. */
h2, h3, h4, #menu a, #slogan { letter-spacing: -0.7px; }
/* Cufon's drawings carried about a pixel of space either side of each word, so the
   menu tabs were ~2px wider than the bare text. Match that (small screens set their own padding below). */
#menu li a span span { padding-left: 32.8px; padding-right: 32.8px; }

/* ---------- Translated pages ----------
   When a visitor translates the page with their browser (Chrome adds the class translated-ltr
   or translated-rtl to <html>), the menu words are often longer ("Artículos", "Actualités"). In
   that state the header may grow instead of clipping, and on wide screens the menu text and tab
   padding are a little smaller. Normal pages are not affected. */
.translated-ltr header, .translated-rtl header { height: auto; }
@media (min-width: 981px) {
  .translated-ltr header, .translated-rtl header { min-height: 230px; }
  .translated-ltr #menu li a, .translated-rtl #menu li a { font-size: 22px; }
  .translated-ltr #menu li a span span, .translated-rtl #menu li a span span { padding-left: 20px; padding-right: 20px; }
}

/* ---------- All widths: italic names inside headings ----------
   reset.css gives <em> vertical-align:top and its own font-size, which can lift
   italic words such as Olympic or Hawke above the rest of a heading. Keep
   them on the heading's baseline and size. */
h2 em, h2 i, h3 em, h3 i, h4 em, h4 i {
  vertical-align: baseline !important;
  font-size: inherit !important;
  line-height: inherit !important;
}

/* ---------- 980px and below: remove the fixed page width ---------- */
@media (max-width: 980px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { min-width: 0 !important; }              /* style.css sets min-width:980px */
  .main { width: auto !important; max-width: 960px; }   /* style.css sets width:960px */
  /* The banner picture carries the badge, the portraits AND the site title, so it is scaled to fit
     the screen (never narrower than 600px, so on a phone the title still reads and only the far
     right of the picture is cropped). Everything laid over it, the logo link and the height of
     the banner area, scales by the same amount. Below the picture the banner is plain black, so the
     header can grow if a translated menu ever wraps. */
  header {
    --bw: max(600px, calc(100vw - 20px));      /* the width the banner picture is drawn at */
    background-size: max(600px, 100%) auto;
    background-color: #000;
    height: auto;
  }
  header .wrapper { height: calc(var(--bw) * .1365); overflow: visible; }   /* 131px at full size */
  header h1 { padding: calc(var(--bw) * .0281) 0 0 calc(var(--bw) * .0427); }
  #logo { width: calc(var(--bw) * .125); height: calc(var(--bw) * .1083); }
}

/* ---------- 940px and below: single column ----------
   layout.css uses fixed 287px + 557px columns (923px in total), so the layout
   switches to one column at the point where they would stop fitting. */
@media (max-width: 940px) {
  /* Reading text: 13px is too small on a phone */
  body { font-size: 16px; line-height: 1.5; }
  .box2 { font-size: 14px; }
  .box2 strong { font-size: 15px; }
  .ref { font-size: 11px; }
  footer { font-size: 14px; }
  .button1 { font-size: 14px; height: auto; min-height: 30px; }
  #content .wrapper.pad1 { display: flex; flex-direction: column; box-sizing: border-box; padding-left: 18px; padding-right: 18px; }   /* side margins for text */
  #content .col2 { order: 1; }
  #content .col1 { order: 2; margin-top: 24px; }
  #content .col1,
  #content .col2 {
    float: none !important;
    width: auto !important;
    padding-left: 0 !important;
  }

  /* Images, floated figures, video */
  #content img { max-width: 100%; height: auto; }
  #content figure.left,
  #content figure.right {
    float: none !important;
    margin: 1em auto !important;
    text-align: center;
  }
  #content iframe[src*="youtube"],
  #content iframe[src*="youtu.be"],
  #content iframe[src*="vimeo"] {
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  #content table { max-width: 100%; }

  /* Mailchimp sign-up box (book page): Mailchimp's own style fixes it at 350px wide */
  #mc_embed_signup { max-width: 100%; box-sizing: border-box; }

  /* Quoted testimony: style.css pads 50pt each side, far too much for a phone */
  #content .indented { padding-left: 24px !important; padding-right: 24px !important; }

  /* Two image tiles per row on the home page */
  #content .col2 .cols {
    float: left;
    width: 48% !important;
    margin: 0 0 16px 0;
    padding-left: 0 !important;
    clear: both;      /* a new row always starts below the tallest tile above it */
  }
  #content .col2 .cols.pad_left1 { float: right; clear: none; }
  #content .col2 .cols { text-align: center; }   /* images and buttons centred together, no gap */

  /* Footer */
  footer { padding: 24px 18px 28px; }
  footer #icons { float: none; padding: 0 0 16px; }
  footer #icons form > div { width: auto !important; max-width: 100%; box-sizing: border-box; }
  footer #icons input[type="text"] { max-width: 55%; box-sizing: border-box; }
  footer .links { float: none; width: auto; padding-left: 0; }

  /* Buy Me a Coffee: the widget's pop-up message is built with a plain white
     background, so on small screens it disappears against the white page.
     It has no id or class, so it is found by its inline styles. */
  body > div[style*="z-index: 9999;"][style*="rgb(255, 255, 255)"]:not(#bmc-wbtn),
  body > div[style*="z-index: 9999;"][style*="#ffffff"]:not(#bmc-wbtn) {
    background: #e4e9ff !important;
    border: 1px solid #aebcf4;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .28) !important;
  }

  /* Old Prototype lightbox only (pages that still load it): keep enlarged images on screen */
  #outerImageContainer,
  #imageDataContainer { max-width: 100% !important; box-sizing: border-box; }
  #lightbox img { max-width: 100% !important; height: auto !important; }
}

/* ---------- Main menu: sized to the screen so all five items stay on one row ---------- */
@media (max-width: 820px) {
  #menu { padding-left: clamp(4px, calc(6.3vw - 16px), 42px); }
  #menu li a { font-size: 18px; font-size: min(26px, calc(2.04vw + 12.65px), calc(4.36vw + 4px)); }
  #menu li a span span {
    padding: 0 clamp(4px, calc(5.08vw - 14px), 32.8px);
    margin: 0 clamp(1px, calc(.79vw - 1.3px), 6px);
  }
}

/* ---------- 940px and below: the Home / Sitemap / Contact links ----------
   They move to the top right of the banner, over the row of portraits, with a soft dark edge so the
   white text stays readable on the photographs. (The Google Translate box, when it shows, sits
   beneath them.) */
@media (max-width: 940px) {
  header .wrapper { position: relative; }
  #top_nav {
    position: absolute;
    top: 6px;
    right: 6px;
    float: none;
    padding: 0;
    text-align: center;
  }
  #top_nav li { padding-left: 0; width: 56px; }
  #top_nav li a { font-size: 14px; text-shadow: 0 0 3px #000, 0 1px 2px #000; }
  #top_nav br { display: none; }
  #top_nav figure.right { float: none; clear: both; margin: 4px 0 0; }
}

/* ---------- 560px and below: phones ---------- */
@media (max-width: 560px) {
  h3 { font-size: 26px; }
  h3 span { font-size: 17px; }
  h2 { padding-left: 20px; padding-right: 20px; }
  #content .indented { padding-left: 12px !important; padding-right: 12px !important; }
  .button1 { max-width: 100%; box-sizing: border-box; height: auto; min-height: 30px; }

  /* image tiles go to one per row */
  #content .col2 .cols,
  #content .col2 .cols.pad_left1 { float: none !important; width: auto !important; clear: both; }
}

@media (max-width: 480px) {
  .main { padding: 6px; }
}

