/* jameskincaid.com: shared styles for every page.
   The rules behind these values live in CLAUDE.md. Change tokens here, not
   inside components. Fonts are self-hosted, so pages make no outside requests. */

@font-face {
  font-family: "Townie Pixel";
  src: url("/assets/fonts/townie-pixel.woff") format("woff");
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("/assets/fonts/lora.woff") format("woff");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("/assets/fonts/lora-italic.woff") format("woff");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

:root {
  /* color: an Austin evening */
  --night: #1E1A36;       /* page background */
  --dusk: #2B2550;        /* panels */
  --dusk-edge: #453C78;   /* pixel borders on panels */
  --dusk-hi: #3B3368;     /* tiles, quiet buttons */
  --shadow: #131026;      /* pixel drop shadows */
  --limestone: #F3E6CC;   /* main text */
  --limestone-dim: #C9BBA3; /* secondary text */
  --gold: #F7C55E;        /* links, highlights */
  --coral: #EE8059;       /* primary buttons */
  --coral-dark: #C9584A;
  --coral-lit: #F49A76;    /* primary button hover */
  --creek: #74B8B0;       /* focus rings */
  --oak: #8AA04A;

  /* type */
  --pixel: "Townie Pixel", "Lora", Georgia, serif;
  --serif: "Lora", "Iowan Old Style", Georgia, serif;

  /* spacing: everything sits on a 4px grid, the size of one art pixel */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  --measure: 40rem;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--night);
  color: var(--limestone);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
}

::selection { background: var(--gold); color: var(--night); }

a { color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
a:hover { color: var(--limestone); }
:focus-visible { outline: 3px solid var(--creek); outline-offset: 4px; }

img { max-width: 100%; }

/* ---------- pixel type: sizes are always multiples of 10px so pixels stay square */
.pixel, h1, h2, .brand, .site-nav, .button {
  font-family: var(--pixel);
  font-weight: 400;
  -webkit-font-smoothing: none;
  font-smooth: never;
  letter-spacing: 0;
}
h1 { font-size: 40px; line-height: 1.1; margin: 0 0 var(--s4); }
h2 { font-size: 30px; line-height: 1.2; margin: var(--s8) 0 var(--s5); }
h3 { font-family: var(--serif); font-size: 1.375rem; font-weight: 600; line-height: 1.3; margin: var(--s6) 0 var(--s2); }
@media (min-width: 640px) {
  h1 { font-size: 60px; }
  h2 { font-size: 40px; }
}
p { margin: 0 0 var(--s4); }

/* ---------- layout */
.wrap { max-width: calc(var(--measure) + 2 * var(--s4)); margin: 0 auto; padding: 0 var(--s4); }

/* ---------- pixel frame: notched corners made from four flat shadows */
.frame {
  background: var(--dusk);
  margin: var(--s1);
  box-shadow:
    0 calc(-1 * var(--s1)) 0 0 var(--dusk-edge),
    0 var(--s1) 0 0 var(--dusk-edge),
    calc(-1 * var(--s1)) 0 0 0 var(--dusk-edge),
    var(--s1) 0 0 0 var(--dusk-edge),
    0 var(--s3) 0 0 var(--shadow);
}

/* ---------- the scene: pixel art behind the header */
.scene {
  position: relative;
  overflow: hidden;
  background: var(--night);
}
.scene > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}
.scene--tall { height: clamp(380px, 52vh, 520px); }
.scene--tall > img { object-position: 84% 100%; }
.scene--strip { height: 200px; }
.scene--strip > img { object-position: 50% 12%; }
@media (max-width: 899px) {
  /* phones and tablets: show the strip at an exact 2x, cropped right, so the moon clears the nav */
  .scene--strip > img { height: 352px; bottom: auto; object-position: 100% 0; }
}
@media (min-width: 900px) {
  .scene--tall { height: clamp(460px, 70vh, 720px); }
  .scene--tall > img { object-position: 50% 60%; }
  .scene--strip { height: 240px; }
}

/* fireflies and water glints: the one bit of motion on the site */
.scene .glow { animation: blink 1.6s steps(1, end) infinite; }
.scene .glow-b { animation-delay: -0.8s; }
@keyframes blink { 0% { opacity: 1; } 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .scene .glow { animation: none; }
  .scene .glow-b { display: none; }
}

/* ---------- header, sits on top of the scene */
.site-head {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s4);
  max-width: 72rem;
  margin: 0 auto;
}
@media (min-width: 1500px) {
  /* wide screens: the art keeps growing, so the nav moves out to the edge to stay clear of the moon */
  .site-head { max-width: none; padding: var(--s4) var(--s6); }
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  font-size: 20px;
  color: var(--limestone);
  text-decoration: none;
  text-shadow: 2px 2px 0 var(--shadow);
  white-space: nowrap;
}
.brand img { width: 32px; height: 32px; image-rendering: pixelated; }
.site-nav { display: flex; gap: var(--s4); font-size: 20px; white-space: nowrap; }
@media (min-width: 640px) { .site-nav { gap: var(--s5); } }
.site-nav a {
  color: var(--limestone);
  text-decoration: none;
  text-shadow: 2px 2px 0 var(--shadow);
  padding: var(--s1) 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { border-bottom-color: var(--gold); color: var(--limestone); }

/* ---------- home: the welcome sign that overlaps the scene */
.welcome {
  position: relative;
  z-index: 3;
  max-width: calc(var(--measure) - 2 * var(--s1));
  margin: calc(-1 * var(--s8)) auto 0;
  padding: var(--s5) var(--s5) var(--s4);
}
@media (max-width: 720px) {
  .welcome { margin-left: calc(var(--s4) + var(--s1)); margin-right: calc(var(--s4) + var(--s1)); }
}
@media (min-width: 640px) {
  .welcome { padding: var(--s6) var(--s6) var(--s5); }
}
.tagline {
  font-style: italic;
  font-size: 1.25rem;
  color: var(--gold);
  margin-bottom: var(--s4);
}

/* ---------- projects */
.projects { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s6); }
.project {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: var(--s5);
  padding: var(--s5);
}
.project .icon {
  width: 80px; height: 80px;
  background: var(--dusk-hi);
  image-rendering: pixelated;
}
.project h3 { margin-top: 0; }
.project .who { font-style: italic; color: var(--limestone-dim); margin-bottom: var(--s2); }
.links { display: flex; flex-wrap: wrap; gap: var(--s4); margin-top: var(--s5); }
@media (max-width: 520px) {
  .project { grid-template-columns: 1fr; }
}
.note { color: var(--limestone-dim); font-style: italic; margin-top: var(--s6); }

/* ---------- buttons: a pixel button with a lip that presses down */
.button {
  display: inline-block;
  font-size: 20px;
  line-height: 1;
  padding: var(--s3) var(--s4);
  margin: var(--s1) var(--s1) var(--s2);
  background: var(--coral);
  color: var(--night);
  text-decoration: none;
  box-shadow:
    0 calc(-1 * var(--s1)) 0 0 var(--coral-dark),
    calc(-1 * var(--s1)) 0 0 0 var(--coral-dark),
    var(--s1) 0 0 0 var(--coral-dark),
    0 var(--s2) 0 0 var(--coral-dark);
}
.button:hover { background: var(--coral-lit); color: var(--night); }
.button:active { transform: translateY(var(--s1)); box-shadow:
    0 calc(-1 * var(--s1)) 0 0 var(--coral-dark),
    calc(-1 * var(--s1)) 0 0 0 var(--coral-dark),
    var(--s1) 0 0 0 var(--coral-dark),
    0 var(--s1) 0 0 var(--coral-dark); }
.button.quiet {
  background: var(--dusk-hi);
  color: var(--limestone);
  box-shadow:
    0 calc(-1 * var(--s1)) 0 0 var(--dusk-edge),
    calc(-1 * var(--s1)) 0 0 0 var(--dusk-edge),
    var(--s1) 0 0 0 var(--dusk-edge),
    0 var(--s2) 0 0 var(--dusk-edge);
}
.button.quiet:hover { background: var(--dusk-edge); }

/* ---------- inner pages */
.page { padding-top: var(--s7); }
.page > h1 { margin-bottom: var(--s2); }
.updated { color: var(--limestone-dim); font-size: 1rem; margin-bottom: var(--s6); }
.page ul { padding-left: 1.25em; }
.page li { margin-bottom: var(--s2); }
.summary { padding: var(--s5); margin-bottom: var(--s6); }
.summary p:last-child { margin-bottom: 0; }

/* favorite things on the about page */
.favorites {
  list-style: none;
  padding: 0 !important;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s5);
}
@media (min-width: 640px) { .favorites { grid-template-columns: repeat(4, 1fr); } }
.favorites li {
  margin: var(--s1);
  padding: var(--s4) var(--s2);
  text-align: center;
  font-size: 1rem;
  line-height: 1.3;
}
.favorites img { display: block; width: 64px; height: 64px; margin: 0 auto var(--s3); image-rendering: pixelated; }

/* questions on the support page */
details { margin: var(--s4) var(--s1); padding: 0; }
summary {
  cursor: pointer;
  list-style: none;
  padding: var(--s4) var(--s5);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  gap: var(--s4);
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-family: var(--pixel); font-size: 30px; line-height: 0.8; color: var(--gold); }
details[open] summary::after { content: "-"; }
details > p { padding: 0 var(--s5) var(--s4); margin: 0; }

/* ---------- footer */
.site-foot {
  margin-top: var(--s9);
  border-top: var(--s1) solid var(--dusk-hi);
  padding: var(--s6) 0 var(--s7);
  font-size: 1rem;
  color: var(--limestone-dim);
}
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s4); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: var(--s5); }
.site-foot p { margin: 0; display: flex; align-items: center; gap: var(--s3); }
.site-foot img { width: 24px; height: 24px; image-rendering: pixelated; }

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

/* small phones: the header keeps the mark and the nav; the name shows on the page itself */
@media (max-width: 479px) {
  .brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
