/* ==========================================================================
   responsive.css  (williammurdoch.net)
   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 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: 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.7px; padding-right: 32.7px; }
#slogan { text-shadow: 1px 1px 0 #1063e4; }   /* the blue edge Cufon used to draw */

/* ---------- 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; min-height: 230px; }
@media (min-width: 921px) {
  .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 */
  header { background-size: auto; background-color: #000; min-height: 230px; height: auto; }   /* can grow if the menu ever wraps; the image's lower strip is black, so it blends in */
}

/* ---------- 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%; }

  /* 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: #dbe8f7 !important;
    border: 1px solid #a3c0e3;
    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 six items stay on one row ----------
   The full-size menu fits down to about 920px. Below that the text, the space between the
   words and the indent all shrink smoothly with the screen width, so Home, Man, Mystery,
   Articles, News and Contact never wrap. */
@media (max-width: 920px) {
  #menu { padding-left: clamp(4px, calc(6.3vw - 16px), 42px); }
  #menu li a { font-size: 17px; font-size: min(26px, calc(1.3vw + 12.5px), calc(3.8vw + 3.4px)); }
  #menu li a span span {
    padding: 0 clamp(4px, calc(5.08vw - 14px), 32.7px);
    margin: 0 clamp(1px, calc(.79vw - 1.3px), 6px);
  }
}

/* ---------- 940px and below: header keeps its 230px banner ----------
   This site's slogan is long, so beside it there is no longer room for the Home / Sitemap /
   Contact links from 940px down. They move to the top right of the red banner (where the
   banner artwork has room) and the slogan stays beside the logo. The banner is never stretched. */
@media (max-width: 940px) {
  header .wrapper { position: relative; }
  #slogan { box-sizing: border-box; max-width: calc(100% - 165px); }   /* wraps beside the logo instead of dropping below it */
  #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; }
  #top_nav br { display: none; }
}

/* ---------- Slogan: this site's is long, so it is sized to fit beside the logo ----------
   Two lines at 17px fit in the 131px the logo occupies; on the very narrowest phones it
   is raised so that three lines fit, and the header never grows. */
@media (max-width: 640px) {
  #slogan { font-size: 17px; padding-top: 88px; }
}
@media (max-width: 360px) {
  #slogan { padding-top: 70px; }
}

/* ---------- 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; }
  header h1 { padding-left: 10px; }
  #slogan { padding-left: 10px; max-width: calc(100% - 134px); }
}

