/* ---------------------------------------------
   Low Horse, shared by every *.lowhorse.app page
   that isn't a game. Paper and ink.
   --------------------------------------------- */

@font-face {
  font-family: "Departure Mono";
  src: url("/shared/fonts/DepartureMono-Regular.woff2") format("woff2");
  font-display: swap;
}

:root {
  /* night is the default */
  --paper: #101208;
  --ink: #ebe7d8;
  --ink-soft: #9d9682;
  --ink-far: color-mix(in srgb, var(--ink) 58%, var(--paper));
  --line: #2b2e1d;
  --accent: #ff6b45;
  --iris: #050603;
  --grain-opacity: 0.22;

  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-body: "Space Grotesk", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Departure Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --paper: #f5f1e6;
  --ink: #211d12;
  --ink-soft: #6f6754;
  --line: #ddd5c2;
  --accent: #d94e26;
  --iris: #14120b;
  --grain-opacity: 0.28;
  color-scheme: light;
}

* { box-sizing: border-box; }

/* galleries park slides off-screen; never let them widen the page */
html { overflow-x: clip; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 200ms ease, color 200ms ease;
}

/* paper grain over everything, ink included */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .41  0 0 0 0 .33  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

::selection { background: var(--accent); color: var(--paper); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- logo ---------- */

.top {
  position: relative;
  padding: clamp(22px, 5vh, 56px) 16px 0;
  text-align: center;
}

.logo {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(26px, 3.6vw, 42px);
  line-height: 1;
  letter-spacing: 0.36em;
  margin-right: -0.36em; /* tracking hangs off the end; pull it back to true center */
  white-space: nowrap;
}
.logo span + span { margin-left: 0.2em; }
/* The logo is the way home, so it reads as a link: a rule under it that
   turns accent on hover, and on other pages an arrow pointing back. */
.logo a {
  position: relative;
  color: inherit;
  text-decoration: none;
  padding-bottom: 0.16em;
  background: linear-gradient(var(--ink-soft), var(--ink-soft)) left bottom / calc(100% - 0.36em) 2px no-repeat;
  transition: color 160ms ease, background-size 160ms ease;
}
.logo a:hover { color: var(--accent); background-image: linear-gradient(var(--accent), var(--accent)); }
.logo a[data-home]::before {
  content: "\2190";
  position: absolute;
  right: 100%;
  top: 50%;
  margin-right: 0.6em;
  font-size: 0.8em;
  letter-spacing: 0;
  color: var(--ink-soft);
  transform: translateY(-60%);
  transition: transform 160ms ease, color 160ms ease;
}
.logo a[data-home]:hover::before { color: var(--accent); transform: translate(-4px, -60%); }

/* ---------- social links ---------- */

.social {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--ink-soft);
  text-decoration: none;
}
.social svg { width: 14px; height: 14px; }
.social:hover { color: var(--ink); }

/* ---------- light / dark ---------- */

/* While the sun and moon trade places, colors ease instead of snapping. */
html.theme-shift *,
html.theme-shift *::before,
html.theme-shift *::after {
  transition: background-color 700ms ease, color 700ms ease, border-color 700ms ease,
    fill 700ms ease, stroke 700ms ease, opacity 700ms ease !important;
}

/* The sky sits behind the page, and nothing shows below the horizon. */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.sky svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  overflow: visible;
  will-change: transform;
}

.theme-toggle {
  position: absolute;
  top: clamp(14px, 3vh, 28px);
  right: 16px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  z-index: 6;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle svg { width: 16px; height: 16px; }
