/*
 * marspuntocom.com: the game selector.
 * Static, no JavaScript, no web fonts, no third-party requests. The CSP (.htaccess) allows styles from
 * this file only: never add a style="" attribute or a <style> block to a page.
 */

:root {
  color-scheme: light dark;

  --paper: #f7f5f0;
  --ink: #1b1b1f;
  --muted: #5f5f68;
  --hairline: #e3dfd6;
  --accent: #b4532a;
  --surface: #fdfcf9;
  --shadow-rest: 0 1px 2px rgb(27 27 31 / 0.04);
  --shadow-lift: 0 1px 2px rgb(27 27 31 / 0.04), 0 18px 40px -18px rgb(27 27 31 / 0.22);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(20px, 5vw, 56px);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121214;
    --ink: #ecebe7;
    --muted: #a2a09a;
    --hairline: #2a2a2e;
    --accent: #e07a4f;
    --surface: #18181b;
    --shadow-rest: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-lift: 0 1px 2px rgb(0 0 0 / 0.3), 0 18px 40px -18px rgb(0 0 0 / 0.7);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

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

/* ─── Page frame ─────────────────────────────────────────────────────────────────────────────── */

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: calc(1100px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header {
  padding-block: clamp(56px, 11vh, 128px) clamp(36px, 6vh, 64px);
}

.wordmark {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.75rem, 2.1rem + 2.4vw, 4rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.015em;
}

/* The one accent in the header: a small planet after the name. */
.wordmark::after {
  content: "";
  display: inline-block;
  width: 0.15em;
  height: 0.15em;
  margin-left: 0.07em;
  border-radius: 50%;
  background: var(--accent);
}

.wordmark a {
  text-decoration: none;
}

.tagline {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 1.0625rem;
  letter-spacing: 0.005em;
}

main {
  flex: 1 0 auto;
}

.site-footer {
  margin-top: clamp(64px, 12vh, 128px);
  padding-block: 24px 40px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}

/* ─── Project cards ──────────────────────────────────────────────────────────────────────────── */

/* auto-fit, not auto-fill: empty tracks collapse, so a row with fewer cards than fit shares the whole width
   (a lone card spans it at every width, two cards on a desktop take half each). */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: clamp(20px, 3vw, 32px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-rest);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lift);
  }
}

/* The whole card is one link: the title's anchor stretches over it. */
.card-title a {
  text-decoration: none;
}

.card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

/* The ring moves from the title to the whole card, only where :has() can draw it: without :has() the
   link keeps the global :focus-visible outline. */
@supports selector(:has(a)) {
  .card-title a:focus-visible {
    outline: none;
  }
}

.card:has(.card-title a:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Covers: 16:9. A project without a screenshot gets a gradient and a line mark. */
.cover {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  color: #f7f5f0;
  background: #7a3420;
}

.cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover--moba {
  background:
    radial-gradient(120% 95% at 12% 8%, rgb(232 154 108 / 0.55) 0%, rgb(232 154 108 / 0) 58%),
    radial-gradient(90% 80% at 100% 100%, rgb(26 18 22 / 0.65) 0%, rgb(26 18 22 / 0) 70%),
    linear-gradient(135deg, #c0602f 0%, #93401f 48%, #4a2219 100%);
}

@media (prefers-color-scheme: dark) {
  .cover--moba {
    filter: brightness(0.88) saturate(0.95);
  }
}

.cover-mark {
  width: clamp(112px, 32%, 200px);
  height: auto;
  overflow: visible;
}

.mark-river {
  stroke-width: 6;
  opacity: 0.22;
}

.mark-lane {
  stroke-width: 2.5;
  opacity: 0.92;
}

.mark-towers,
.mark-base {
  fill: currentColor;
  stroke: none;
}

.mark-towers {
  opacity: 0.85;
}

.mark-ring {
  stroke-width: 1.25;
  opacity: 0.45;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: clamp(20px, 2.4vw, 28px);
}

.kicker {
  margin: 0 0 0.6rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card-title {
  margin: 0 0 0.6rem;
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.005em;
}

.card-text {
  margin: 0 0 1.5rem;
  max-width: 38em;
}

.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline);
}

.card-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* The meta wraps between its items, never inside one ("sign-in"). */
.card-meta span {
  white-space: nowrap;
}

.card-open {
  margin: 0;
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Arrows are drawn, not typed: a font's → differs in size and height from system to system. */
.arrow {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.14em;
}

.card-open .arrow {
  margin-left: 0.2em;
}

.back .arrow {
  margin-right: 0.4em;
  vertical-align: 0;
}

/* A lone card on a wide screen is a featured card: cover beside the text (auto-fit already gives it the row). */
@media (min-width: 900px) {
  .projects > .card:only-child {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }

  /* The cover fills the card's height: 16:9 at least, a little taller when the text needs it. */
  .projects > .card:only-child .cover {
    aspect-ratio: auto;
  }

  .projects > .card:only-child .cover::before {
    content: "";
    grid-area: 1 / 1;
    padding-top: 56.25%;
  }

  .projects > .card:only-child .cover > * {
    grid-area: 1 / 1;
  }

  .projects > .card:only-child .card-body {
    justify-content: center;
    padding: clamp(32px, 4vw, 52px);
  }

  .projects > .card:only-child .card-title {
    font-size: 2.375rem;
  }

  .projects > .card:only-child .card-text {
    font-size: 1.0625rem;
  }

  .projects > .card:only-child .card-foot {
    margin-top: 0.5rem;
  }
}

/* ─── 404 ────────────────────────────────────────────────────────────────────────────────────── */

.notfound {
  max-width: 34rem;
}

.notfound h1 {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: clamp(2rem, 1.6rem + 1.6vw, 2.75rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.notfound .lede {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 1.0625rem;
}

.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.back:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }

  .card:hover {
    transform: none;
  }
}
