/* ==========================================================================
   Fruit Puzzle – Terms & Privacy site
   Visual language taken from the game: low-poly meadow backdrop, dark-green
   panels with an orange frame, white bevelled tiles, Baloo 2 headings.
   ========================================================================== */

@font-face {
  font-family: "Baloo 2";
  src: url("../assets/fonts/baloo2-latin.woff") format("woff");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --green-dark: #0f3d1a;      /* the game's panel / text green  */
  --green-mid: #1f6b2c;
  --green: #2e8c3d;
  --orange: #ffa500;          /* grid frame orange              */
  --orange-dark: #d98200;
  --yellow: #ffd933;          /* selected-tile yellow           */
  --paper: #f4fff0;
  --ink: #0f3d1a;
  --radius: 26px;
  --header-h: 64px;
  --font-display: "Baloo 2", "Nunito", "Trebuchet MS", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--paper);
  background: #8bd05f;
}

/* Fixed meadow backdrop (a pseudo-element, because background-attachment:
   fixed is unreliable on phones). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #8bd05f url("../assets/img/background.webp") center top / cover no-repeat;
}

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

a { color: var(--yellow); text-underline-offset: 3px; }
a:hover { color: #fff; }

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  border-radius: 12px;
  transition: top .15s;
}
.skip-link:focus { top: 12px; }

/* ---------- Top bar ---------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--green-dark);
  border-bottom: 4px solid var(--orange);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}

.topbar__inner {
  max-width: 1000px;
  height: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  line-height: 1;
  white-space: nowrap;
}
.topbar__brand img { display: block; }

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar__nav a {
  padding: 6px 14px;
  border-radius: 12px;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.topbar__nav a:hover,
.topbar__nav a:focus-visible { background: var(--yellow); color: var(--ink); }

/* ---------- Hero ------------------------------------------------------- */

.hero {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 64px) 16px clamp(36px, 7vw, 72px);
  text-align: center;
}

.hero__logo {
  position: relative;
  z-index: 1;
  display: block;
  width: min(520px, 86%);
  margin: 0 auto;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .35));
}

.hero__tagline,
.legal__heading {
  font-family: var(--font-display);
  font-weight: 800;
  color: #fff;
  -webkit-text-stroke: 7px var(--green-dark);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 rgba(15, 61, 26, .55);
  letter-spacing: .01em;
}

.hero__tagline {
  position: relative;
  z-index: 1;
  margin: 10px auto 4px;
  max-width: 17em;
  font-size: clamp(1.7rem, 5.2vw, 2.6rem);
  line-height: 1.15;
}

.hero__sub {
  position: relative;
  z-index: 1;
  margin: 8px 0 30px;
  color: #fff;
  font-size: 1.1rem;
  text-shadow: 0 2px 6px rgba(15, 61, 26, .8), 0 0 2px rgba(15, 61, 26, .9);
}

.hero__cards {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

/* White bevelled tile, as in the game board */
.tile-card {
  width: min(260px, 100%);
  padding: 20px 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: #fff url("../assets/img/tile.webp") center / 100% 100% no-repeat;
  border-radius: 20px;
  border: 4px solid var(--green-dark);
  box-shadow: 0 8px 0 var(--green-dark), 0 18px 28px rgba(0, 0, 0, .3);
  color: var(--ink);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
}
.tile-card:hover,
.tile-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--orange);
  box-shadow: 0 12px 0 var(--green-dark), 0 22px 30px rgba(0, 0, 0, .3);
  color: var(--ink);
}
.tile-card:active { transform: translateY(2px); box-shadow: 0 4px 0 var(--green-dark), 0 8px 14px rgba(0, 0, 0, .3); }

.tile-card__tile img { display: block; width: 64px; height: 64px; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .25)); }
.tile-card__label { font-family: var(--font-display); font-weight: 800; font-size: 1.45rem; line-height: 1.2; }
.tile-card__hint  { font-size: .95rem; color: var(--green-mid); line-height: 1.3; }

/* Floating fruit around the logo */
.hero__fruits { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fruit {
  position: absolute;
  width: clamp(48px, 8vw, 84px);
  height: auto;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .3));
  animation: bob 5s ease-in-out infinite;
}
.f1 { left: 4%;  top: 12%;  --rot: -14deg; animation-delay: -.5s; }
.f2 { right: 5%; top: 8%;   --rot: 18deg;  animation-delay: -2s; }
.f3 { left: 9%;  top: 52%;  --rot: 10deg;  animation-delay: -3.2s; }
.f4 { right: 8%; top: 46%;  --rot: -10deg; animation-delay: -1.2s; }
.f5 { left: 5%;  bottom: 8%; --rot: 16deg; animation-delay: -4s; }
.f6 { right: 5%; bottom: 7%; --rot: -18deg; animation-delay: -2.6s; }

@keyframes bob {
  0%, 100% { transform: translateY(0)   rotate(var(--rot)); }
  50%      { transform: translateY(-12px) rotate(calc(var(--rot) * -0.5)); }
}

/* ---------- Legal sections -------------------------------------------- */

.legal {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.legal__heading {
  margin: 0 0 18px;
  text-align: center;
  font-size: clamp(2.3rem, 7vw, 3.4rem);
  line-height: 1.1;
}

.panel {
  padding: clamp(20px, 4.5vw, 44px);
  background: rgba(15, 61, 26, .96);
  border: 4px solid var(--orange);
  border-radius: var(--radius);
  box-shadow: 0 0 0 4px var(--green-dark), 0 18px 44px rgba(0, 0, 0, .35);
}

.panel p { margin: 0 0 1em; }
.panel p:last-child { margin-bottom: 0; }

.panel__meta { margin-bottom: 1.2em !important; }

.badge {
  display: inline-block;
  padding: 4px 16px;
  background: var(--yellow);
  color: var(--ink);
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .98rem;
  line-height: 1.6;
}

.panel ul { margin: 0 0 1em; padding-left: 1.3em; }
.panel li { margin: .3em 0; }
.panel li::marker { color: var(--orange); }

/* Section headings with a numbered tile */
.panel section {
  padding-top: 26px;
  margin-top: 26px;
  border-top: 2px dashed rgba(255, 255, 255, .16);
}

.panel h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 .5em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1.25;
  color: var(--yellow);
}

.num {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 8px;
  background: var(--orange);
  color: var(--ink);
  border-radius: 11px;
  box-shadow: 0 3px 0 var(--orange-dark);
  font-size: 1.15rem;
  line-height: 1;
}

.panel section:target h3 .num {
  background: var(--yellow);
  animation: pop .7s ease;
}
@keyframes pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.35) rotate(-6deg); }
  100% { transform: scale(1); }
}

/* Table of contents as a grid of little tiles */
.toc {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin: 1.6em 0 .4em;
}

.toc a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #fff url("../assets/img/tile.webp") center / 100% 100% no-repeat;
  border-radius: 10px;
  border-bottom: 3px solid rgba(15, 61, 26, .35);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.25;
  transition: transform .12s, background-color .12s;
}
.toc a b {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  background: var(--green);
  color: #fff;
  border-radius: 8px;
  font-size: .85rem;
}
.toc a:hover,
.toc a:focus-visible { transform: translateY(-2px); background-color: var(--yellow); color: var(--ink); }

/* Plain-language summary box */
.callout {
  margin: 1.5em 0 0;
  padding: 18px 22px 12px;
  background: rgba(255, 255, 255, .09);
  border-left: 6px solid var(--yellow);
  border-radius: 6px 18px 18px 6px;
}
.callout h3 { margin-bottom: .3em; font-size: 1.3rem; }
.callout ul { margin-bottom: .6em; }

/* ---------- Contact ---------------------------------------------------- */

.panel--contact { text-align: center; }

.button {
  display: inline-block;
  margin-top: .4em;
  padding: 10px 28px 8px;
  background: var(--orange);
  color: var(--ink);
  border-bottom: 6px solid var(--orange-dark);
  border-radius: 16px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  line-height: 1.4;
  text-decoration: none;
  transition: transform .12s, background-color .12s;
}
.button:hover,
.button:focus-visible { background: var(--yellow); color: var(--ink); transform: translateY(-2px); }

/* ---------- Footer ----------------------------------------------------- */

.footer {
  margin-top: 24px;
  padding: 32px 16px 40px;
  background: var(--green-dark);
  border-top: 4px solid var(--orange);
  color: #d9f2d2;
  text-align: center;
  font-size: .98rem;
}
.footer p { margin: .3em 0; line-height: 1.6; }
.footer__logo { display: block; width: 140px; height: auto; margin: 0 auto 10px; }
.footer a { color: var(--yellow); }
.footer a:hover { color: #fff; }

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

@media (max-width: 720px) {
  :root { --header-h: 58px; }
  body { font-size: 1rem; }
  .topbar__brand span { display: none; }
  .topbar__inner { justify-content: center; }
  .topbar__nav a { padding: 6px 10px; font-size: 1rem; }
  .f3, .f4 { display: none; }
  .f1 { left: 1%; top: 3%; }
  .f2 { right: 1%; top: 2%; }
  .f5 { left: 6%; }
  .f6 { right: 6%; }
  .panel { border-width: 3px; box-shadow: 0 0 0 3px var(--green-dark), 0 12px 30px rgba(0, 0, 0, .35); }
  .panel h3 { font-size: 1.3rem; }
  .toc { grid-template-columns: repeat(2, 1fr); }
  .hero__tagline,
  .legal__heading { -webkit-text-stroke-width: 6px; }
}

@media (max-width: 380px) {
  .topbar__nav a { padding: 6px 7px; font-size: .92rem; }
  .toc { grid-template-columns: 1fr; }
}

/* ---------- Motion & print -------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fruit { animation: none; transform: rotate(var(--rot)); }
  .tile-card, .toc a, .button { transition: none; }
  .panel section:target h3 .num { animation: none; }
}

@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  body::before, .topbar, .hero__fruits, .hero__cards, .hero__sub, .toc, .skip-link, .footer__logo, .legal--contact { display: none !important; }
  .hero { padding: 0 0 12pt; }
  .hero__logo { width: 180px; filter: none; }
  .hero__tagline, .legal__heading { color: #000; -webkit-text-stroke: 0; text-shadow: none; text-align: left; }
  .panel { background: none; color: #000; border: 0; box-shadow: none; padding: 0; }
  .panel h3 { color: #000; }
  .num { background: none; color: #000; box-shadow: none; padding: 0; min-width: 0; height: auto; }
  .badge { background: none; border: 1px solid #000; }
  .callout { background: none; border-left-color: #000; }
  a { color: #000; }
  .footer { background: none; color: #000; border: 0; }
  .legal { page-break-before: always; }
}
