/* site.css: BaconBitsStudio
   Visual idea: the logo is a die-cut sticker (thick ink outline, flat color,
   gold sunburst). The site borrows that: ink outlines, hard offset shadows
   instead of blurred ones, colors taken straight from the logo, and one
   moving thing, the sunburst behind the hero mark. */

/* --- Fonts (self-hosted) --------------------------------------------------- */
@font-face {
  font-family: "Fredoka";
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/fredoka-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Fredoka";
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/fredoka-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Fredoka";
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/fredoka-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  src: url("/fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-weight: 700;
  font-style: italic;
  font-display: swap;
  src: url("/fonts/atkinson-hyperlegible-latin-700-italic.woff2") format("woff2");
}

/* --- Tokens -------------------------------------------------------------- */
:root {
  /* Logo colors */
  --ink: #151413;
  --field: #81bdc7;        /* the logo's dusty teal background */
  --field-deep: #2c6871;   /* readable teal for links/text on light backgrounds */
  --pig: #f4abab;
  --pig-light: #f8d3c7;
  --cream: #f8f7de;
  --gold: #bbae76;
  --headset: #3bbcc6;
  --paper: #fffef4;
  --white: #ffffff;

  /* Type */
  --font-display: "Fredoka", "Trebuchet MS", sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --step--1: clamp(0.875rem, 0.85rem + 0.1vw, 0.95rem);
  --step-0: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-1: clamp(1.3rem, 1.18rem + 0.5vw, 1.55rem);
  --step-2: clamp(1.65rem, 1.4rem + 1.1vw, 2.2rem);
  --step-3: clamp(2.25rem, 1.7rem + 2.6vw, 3.9rem);

  /* Space and shape */
  --space-xs: 0.5rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: 2.5rem;
  --space-xl: clamp(3.5rem, 2.5rem + 4vw, 6rem);
  --outline: 3px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-small: 3px 3px 0 var(--ink);
  --radius: 16px;
  --radius-pill: 999px;
  --wrap: 72rem;
  --narrow: 46rem;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  margin: 0;
}

h1 {
  font-size: var(--step-3);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--step-2);
}

h3 {
  font-size: var(--step-1);
}

p {
  margin: 0;
}

a {
  color: var(--field-deep);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--ink);
}

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

img {
  max-width: 100%;
  height: auto;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}

.wrap.narrow {
  width: min(100% - 2.5rem, var(--narrow));
}

.skip-link {
  position: absolute;
  left: var(--space-s);
  top: -4rem;
  z-index: 10;
  padding: var(--space-xs) var(--space-s);
  background: var(--ink);
  color: var(--cream);
  border-radius: 8px;
}

.skip-link:focus {
  top: var(--space-s);
}

/* --- Header -------------------------------------------------------------- */
.site-header {
  background: var(--paper);
  border-bottom: var(--outline);
  position: sticky;
  top: 0;
  z-index: 5;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
  flex-wrap: wrap;
  padding-block: 0.6rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 44px;
  height: 44px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
}

.nav a {
  display: block;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border: 2px solid transparent;
}

.nav a:hover {
  border-color: var(--ink);
}

.nav a[aria-current="page"] {
  background: var(--pig);
  border-color: var(--ink);
}

/* --- Buttons ------------------------------------------------------------- */
.button {
  display: inline-block;
  padding: 0.75rem 1.4rem;
  border: var(--outline);
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  box-shadow: var(--shadow-small);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.button--primary {
  background: var(--pig);
}

.button:hover {
  color: var(--ink);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
}

.button:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}

/* --- Hero ---------------------------------------------------------------- */
.hero {
  background: var(--field);
  border-bottom: var(--outline);
  overflow: hidden;
}

.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--space-l);
  padding-block: var(--space-xl);
}

.hero__copy h1 {
  max-width: 15ch;
}

.hero__lede {
  margin-top: var(--space-m);
  max-width: 34rem;
  font-size: var(--step-1);
  line-height: 1.45;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  margin-top: var(--space-l);
}

.hero__mark {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: min(100%, 30rem);
  justify-self: center;
}

/* The sunburst: gold rays from the logo, slowly turning. */
.hero__rays {
  position: absolute;
  inset: -22%;
  background: repeating-conic-gradient(
    from 0deg,
    var(--gold) 0deg 2.2deg,
    transparent 2.2deg 10deg,
    var(--cream) 10deg 11deg,
    transparent 11deg 18deg
  );
  mask-image: radial-gradient(circle, transparent 34%, #000 36%, #000 52%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle, transparent 34%, #000 36%, #000 52%, transparent 70%);
  opacity: 0.85;
  animation: rays-turn 80s linear infinite;
}

.hero__mark img {
  position: relative;
  width: 82%;
  filter: drop-shadow(6px 6px 0 var(--ink));
  animation: sticker-in 700ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes rays-turn {
  to {
    transform: rotate(360deg);
  }
}

@keyframes sticker-in {
  from {
    opacity: 0;
    transform: scale(0.6) rotate(-14deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

/* --- Sections ------------------------------------------------------------ */
.section {
  padding-block: var(--space-xl);
}

.section--tinted {
  background: var(--cream);
  border-block: var(--outline);
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-s);
  flex-wrap: wrap;
  margin-bottom: var(--space-l);
}

.section__head a {
  font-family: var(--font-display);
  font-weight: 600;
}

/* Services: heading in a left column, list on the right. */
.services {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr);
  gap: var(--space-l);
  align-items: start;
}

.services h2 {
  position: sticky;
  top: 6rem;
}

.service-list li {
  padding-block: var(--space-m);
  border-top: var(--outline);
}

.service-list li:last-child {
  border-bottom: var(--outline);
}

.service-list h3 {
  margin-bottom: var(--space-xs);
}

.service-list p {
  max-width: 40rem;
}

.service-list__example {
  margin-top: var(--space-xs);
  font-size: var(--step--1);
  font-style: italic;
  color: #4a4a45;
}

/* Project stickers: each card is a die-cut sticker, slightly crooked. */
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: var(--space-l) var(--space-m);
}

.sticker {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  padding: var(--space-m);
  background: var(--white);
  border: var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform: rotate(-1deg);
  transition: transform 160ms ease;
}

.sticker:nth-child(even) {
  transform: rotate(0.8deg);
}

.sticker:nth-child(3n) {
  transform: rotate(-0.4deg);
}

.sticker:hover,
.sticker:focus-within {
  transform: rotate(0) translateY(-3px);
}

.sticker h3 a {
  color: var(--ink);
}

.sticker__stack {
  margin-top: auto;
  font-size: var(--step--1);
  color: #4a4a45;
}

.sticker__links a {
  font-family: var(--font-display);
  font-weight: 600;
}

/* Status tags: text carries the meaning; color backs it up.
   Blue / gold / pink, no red-green pairing. */
.tag {
  align-self: flex-start;
  padding: 0.15rem 0.7rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step--1);
}

.tag--live {
  background: var(--headset);
}

.tag--client {
  background: var(--gold);
}

.tag--building {
  background: var(--pig-light);
}

.tag--bench {
  background: var(--paper);
}

/* Dev log rows */
.post-row {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: var(--space-m);
  padding-block: var(--space-m);
  border-top: 2px solid var(--ink);
}

.post-row:last-child {
  border-bottom: 2px solid var(--ink);
}

.post-row time {
  font-family: var(--font-display);
  font-weight: 500;
  color: #4a4a45;
  padding-top: 0.2rem;
}

.post-row h3 a {
  color: var(--ink);
}

.post-row p {
  margin-top: 0.35rem;
}

.empty {
  padding: var(--space-m);
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  background: var(--cream);
}

/* Contact band */
.contact {
  background: var(--ink);
  color: var(--cream);
  padding-block: var(--space-xl);
}

.contact p {
  margin-top: var(--space-s);
  max-width: 38rem;
}

.contact__email {
  display: inline-block;
  margin-top: var(--space-l);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-2);
  color: var(--pig);
  overflow-wrap: anywhere;
}

.contact__email:hover {
  color: var(--cream);
}

.contact :focus-visible {
  outline-color: var(--pig);
}

/* Page headers */
.page-head {
  background: var(--field);
  border-bottom: var(--outline);
  padding-block: var(--space-l);
}

.page-head p {
  margin-top: var(--space-s);
  font-size: var(--step-1);
  max-width: 40rem;
}

.page-head a {
  color: var(--ink);
}

.page-head--center {
  padding-block: var(--space-xl);
}

.post .page-head p:first-child {
  margin: 0 0 var(--space-s);
  font-size: var(--step-0);
  font-family: var(--font-display);
  font-weight: 600;
}

.post__meta {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.post__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-s);
}

.post__tags li {
  padding: 0.1rem 0.7rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-size: var(--step--1);
}

/* Post body */
.prose {
  padding-block: var(--space-xl);
}

.prose > * + * {
  margin-top: 1.1em;
}

.prose h2,
.prose h3 {
  margin-top: 1.8em;
}

.prose > :first-child {
  margin-top: 0;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose ul {
  list-style: disc;
}

.prose img {
  border: var(--outline);
  border-radius: var(--radius);
}

.prose code {
  font-size: 0.9em;
  background: var(--cream);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

.prose pre {
  overflow-x: auto;
  padding: var(--space-s);
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--radius);
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose blockquote {
  margin-inline: 0;
  padding-left: var(--space-s);
  border-left: 4px solid var(--field);
}

/* Footer */
.site-footer {
  border-top: var(--outline);
  padding-block: var(--space-m);
  font-size: var(--step--1);
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-s);
  flex-wrap: wrap;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-m);
}

/* --- Dev log blocks (DL-3) ----------------------------------------------- */
/* Accent: one of the four logo colors, chosen per post. Default is the field blue. */
.post--accent-blue { --accent: var(--field); }
.post--accent-gold { --accent: var(--gold); }
.post--accent-pink { --accent: var(--pig); }
.post--accent-teal { --accent: var(--headset); }

.post[class*="post--accent-"] .page-head {
  background: var(--accent);
}

.post__cover {
  margin-top: var(--space-l);
}

.post__cover img {
  width: 100%;
  border: var(--outline);
  border-radius: var(--radius);
}

/* Blocks sit in a center column; wide and full-bleed images break out of it. */
.post-blocks {
  --content: var(--narrow);
  --gutter: 1.25rem;
  --side: minmax(0, calc((var(--wrap) - var(--content)) / 2));
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), 1fr)
    [wide-start] var(--side)
    [content-start] min(100% - 2 * var(--gutter), var(--content))
    [content-end] var(--side)
    [wide-end] minmax(var(--gutter), 1fr)
    [full-end];
  row-gap: var(--space-m);
  padding-block: var(--space-xl);
}

.post--wide .post-blocks {
  --content: var(--wrap);
}

.post-blocks > * {
  grid-column: content;
  margin: 0;
}

.post-blocks > .block--wide {
  grid-column: wide;
}

.post-blocks > .block--full-bleed {
  grid-column: full;
}

.post-blocks > .block--heading {
  margin-top: var(--space-m);
}

.post-blocks > :first-child {
  margin-top: 0;
}

/* Text inside blocks: the same rhythm as .prose */
.block--text > * + *,
.callout__body > * + *,
.image-text__text > * + * {
  margin-top: 1.1em;
}

.block--text ul,
.block--text ol,
.callout__body ul,
.callout__body ol,
.image-text__text ul,
.image-text__text ol {
  padding-left: 1.4em;
}

.block--text ul,
.callout__body ul,
.image-text__text ul {
  list-style: disc;
}

.post-blocks :not(pre) > code {
  font-size: 0.9em;
  background: var(--cream);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

.post-blocks figcaption {
  margin-top: var(--space-xs);
  font-size: var(--step--1);
}

/* Images */
.post-blocks img {
  display: block;
  width: 100%;
  border: var(--outline);
  border-radius: var(--radius);
}

.block--full-bleed img {
  border-inline: 0;
  border-radius: 0;
}

.block--full-bleed figcaption {
  width: min(100% - 2.5rem, var(--narrow));
  margin-inline: auto;
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-s);
  align-items: start;
}

.gallery--3 .gallery__grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gallery__grid figure {
  margin: 0;
}

.image-text {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-m);
  align-items: center;
}

.image-text--right .image-text__media {
  order: 2;
}

/* Callouts: tone is named by the label, color is only a second cue. */
.callout {
  --tone: var(--field);
  padding: var(--space-s) var(--space-m);
  border: var(--outline);
  border-left-width: 10px;
  border-left-color: var(--tone);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--tone) 22%, var(--paper));
}

.callout--tip { --tone: var(--gold); }
.callout--heads-up { --tone: var(--pig); }

.callout__label {
  margin-bottom: var(--space-xs);
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: var(--step--1);
}

/* Quote */
.quote blockquote {
  margin: 0;
  padding-left: var(--space-m);
  border-left: 6px solid var(--accent, var(--field));
  font-size: var(--step-1);
}

.quote blockquote > * + * {
  margin-top: 0.8em;
}

.quote figcaption {
  padding-left: var(--space-m);
  font-size: var(--step-0);
  font-weight: 700;
}

.quote figcaption::before {
  content: "— ";
}

/* Code */
.code-block__lang {
  display: inline-block;
  margin: 0;
  padding: 0.2rem 0.8rem;
  background: var(--ink);
  color: var(--cream);
  border-radius: 6px 6px 0 0;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: var(--step--1);
}

.code-block pre {
  overflow-x: auto;
  padding: var(--space-s);
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--radius);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.9em;
}

.code-block__lang + pre {
  border-top-left-radius: 0;
}

.code-block pre:focus-visible {
  outline-color: var(--pig);
}

/* Divider */
.block--divider {
  height: 0;
  border: 0;
  border-top: 3px dashed var(--accent, var(--ink));
  margin-block: var(--space-m);
}

/* Video */
.video__frame {
  aspect-ratio: 16 / 9;
  border: var(--outline);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--ink);
}

.video__frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Dev log list: cover thumbnail on the right */
.post-row--cover {
  grid-template-columns: 8.5rem minmax(0, 1fr) 8rem;
}

.post-row__cover img {
  width: 8rem;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 2px solid var(--ink);
  border-radius: 10px;
}

@media (max-width: 52rem) {
  /* Two classes: beats the single-column .post-row rule in "Small screens" below. */
  .post-row.post-row--cover {
    grid-template-columns: minmax(0, 1fr) 6rem;
  }

  .post-row--cover time {
    grid-column: 1 / -1;
  }

  .post-row__cover img {
    width: 6rem;
  }
}

@media (max-width: 34rem) {
  .gallery__grid,
  .gallery--3 .gallery__grid,
  .image-text {
    grid-template-columns: 1fr;
  }

  .image-text--right .image-text__media {
    order: 0;
  }
}

/* --- Small screens ------------------------------------------------------- */
@media (max-width: 52rem) {
  .hero__inner {
    grid-template-columns: 1fr;
    padding-block: var(--space-l) var(--space-xl);
  }

  .hero__mark {
    order: -1;
    width: min(70%, 18rem);
  }

  .services {
    grid-template-columns: 1fr;
    gap: var(--space-m);
  }

  .services h2 {
    position: static;
  }

  .post-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

@media (max-width: 34rem) {
  .site-header__inner {
    justify-content: center;
  }

  .nav a {
    padding: 0.3rem 0.6rem;
  }
}

/* --- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero__rays,
  .hero__mark img {
    animation: none;
  }

  .sticker,
  .button {
    transition: none;
  }
}
