/* Shared styles for xorway.com.*/

:root {
  --bg: #2d2e2c;
  --fg: #e8e8e6;
  --muted: #a3a39e;
  --accent: #6aa6ff;
  --accent-dim: rgba(106, 166, 255, 0.3);

  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Consolas,
    "DejaVu Sans Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;

  --measure: 44rem;       /* reduced width */
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
}

/* ---- Header / navigation ------------------------------------------------ */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1.1rem 2rem;

  /* Ensure the header has the same height on all pages, to avoid the "jumping
     around" effect */
  min-height: calc(36px + 2 * 1.1rem);

  /* A dashed ANSI-style rule under the header */
  background-image: repeating-linear-gradient(
    to right,
    var(--accent-dim) 0 10px,
    transparent 10px 16px
  );
  background-position: bottom;
  background-size: 100% 1px;
  background-repeat: no-repeat;
}

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.logo img {
  height: 36px;
  width: auto;
  display: block;

  /* Deliberately avoid smoothing out the edges of the ANSI logo */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.logo:hover img {
  opacity: 0.85;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-family: var(--mono);
  font-size: 0.95rem;

  /* Keep the nav right-aligned even on pages without a logo (e.g. index). */
  margin-left: auto;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

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

/* ---- Content pages ------------------------------------------------------ */

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.page h1 {
  font-family: var(--mono);
  font-size: 2rem;
  line-height: 1.25;
  color: var(--accent);
  margin: 0 0 1.5rem;
}

.page h2 {
  font-family: var(--mono);
  font-size: 1.25rem;
  color: var(--fg);
  margin: 2.5rem 0 0.75rem;
}

.page p {
  margin: 0 0 1.2rem;
}

.page .lead {
  font-size: 1.2rem;
  color: var(--muted);
}

.page a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

.page a:hover {
  color: #9cc4ff;
}

.page code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.07);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

.page .cta {
  margin-top: 2rem;
}

.button {
  display: inline-block;
  font-family: var(--mono);
  text-decoration: none;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  padding: 0.6rem 1.1rem;
  border-radius: 4px;
}

.button:hover {
  border-color: var(--accent);
  background: rgba(106, 166, 255, 0.08);
}

/* ---- Footer ------------------------------------------------------------- */

.site-footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem 1.5rem 2.5rem;
  border-top: 1px solid var(--accent-dim);
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0 0 0.6rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

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

.site-footer .sep {
  margin: 0 0.5rem;
  opacity: 0.6;
}

/* ---- Small screens ------------------------------------------------------ */

@media (max-width: 40rem) {
  body {
    font-size: 16px;
  }

  .site-header {
    padding: 1rem 1.25rem;
  }

  .page {
    padding: 2rem 1.25rem 3rem;
  }

  .page h1 {
    font-size: 1.6rem;
  }
}

/* Avoid wrapping the header onto two lines. Instead, keep nav below the logo,
   and ensure both of them are left-aligned. */
@media (max-width: 52rem) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .site-nav {
    margin-left: 0;
  }
}

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