:root {
  color-scheme: light;
  --bg: #f6f7f1;
  --surface: #ffffff;
  --text: #16281f;
  --muted: #55695d;
  --accent: #2d6a4f;
  --accent-deep: #163f2c;
  --accent-soft: #dbe9dc;
  --earth: #c98a4b;
  --sky: #a8dadc;
  --border: rgba(22, 40, 31, 0.12);
  --shadow: 0 20px 45px rgba(22, 60, 42, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--text);
  line-height: 1.65;
  background:
    linear-gradient(160deg, rgba(45, 106, 79, 0.07), transparent 40%),
    linear-gradient(180deg, var(--bg) 0%, #eef3ea 100%);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(22, 40, 31, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 40, 31, 0.03) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 90%);
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 5;
  opacity: 0.035;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 999px;
  border: 2px solid var(--bg);
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

/* Scroll progress */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 60;
  background: rgba(22, 40, 31, 0.06);
}

.scroll-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  transition: width 80ms linear;
}

.scroll-ball {
  position: absolute;
  top: -3.5px;
  left: 0%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translateX(-50%);
  transition: left 80ms linear;
  background: radial-gradient(circle at 35% 32%, #ffffff, var(--accent-deep) 82%);
  box-shadow: 0 2px 3px rgba(22, 40, 31, 0.35);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
  background: rgba(246, 247, 241, 0.82);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

.brand {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.brand-dot {
  color: var(--earth);
}

.nav-links {
  display: flex;
  gap: 1.25rem;
}

.nav-links a {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  transition: color 160ms ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -4px;
  height: 2px;
  background: var(--accent);
  transition: right 220ms ease;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a.active {
  color: var(--accent-deep);
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after,
.nav-links a.active::after {
  right: 0;
}

h1,
h2,
h3 {
  font-family: "Playfair Display", Georgia, serif;
  line-height: 1.1;
  margin: 0 0 0.75rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

h1 {
  font-size: clamp(2.6rem, 5.5vw, 4.4rem);
}

h2 {
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
}

.hero-tagline {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  color: var(--accent-deep);
  margin: 0 0 1rem;
}

.hero-text,
.section p,
.project-card p,
.about-list p,
.contact-card p {
  color: var(--muted);
  font-size: 1rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.3rem;
  border-radius: 999px;
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(22, 60, 42, 0.18);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #f6f7f1;
}

.btn-secondary {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.8);
}

/* Reveal-on-scroll */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 700ms ease, transform 700ms ease;
  transition-delay: var(--reveal-delay, 0ms);
}

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

/* Hero (full-screen juggle game) */

.hero {
  --ground-h: 200px;
  position: relative;
  min-height: calc(100svh - 4.5rem);
  overflow: hidden;
  isolation: isolate;
  cursor: default;
}

.hero .sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, #f6faf3 0%, #dcefe0 55%, #bfe0c4 100%);
}

.hero .sun {
  position: absolute;
  top: 12%;
  right: 9%;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  z-index: 1;
  background: radial-gradient(circle at 35% 35%, #fff6da, #ffd873 55%, transparent 76%);
  box-shadow: 0 0 52px 12px rgba(255, 216, 115, 0.35);
  pointer-events: none;
}

.hills {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.hill {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
}

.hill-back {
  width: 130%;
  height: 260px;
  bottom: calc(var(--ground-h) - 30px);
  background: #6b9c76;
  opacity: 0.55;
}

.hill-front {
  width: 150%;
  height: 220px;
  bottom: calc(var(--ground-h) - 60px);
  background: #3f7a52;
}

.pitch-stripes {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--ground-h);
  z-index: 2;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.07) 0px,
      rgba(255, 255, 255, 0.07) 40px,
      rgba(0, 0, 0, 0.05) 40px,
      rgba(0, 0, 0, 0.05) 80px
    ),
    #2d6a4f;
  pointer-events: none;
}

.hero > .container {
  position: relative;
  z-index: 3;
}

.hero-copy {
  max-width: 620px;
  padding: 5rem 0 2rem;
}

.goal {
  position: absolute;
  left: 50%;
  bottom: var(--ground-h);
  transform: translateX(-50%);
  width: 320px;
  height: 148px;
  z-index: 3;
  pointer-events: none;
}

.goal-net {
  position: absolute;
  inset: 8px 8px 0 8px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.32) 0px, rgba(255, 255, 255, 0.32) 1px, transparent 1px, transparent 11px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.32) 0px, rgba(255, 255, 255, 0.32) 1px, transparent 1px, transparent 11px);
  opacity: 0.6;
}

.goal-post {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 9px;
  background: #f7faf4;
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.22);
}

.goal-post-left {
  left: 0;
}

.goal-post-right {
  right: 0;
}

.goal-crossbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 9px;
  background: #f7faf4;
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.22);
}

.keeper {
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 26px;
  height: 52px;
  transform: translateX(-50%) translate(var(--dive-x, 0px), var(--dive-y, 0px)) rotate(var(--dive-rot, 0deg));
  transition: transform 340ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.keeper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #16281f;
  transform: translateX(-50%);
}

.keeper::after {
  content: "";
  position: absolute;
  top: 13px;
  left: 50%;
  width: 23px;
  height: 33px;
  border-radius: 7px;
  background: #c9483f;
  transform: translateX(-50%);
}

.ball-wrap {
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: 90px;
  height: 96px;
  z-index: 4;
  transform: translateX(-50%);
  will-change: transform, opacity;
}

.ball-shadow {
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 56px;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(10, 30, 20, 0.45), transparent 72%);
  transition: opacity 200ms ease;
}

.soccer-ball {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%) translate(var(--nudge-x, 0px), var(--nudge-y, 0px));
  touch-action: none;
  width: 74px;
  height: 74px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  filter: drop-shadow(0 6px 8px rgba(22, 40, 31, 0.25));
  transition: transform 260ms ease;
}

.soccer-ball:focus-visible {
  outline: 3px solid var(--accent-deep);
  outline-offset: 4px;
}

.soccer-ball.is-charging {
  transform: translateX(-50%) translate(var(--nudge-x, 0px), var(--nudge-y, 0px)) scale(0.93);
  transition: transform 120ms ease;
}

.ball-wrap.is-tapped .soccer-ball {
  animation: tap-squash 220ms ease;
}

@keyframes tap-squash {
  0% {
    transform: translateX(-50%) scale(1, 1);
  }
  35% {
    transform: translateX(-50%) scale(1.18, 0.82);
  }
  100% {
    transform: translateX(-50%) scale(1, 1);
  }
}

/* Shot: flight is driven frame-by-frame from JS (true parabolic arc), which sets
   ballWrap's inline transform directly. These custom properties just capture the
   final frame so .is-away can freeze the exact same look with no snap. */
.ball-wrap.is-away {
  transform: translateX(-50%) translate(var(--kick-dx), var(--kick-dy)) scale(var(--kick-scale, 0.32)) rotate(var(--kick-rot));
  opacity: 1;
}

/* Reset: fade the ball back to the spot for the next shot */
.ball-wrap.is-reset {
  transition: transform 280ms ease, opacity 280ms ease;
}

.ball-wrap.is-kicked .ball-shadow,
.ball-wrap.is-away .ball-shadow {
  opacity: 0;
}

.impact-ring {
  position: absolute;
  left: 0;
  top: 0;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid rgba(251, 253, 249, 0.9);
  pointer-events: none;
  z-index: 5;
  animation: impact-ring 480ms ease-out forwards;
}

@keyframes impact-ring {
  0% {
    transform: scale(0.4);
    opacity: 0.9;
  }
  100% {
    transform: scale(3.4);
    opacity: 0;
  }
}

.juggle-hud {
  position: absolute;
  bottom: calc(var(--ground-h) + 1.25rem);
  right: 1.5rem;
  z-index: 6;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  padding: 0.6rem 0.85rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(22, 40, 31, 0.1);
  backdrop-filter: blur(6px);
  font-size: 0.85rem;
  text-align: right;
}

.juggle-count strong {
  font-family: "Playfair Display", Georgia, serif;
  color: var(--accent-deep);
}

.juggle-hint {
  color: var(--muted);
  font-size: 0.78rem;
  transition: opacity 260ms ease;
}

/* Grass divider */

.grass-divider {
  height: 22px;
  background: var(--accent-soft);
  clip-path: polygon(
    0% 100%, 4% 30%, 8% 100%, 12% 25%, 16% 100%, 20% 35%, 24% 100%,
    28% 20%, 32% 100%, 36% 30%, 40% 100%, 44% 15%, 48% 100%, 52% 35%,
    56% 100%, 60% 25%, 64% 100%, 68% 30%, 72% 100%, 76% 20%, 80% 100%,
    84% 30%, 88% 100%, 92% 25%, 96% 100%, 100% 30%, 100% 100%
  );
}

/* Sections */

.section {
  padding: 1.4rem 0 4rem;
}

.section-heading {
  margin-bottom: 1.4rem;
}

.project-grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.4rem;
  border-radius: 1.2rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
  transform: perspective(800px) rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg));
  transition: transform 260ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.project-card:hover,
.project-card:focus-visible {
  border-color: rgba(45, 106, 79, 0.45);
  box-shadow: 0 20px 42px rgba(22, 60, 42, 0.2);
}

.project-card.featured {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(219, 233, 220, 0.9));
}

.project-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-num {
  font-size: 0.8rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}

.project-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--accent-deep);
  transform: translateX(0);
  transition: transform 220ms ease, background 220ms ease, border-color 220ms ease;
}

.project-card:hover .project-arrow {
  transform: translateX(4px);
  background: var(--accent);
  border-color: var(--accent);
  color: #f6f7f1;
}

.project-meta {
  margin-top: auto;
  padding-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  display: inline-flex;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.about-section {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: start;
}

.about-list {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.about-list > div {
  padding: 1rem 1.1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
}

.stat-grid {
  display: grid;
  gap: 1rem;
}

.stat-card {
  padding: 1.4rem 1.2rem;
  border-radius: 1.2rem;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-number {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.1rem, 4vw, 2.9rem);
  font-weight: 700;
  color: var(--accent-deep);
}

.stat-suffix {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.15rem;
  color: var(--accent);
  margin-left: 2px;
}

.stat-card p {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
}

.contact-card {
  padding: 1.6rem;
  border-radius: 1.4rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
}

.site-footer {
  padding: 1rem 0 2.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 30;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: var(--accent-deep);
  color: #f6f7f1;
  font-size: 1.1rem;
  box-shadow: 0 12px 24px rgba(22, 60, 42, 0.28);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease, background 180ms ease;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--accent);
}

@media (max-width: 860px) {
  .about-section {
    grid-template-columns: 1fr;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .nav {
    padding: 0.9rem 0;
  }

  .nav-links {
    gap: 0.9rem;
  }

  .hero {
    --ground-h: 140px;
    min-height: calc(100svh - 3.8rem);
  }

  .hero-copy {
    padding-top: 3rem;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  /* Move the score HUD clear of the goal, which is centered and would otherwise sit behind it */
  .juggle-hud {
    top: 1rem;
    bottom: auto;
  }

  .goal {
    width: 230px;
    height: 112px;
  }

  .keeper {
    width: 20px;
    height: 40px;
  }

  .keeper::before {
    width: 11px;
    height: 11px;
  }

  .keeper::after {
    top: 10px;
    width: 17px;
    height: 25px;
  }
}
