/* =====================================================================
   LAYOUT FILE  -  Dark Signal Defense website
   ---------------------------------------------------------------------
   This file sets the position, spacing and size of everything on the
   pages. It takes every color and font from theme.css.

   You do not normally edit this file. Change colors and fonts in
   theme.css, and change wording in the HTML pages.
   ===================================================================== */

/* ---------- Starting point for every element ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--color-page-background);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-page-background);
  color: var(--color-body-text);
  font-family: var(--font-body);
  font-size: var(--body-text-size);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1 0 auto;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-accent);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--color-accent-hover);
}

/* The outline a keyboard user sees on the link or button that is selected. */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

/* Keeps the content in a centered column with space at both sides. */
.page-width {
  width: 100%;
  max-width: var(--page-width);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

/* Text that screen-reader software reads aloud and that is not drawn on screen. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* A link for keyboard users that appears on the first press of the Tab key. */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -6rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  background-color: var(--color-accent);
  color: var(--color-text-on-accent);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
  color: var(--color-text-on-accent);
}

/* ---------- Top bar: logo and menu ---------- */

.site-header {
  border-bottom: 1px solid var(--color-border-line);
  background-color: var(--color-page-background);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 6.25rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--color-heading-text);
  text-decoration: none;
}

.brand:hover {
  color: var(--color-heading-text);
}

/* The company name set in type, beside the logo. */
.brand-name {
  font-family: var(--font-heading);
  font-size: var(--company-name-size);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.005em;
}

/* The logo beside the company name. The logo file has wide empty margins around the hexagon,
   so the picture is enlarged inside a square frame, and the frame trims the margins. */
.brand-mark {
  flex: none;
  display: block;
  width: var(--logo-height);
  height: var(--logo-height);
  margin-right: 0.85rem;
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transform: scale(var(--logo-zoom));
}

.site-menu {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 3.5vw, 2.5rem);
}

.site-menu a {
  padding-block: 0.9rem;
  color: var(--color-muted-text);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: var(--label-letter-spacing);
  text-transform: var(--label-letter-case);
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-menu a:hover,
.site-menu a[aria-current="page"] {
  color: var(--color-heading-text);
}

/* ---------- Headlines ---------- */

h1 {
  max-width: 46rem;
  color: var(--color-heading-text);
  font-family: var(--font-heading);
  font-size: clamp(2.1rem, 1.15rem + 3.4vw, var(--headline-size));
  font-weight: var(--heading-weight);
  line-height: 1.1;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

/* The short line above each main headline. */
h1::before {
  content: "";
  display: block;
  width: 4.75rem;
  height: 1px;
  margin-bottom: 1.9rem;
  background-color: var(--color-accent);
}

/* ---------- Home page: headline area with the image ---------- */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: clamp(30rem, 76vh, 46rem);
  padding-block: clamp(3.5rem, 9vw, 6.5rem);
}

.hero-image {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  z-index: -1;
  width: var(--hero-image-width);
  background-color: var(--color-page-background);
}

.hero-image img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: var(--hero-image-position);
  opacity: var(--hero-image-opacity);
  mix-blend-mode: var(--hero-image-blend-mode);
  filter: var(--hero-image-filter);
}

/* Optional blend of the left edge and the bottom edge of the image into the page
   background. The two widths are set in theme.css; 0% switches a blend off. */
.hero-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--color-page-background) 0%, transparent var(--hero-image-blend-left)),
    linear-gradient(to top, var(--color-page-background) 0%, transparent var(--hero-image-blend-bottom));
}

/* The moving light lies exactly over the home page image. */
.hero-image .hero-pulses {
  position: absolute;
  inset: 0;
  mix-blend-mode: screen;
  filter: none;
}

/* The switch that pauses the moving light. The checkbox itself is not drawn, and a keyboard
   still reaches it. Its label is the small text at the lower right of the headline area. */
.motion-switch {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
  opacity: 0;
}

.motion-label {
  position: absolute;
  right: clamp(1.25rem, 4vw, 2.5rem);
  bottom: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--color-muted-text);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: var(--label-letter-spacing);
  text-transform: var(--label-letter-case);
  cursor: pointer;
  user-select: none;
}

.motion-label::before {
  content: "";
  width: 0.8rem;
  height: 0.8rem;
  border: 1px solid var(--color-muted-text);
  border-radius: 2px;
}

.motion-label:hover {
  color: var(--color-heading-text);
}

.motion-switch:checked ~ .motion-label::before {
  border-color: var(--color-accent);
  background-color: var(--color-accent);
}

.motion-switch:checked ~ .hero-image .hero-pulses {
  display: none;
}

.motion-switch:focus-visible ~ .motion-label {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

.hero-summary {
  max-width: 37rem;
  margin-top: 1.6rem;
  font-size: 1.1em;
  line-height: 1.75;
}

/* ---------- Button ---------- */

.button {
  display: inline-block;
  margin-top: 2.4rem;
  padding: 0.95rem 1.75rem;
  border: 1px solid var(--color-accent);
  border-radius: var(--corner-radius);
  background-color: var(--color-accent);
  color: var(--color-text-on-accent);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: var(--label-letter-spacing);
  text-transform: var(--label-letter-case);
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.button:hover {
  border-color: var(--color-accent-hover);
  background-color: var(--color-accent-hover);
  color: var(--color-text-on-accent);
}

/* ---------- Home page: the band with the boxes ---------- */

.capabilities {
  border-top: 1px solid var(--color-border-line);
  background-color: var(--color-band-background);
  padding-block: clamp(1.25rem, 3vw, 2rem);
}

.capability-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0;
  list-style: none;
}

.capability {
  padding: 1.5rem 1.5rem 1.6rem;
  border: 1px solid var(--color-border-line);
  border-radius: var(--corner-radius);
}

.capability h3 {
  color: var(--color-heading-text);
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: var(--heading-weight);
  line-height: 1.25;
}

.capability p {
  margin-top: 0.65rem;
  color: var(--color-muted-text);
  font-size: 0.94em;
  line-height: 1.55;
}

/* ---------- Contact page and page-not-found page ---------- */

.plain-page {
  padding-block: clamp(3.5rem, 9vw, 7rem);
}

.plain-page .lead {
  max-width: 37rem;
  margin-top: 1.6rem;
  font-size: 1.1em;
  line-height: 1.75;
}

.contact-box {
  max-width: 37rem;
  margin-top: 2.75rem;
  padding: 1.6rem 1.75rem 1.75rem;
  border: 1px solid var(--color-border-line);
  border-radius: var(--corner-radius);
  background-color: var(--color-band-background);
}

.contact-box h2 {
  color: var(--color-muted-text);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: var(--label-letter-spacing);
  text-transform: var(--label-letter-case);
}

.contact-box p {
  margin-top: 0.6rem;
}

.contact-box a {
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 0.9rem + 1.6vw, 1.7rem);
  font-weight: var(--heading-weight);
  line-height: 1.3;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.contact-box a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

/* ---------- Home page: the one line about the standards, under the boxes ---------- */

.standards-line {
  margin-top: 1.5rem;
  color: var(--color-muted-text);
  font-size: 0.94em;
  text-align: center;
}

/* ---------- The page "Standards" ---------- */

.standards-page .lead {
  max-width: 44rem;
}

.standards-heading {
  margin-top: 3.5rem;
  color: var(--color-heading-text);
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: var(--heading-weight);
  line-height: 1.2;
}

.standards-note {
  max-width: 46rem;
  margin-top: 0.6rem;
  color: var(--color-muted-text);
}

.standards-closing {
  margin-top: 3rem;
}

.standards-table {
  width: 100%;
  margin-top: 1.5rem;
  border-collapse: collapse;
}

.standards-table th {
  padding: 0 1.5rem 0.8rem 0;
  border-bottom: 1px solid var(--color-accent);
  color: var(--color-muted-text);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: var(--label-letter-spacing);
  text-align: left;
  text-transform: var(--label-letter-case);
}

.standards-table td {
  padding: 1.15rem 1.5rem 1.2rem 0;
  border-bottom: 1px solid var(--color-border-line);
  vertical-align: top;
}

.standards-table td:first-child {
  width: 36%;
  color: var(--color-heading-text);
}

.standards-table td:last-child {
  width: 26%;
  padding-right: 0;
  color: var(--color-muted-text);
}

/* The number of the requirement, under its plain name. */
.requirement-number {
  display: block;
  margin-top: 0.35rem;
  color: var(--color-muted-text);
  font-size: 0.85em;
}

/* On a phone each row of the table becomes one block, and its three parts stand under each other. */
@media (max-width: 44rem) {
  .standards-table thead {
    display: none;
  }

  .standards-table tr,
  .standards-table td {
    display: block;
  }

  .standards-table td,
  .standards-table td:first-child,
  .standards-table td:last-child {
    width: auto;
    padding: 0.4rem 0;
    border-bottom: 0;
  }

  .standards-table tr {
    padding-block: 1rem;
    border-bottom: 1px solid var(--color-border-line);
  }
}

/* ---------- Bottom line of every page ---------- */

.site-footer {
  border-top: 1px solid var(--color-border-line);
  padding-block: 1.5rem;
  color: var(--color-muted-text);
  font-size: 0.9em;
  text-align: center;
}

/* ---------- Medium screens (small laptops and tablets) ---------- */

@media (max-width: 64rem) {
  .capability-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Phones ---------- */

@media (max-width: 44rem) {
  /* On a narrow phone the menu moves to a second line under the logo when it is wider than the space beside it. */
  .header-row {
    flex-wrap: wrap;
    row-gap: 0;
    min-height: 5rem;
  }

  .brand-name {
    font-size: calc(var(--company-name-size) * 0.85);
  }

  .brand-mark {
    width: calc(var(--logo-height) * 0.8);
    height: calc(var(--logo-height) * 0.8);
  }

  .site-menu a {
    font-size: 0.72rem;
    letter-spacing: calc(var(--label-letter-spacing) * 0.7);
  }

  .hero {
    min-height: 0;
  }

  /* On a phone the image fills the width and sits, fainter, behind the words. */
  .hero-image {
    width: 100%;
  }

  .hero-image img {
    object-position: var(--hero-image-position-on-phones);
    opacity: var(--hero-image-opacity-on-phones);
  }

  /* On a phone the image sits behind the words, so the light stays still there. */
  .hero-image .hero-pulses,
  .motion-switch,
  .motion-label {
    display: none;
  }

  .capability-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- For visitors who have asked their device for less motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }

  /* The light stays still for these visitors. */
  .hero-image .hero-pulses,
  .motion-switch,
  .motion-label {
    display: none;
  }
}

/* ---------- Printed copies ---------- */

@media print {
  .hero-image,
  .skip-link {
    display: none;
  }
}
