/* ==========================================================================
   QME, Inc. - site stylesheet
   Modernized markup of the original 2002 (GoLive) / 2012 (Word) site.
   Goal: same look as the original pages, built with HTML5 + CSS
   instead of layout tables, spacer GIFs, <font> tags and JavaScript.

   The original pages were each laid out by hand, so things sit a few
   pixels differently from page to page. Those offsets are kept below as
   per-page custom properties (--logo-x, --footer-x, ...) so the copy
   matches the live site; set them all to one value to make pages consistent.

   FONTS: every font family, size and line height on the site is set in the
   "Typography" section below, from the variables in :root. To change the
   text site-wide, change the variables - the per-page sections further down
   only handle layout (positions, widths, margins).
   ========================================================================== */

/* ---------- Font scheme (site-wide) ---------- */
:root {
  --font-text: Helvetica, Arial, sans-serif;

  --text-main: 18px;      /* main content text on every page              */
  --lh-main: 21px;        /*   ...and its line height                     */

  --text-side: 16px;      /* blue sidebar / side notes / footer address   */
  --lh-side: 18px;

  --text-small: 13px;     /* footer menu, photo captions, fine print      */
  --lh-small: 15px;

  --text-heading: 22px;   /* text headings inside the content area        */
  --lh-heading: 26px;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 800px;                       /* fixed-width layout, as the original */
  background: #fff url("../Media/bkgnd.gif"); /* blue / white / blue column stripes */
  color: #000;
  font: var(--text-main)/var(--lh-main) var(--font-text);
}

img {
  display: block;
  border: 0;
}

a {
  color: #0000ee;
}

a:visited {
  color: #551a8b;
}

/* The pages that were rebuilt in MS Word (Engineering, Quality, Contact)
   used plain "blue" links */
.links-blue a,
.links-blue a:visited {
  color: #00f;
}

/* Text kept for screen readers / search engines, hidden visually */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Typography (the same on every page) ---------- */

/* Main content: paragraphs, lists and contact details use the body font
   (--text-main). One blank line between paragraphs. */
.page p {
  margin: 0 0 var(--lh-main);
}

/* Text headings in the content area */
.page h2 {
  margin: 0;
  font: bold var(--text-heading)/var(--lh-heading) var(--font-text);
}

.page h3 {
  margin: 0;
  font: bold var(--text-main)/var(--lh-main) var(--font-text);
}

/* Secondary text: blue sidebar, side notes */
.page .sidebar,
.page .side-notes {
  font-size: var(--text-side);
  line-height: var(--lh-side);
}

.page .sidebar p,
.page .side-notes p {
  margin: 0 0 var(--lh-side);
}

/* Small text: photo captions, fine print (the footer menu is set in Footer) */
.page figcaption,
.page .fine-print {
  font-size: var(--text-small);
  line-height: var(--lh-small);
}

/* ---------- Page defaults (overridden per page below) ---------- */
body {
  --logo-x: 214px;          /* left edge of the QME logo                   */
  --footer-rule-x: 0px;     /* left edge of the bottom red bar             */
  --footer-x: 208px;        /* left edge of the footer text links          */
  --footer-gap: 0px;        /* space between bottom bar and footer links   */
}

/* ---------- Header: image menu, logo, red rule ---------- */
.main-nav {
  display: flex;
  width: 790px;
  height: 28px;
}

.main-nav a {
  display: block;
  width: 105px;
  height: 28px;
  background-repeat: no-repeat;
  background-position: 0 0;
}

/* Rollover states: 1 = normal, 2 = mouse over, 3 = mouse down */
.nav-home    { background-image: url("../Media/home1.gif"); }
.nav-about   { background-image: url("../Media/about1.gif"); }
.nav-eng     { background-image: url("../Media/cnc1.gif"); }
.nav-quality { background-image: url("../Media/quality1.gif"); }
.nav-equip   { background-image: url("../Media/equip1.gif"); }
.nav-contact { background-image: url("../Media/contact1.gif"); }

.nav-home:hover,    .nav-home:focus-visible    { background-image: url("../Media/home2.gif"); }
.nav-about:hover,   .nav-about:focus-visible   { background-image: url("../Media/about2.gif"); }
.nav-eng:hover,     .nav-eng:focus-visible     { background-image: url("../Media/cnc2.gif"); }
.nav-quality:hover, .nav-quality:focus-visible { background-image: url("../Media/quality2.gif"); }
.nav-equip:hover,   .nav-equip:focus-visible   { background-image: url("../Media/equip2.gif"); }
.nav-contact:hover, .nav-contact:focus-visible { background-image: url("../Media/contact2.gif"); }

.nav-home:active    { background-image: url("../Media/home3.gif"); }
.nav-about:active   { background-image: url("../Media/about3.gif"); }
.nav-eng:active     { background-image: url("../Media/cnc3.gif"); }
.nav-quality:active { background-image: url("../Media/quality3.gif"); }
.nav-equip:active   { background-image: url("../Media/equip3.gif"); }
.nav-contact:active { background-image: url("../Media/contact3.gif"); }

.main-nav a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

/* Preload the hover/pressed images so the first rollover doesn't flicker */
.main-nav::after {
  content: url("../Media/home2.gif") url("../Media/about2.gif") url("../Media/cnc2.gif")
           url("../Media/quality2.gif") url("../Media/equip2.gif") url("../Media/contact2.gif")
           url("../Media/home3.gif") url("../Media/about3.gif") url("../Media/cnc3.gif")
           url("../Media/quality3.gif") url("../Media/equip3.gif") url("../Media/contact3.gif");
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}

.site-logo {
  margin: 2px 0 2px var(--logo-x);
}

.rule {
  width: 649px;
  height: 17px;
}

/* ---------- Page body: two columns (blue sidebar | white content) ---------- */
.page {
  position: relative;
  display: grid;
  width: 800px;
}

.sidebar {
  color: whitesmoke;
}

/* ---------- Footer ---------- */
.site-footer .rule {
  margin-left: var(--footer-rule-x);
}

.text-nav {
  margin: var(--footer-gap) 0 0 var(--footer-x);
  text-indent: 0.556em;                   /* the original indented with two &nbsp; */
  font-size: var(--text-small);
  line-height: var(--lh-small);
}

.footer-contact {
  margin: 16px 0 0 var(--footer-x);
  text-indent: 0.556em;
  font-size: var(--text-side);
  line-height: var(--lh-side);
}

.footer-contact strong {
  font-weight: bold;
}

/* ==========================================================================
   Home (index.htm)
   ========================================================================== */
.page-home {
  --logo-x: 211px;
  --footer-rule-x: 3px;
  --footer-x: 219px;
  --footer-gap: 3px;
}

.page-home .page {
  grid-template-columns: 219px 483px;
}

.page-home .page-title {
  grid-column: 2;
  margin: 3px 0 0;
}

.page-home .page-title img + img {
  margin-top: 3px;
}

.page-home .sidebar {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin: 105px 0 0;
  padding-left: 43px;
}

.page-home .sidebar h2 {
  margin: 0 0 var(--lh-side);
  font: inherit;
  font-style: italic;
  font-weight: bold;
  text-decoration: underline;
}

.page-home .sidebar ul {
  margin: 0 0 var(--lh-side);
  padding: 0;
  list-style: none;
}

.page-home .sidebar h2:nth-of-type(2) {
  margin-bottom: 16px;
}

.page-home .intro {
  grid-column: 2;
  margin: 3px 0 0;
  min-height: 252px;
}

.page-home .intro img {
  float: right;
}

.page-home .site-footer {
  margin-top: 0;
}

/* ==========================================================================
   About (aboutqme.htm)
   ========================================================================== */
.page-about {
  --footer-x: 208px;
  --footer-gap: 0px;
}

.page-about .page {
  grid-template-columns: 208px 186px 249px;
  grid-template-rows: 25px 71px auto;
}

.page-about .page-title {
  display: contents;
}

.page-about .title-1 {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin-left: 18px;
}

.page-about .title-2 {
  grid-column: 2;
  grid-row: 2;
}

.page-about .building {
  grid-column: 3;
  grid-row: 1 / span 3;
}

.page-about .facts {
  grid-column: 1;
  grid-row: 3;
  margin: 6.4px 0 0;
  padding-left: 18px;                     /* lines up with the "About" title above */
}

.page-about .story {
  grid-column: 2 / span 2;
  grid-row: 3;
  align-self: start;
  width: 408px;
}

.page-about .story h2 {
  margin: 0;
}

.page-about .story-text {
  margin: 31.4px 0 0 10px;
  width: 388px;
}

.page-about .site-footer {
  margin-top: -8px;
}

/* ==========================================================================
   Engineering / Design (engineering.htm)
   ========================================================================== */
.page-engineering {
  --footer-rule-x: 5px;
  --footer-x: 210px;
  --footer-gap: 6px;
}

.page-engineering .page {
  grid-template-columns: 210px 224px 300px;
}

.page-engineering .page-title {
  display: contents;
}

.page-engineering .title-1 {
  grid-column: 1;
  grid-row: 1;
  margin: 5px 0 0 13px;
}

.page-engineering .title-2 {
  grid-column: 2;
  grid-row: 1;
  margin-top: 5px;
}

.page-engineering .title-2 img + img {
  margin-top: 4px;
}

.page-engineering .hero {
  grid-column: 3;
  grid-row: 1 / span 2;
  margin-top: 5px;
}

.page-engineering .cad {
  grid-column: 2 / span 2;
  grid-row: 3;
  display: grid;
  grid-template-columns: 180px 278px;
  margin-top: 45px;
}

.page-engineering .printer {
  margin: 0;
}

.page-engineering .printer figcaption {
  margin-top: 16px;
  width: 180px;
  font-weight: bold;
  text-align: center;
}

.page-engineering .cad-text {
  padding-top: 12px;
}

.page-engineering .systems {
  grid-column: 2 / span 2;
  grid-row: 4;
  font-weight: bold;
}

.page-engineering .systems h2 {
  text-indent: 0.5em;                     /* the original used en-space characters */
}

.page-engineering .systems li {
  text-indent: 0.5em;
}

.page-engineering .systems li:first-child {
  text-indent: 0.75em;
}

.page-engineering .systems ul {
  margin: var(--lh-main) 0 0;
  padding: 0;
  list-style: none;
}

.page-engineering .systems li + li {
  margin-top: var(--lh-main);
}

.page-engineering .site-footer {
  margin-top: 5px;
  padding-bottom: 5px;
}

/* ==========================================================================
   Quality (quality.htm)
   ========================================================================== */
.page-quality {
  --footer-rule-x: 5px;
  --footer-x: 215px;
  --footer-gap: 4.9px;
}

.page-quality .page {
  grid-template-columns: 215px 395px 165px;
  grid-template-rows: 71px 134px auto auto;
}

.page-quality .page-title {
  display: contents;
}

.page-quality .title-1 {
  grid-column: 1;
  grid-row: 1;
  margin: 5px 0 0 18px;
}

.page-quality .title-2 {
  grid-column: 2;
  grid-row: 1;
  margin-top: 5px;
}

.page-quality .inspection {
  grid-column: 3;
  grid-row: 1 / span 2;
  margin-top: 5px;
}

.page-quality .tagline {
  grid-column: 2;
  grid-row: 2;
  margin: 56px 0 0;
}

.page-quality .story {
  grid-column: 2;
  grid-row: 3;
  margin: 10px 0 0 5px;
  width: 361px;
}

.page-quality .story .motto {
  margin: 0;
  font-style: italic;
  font-weight: bold;
}

.page-quality .side-notes {
  grid-column: 2 / span 2;
  grid-row: 3;
  justify-self: end;
  margin: 10px 0 0;
  width: 181px;
  text-align: right;
  font-style: italic;
}

.page-quality .policy {
  grid-column: 2 / span 2;
  grid-row: 4;
  margin: -8px 0 0 5px;
  width: 555px;
  padding: 10px 10px 10px 10.5px;
  background: blanchedalmond;
}

.page-quality .policy .cert {
  margin: 19.9px 0 0;
  font-weight: bold;
}

.page-quality .policy .pledge {
  margin: 50px 0 0;
}

.page-quality .site-footer {
  margin-top: 10px;
}

.page-quality .footer-contact {
  text-indent: 0.834em;                   /* three &nbsp; on this page */
}

/* ==========================================================================
   Equipment (equipment1.htm)
   ========================================================================== */
.page-equipment {
  --logo-x: 217px;
  --footer-x: 218px;
  --footer-gap: 0px;
}

.page-equipment .page {
  grid-template-columns: 218px 489px 190px;
  width: 897px;
}

.page-equipment .page-title {
  grid-column: 1 / span 2;
  grid-row: 1;
  display: flex;
  margin: 0;
}

.page-equipment .page-title img:first-child {
  margin: 0 11px 0 11px;
}

.page-equipment .machines {
  grid-column: 3;
  grid-row: 1 / span 2;
  margin-top: 62px;
}

.page-equipment .equipment {
  grid-column: 2;
  grid-row: 2;
}

.page-equipment .equipment h2 {
  margin: 25px 0 0;
}

.page-equipment .equipment h3 {
  margin: var(--lh-main) 0 0;
}

.page-equipment .equipment h3 + ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Long entries wrap onto a second line; indent the wrapped part */
.page-equipment .equipment li {
  padding-left: 1.5em;
  text-indent: -1.5em;
}

.page-equipment .site-footer {
  margin-top: 0;
}

/* ==========================================================================
   Contact (contact.htm)
   ========================================================================== */
.page-contact {
  --logo-x: 219px;
  --footer-rule-x: 3px;
  --footer-x: 221px;
  --footer-gap: 4px;
}

.page-contact .page {
  grid-template-columns: 221px 310px 213px;
  grid-template-rows: 78px auto;
}

.page-contact .page-title {
  grid-column: 2;
  grid-row: 1;
  margin: 25px 0 0;
}

.page-contact .map {
  grid-column: 3;
  grid-row: 1 / span 2;
  margin-top: 43px;
}

.page-contact .details {
  grid-column: 2;
  grid-row: 2;
}

.page-contact .details p {
  margin: 0;
}

.page-contact .details .person {
  margin-top: 21px;
  font-weight: bold;
}

.page-contact .details address {
  margin-top: 16px;
  font-style: normal;
}

.page-contact .site-footer {
  margin-top: 3px;
}
