/* Mango Tree Games — shared styles. Fonts are self-hosted (SIL OFL, see fonts/OFL.txt). */

@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Josefin Sans';
  src: url('../fonts/josefin-sans-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('../fonts/dm-sans-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --green-deep: #0b2e24;
  --green: #114536;
  --green-lift: #175a45;
  --leaf: #3e8e5a;
  --mango: #ff7a1a;
  --mango-mid: #ff9a2e;
  --mango-light: #ffb44d;
  --cream: #f6ebd9;
  --ink: #12382c;
  --cream-dim: rgba(246, 235, 217, 0.78);

  --font-title: 'Fraunces', Georgia, serif;
  --font-caps: 'Josefin Sans', 'Trebuchet MS', sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  font-family: var(--font-body);
  line-height: 1.55;
  color: var(--cream);
  background: var(--green-deep);
}

a { color: inherit; }
img, svg { max-width: 100%; }

/* The sprite must stay renderable (display:none breaks gradient fills). */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

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

/* ---------- type helpers ---------- */
.caps {
  font-family: var(--font-caps);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--cream-dim);
}
.title {
  font-family: var(--font-title);
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-weight: 500;
  line-height: 1.04;
  color: var(--cream);
  margin: 0;
}

/* ---------- header / footer ---------- */
.site-header,
.site-footer {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.6rem clamp(1.25rem, 6vw, 5rem);
}
.site-footer { padding-top: 1rem; padding-bottom: 1.4rem; }

.logo {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 0.7em;
  font-family: var(--font-caps);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cream);
  text-decoration: none;
}
.logo svg { width: 1.9em; height: 1.9em; flex: none; }

.site-header nav { display: flex; gap: 2rem; }
.site-header nav a,
.site-footer a,
.site-footer span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-caps);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.68rem;
  color: var(--cream-dim);
  text-decoration: none;
  padding: 0.7rem 0;
  transition: color 0.2s ease;
}
.site-header nav a:hover,
.site-footer a:hover { color: var(--cream); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.8em;
  padding: 0.95em 1.6em;
  border-radius: 999px;
  background: var(--mango);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  box-shadow: 0 10px 34px rgba(255, 122, 26, 0.45);
}


/* ---------- the green scene (landing, details, 404) ---------- */
.scene {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 100%, var(--green-lift) 0%, var(--green) 40%, var(--green-deep) 100%);
}

/* ---------- motion (all of it off under reduce-motion) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- landing page ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.home .scene {
  --hero: min(44vw, 52svh);
  --footer-h: 0rem;
  --gutter: clamp(1.25rem, 6vw, 5rem);
  overflow-x: hidden;
  overflow-y: hidden;
}

.art { display: block; position: absolute; pointer-events: none; }

.home .hero-glow {
  position: absolute;
  left: 50%;
  bottom: var(--footer-h);
  width: min(110vw, 90svh);
  height: calc(var(--hero) * 1.1);
  transform: translateX(-50%);
  background: radial-gradient(50% 60% at 50% 100%, rgba(255, 154, 46, 0.4), rgba(255, 154, 46, 0) 100%);
  pointer-events: none;
}
.art-hero {
  left: 50%;
  bottom: calc(var(--hero) * -0.45 + var(--footer-h));
  width: var(--hero);
  height: var(--hero);
  transform: translateX(-50%) rotate(-8deg);
}
.art-mango-s { left: 5%; bottom: 26%; width: 4.6rem; height: 4.6rem; transform: rotate(-24deg); }
.art-leaf-r { right: -1.5rem; top: 40%; width: 8.5rem; height: 3.4rem; transform: rotate(-35deg); }
.art-leaf-l { left: -1.5rem; top: 24%; width: 5.5rem; height: 2.2rem; transform: rotate(25deg); opacity: 0.7; }

.home main {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 var(--gutter);
}

.featured {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin: clamp(1.5rem, 8svh, 5rem) 0 0;
  padding: 0 clamp(0rem, 4vw, 4rem);
}
.featured-game .title { font-size: clamp(1.9rem, 3.4vw, 2.6rem); }
.featured-game .caps { margin: 1.1em 0 0; }

/* the vine: a wavy line with the games hanging from it */
.vine {
  position: relative;
  height: 9rem;
  margin: auto 0 calc(var(--hero) * 0.55 + 1.5rem);
}
.vine-sway { position: absolute; inset: 0; transform-origin: 0 40px; }
.vine-line { left: 0; top: 4.4rem; width: 100%; height: 80px; overflow: visible; }
.vine-leaf { width: 3rem; height: 1.2rem; opacity: 0.95; }
.vine-leaf-1 { left: 11%; top: calc(4.4rem + 22px); transform: rotate(-25deg); }
.vine-leaf-2 { left: 44%; top: calc(4.4rem + 30px); transform: rotate(160deg); }
.vine-leaf-3 { left: 93%; top: calc(4.4rem + 32px); transform: rotate(-150deg); }

.vine-game, .vine-slot {
  position: absolute;
  left: var(--x);
  top: calc(4.4rem + var(--y));
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
  text-decoration: none;
}
.vine-stalk { display: block; width: 2px; height: 14px; background: #5a3a22; }
.vine-slot .vine-stalk { background: rgba(246, 235, 217, 0.35); }
.vine-fruit { position: static; width: 3.4rem; height: 3.4rem; margin-top: -2px; }
.vine-slot .vine-fruit { width: 2.4rem; height: 2.4rem; }

.vine-game { padding: 0 0.5rem 0.4rem; transition: transform 0.25s ease; }
.vine-game .vine-fruit { filter: drop-shadow(0 6px 18px rgba(255, 122, 26, 0.65)); transition: filter 0.25s ease; }
.vine-label {
  position: absolute;
  bottom: calc(100% + 1.5rem);
  left: 50%;
  white-space: nowrap;
  transform: translateX(-50%);
  text-align: center;
  color: var(--cream);
  font-weight: 600;
  transition: color 0.2s ease;
}
.vine-game:hover, .vine-game:focus-visible { transform: translate(-50%, -4px); }
.vine-game:hover .vine-fruit, .vine-game:focus-visible .vine-fruit { filter: drop-shadow(0 8px 26px rgba(255, 154, 46, 0.95)); }
.vine-game:hover .vine-label, .vine-game:focus-visible .vine-label { color: #fff; }

.vine-note {
  position: absolute;
  left: 68%;
  top: calc(4.4rem - 0.2rem);
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ---------- motion ---------- */
@keyframes sway { from { transform: rotate(-0.6deg); } to { transform: rotate(0.6deg); } }
@keyframes bob { from { translate: 0 0; } to { translate: 0 -8px; } }
@keyframes glow { from { opacity: 0.85; } to { opacity: 1; } }

.vine-sway { animation: sway 6s ease-in-out infinite alternate; }
.art-mango-s { animation: bob 5s ease-in-out infinite alternate; }
.art-leaf-r { animation: bob 7s ease-in-out infinite alternate -2s; }
.home .hero-glow { animation: glow 4s ease-in-out infinite alternate; }

/* ---------- tablets and phones ---------- */
@media (max-width: 1100px) {
  /* a solid footer strip keeps its text off the big mango */
  .home .scene { --footer-h: 3.5rem; }
  .home .site-footer { height: var(--footer-h); padding-top: 0; padding-bottom: 0; background: var(--green-deep); }
  .art-mango-s { display: none; }
}

@media (max-width: 1100px) and (min-width: 721px) and (orientation: portrait) {
  .home .scene { --hero: min(60vw, 40svh); }
}

@media (max-width: 720px) {
  .home .scene { --hero: min(82vw, 38svh); }
  .site-header { padding-top: 1.1rem; }
  .site-header nav { gap: 1.2rem; }
  .logo { letter-spacing: 0.2em; }
  .featured { flex-direction: column; align-items: flex-start; gap: 1.2rem; padding: 0; margin-top: 1.5rem; }
  .vine-label { white-space: normal; width: 8.5rem; }
  .vine-note { left: 72%; top: calc(4.4rem - 1.6rem); white-space: normal; width: 7rem; text-align: center; letter-spacing: 0.22em; }
  .vine-game { --x: 27%; }
  .art-leaf-r { top: 40%; }
  .home .vine { margin-bottom: calc(var(--hero) * 0.55 + var(--footer-h) * 0 + 2.8rem); }
  .site-footer a, .site-footer span { letter-spacing: 0.2em; }
  .art-mango-s { display: none; }
}

/* ---------- game details page ---------- */
.details .scene { --gutter: clamp(1.25rem, 6vw, 5rem); overflow-x: hidden; overflow-y: hidden; }
.details .art-leaf-l { left: -1.5rem; top: 52%; width: 7rem; height: 2.8rem; transform: rotate(25deg); opacity: 0.7; }
.details .art-mango-s { left: 3%; bottom: 14%; width: 4.2rem; height: 4.2rem; transform: rotate(-24deg); }

.game {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 6rem);
  padding: clamp(1rem, 4svh, 3rem) calc(var(--gutter) + 2vw);
}
.game-text .back {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  min-height: 44px;
  text-decoration: none;
  transition: color 0.2s ease;
}
.game-text .back:hover { color: var(--cream); }
.game-text .title { font-size: clamp(2.4rem, 5vw, 4rem); margin-top: 0.6rem; }
.game-meta { margin: 1.3rem 0 0; }
.blurb {
  max-width: 34rem;
  margin: 1.6rem 0 2rem;
  font-size: clamp(1rem, 1.2vw, 1.15rem);
  line-height: 1.65;
  color: rgba(246, 235, 217, 0.82);
}
.game-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem 1.8rem; }
.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--mango-light);
  text-decoration: underline;
  text-decoration-color: rgba(255, 180, 77, 0.5);
  text-underline-offset: 6px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.text-link:hover { color: #fff; text-decoration-color: #fff; }

.game-art {
  justify-self: end;
  width: min(100%, 34rem);
  aspect-ratio: 4 / 3.4;
  border-radius: 22px;
  background: radial-gradient(80% 80% at 50% 70%, #1f6e4e, #0f3d30);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.game-art-svg { position: static; width: 100%; height: 100%; }

@keyframes game-bob { from { translate: 0 0; } to { translate: 0 -6px; } }
.details .game-art { animation: game-bob 6s ease-in-out infinite alternate; }
.details .art-mango-s { animation: bob 5s ease-in-out infinite alternate; }

@media (max-width: 900px) {
  .game { grid-template-columns: minmax(0, 1fr); padding-left: var(--gutter); padding-right: var(--gutter); gap: 2.2rem; }
  .game-art { justify-self: center; }
  .details .art-mango-s, .details .art-leaf-l { display: none; }
  .details .site-footer { padding-top: 1.5rem; }
}

/* ---------- 404 ---------- */
.lost {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 2rem var(--gutter, 1.5rem) 3rem;
  text-align: center;
}
.lost .title { font-size: clamp(2rem, 5vw, 3.6rem); max-width: 18ch; }
.lost .caps { margin: 0 0 0.8rem; }
.lost-mango {
  position: static;
  width: clamp(6rem, 14vw, 9rem);
  height: clamp(6rem, 14vw, 9rem);
  transform: rotate(78deg);
  filter: drop-shadow(0 14px 30px rgba(255, 122, 26, 0.5));
}

/* ---------- contact page ---------- */
.site-header nav a[aria-current] { color: var(--cream); }
.contact .scene { overflow-x: hidden; overflow-y: hidden; }
.contact .art-mango-s { top: 20%; right: 10%; left: auto; bottom: auto; width: 5.6rem; height: 5.6rem; transform: rotate(14deg); }
.contact .art-leaf-r { right: -1.5rem; bottom: 18%; top: auto; width: 8rem; height: 3.2rem; transform: rotate(-30deg); }
.contact-main {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
  padding: 2rem calc(clamp(1.25rem, 6vw, 5rem) + 2vw) 4rem;
}
.contact-main .caps { margin: 0; }
.contact-main .title { font-size: clamp(2.6rem, 6vw, 4.6rem); }
.contact-note { max-width: 32rem; margin: 0.4rem 0 0; font-size: clamp(1rem, 1.2vw, 1.15rem); line-height: 1.65; color: rgba(246, 235, 217, 0.82); }
.contact-email {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-title);
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-size: clamp(1.4rem, 4.2vw, 2.4rem);
  color: var(--mango-light);
  text-decoration: underline;
  text-decoration-color: rgba(255, 180, 77, 0.5);
  text-underline-offset: 8px;
  overflow-wrap: anywhere;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.contact-email:hover { color: #fff; text-decoration-color: #fff; }
.contact .art-mango-s { animation: bob 5s ease-in-out infinite alternate; }
@media (max-width: 720px) {
  .contact .art-mango-s { top: 11rem; right: 8%; width: 4.4rem; height: 4.4rem; }
  .contact-main { padding-left: var(--gutter, 1.25rem); padding-right: var(--gutter, 1.25rem); }
}
