/* Ghostherdr site styles. Loaded after Pico, which supplies the reset, grid,
   container, nav, button and card behaviour. This file sets the theme tokens
   Pico reads and adds the handful of page-specific layouts. */

/* ---------- Fonts (self-hosted, copied from npm at build time) ---------- */

@font-face {
  font-family: "Spectral";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("../fonts/spectral-latin-300-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Spectral";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/spectral-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
}

/* ---------- Tokens ---------- */

:root {
  /* Palette, taken from the concept art and the app window. */
  --night: #070a12;       /* page */
  --dusk: #0f1422;        /* raised surfaces */
  --line: #222a3e;        /* rules and borders */
  --mist: #a7b1c8;        /* body text */
  --ghostlight: #eef2fb;  /* headings, emphasis */
  --thread: #f2c27b;      /* the glowing thread: primary actions */
  --thread-hot: #ffdcaa;
  --tab-blue: #8fb0f2;    /* the app's active-tab colour: links */

  --font-display: "Spectral", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --header-h: 4.5rem;
  --measure: 36em;

  --pico-font-family-sans-serif: var(--font-body);
  --pico-font-family-monospace: var(--font-mono);
  --pico-font-family: var(--font-body);
  --pico-line-height: 1.6;
  --pico-border-radius: 0.5rem;
}

/* Pico keeps growing the root size up to 131%; stop at 18px. */
@media (min-width: 1024px) {
  :root {
    --pico-font-size: 112.5%;
  }
}

[data-theme="dark"] {
  --pico-background-color: var(--night);
  --pico-color: var(--mist);
  --pico-muted-color: #7d879e;
  --pico-muted-border-color: var(--line);
  --pico-text-selection-color: rgba(242, 194, 123, 0.3);

  --pico-h1-color: var(--ghostlight);
  --pico-h2-color: var(--ghostlight);
  --pico-h3-color: var(--ghostlight);
  --pico-h4-color: var(--ghostlight);

  /* Links are tab-blue; filled buttons are thread-amber. */
  --pico-primary: var(--tab-blue);
  --pico-primary-underline: rgba(143, 176, 242, 0.45);
  --pico-primary-hover: #b9cffa;
  --pico-primary-hover-underline: #b9cffa;
  --pico-primary-background: var(--thread);
  --pico-primary-border: var(--thread);
  --pico-primary-hover-background: var(--thread-hot);
  --pico-primary-hover-border: var(--thread-hot);
  --pico-primary-focus: rgba(242, 194, 123, 0.55);
  --pico-primary-inverse: #1a1206;

  --pico-card-background-color: var(--dusk);
  --pico-card-border-color: var(--line);
  --pico-card-sectioning-background-color: var(--dusk);
  --pico-card-box-shadow: none;

  --pico-code-background-color: var(--dusk);
  --pico-code-color: var(--ghostlight);
  --pico-code-kbd-background-color: var(--dusk);
  --pico-code-kbd-color: var(--ghostlight);
}

/* ---------- Base ---------- */

body {
  background: var(--night);
  overflow-x: clip;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.5rem, 1.5rem + 4.2vw, 4.5rem);
  line-height: 1.04;
  letter-spacing: -0.022em;
}

h2 {
  font-size: clamp(1.9rem, 1.4rem + 1.9vw, 2.75rem);
  line-height: 1.1;
}

h3 {
  font-size: clamp(1.45rem, 1.2rem + 0.9vw, 1.9rem);
  line-height: 1.15;
}

p,
li {
  text-wrap: pretty;
}

picture {
  display: block;
}

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

kbd {
  padding: 0.1em 0.4em;
  border: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 0.85em;
  font-weight: 500;
  line-height: 1.3;
}

/* Pico pads header, main and footer; the hero art has to start at the very top. */
body > header,
body > main {
  padding-block: 0;
}

:focus-visible {
  outline: 2px solid var(--thread-hot);
  outline-offset: 3px;
}

main > section {
  margin-block: clamp(4.5rem, 9vw, 8rem);
}

.lede {
  max-width: var(--measure);
  font-size: 1.2rem;
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.5rem 1rem;
  border-radius: var(--pico-border-radius);
  background: var(--thread);
  color: #1a1206;
}

.skip-link:focus {
  top: 1rem;
}

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

.site-header {
  position: relative;
  z-index: 2;
}

.site-header nav {
  height: var(--header-h);
  align-items: center;
}

.site-header li {
  padding-block: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  color: var(--ghostlight);
  text-decoration: none;
  text-shadow: 0 1px 12px var(--night);
}

.brand img {
  width: 2.25rem;
  height: 2.25rem;
}

.nav-link {
  color: var(--ghostlight);
  text-decoration: none;
  text-shadow: 0 1px 12px var(--night);
  white-space: nowrap;
}

/* Small phones: tighten the header so the brand and both links stay on one row. */
@media (max-width: 26rem) {
  .brand {
    gap: 0.5rem;
    font-size: 1.15rem;
  }

  .brand img {
    width: 2rem;
    height: 2rem;
  }

  .nav-link {
    font-size: 0.9rem;
  }
}

@media (max-width: 21.5rem) {
  .site-header li:has(.nav-link[href*="#"]) {
    display: none;
  }
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--thread);
}

/* ---------- Hero ---------- */

.hero {
  --art-h: clamp(21rem, 60vh, 38rem);
  --overlap: clamp(4.5rem, 13vh, 8rem);
  position: relative;
  isolation: isolate;
  margin-block: 0;
}

.hero-art {
  position: absolute;
  z-index: -1;
  top: calc(-1 * var(--header-h));
  left: 50%;
  width: min(100%, 90rem);
  height: var(--art-h);
  translate: -50% 0;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 0, #000 8.5rem, #000 50%, transparent 98%);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 0, #000 8.5rem, #000 50%, transparent 98%);
}

.hero-art picture,
.hero-art img {
  width: 100%;
  height: 100%;
}

.hero-art img {
  object-fit: cover;
  object-position: 28% 14%;
}

/* On very wide screens the art stops growing and its sides fade out too. */
@media (min-width: 90rem) {
  .hero-art {
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 0, #000 8.5rem, #000 50%, transparent 98%),
      linear-gradient(to right, transparent, #000 14%, #000 86%, transparent);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 0, #000 8.5rem, #000 50%, transparent 98%),
      linear-gradient(to right, transparent, #000 14%, #000 86%, transparent);
    mask-composite: intersect;
  }
}

.hero-copy {
  padding-top: calc(var(--art-h) - var(--header-h) - var(--overlap));
}

.hero-copy h1 {
  max-width: 13em;
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 28px var(--night);
}

.hero-copy .lede {
  margin-bottom: 2rem;
  text-shadow: 0 1px 14px var(--night);
}

/* ---------- Download buttons ---------- */

.download-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.download-buttons [role="button"],
.download-buttons button {
  width: auto;
  margin: 0;
  font-weight: 600;
}

.download-buttons .outline {
  --pico-color: var(--thread);
  --pico-border-color: var(--thread);
}

.download-buttons .outline:hover {
  --pico-color: var(--thread-hot);
  --pico-border-color: var(--thread-hot);
}

/* No link yet: a quiet placeholder instead of a dimmed call to action. */
.download-buttons button:disabled,
.builds button:disabled {
  --pico-background-color: transparent;
  --pico-border-color: var(--line);
  --pico-color: var(--pico-muted-color);
  opacity: 1;
  font-weight: 500;
}

@media (max-width: 30rem) {
  .download-buttons {
    display: grid;
  }
}

.download-note {
  font-size: 0.9rem;
  color: var(--pico-muted-color);
}

/* ---------- Product screenshot ---------- */

.window {
  width: 100%;
  filter: drop-shadow(0 1.5rem 3rem rgba(0, 0, 0, 0.6));
}

.product-shot {
  margin-top: clamp(3rem, 6vw, 5rem);
}

.product-shot figure {
  max-width: 72rem;
  margin-inline: auto;
}

figcaption {
  margin-top: 1rem;
  padding: 0;
  font-size: 0.9rem;
  color: var(--pico-muted-color);
}

.product-shot figcaption {
  text-align: center;
}

/* A whole window is unreadable at phone width, so show it larger and let it run off the right edge. */
@media (max-width: 767px) {
  .product-shot {
    overflow-x: clip;
  }

  .product-shot .window {
    width: 175%;
    max-width: none;
  }
}

/* ---------- What it does ---------- */

.features h2 {
  margin-bottom: 2rem;
}

.feature {
  display: grid;
  gap: 0.75rem 3rem;
  padding-block: 1.75rem;
  border-top: 1px solid var(--line);
}

.feature h3,
.feature p {
  margin: 0;
}

.feature p {
  max-width: var(--measure);
}

.feature p + p {
  margin-top: 0.75rem;
}

@media (min-width: 768px) {
  .feature {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    padding-block: 2.25rem;
  }
}

/* ---------- What's underneath: before and after ---------- */

.underneath-intro {
  max-width: var(--measure);
  margin-bottom: 2.5rem;
}

.before-after {
  display: grid;
  gap: 1.25rem;
  justify-items: center;
}

.before-after figure {
  width: 100%;
  margin: 0;
}

@media (min-width: 1024px) {
  /* Column widths follow each window's aspect ratio, so both end up the same height. */
  .before-after {
    grid-template-columns: minmax(0, 1.469fr) minmax(0, 1.639fr);
    gap: 2rem;
    align-items: start;
  }
}

/* ---------- If you already use ---------- */

.coming-from h2 {
  margin-bottom: 2rem;
}

.coming-from .grid {
  gap: 2rem 3rem;
}

.coming-from h3 {
  margin-bottom: 0.5rem;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--thread);
}

.coming-from p {
  margin: 0;
}

/* ---------- Download call ---------- */

.get-it {
  display: grid;
  gap: 1rem 3rem;
  align-items: center;
}

.get-it h2 {
  margin-bottom: 0.5rem;
}

.get-it-art,
.not-found img {
  width: min(100%, 22rem);
  -webkit-mask-image: radial-gradient(closest-side, #000 45%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 45%, transparent 100%);
}

@media (min-width: 768px) {
  .get-it {
    grid-template-columns: auto minmax(0, 1fr);
  }
}

/* ---------- Download page ---------- */

.page-head {
  margin-block: clamp(2.5rem, 6vw, 5rem) 0;
}

.page-head h1 {
  font-size: clamp(2.4rem, 1.6rem + 3.4vw, 4rem);
  margin-bottom: 1rem;
}

.platforms {
  margin-top: 2.5rem;
}

.platforms article {
  margin: 0;
  padding: 1.75rem;
  border: 1px solid var(--line);
}

.platforms h2 {
  font-size: 1.9rem;
  margin-bottom: 1.25rem;
}

.platforms h3 {
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
}

.builds {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
}

.builds li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0;
  list-style: none;
}

.builds [role="button"],
.builds button {
  width: auto;
  margin: 0;
  font-weight: 600;
}

.builds small,
.requirements {
  color: var(--pico-muted-color);
}

.requirements {
  font-size: 0.95rem;
}

/* site.js sets data-os on <html>; the visitor's own platform gets the brighter edge. */
[data-os="macos"] [data-os-panel="macos"],
[data-os="linux"] [data-os-panel="linux"] {
  border-color: rgba(242, 194, 123, 0.55);
}

.first-run ol {
  max-width: var(--measure);
  padding-left: 1.25rem;
}

.first-run li {
  margin-bottom: 0.75rem;
  padding-left: 0.35rem;
}

/* ---------- 404 ---------- */

.not-found {
  margin-top: clamp(2rem, 5vw, 4rem);
}

.not-found h1 {
  font-size: clamp(2.2rem, 1.6rem + 3vw, 3.5rem);
  margin-block: 1rem;
}

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

.site-footer {
  padding-block: 2.5rem 3rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--pico-muted-color);
}

.site-footer p {
  max-width: var(--measure);
  color: inherit;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0 0 1rem;
  padding: 0;
}

.footer-nav li {
  margin: 0;
  list-style: none;
}

.copyright {
  margin: 0;
}

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