/* ============================================================================
 * Afterwarp Framework - site stylesheet
 *
 * Implements the visual character of afterwarp.io:
 *   - Classic professional software/engineering site: compact, technical,
 *     restrained and text-first.
 *   - Full-width dark header with centered logo/navigation and a fixed-width
 *     content canvas (~980 px).
 *   - White content surface on a light gray page background, dark gray text,
 *     subdued blue links, gray borders.
 *   - Minimal border radius and shadows, with subtle header shading and item bevels.
 * ==========================================================================*/

/* --- Design tokens -------------------------------------------------------- */
:root {
  --page-width: 980px;      /* fixed desktop canvas width */
  --page-gutter: 24px;      /* side gutters used on narrow screens */

  --page-bg: #eeeeee;       /* page (outside the canvas) */
  --surface: #ffffff;       /* content surface */

  --text: #333333;
  --text-muted: #777777;
  --heading: #2f2f2f;

  --link: #2b6fa8;
  --link-hover: #1d527f;

  --border: #d7d7d7;
  --border-soft: #e7e7e7;

  --highlight-bg: #6f7275;  /* information badges and inline content labels */

  --nav-bg: #3f4347;        /* navigation bar background */
  --nav-bg-hover: #50555a;  /* navigation hover / submenu border */
  --nav-bg-current: #303438; /* slightly darker current menu item */
  --nav-text: #f3f3f3;

  --radius: 2px;

  --content-gap: 24px;      /* blank space between the menu and the
                               content; the same gap separates the
                               blog-style entries on the Home page */
}

/* --- Reset and base -------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

/* Centered fixed-width canvas shared by header, content and footer. */
.site-shell {
  width: min(var(--page-width), calc(100% - 2 * var(--page-gutter)));
  margin-inline: auto;
}

/* --- Header logo, contained in the dark navigation bar -------------------- */
.site-header {
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--nav-bg) 92%, white),
    color-mix(in srgb, var(--nav-bg) 92%, black));
}

.logo {
  padding: 0;
}

/* Keep the raster logo crisp: never enlarge it beyond its natural size. */
.logo img {
  display: block;
  height: auto;
  max-height: 64px;
  width: auto;
  max-width: 100%;
}

/* --- Navigation bar -------------------------------------------------------- */
/* Keep the logo and links together, with a clear gap before the first item.
   Collapse the links before the full row can crowd the logo. */
.site-nav {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  align-items: center;
  column-gap: 24px;
  min-height: 55px;
  padding: 0 16px;
}

.nav-list {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  width: fit-content;        /* compact row, not stretched across the bar */
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Every top-level entry (plain link or <summary>) gets the exact same box:
   flex-centered, 55 px tall, same horizontal padding - so all labels sit on
   the same baseline. */
.nav-list > li > a,
.nav-list > li > details > summary {
  display: flex;
  align-items: center;
  min-height: 55px;
  padding: 0 14px;
  white-space: nowrap;
  color: var(--nav-text);
  text-decoration: none;
  cursor: pointer;
  list-style: none;
  /* Paired light/dark edges suggest the original menu's two-pixel bevel. */
  box-shadow: inset 1px 0 rgb(255 255 255 / 7%), inset -1px 0 rgb(0 0 0 / 18%);
}

/* Remove the native <summary> disclosure marker in all browsers. */
.nav-list summary::-webkit-details-marker {
  display: none;
}

/* Reuse the current-page marker, including its Corporate parent when applicable.
   Keep specificity low so hover and keyboard focus remain visible. */
.nav-list :where(a[aria-current="page"], details:has(a[aria-current="page"]) > summary) {
  background: var(--nav-bg-current);
}

.nav-list > li > a:hover,
.nav-list > li > details > summary:hover,
.nav-list > li > a:focus-visible,
.nav-list > li > details > summary:focus-visible {
  background: var(--nav-bg-hover);
  outline: none;
}

/* --- Corporate dropdown submenu ------------------------------------------- */
/* The <li> is the positioning anchor, so the dropdown hangs directly below
   the "Corporate" label with a small fixed width. */
.has-submenu {
  position: relative;
}

/* Small down-arrow hint after the parent label. */
.has-submenu summary::after {
  content: " \25BC";
  font-size: 0.75em;
  margin-left: 4px;
}

.has-submenu details[open] summary::after {
  content: " \25B2";
}

.submenu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 200px;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--nav-bg);
  border: 1px solid var(--nav-bg-hover);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  z-index: 1000;
}

.submenu a {
  display: block;
  padding: 10px 16px;
  color: var(--nav-text);
  text-decoration: none;
  white-space: nowrap;
}

/* Subtle rules separate desktop submenu entries without adding spacing. */
.submenu > li + li > a {
  box-shadow: inset 0 1px rgb(255 255 255 / 12%);
}

.submenu a:hover,
.submenu a:focus-visible {
  background: var(--nav-bg-hover);
  color: #ffffff;
  outline: none;
}

/* Mobile toggle button: hidden on desktop, shown at 1023px and below. */
.mobile-menu-toggle {
  display: none;
}

/* --- Main content surface --------------------------------------------------- */
main.site-shell {
  margin-top: var(--content-gap);  /* blank space between menu and content */
  padding: 24px 28px 28px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
}

/* --- Typography ------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  color: var(--heading);
  font-weight: 500;
}

h1 {
  margin: 0 0 14px;
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  margin: 1.4em 0 0.6em;
  font-size: 21px;
}

h3 {
  margin: 1.25em 0 0.5em;
  font-size: 18px;
}

/* Share the original site's compact section-heading treatment. */
h4 {
  margin: 15px 0;
  color: #666666;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

/* The source uses larger download links with more generous line spacing. */
.download-links {
  margin: 10px 0;
  padding-left: 2em;
  list-style-type: square;
}

.download-links li + li {
  margin-top: 0;
}

.download-links a {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.8;
}

p {
  margin: 0 0 0.9em;
}

ul,
ol {
  margin: 0 0 1em 1.4em;
}

/* Keep the requirements outline compact at every nesting level. */
h4:has(+ .requirements-list) {
  margin-bottom: 6px;
}

.requirements-list,
.requirements-list ul {
  margin-inline-start: 0;
  padding-inline-start: 2em;
  list-style-type: square;
}

.requirements-list li::marker,
.download-links li::marker {
  color: var(--text-muted);
}

/* Scope list-item spacing to the main content only: a global rule here
   would leak into the navigation and offset every menu item except the
   first one, breaking their vertical alignment. */
main li + li {
  margin-top: 0.25em;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  color: var(--link-hover);
  text-decoration: underline;
}

/* --- Article (page) content -------------------------------------------------- */
.page {
  margin-bottom: 16px;
}

/* Multi-entry pages (currently only Home): entries are separated by the
   same blank space as between the menu and the content. (Sibling block
   margins collapse, so the effective gap is exactly --content-gap.) */
.page + .page {
  margin-top: var(--content-gap);
}

/* Let the container padding alone set the gap after the final article. */
.page:last-child {
  margin-bottom: 0;
}

/* Do not add a trailing paragraph/list margin to the gap between stories. */
.page > .content-body > :last-child {
  margin-bottom: 0;
}

/* Low-emphasis compact metadata (Last Updated / Published). */
.article-meta {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.4;
}

.article-meta div {
  display: flex;
  gap: 0.35em;
}

.article-meta dt {
  font-weight: 600;
}

.article-meta dd {
  margin: 0;
}

.content-body {
  color: var(--text);
  /* Allow download checksums and filenames to fit narrow screens. */
  overflow-wrap: anywhere;
  /* Contain the source article's floated screenshots within its content. */
  display: flow-root;
}

/* Match the source articles' prose alignment; headings and lists stay left-aligned. */
.content-body p {
  text-align: justify;
}

/* A CSS-drawn information badge keeps this decorative icon self-contained. */
.info-note {
  color: #666666;
  position: relative;
  padding-left: 24px;
  font-size: 0.88em;
  line-height: 20px;
}

.info-note::before {
  content: "";
  content: "i" / "";
  position: absolute;
  top: 3px;
  left: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--highlight-bg);
  color: #ffffff;
  font: italic 12px/14px Georgia, "Times New Roman", serif;
  text-align: center;
}

/* Share the compact highlight between company labels and license titles. */
.about-us-content p > strong:first-child,
.content-label {
  font-weight: 500;
  font-style: normal;
  padding: 0 0.5em;
  border-radius: var(--radius);
  background: var(--highlight-bg);
  color: #ffffff;
}

/* Match the original site's light gray panels around each license option. */
.license-option {
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 8px;
  background: #f2f2f2;
  color: #666666;
}

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

/* Preserve the source content's image placement without inline styling. */
.content-image-left {
  float: left;
  max-width: calc(100% - 16px);
  margin: 0 16px 12px 0;
}

.content-image-right {
  float: right;
  max-width: calc(100% - 16px);
  margin: 0 0 12px 16px;
}

/* Match the Downloads illustrations' original float spacing. */
.download-image {
  margin-bottom: 0;
  margin-left: 4px;
}

/* --- Contact form ----------------------------------------------------------- */
.contact-form {
  max-width: 600px;
}

.form-field {
  margin-bottom: 16px;
}

.form-field label,
.form-field > span {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
}

.contact-form input,
.contact-form textarea {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.contact-form textarea {
  resize: vertical;
  min-height: 150px;
}

.contact-form button {
  padding: 8px 16px;
  border: 1px solid var(--nav-bg);
  border-radius: var(--radius);
  background: var(--nav-bg);
  color: var(--nav-text);
  font: inherit;
  cursor: pointer;
}

.contact-form button:hover:enabled {
  background: var(--nav-bg-hover);
}

.contact-form button:disabled {
  opacity: 0.6;
  cursor: default;
}

.contact-form :focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

#captcha-status,
#contact-status {
  margin-top: 10px;
  text-align: left;
}

/* --- Footer -------------------------------------------------------------------- */
.site-footer {
  text-align: center;
  padding: 18px 0 24px;
  color: var(--text-muted);
  font-size: 12.5px;
}

/* --- Skip link (accessibility) -------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus-visible {
  position: static;
  margin: 8px 0 0 16px;
  padding: 8px 14px;
  background: var(--link);
  color: #ffffff;
  z-index: 2000;
}

/* Breakpoints must be literal values: var() is not supported in media conditions.
 * When changing them, update every matching query and comment here, plus AGENTS.md,
 * README.md and the responsive guidance/examples in afterwarp_style_guide.md.
 * Search all four files for both old values and related desktop boundary values.
 */
/* --- Mobile: collapsed navigation (1023px and below) ----------------------------- */
@media (max-width: 1023px) {
  .site-nav {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
  }

  .mobile-menu-toggle {
    grid-column: 2;
    grid-row: 1;
    display: block;
    min-height: 44px;
    padding: 0 16px;
    border: none;
    background: transparent;
    color: var(--nav-text);
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
  }

  .mobile-menu-toggle:hover {
    background: var(--nav-bg-hover);
  }

  /* Hidden until the toggle adds .nav-open (script.js). */
  .nav-list {
    grid-column: 1 / -1;
    grid-row: 2;
    display: none;
  }

  .site-nav.nav-open .nav-list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: auto;
  }

  .nav-list > li > a,
  .nav-list > li > details > summary {
    min-height: 44px;
    padding: 0 16px;
    box-shadow: none;
  }

  /* Submenu stays visibly subordinate: in-flow, indented, no dropdown box. */
  .submenu {
    position: static;
    width: auto;
    border: none;
    box-shadow: none;
    padding: 0;
    background: rgba(255, 255, 255, 0.05);
  }

  .submenu a {
    padding: 10px 16px 10px 32px;
  }

  .submenu > li + li > a {
    box-shadow: none;
  }
}

/* Preserve the content canvas gutters independently of navigation collapse. */
@media (max-width: 759px) {
  :root {
    --page-gutter: 16px;
  }
}

/* --- Small phones: tighter padding and headings (560px and below) ----------------- */
@media (max-width: 560px) {
  /* Keep imported screenshots from squeezing article text into narrow strips. */
  .content-image-left,
  .content-image-right {
    float: none;
    display: block;
    max-width: 100%;
    margin: 0 0 12px;
  }

  /* Opt-in for decorative images that can be omitted in the compact layout. */
  .hide-on-mobile {
    display: none;
  }

  main.site-shell {
    width: 100%;
    margin-top: 0;
    padding: 18px 16px 22px;
    border-left: 0;
    border-right: 0;
  }

  h1 {
    font-size: 23px;
  }

  h2 {
    font-size: 19px;
  }
}

/* --- Reduced motion ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}