/* ==========================================================================
   Cooler Sheep — stylesheet
   Made with love for games. Pixels kept deliberately chunky.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Fonts (self-hosted — no third-party requests)
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Piedra";
  src: url("../fonts/Piedra-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "La Belle Aurore";
  src: url("../fonts/LaBelleAurore-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   2. Design tokens
   Light is the base. Dark is redefined twice: once for system preference
   (unless the visitor forced light) and once for an explicit toggle.
   -------------------------------------------------------------------------- */

:root {
  /* palette */
  --bg: #eef4df;
  --bg-alt: #e3ecd0;
  --surface: #fffdf6;
  --ink: #131a0e;
  --muted: #5b6650;
  --accent: #6f9f00;
  --accent-loud: #a0e200;
  --accent-ink: #131a0e;
  --line: #131a0e;
  --line-soft: #c6d2ae;
  --shadow: #131a0e;

  /* Display type is always light-on-dark-outline so it reads in both themes */
  --display-fill: #fffdf6;
  --display-stroke: #131a0e;

  /* type */
  --font-display: "Piedra", "Rockwell", Georgia, serif;
  --font-hand: "La Belle Aurore", "Segoe Script", cursive;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;

  /* rhythm */
  --step: 0.5rem;
  --radius: 14px;
  --radius-sm: 8px;
  --border: 3px;
  --shadow-hard: 5px 5px 0 var(--shadow);
  --shadow-hard-sm: 3px 3px 0 var(--shadow);
  --wrap: 1120px;
  --ease-boing: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1309;
    --bg-alt: #141b0e;
    --surface: #1b2413;
    --ink: #f0f5e4;
    --muted: #9fae8c;
    --accent: #a0e200;
    --accent-loud: #c2ff3d;
    --accent-ink: #101508;
    --line: #3a4a28;
    --line-soft: #2a3620;
    --shadow: #000000;
    --display-fill: #f4f9e8;
    --display-stroke: #000000;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1309;
  --bg-alt: #141b0e;
  --surface: #1b2413;
  --ink: #f0f5e4;
  --muted: #9fae8c;
  --accent: #a0e200;
  --accent-loud: #c2ff3d;
  --accent-ink: #101508;
  --line: #3a4a28;
  --line-soft: #2a3620;
  --shadow: #000000;
  --display-fill: #f4f9e8;
  --display-stroke: #000000;
}

/* --------------------------------------------------------------------------
   3. Reset & base
   -------------------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

/* The sheep is pixel art. Let the browser keep the pixels square. */
.pixel {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

a {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

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

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
  margin: 0;
  letter-spacing: 0.01em;
}

p {
  margin: 0 0 1rem;
}

p:last-child {
  margin-bottom: 0;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent-loud);
  color: var(--accent-ink);
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  left: 0;
}

/* --------------------------------------------------------------------------
   4. Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: var(--border) solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 72px;
  padding-block: 0.6rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.35rem;
  white-space: nowrap;
  margin-right: auto;
}

.brand img {
  width: 40px;
  height: auto;
}

.brand:hover img {
  animation: nudge 0.5s var(--ease-boing);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav a {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
  transition: background-color 0.18s ease, color 0.18s ease;
}

.nav a:hover,
.nav a.is-active {
  background: var(--accent-loud);
  color: var(--accent-ink);
}

.icon-btn {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--ink);
  border: var(--border) solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: transform 0.15s var(--ease-boing), background-color 0.15s ease;
}

.icon-btn:hover {
  background: var(--accent-loud);
  color: var(--accent-ink);
  transform: translateY(-2px);
}

.icon-btn[aria-pressed="true"] {
  background: var(--accent-loud);
  color: var(--accent-ink);
}

/* --------------------------------------------------------------------------
   5. Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  padding-block: clamp(2.5rem, 7vw, 5rem) clamp(3rem, 8vw, 6rem);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../images/grass-bg.jpg");
  background-size: 380px;
  opacity: 0.16;
  z-index: -2;
}

.hero::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 55%;
  background: linear-gradient(to bottom, transparent, var(--bg));
  z-index: -1;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: var(--border) solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-hard-sm);
}

.eyebrow .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-loud);
  border: 2px solid var(--line);
}

.hero h1 {
  font-size: clamp(2.9rem, 9vw, 5.5rem);
  color: var(--display-fill);
  -webkit-text-stroke: 3px var(--display-stroke);
  paint-order: stroke fill;
  text-shadow: 5px 5px 0 var(--display-stroke);
  margin-bottom: 1.25rem;
}

.hero__lead {
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  max-width: 46ch;
  color: var(--ink);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  border: var(--border) solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-hard-sm);
  cursor: pointer;
  transition: transform 0.15s var(--ease-boing), box-shadow 0.15s ease;
}

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

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--shadow);
}

.btn--primary {
  background: var(--accent-loud);
  color: var(--accent-ink);
}

/* --------------------------------------------------------------------------
   7. The clickable sheep
   -------------------------------------------------------------------------- */

.sheep-stage {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  position: relative;
}

.sheep-btn {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  border-radius: var(--radius);
}

.sheep-btn img {
  width: min(300px, 70vw);
}

.signature {
  font-family: var(--font-hand);
  font-size: clamp(2rem, 5vw, 2.9rem);
  line-height: 1.1;
  text-align: center;
  color: var(--ink);
  margin: 0;
}

.counter {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  background: var(--surface);
  border: var(--border) solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 1.1rem;
  box-shadow: var(--shadow-hard-sm);
}

.counter__value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.counter__label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.counter.is-popped {
  animation: pop 0.35s var(--ease-boing);
}

/* Milestone toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  translate: -50% 0;
  z-index: 80;
  max-width: min(92vw, 30rem);
  background: var(--accent-loud);
  color: var(--accent-ink);
  border: var(--border) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 0.85rem 1.15rem;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  translate: -50% 1.5rem;
  pointer-events: none;
  transition: opacity 0.25s ease, translate 0.35s var(--ease-boing);
}

.toast.is-visible {
  opacity: 1;
  translate: -50% 0;
}

/* Sheep that wander in at milestones */
.stray {
  position: fixed;
  bottom: 0;
  z-index: 40;
  width: 56px;
  pointer-events: none;
  animation: wander linear forwards;
}

/* --------------------------------------------------------------------------
   8. Sections
   -------------------------------------------------------------------------- */

.section {
  padding-block: clamp(3rem, 8vw, 5.5rem);
}

.section--tint {
  background: var(--bg-alt);
  border-block: var(--border) solid var(--line);
}

.section__head {
  max-width: 58ch;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

.section__head h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.75rem;
}

.section__head p {
  color: var(--muted);
  font-size: 1.05rem;
}

/* --------------------------------------------------------------------------
   9. Project cards
   -------------------------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  background: var(--surface);
  border: var(--border) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 1.4rem;
  transition: transform 0.2s var(--ease-boing), box-shadow 0.2s ease;
}

.card:hover,
.card:focus-within {
  transform: translate(-3px, -3px);
  box-shadow: 8px 8px 0 var(--shadow);
}

.card__top {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.card__logo {
  flex: none;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  background: var(--bg-alt);
  border: 2px solid var(--line-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  padding: 6px;
}

.card__logo img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  object-fit: contain;
}

.card h3 {
  font-size: 1.5rem;
}

.card__meta {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.card__body {
  color: var(--ink);
  font-size: 0.98rem;
  flex: 1;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tags li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border: 2px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
}

.card__link {
  align-self: flex-start;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 3px solid var(--accent-loud);
  padding-bottom: 2px;
}

.card__link::after {
  content: " \2192";
  display: inline-block;
  transition: translate 0.18s ease;
}

.card__link:hover::after {
  translate: 4px 0;
}

/* --------------------------------------------------------------------------
   10. Logo gallery
   -------------------------------------------------------------------------- */

.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.logo-grid > li {
  display: grid;
}

.logo-tile {
  margin: 0;
  min-height: 165px;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--surface);
  border: var(--border) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard-sm);
  text-align: center;
  transition: transform 0.2s var(--ease-boing);
}

.logo-tile:hover {
  transform: rotate(-1.5deg) translateY(-3px);
}

.logo-tile img {
  max-height: 76px;
  width: auto;
}

.logo-tile figcaption {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Empty slots waiting for artwork */
.logo-tile--empty {
  background: repeating-linear-gradient(
    45deg,
    var(--bg-alt),
    var(--bg-alt) 10px,
    var(--surface) 10px,
    var(--surface) 20px
  );
  border-style: dashed;
  box-shadow: none;
  color: var(--muted);
}

.logo-tile--empty .sheep-ghost {
  width: 44px;
  opacity: 0.4;
}

/* --------------------------------------------------------------------------
   11. About
   -------------------------------------------------------------------------- */

.about {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: clamp(1.5rem, 5vw, 3.5rem);
  align-items: start;
}

.prose p {
  max-width: 62ch;
  font-size: 1.08rem;
}

.facts {
  list-style: none;
  margin: 0;
  padding: 1.25rem;
  background: var(--surface);
  border: var(--border) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  display: grid;
  gap: 0.9rem;
}

.facts li {
  display: grid;
  gap: 0.15rem;
}

.facts dt,
.facts .k {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.facts .v {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

/* --------------------------------------------------------------------------
   12. Contact
   -------------------------------------------------------------------------- */

.contact {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 1.5rem;
}

.contact h2 {
  font-size: clamp(2rem, 6vw, 3.25rem);
}

.contact p {
  max-width: 48ch;
  color: var(--muted);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

/* --------------------------------------------------------------------------
   13. Footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: var(--border) solid var(--line);
  background: var(--bg-alt);
  padding-block: 2rem;
  text-align: center;
}

.site-footer__inner {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}

.site-footer img {
  width: 34px;
}

.copy {
  font-size: 0.9rem;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   14. Legal / long-form pages
   -------------------------------------------------------------------------- */

.doc {
  max-width: 46rem;
  margin-inline: auto;
  background: var(--surface);
  border: var(--border) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: clamp(1.5rem, 5vw, 3rem);
}

.doc h1 {
  font-size: clamp(1.9rem, 5vw, 2.75rem);
  margin-bottom: 0.5rem;
}

.doc h2 {
  font-size: 1.35rem;
  margin: 2rem 0 0.5rem;
}

.doc .revised {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.doc__back {
  margin-top: 2.5rem;
}

/* --------------------------------------------------------------------------
   15. Animations
   -------------------------------------------------------------------------- */

@keyframes jump {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-40px);
  }
  60% {
    transform: translateY(-10px);
  }
}

.jump {
  animation: jump 0.6s;
}

@keyframes nudge {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  35% {
    transform: translateY(-5px) rotate(-6deg);
  }
  70% {
    transform: translateY(-2px) rotate(4deg);
  }
}

@keyframes pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.14);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes wander {
  from {
    transform: translateX(-90px) scaleX(1);
  }
  to {
    transform: translateX(calc(100vw + 90px)) scaleX(1);
  }
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s var(--ease-boing);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   16. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 880px) {
  .hero__grid,
  .about {
    grid-template-columns: 1fr;
  }

  .sheep-stage {
    order: -1;
  }

  .nav a {
    padding: 0.4rem 0.55rem;
    font-size: 0.88rem;
  }

  .brand span {
    display: none;
  }
}

@media (max-width: 560px) {
  .site-header__inner {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .brand span {
    display: inline;
  }
}

/* --------------------------------------------------------------------------
   17. Reduced motion — a calm pasture for those who want one
   -------------------------------------------------------------------------- */

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .stray {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   18. Print
   -------------------------------------------------------------------------- */

@media print {
  .site-header,
  .sheep-stage,
  .toast,
  .stray {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
