/* Shared styles for every page on puddleduck.games.
   Lives at /site.css (not /assets/) so it is not caught by the 7-day cache rule in _headers:
   edits show up on the next page load instead of up to a week later. */

@font-face { font-family: "Montserrat"; font-weight: 600; font-style: normal; font-display: swap; src: url("/assets/fonts/montserrat-600.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-style: normal; font-display: swap; src: url("/assets/fonts/montserrat-700.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 800; font-style: normal; font-display: swap; src: url("/assets/fonts/montserrat-800.woff2") format("woff2"); }

:root {
  --bg: #000;
  --fg: #fff;
  --accent: #75ceff;
  --border: #255f7e;
  --muted: #7f7f7f;
  --track: 0.1em;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.4;
  letter-spacing: var(--track);
}

a { color: inherit; }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

/* ---------- top-right social icons ---------- */
.social {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 48px;
  padding: 40px 52px 0;
}
.social a { display: block; line-height: 0; transition: opacity .15s; }
.social a:hover { opacity: .75; }
.social img { display: block; }
.social .nav-text {
  line-height: 1;
  font-weight: 800;
  font-size: 1.25rem;
  text-transform: uppercase;
  text-decoration: none;
}
.social .nav-text:hover { opacity: 1; color: var(--accent); }
.social .nav-text[aria-current="page"] { color: var(--accent); }

/* ---------- logo ----------
   Source GIF is 800x800 pixel art on an 8px grid; the art sits in a 512x512 window
   at (144,120). The wrapper crops to that window. 320px wide = 0.625 scale, so every
   art pixel becomes exactly 5 CSS px (4px at 256, 2px at 128) - crisp with pixelated rendering. */
.logo {
  --size: 320px;
  width: var(--size);
  aspect-ratio: 1;
  margin: 56px auto 40px;
  overflow: hidden;
}
.logo a { display: block; }
.logo img {
  display: block;
  width: 156.25%;              /* 800 / 512 */
  height: auto;
  max-width: none;
  margin-left: -28.125%;       /* 144 / 512 */
  margin-top: -23.4375%;       /* 120 / 512 (margin % is relative to width) */
  image-rendering: pixelated;
}
.logo img.replayable { cursor: pointer; }  /* set by logo.js once the intro has finished */
/* Smaller logo on inner pages (devlog), links back home */
.logo.small { --size: 128px; margin: 8px auto 40px; }

/* ---------- content column ---------- */
main {
  width: min(770px, 100% - 32px);
  margin: 0 auto;
  padding-bottom: 96px;
}

h1, h2 {
  margin: 0;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: var(--track);
  line-height: 1.15;
}
h1 { font-size: clamp(2rem, 6vw, 3rem); margin-bottom: 18px; }

.about p { margin: 0; }

/* ---------- game cards ---------- */
.games {
  list-style: none;
  margin: 64px 0 0;
  padding: 0;
  display: grid;
  gap: 48px;
}
.card {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 28px 40px 28px 28px;
  border: 3px solid var(--border);
  border-radius: 16px;
}
.card .thumb {
  flex: none;
  width: 110px;
  height: 110px;
  border-radius: 14px;
  object-fit: cover;
  background: #d9d9d9;
}
.card .thumb.pixel { image-rendering: pixelated; }
.card h2 { font-size: 1.5rem; margin-bottom: 10px; }
.card h2 a { text-decoration-thickness: 3px; text-underline-offset: 4px; }
.card h2 a:hover { color: #fff; }
.card .soon { color: var(--muted); white-space: nowrap; }
.card p { margin: 0; }

/* ---------- devlog list (/devlog/ index) ---------- */
.devlog { margin-top: 76px; }
.posts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}
.posts a {
  display: block;
  padding: 20px 24px;
  border: 3px solid var(--border);
  border-radius: 16px;
  text-decoration: none;
  transition: border-color .15s;
}
.posts a:hover { border-color: var(--accent); }
.posts time, .post-meta { display: block; color: var(--muted); font-size: .875rem; }
.posts .post-title {
  display: block;
  margin: 4px 0 6px;
  color: var(--accent);
  font-weight: 800;
  font-size: 1.25rem;
  text-transform: uppercase;
  line-height: 1.2;
}
.posts p { margin: 0; }
.devlog .empty { margin: 0; color: var(--muted); }
.back:hover { color: var(--accent); }

/* ---------- single devlog post ---------- */
.back { display: inline-block; margin-bottom: 32px; text-underline-offset: 3px; }
.post h1 { margin-bottom: 8px; }
.post-meta { margin: 0 0 40px; }
/* Long-form text: tighter tracking and looser leading than the headline style */
.post-body { letter-spacing: .03em; line-height: 1.65; font-weight: 600; }
.post-body > * { margin: 0 0 1.25em; }
.post-body h2 { font-size: 1.5rem; margin: 2em 0 .75em; }
.post-body h3 { font-size: 1.2rem; margin: 1.75em 0 .5em; color: var(--accent); }
.post-body a { color: var(--accent); text-underline-offset: 3px; }
.post-body a:hover { color: #fff; }
.post-body ul, .post-body ol { padding-left: 1.5em; }
.post-body li + li { margin-top: .4em; }
.post-body img, .post-body video {
  display: block;
  max-width: 100%;
  height: auto;
  border: 3px solid var(--border);
  border-radius: 12px;
  background: #111;
}
.post-body .pixel { image-rendering: pixelated; }
.post-body figure { margin: 2em 0; }
.post-body figcaption { margin-top: 10px; color: var(--muted); font-size: .875rem; }
.post-body blockquote {
  margin: 1.5em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: #ddd;
}
.post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  letter-spacing: 0;
  padding: .1em .35em;
  background: #10232e;
  border-radius: 4px;
}
.post-body pre {
  overflow-x: auto;
  padding: 16px 20px;
  background: #10232e;
  border-radius: 12px;
  line-height: 1.5;
}
.post-body pre code { padding: 0; background: none; }
.post-body hr { border: 0; border-top: 3px solid var(--border); margin: 2.5em 0; }

/* ---------- contact ---------- */
.contact { margin-top: 76px; }
.contact h2 { font-size: 1.75rem; margin-bottom: 8px; }
.contact a { text-underline-offset: 3px; }
.contact a:hover { color: var(--accent); }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .social { gap: 28px; padding: 20px 20px 0; }
  .social .steam img { width: 34px; height: 34px; }
  .social .mail img { width: 34px; height: 27px; }
  .logo { --size: 256px; margin: 32px auto 32px; }
  .logo.small { --size: 128px; margin: 8px auto 28px; }  /* keep 128: 96 would be 1.5px per art pixel */
  .games { margin-top: 48px; gap: 32px; }
  .card { flex-direction: column; align-items: flex-start; gap: 20px; padding: 24px; }
  .card h2 { font-size: 1.375rem; }
  .devlog { margin-top: 56px; }
  .posts a { padding: 16px 18px; }
  .posts .post-title { font-size: 1.1rem; }
  .contact { margin-top: 56px; }
  .contact h2 { font-size: 1.375rem; }
}

@media (prefers-reduced-motion: reduce) {
  .social a, .posts a { transition: none; }
}
