/*
  Meaning:Burg "Baseplate": the site is a toy baseplate (a field of studs), and
  everything on it is a brick: chunky ink edges, studs on top, a hard shadow
  underneath, and a press when you click. Four brick colours; one display face.
  Tokens here are mirrored in the Meaning:Burg Design System (tokens.json).
*/

@font-face { font-family: "Lilita One"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/lilita-one.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("fonts/nunito.woff2") format("woff2"); }
@font-face { font-family: "Silkscreen"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/silkscreen.woff2") format("woff2"); }

:root {
  /* Type */
  --font-display: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --font-hud: "Silkscreen", ui-monospace, "Courier New", monospace;

  /* Ground and ink */
  --plate: #E4EEFF;        /* the baseplate: page background */
  --plate-stud: #C9DAF8;   /* the studs on the baseplate */
  --surface: #FFFFFF;      /* a brick's face: cards, bubbles */
  --ink: #16213E;          /* text, and every brick's edge */
  --ink-muted: #46527A;    /* secondary text */
  --edge: #16213E;         /* outlines and hard shadows */
  --console: #16213E;      /* code blocks */
  --on-console: #E4EEFF;

  /* Bricks */
  --brick-red: #D7351F;
  --brick-yellow: #FFC21A;
  --brick-blue: #2F64F0;
  --brick-green: #1FA35B;
  --on-red: #FFFFFF;
  --on-yellow: #16213E;
  --on-blue: #FFFFFF;
  --on-green: #0B1F14;

  /* Shape */
  --edge-width: 3px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --lift: 6px;             /* how high a brick sits: its hard shadow */
  --stud: 14px;            /* a stud's diameter */

  /* Space */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;

  --measure: 40rem;
  --wide: 70rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --plate: #0E1730;
    --plate-stud: #1A2850;
    --surface: #18254A;
    --ink: #F1F4FF;
    --ink-muted: #AAB6D8;
    --edge: #03081A;
    --console: #03081A;
    --on-console: #F1F4FF;
    --brick-blue: #4D7DFF;
    --on-blue: #03081A;
    color-scheme: dark;
  }
}

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

html {
  background: var(--plate);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* The baseplate: a stud every 28px. */
  background-color: var(--plate);
  background-image: radial-gradient(circle at center, var(--plate-stud) 0 5px, transparent 5.5px);
  background-size: 28px 28px;
}

main {
  flex: 1;
  width: 100%;
  max-width: calc(var(--measure) + 2.5rem);
  margin: 0 auto;
  padding: var(--space-5) 1.25rem 5rem;
}

main:has(.frontpage) { max-width: calc(var(--wide) + 2.5rem); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-wrap: balance;
}

p { margin: 0 0 1.1em; }

a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--brick-blue);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.18em;
  border-radius: 4px;
  transition: background-color 0.12s;
}

a:hover { background: var(--brick-yellow); color: var(--on-yellow); text-decoration-color: var(--edge); }

:focus-visible { outline: 3px solid var(--brick-blue); outline-offset: 3px; border-radius: var(--radius-sm); }

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

code, pre { font-size: 0.9em; }

/* ---------- Header ---------- */

.site-header { padding: var(--space-2) 1.25rem 0; }

.site-nav {
  max-width: var(--wide);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
}

.site-name {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.7rem;
  line-height: 1;
  text-decoration: none;
  color: var(--ink);
}

.site-name img { width: 44px; height: 44px; transition: transform 0.2s; }
.site-name:hover { background: none; color: var(--ink); }
.site-name:hover img { transform: rotate(-8deg) translateY(-3px); }

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* Nav items are small pressable bricks; the current page is the yellow one. */
.site-nav ul a {
  display: inline-block;
  padding: 0.35rem 0.95rem 0.3rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
  border: var(--edge-width) solid var(--edge);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--edge);
  transition: transform 0.08s, box-shadow 0.08s, background-color 0.12s;
}

.site-nav ul a:hover { background: var(--surface); transform: translateY(-2px); box-shadow: 0 6px 0 var(--edge); }
.site-nav ul a:active { transform: translateY(4px); box-shadow: 0 0 0 var(--edge); }
.site-nav ul a[aria-current="page"] { background: var(--brick-yellow); color: var(--on-yellow); }

/* ---------- Footer: a row of bricks, then the credits ---------- */

.site-footer {
  margin-top: var(--space-4);
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.site-footer::before {
  content: "";
  display: block;
  height: 22px;
  border-block: var(--edge-width) solid var(--edge);
  background: repeating-linear-gradient(90deg,
    var(--brick-red) 0 88px, var(--edge) 88px 91px,
    var(--brick-yellow) 91px 179px, var(--edge) 179px 182px,
    var(--brick-blue) 182px 270px, var(--edge) 270px 273px,
    var(--brick-green) 273px 361px, var(--edge) 361px 364px);
}

.footer-inner {
  max-width: calc(var(--wide) + 2.5rem);
  margin: 0 auto;
  padding: var(--space-3) 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 2rem;
}

.footer-inner p { margin: 0; }
.footer-name { font-family: var(--font-display); font-size: 1.3rem; color: var(--ink); }
.colophon { margin-left: auto !important; }

/* ---------- Pages ---------- */

article > h1, main > h1 {
  font-size: clamp(2.8rem, 7vw, 4.2rem);
  margin: 0 0 var(--space-3);
}

main h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.2rem);
  margin: var(--space-4) 0 var(--space-2);
}

/* A heading sits on a yellow brick-highlight, like a label stuck on a toy box. */
main article h2 {
  display: inline-block;
  padding: 0.1em 0.35em 0.05em;
  background: linear-gradient(transparent 55%, var(--brick-yellow) 55%);
  border-radius: 4px;
}

main h3 { font-size: 1.35rem; margin: var(--space-3) 0 var(--space-1); }

article > h1 + p {
  font-size: 1.3rem;
  line-height: 1.5;
  font-weight: 600;
  margin-bottom: 1.5em;
}

/* Bullets are little studs, one colour after another. */
main ul:not([class]) { list-style: none; padding-left: 0; display: grid; gap: 0.5rem; }
main ul:not([class]) > li { position: relative; padding-left: 1.9rem; }
main ul:not([class]) > li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.38em;
  width: var(--stud);
  height: var(--stud);
  border-radius: 50%;
  background: var(--brick-red);
  border: 2px solid var(--edge);
  box-shadow: 0 2px 0 var(--edge);
}
main ul:not([class]) > li:nth-child(4n+2)::before { background: var(--brick-yellow); }
main ul:not([class]) > li:nth-child(4n+3)::before { background: var(--brick-blue); }
main ul:not([class]) > li:nth-child(4n+4)::before { background: var(--brick-green); }
li > p { margin: 0; }

/* Code reads like a game console. */
pre {
  background: var(--console);
  color: var(--on-console);
  border: var(--edge-width) solid var(--edge);
  border-radius: var(--radius-md);
  box-shadow: 0 var(--lift) 0 var(--edge);
  padding: 1rem 1.2rem;
  overflow-x: auto;
}

:not(pre) > code {
  padding: 0.1em 0.35em;
  background: var(--surface);
  border: 2px solid var(--edge);
  border-radius: 6px;
}

hr { border: none; border-top: var(--edge-width) dashed var(--plate-stud); margin: 2.5em 0; }

/* ---------- Front page ---------- */

.hero { padding: var(--space-2) 0 var(--space-4); }

/* A HUD chip: pixel font, like a game's status line. */
.eyebrow, .hud {
  display: inline-block;
  margin: 0 0 var(--space-3);
  padding: 0.35rem 0.7rem 0.3rem;
  font-family: var(--font-hud);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--on-console);
  background: var(--console);
  border-radius: var(--radius-sm);
}

/* The name, one brick per letter, each with a stud on top. */
.hero h1 {
  display: flex;
  gap: 0.12em;
  margin: 0 0 var(--space-4);
  /* Sized so the twelve letters always fit on one row. */
  font-size: clamp(1.2rem, 5vw, 3.75rem);
  line-height: 1;
}

.hero h1 .letter {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 1.05em;
  padding: 0.12em 0.14em 0.06em;
  color: var(--on-red);
  background: var(--brick-red);
  border: var(--edge-width) solid var(--edge);
  border-radius: var(--radius-md);
  box-shadow: 0 var(--lift) 0 var(--edge);
  transform: rotate(-2deg);
  transition: transform 0.15s cubic-bezier(.3, 1.6, .5, 1);
}

.hero h1 .letter::before {
  content: "";
  position: absolute;
  /* Scales with the letter: a stud on a 104px letter is about 22px wide. */
  top: calc(-0.11em - var(--edge-width));
  left: 50%;
  width: 0.22em;
  height: 0.11em;
  translate: -50% 0;
  background: inherit;
  border: var(--edge-width) solid var(--edge);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}

.hero h1 .letter:nth-child(4n+2) { background: var(--brick-yellow); color: var(--on-yellow); transform: rotate(1.5deg) translateY(4px); }
.hero h1 .letter:nth-child(4n+3) { background: var(--brick-blue); color: var(--on-blue); transform: rotate(-1deg); }
.hero h1 .letter:nth-child(4n+4) { background: var(--brick-green); color: var(--on-green); transform: rotate(2.5deg) translateY(2px); }
.hero h1 .letter:hover { transform: translateY(-10px) rotate(-4deg); }

.hero-lede p { font-size: 1.25rem; line-height: 1.55; max-width: 36rem; font-weight: 600; }

/* Front-page sections: the heading on the left, the bricks on the right. */
.frontpage > section:not(.hero) {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: var(--space-2) var(--space-4);
  padding: var(--space-4) 0;
}

.frontpage > section:not(.hero) > h2 { font-size: 2rem; margin: 0; }

/* ---------- Speech bubble (pullquote): a line of game dialogue ---------- */

.pullquote {
  position: relative;
  max-width: 44rem;
  margin: var(--space-2) 0 var(--space-4);
  padding: 1.1rem 1.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  line-height: 1.2;
  background: var(--surface);
  border: var(--edge-width) solid var(--edge);
  border-radius: var(--radius-lg);
  box-shadow: 0 var(--lift) 0 var(--edge);
}

/* The tail: a diamond whose top half hides behind the bubble. */
.pullquote::after {
  content: "";
  position: absolute;
  left: 2.5rem;
  bottom: -15px;
  width: 26px;
  height: 26px;
  background: var(--surface);
  border-right: var(--edge-width) solid var(--edge);
  border-bottom: var(--edge-width) solid var(--edge);
  transform: rotate(45deg);
}

.pullquote p { margin: 0; }
.pullquote p + p { margin-top: 0.6rem; font-family: var(--font-body); font-size: 1rem; color: var(--ink-muted); }

/* ---------- Place cards: a brick with studs on top, pressable when it's a link ---------- */

.places {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-4) var(--space-3);
  padding-top: var(--space-1);
}

.place {
  --tone: var(--brick-red);
  --on-tone: var(--on-red);
  position: relative;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  text-decoration: none;
  font-weight: 400;
  background: var(--surface);
  border: var(--edge-width) solid var(--edge);
  border-radius: var(--radius-md);
  box-shadow: 0 var(--lift) 0 var(--edge);
  transition: transform 0.1s, box-shadow 0.1s;
}

.place.tone-yellow { --tone: var(--brick-yellow); --on-tone: var(--on-yellow); }
.place.tone-blue { --tone: var(--brick-blue); --on-tone: var(--on-blue); }
.place.tone-green { --tone: var(--brick-green); --on-tone: var(--on-green); }

/* Two studs on top, like the letter-bricks'. */
.place::before, .place::after {
  content: "";
  position: absolute;
  top: calc(-1 * var(--stud) * 0.8 - var(--edge-width) + 1px);
  left: 1.5rem;
  width: calc(var(--stud) * 2.2);
  height: calc(var(--stud) * 0.8);
  background: var(--tone);
  border: var(--edge-width) solid var(--edge);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
}

.place::after { left: calc(1.5rem + var(--stud) * 3.4); }

.place .band {
  padding: 1rem 1.3rem 0.85rem;
  background: var(--tone);
  color: var(--on-tone);
  border-bottom: var(--edge-width) solid var(--edge);
  border-radius: calc(var(--radius-md) - var(--edge-width)) calc(var(--radius-md) - var(--edge-width)) 0 0;
}

/* A place with nothing more to say is a solid brick of its tone. */
.place .band:last-child {
  flex: 1;
  border-bottom: none;
  border-radius: calc(var(--radius-md) - var(--edge-width));
}

.place h3 { margin: 0; font-size: 1.9rem; color: inherit; }

.place .tagline {
  margin: 0.4rem 0 0;
  font-family: var(--font-hud);
  font-size: 0.72rem;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.place .description { padding: 1rem 1.3rem 0; flex: 1; }
.place .description p { margin: 0; color: var(--ink-muted); font-weight: 600; }

.place .link {
  align-self: flex-start;
  margin: 1rem 1.3rem 1.2rem;
  padding: 0.3rem 0.8rem 0.25rem;
  font-family: var(--font-display);
  font-size: 1rem;
  background: var(--tone);
  color: var(--on-tone);
  border: 2px solid var(--edge);
  border-radius: 999px;
}

.place:not(a) .description { padding-bottom: 1.2rem; }

a.place:hover { background: var(--surface); color: var(--ink); transform: translateY(-4px) rotate(-0.6deg); box-shadow: 0 calc(var(--lift) + 4px) 0 var(--edge); }
a.place:active { transform: translateY(var(--lift)); box-shadow: 0 0 0 var(--edge); }

/* ---------- Project rows ---------- */

.projects { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }

.project {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.25rem;
  padding: 1.1rem 1.3rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 400;
  background: var(--surface);
  border: var(--edge-width) solid var(--edge);
  border-radius: var(--radius-md);
  box-shadow: 0 var(--lift) 0 var(--edge);
  transition: transform 0.1s, box-shadow 0.1s;
}

.project .logo {
  width: 4.25rem;
  height: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem;
  background: #FFFFFF;
  border: 2px solid var(--edge);
  border-radius: var(--radius-sm);
}

.project .logo img { width: 100%; height: 100%; object-fit: contain; }
.project .name { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; }
.project .description p { margin: 0.2rem 0 0; color: var(--ink-muted); font-weight: 600; }

.project .link {
  font-family: var(--font-hud);
  font-size: 0.75rem;
  white-space: nowrap;
  color: var(--ink-muted);
}

.project .link.soon {
  padding: 0.3rem 0.6rem;
  background: var(--brick-yellow);
  color: var(--on-yellow);
  border: 2px solid var(--edge);
  border-radius: var(--radius-sm);
}

a.project:hover { background: var(--surface); color: var(--ink); transform: translateY(-3px); box-shadow: 0 calc(var(--lift) + 3px) 0 var(--edge); }
a.project:hover .link { color: var(--ink); }
a.project:active { transform: translateY(var(--lift)); box-shadow: 0 0 0 var(--edge); }

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  main { padding-top: var(--space-4); }
  .site-nav { justify-content: flex-start; }
  .frontpage > section:not(.hero) { grid-template-columns: 1fr; }
  .project { grid-template-columns: 3.25rem minmax(0, 1fr); gap: 1rem; }
  .project .logo { width: 3.25rem; height: 3.25rem; }
  .project .link { grid-column: 2; }
  .colophon { margin-left: 0 !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .hero h1 .letter:hover, a.place:hover, a.project:hover, .site-nav ul a:hover { transform: none; }
}
