/* ==========================================================
   abbydavid.com — styles
   Colors and fonts live in the :root block. Everything else
   is grouped by section, in page order.
   ========================================================== */

:root {
  /* Core: warm page, raised surface, strong ink, softer ink */
  --paper: #f6f1e7;
  --paper-deep: #efe8d9;
  --surface: #fffcf5;
  --ink: #232321;
  --muted: #5f594e;           /* 6.2:1 on paper */
  --rule: #d9d0bd;

  /* Primary accent: deep teal (links, active states, focus). 5.6:1 on paper. */
  --accent: #1d6a67;
  --accent-soft: #d5e8e3;

  /* Supporting colors: small doses only (labels, rules, project and pet details) */
  --coral: #c2492f;           /* 4.6:1 on paper: ok for small text */
  --gold: #e3a82b;
  --moss: #5b7d3a;
  --violet: #77599b;
  --focus: #1d6a67;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 62rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 2rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1.0625rem, 0.98rem + 0.3vw, 1.1875rem);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
::selection { background: var(--gold); color: var(--ink); }

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

.mono {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 0.5rem 1rem;
}
.skip-link:focus { top: 1rem; color: var(--paper); }

/* ---------- Header ---------- */
.site-header { padding: 1.5rem 0 0; }
.site-header .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

.wordmark { display: inline-flex; align-items: center; min-height: 2.75rem; font-family: var(--mono); font-size: 0.9rem; font-weight: 600; letter-spacing: 0.12em; text-decoration: none; }
.wordmark:hover { color: var(--ink); }
.wordmark span { color: var(--coral); }

.site-nav { margin-left: auto; margin-right: -0.5rem; }
.site-nav ul { display: flex; gap: clamp(0.25rem, 2vw, 1rem); list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding-inline: 0.5rem;
  font-size: 1rem; text-decoration: none; color: var(--muted);
}
.site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--coral); text-decoration-thickness: 2px; text-underline-offset: 0.35em; }
.site-nav a:hover { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent); }
.site-nav .ext { font-family: var(--mono); font-size: 0.8rem; }

/* ---------- Hero ---------- */
.hero { padding: clamp(3.5rem, 9vw, 6.5rem) 0 clamp(2.5rem, 6vw, 4rem); }
.hero h1 {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  margin: 0 0 1.25rem;
}
.hero h1 span { color: var(--coral); }
.hero .tagline {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.125rem, 1.2rem + 3.6vw, 3.75rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  max-width: 18ch;
  text-wrap: balance;
  margin: 0 0 1.25rem;
}
.hero .intro { max-width: 34rem; color: var(--muted); margin: 0; text-wrap: pretty; }
/* the one memorable moment: a hand-drawn gold underline under the last words */
.hero .tagline em {
  font-style: normal;
  background: linear-gradient(transparent 82%, var(--gold) 82% 92%, transparent 92%);
  padding-inline: 0.05em;
}

/* A thin measuring-tape edge — the one nod to the workshop */
.tape {
  height: 9px;
  background:
    repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 10px) bottom / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 50px) bottom / 100% 9px no-repeat;
}

/* ---------- Section heads ---------- */
.section { padding: clamp(2.5rem, 6vw, 4rem) 0 0; }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-head h2 { margin: 0; }
.section-head a, .crew-link a, .site-footer a { display: inline-block; padding-block: 0.6rem; }
.section-head a { font-family: var(--mono); font-size: 0.85rem; letter-spacing: 0.04em; }

/* ---------- Projects ----------
   Homepage: a few <article class="work"> blocks (text + screenshot, sides alternate
   with class "flip"). The full list on /projects/ uses <ol class="entries">. */
.work {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding: clamp(1.75rem, 4vw, 3rem) 0;
  border-top: 1px solid var(--rule);
}
.work:first-of-type { border-top: 2px solid var(--ink); }
.work.flip .shot { order: -1; }
.work .meta { margin: 0 0 1rem; }
.work h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 1rem + 3.6vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0 0 0.75rem;
}
.work p.desc { font-family: var(--serif); font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.3rem); line-height: 1.45; margin: 0 0 1rem; max-width: 30rem; }
.work .fine { color: var(--muted); font-size: 1rem; margin: 0 0 1.25rem; max-width: 30rem; }

/* Screenshot sits slightly off-kilter, like it was pinned there; it straightens on hover */
.shot {
  margin: 0;
  background: var(--paper-deep);
  border: 1px solid var(--ink);
  box-shadow: 6px 6px 0 var(--accent-soft);
  transform: rotate(-0.8deg);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.work.flip .shot { transform: rotate(0.8deg); }
.shot img { display: block; width: 100%; height: auto; }
.shot.pixel img { image-rendering: pixelated; }
.work:focus-within .shot { transform: rotate(0deg); box-shadow: 10px 10px 0 var(--accent-soft); }
@media (hover: hover) { .work:hover .shot { transform: rotate(0deg); box-shadow: 10px 10px 0 var(--accent-soft); } }
.work:focus-within { outline: 3px solid var(--focus); outline-offset: 4px; }
.work .stretch:focus-visible { outline: none; }


/* Tablet portrait and down: stack, with the picture under the text so neither side
   is squeezed. Two columns return once there is real room. */
@media (max-width: 56rem) {
  .work { grid-template-columns: 1fr; gap: 1.5rem; }
  .work.flip .shot { order: 0; margin-inline-start: auto; }
  .shot { width: min(100%, 36rem); }
}

.entries { list-style: none; margin: 0; padding: 0; }
.entry {
  position: relative;
  display: grid;
  grid-template-columns: 13rem 1fr auto;
  gap: 0.25rem 1.5rem;
  align-items: baseline;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.2s, padding 0.2s;
}
.entry h3 { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; line-height: 1.2; margin: 0; }
.entry p { margin: 0.2rem 0 0; color: var(--muted); max-width: 34rem; font-size: 0.98rem; }
.entry .meta { line-height: 1.6; }

/* Whole row is clickable through the title link */
.stretch { text-decoration: none; }
.stretch::after { content: ""; position: absolute; inset: 0; }
.stretch:hover { color: inherit; }

.go { font-family: var(--mono); color: var(--accent); padding-block: 0.6rem; transition: transform 0.2s; display: inline-block; }
.entry:hover { background: var(--paper-deep); }
.entry:hover { padding-inline: 0.75rem; }
.entry:hover .go, .work:hover .go { transform: translateX(4px); }
.entry:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.stretch:focus-visible { outline: none; }

/* Status labels: a small dot + word */
.status::before {
  content: ""; display: inline-block; width: 0.5em; height: 0.5em; margin-right: 0.5em;
  border-radius: 50%; background: var(--moss);
}
.status.concept::before { background: transparent; border: 1px solid var(--muted); }

@media (max-width: 48rem) {
  .entry { grid-template-columns: 1fr auto; }
  .entry .meta { grid-column: 1 / -1; }
  .entry:hover { padding-inline: 0; }
}

/* ---------- Notes (kept quiet on purpose) ---------- */
.notes-quiet { color: var(--muted); margin: 0; max-width: 34rem; }
.notes { list-style: none; margin: 0; padding: 0; }
.note { display: grid; grid-template-columns: 13rem 1fr; gap: 0.25rem 1.5rem; padding: 0.9rem 0; border-top: 1px solid var(--rule); }
.note h3 { font-size: 1.05rem; font-weight: 600; margin: 0; }
.note p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.95rem; }
@media (max-width: 40rem) { .note { grid-template-columns: 1fr; } }

/* ---------- About ---------- */
.about p {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 3vw, 1.65rem);
  line-height: 1.4;
  max-width: 32rem;
  margin: 0;
}

/* ---------- Footer ---------- */
.site-footer { margin-top: clamp(3.5rem, 8vw, 6rem); padding: 1.5rem 0 2.5rem; border-top: 1px solid var(--rule); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; }
.site-footer p { margin: 0; }
.site-footer a { color: inherit; }

/* ---------- Article pages (future projects / notes) ----------
   Wrap a post in <article class="prose">. */
.prose { max-width: 38rem; padding-top: 3rem; }
.prose h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 6vw, 3rem); line-height: 1.1; }
.prose h2 { font-family: var(--serif); font-weight: 400; margin-top: 2.5rem; }
.prose img { max-width: 100%; height: auto; }
.disclosure { font-size: 0.9rem; color: var(--muted); border-left: 2px solid var(--accent); padding-left: 1rem; }

h2 { font-family: var(--mono); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.prose h2 { font-size: 1.5rem; letter-spacing: normal; text-transform: none; }

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

/* ---------- Pixel pets (shared) ----------
   Sheets in /assets/pets/<name>.svg: 8 frames of 32x24 (stand, walk, walk, sit, lie, happy, stand-blink, sit-blink),
   row 0 faces right, row 1 faces left. --u = screen pixels per sprite pixel. */
.px {
  --u: 3; --f: 0; --r: 0;
  display: inline-block; flex: none;
  width: calc(var(--u) * 32px); height: calc(var(--u) * 24px);
  background-repeat: no-repeat;
  background-size: calc(var(--u) * 256px) calc(var(--u) * 48px);
  background-position: calc(var(--u) * -32px * var(--f)) calc(var(--u) * -24px * var(--r));
  image-rendering: pixelated;
}
.px.jack { background-image: url("/assets/pets/jack.svg"); }
.px.albert { background-image: url("/assets/pets/albert.svg"); }
.px.elda { background-image: url("/assets/pets/elda.svg"); }
.px.svetlana { background-image: url("/assets/pets/svetlana.svg"); }
.px[data-pose="sit"] { --f: 3; }
.px[data-pose="lie"] { --f: 4; }
.px[data-pose="happy"] { --f: 5; }
.px[data-pose="stand"] { animation: blink-stand 6s steps(1, end) infinite; animation-delay: var(--d, 0s); }
.px[data-pose="sit"] { animation: blink-sit 7s steps(1, end) infinite; animation-delay: var(--d, 0s); }
.px[data-pose="walk"] { animation: walk 0.5s steps(1, end) infinite; }
@keyframes blink-stand {
  0%, 94% { background-position: calc(var(--u) * 0px) calc(var(--u) * -24px * var(--r)); }
  95%, 98% { background-position: calc(var(--u) * -192px) calc(var(--u) * -24px * var(--r)); }
  99%, 100% { background-position: calc(var(--u) * 0px) calc(var(--u) * -24px * var(--r)); }
}
@keyframes blink-sit {
  0%, 94% { background-position: calc(var(--u) * -96px) calc(var(--u) * -24px * var(--r)); }
  95%, 98% { background-position: calc(var(--u) * -224px) calc(var(--u) * -24px * var(--r)); }
  99%, 100% { background-position: calc(var(--u) * -96px) calc(var(--u) * -24px * var(--r)); }
}
@keyframes walk {
  0%, 49% { background-position: calc(var(--u) * -32px) calc(var(--u) * -24px * var(--r)); }
  50%, 100% { background-position: calc(var(--u) * -64px) calc(var(--u) * -24px * var(--r)); }
}

/* ---------- Meet the crew (homepage) ---------- */
.crew { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; }
.crew li { display: flex; align-items: flex-end; gap: 0.4rem; }
.crew .px { --u: 3; }
.crew li:nth-child(2) .px { --d: -1.5s; }
.crew li:nth-child(3) .px { --d: -3s; }
.crew li:nth-child(4) .px { --d: -4.5s; }
.crew strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.25rem; line-height: 1.1; }
.crew .mono { display: block; font-size: 0.7rem; }
.crew-link { margin: 1.5rem 0 0; font-family: var(--mono); font-size: 0.85rem; }
@media (prefers-reduced-motion: reduce) { .px { animation: none !important; } }

[hidden] { display: none !important; }

.wordmark, .site-nav a { white-space: nowrap; }
.site-header .wrap { flex-wrap: wrap; row-gap: 0.5rem; }
@media (max-width: 30rem) { .site-nav ul { gap: 1rem; } }
