/* Shared Asphyre palette and centered article canvas. */
:root {
  --page-width: 980px;
  --page-gutter: 24px;
  --page-bg: #dedede;
  --surface: #fff;
  --text: #4d4d4d;
  --text-muted: #666;
  --heading: #4b4b4b;
  --link: #2874ac;
  --link-hover: #1f73a8;
  --border: #c5c5c5;
  --border-soft: #d7d7d7;
  --nav-bg: #2a5c81;
  --nav-bg-hover: #214967;
  --nav-bg-current: #245271;
  --nav-text: #fff;
  --radius: 2px;
  --content-gap: 24px;
}

/* --- 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 Neue", Arial, Helvetica, 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;
}

/* The shortcut strip spans the viewport. The logo and primary menu share the content canvas. */
.shortcut-bar {
  background: var(--nav-bg);
  border-bottom: 1px solid #214967;
}

.shortcut-bar ul {
  display: flex;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0;
  margin-block: 0;
  list-style: none;
}

.shortcut-bar a {
  display: block;
  margin: 6px 14px 6px 0;
  padding-right: 14px;
  border-right: 1px solid #467393;
  color: #f4f4f4;
  font-size: 13px;
}

.header-row {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 24px;
  margin-top: 12px;
}

.logo img {
  display: block;
}

.site-nav {
  flex: 1;
  border: 1px solid #528ab4;
  box-shadow: 0 1px 5px rgb(0 0 0 / 30%);
  background: linear-gradient(#3577a9, #2a5c81);
  border-radius: var(--radius);
}

.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;
}

.nav-list > li > a,
.nav-list > li > details > summary {
  display: flex;
  align-items: center;
  min-height: 38px;
  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 parent when applicable.
   Keep specificity low so hover and keyboard focus remain visible. */
.nav-list :where(a[aria-current], details:has(a[aria-current]) > 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);
}

.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: max-content;
  min-width: 180px;
  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;
}

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

.site-header :focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -3px;
}

.logo:focus-visible {
  outline-offset: 2px;
}

/* --- 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 {
  font-family: Verdana, Tahoma, Geneva, sans-serif;
  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;
}

:is(h1, h2):has(+ .article-meta) {
  margin-bottom: 9px;
}

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

p {
  margin: 0 0 0.9em;
}

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

.content-body :is(h2, h3, h4):has(+ ul) {
  margin-bottom: 6px;
}

.game-downloads-heading {
  margin-bottom: 6px;
}

.game-downloads-heading + h3 {
  margin-top: 0;
}

.game-downloads-heading + h3 + ul {
  margin-bottom: 12px;
}

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

.content-body strong + br + ul {
  margin-top: 6px;
}

.content-body ul > 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;
}

/* Preserve source creation and revision dates in reading order. */
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  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;
}

.article-note {
  margin: 1em 0 12px;
  padding: 10px 14px;
  border-left: 3px solid var(--nav-bg);
  background: #f3f6f8;
}

.article-note + * {
  margin-top: 0;
}

.project-notice {
  margin: 0 0 18px;
}

.project-notice p {
  margin: 0;
}

.project-notice p + p {
  margin-top: 4px;
}

.screenshots {
  --thumb-width: 128px;
  --thumb-gap: 8px;
  max-width: calc(5 * var(--thumb-width) + 4 * var(--thumb-gap));
  display: flex;
  flex-wrap: wrap;
  gap: var(--thumb-gap);
}

.screenshots img {
  width: var(--thumb-width);
}

.screenshots img,
.poster img {
  display: block;
}

.poster {
  width: fit-content;
}

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

/* --- 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 {
  left: 16px;
  top: 8px;
  padding: 8px 14px;
  background: var(--link);
  color: #ffffff;
  z-index: 2000;
}

/* Keep these literal boundaries in sync with README.md and AGENTS.md. */
@media (max-width: 1023px) {
  .header-row {
    display: block;
    min-height: 70px;
  }

  .logo {
    position: absolute;
    top: 0;
    left: 0;
    max-width: calc(100% - 104px);
  }

  .site-nav {
    padding-top: 12px;
    border: 0;
    box-shadow: none;
    background: none;
  }

  .mobile-menu-toggle {
    display: block;
    margin-left: auto;
    min-height: 44px;
    padding-inline: 16px;
    border: 0;
    border-radius: var(--radius);
    color: var(--nav-text);
    background: linear-gradient(#3577a9, #2a5c81);
    font: inherit;
    cursor: pointer;
  }

  .nav-list {
    display: none;
  }

  .site-nav.nav-open .nav-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 16px;
    background: var(--nav-bg);
  }

  .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;
  }

  .hide-on-mobile {
    display: none !important;
  }

  .header-row {
    margin-bottom: 16px;
  }

  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;
  }
}