/* =========================
   GLOBAL DESIGN TOKENS
   ========================= */

:root {

  --color-bg: #FAFBFC;
  --color-primary: #2563EB;
  --color-primary-hover: #1D4ED8;

  --color-accent: #F59E0B;
  --color-accent-hover: #D97706;

  --color-text: #1F2937;
  --color-text-muted: #6B7280;

  --color-border: #E5E7EB;
  --color-card: #FFFFFF;

  --radius: 8px;

  --container-width: 900px;
}

/* =========================
   RESET
   ========================= */

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-y: scroll;
}

/* Header */
.site-header {
  text-align: center;
  padding: 1.2rem 1rem;
  background: #ffffff;
  border-bottom: 1px solid #eee;
}

.site-header h1 {
  font-size: clamp(1.5rem, 5vw, 2rem);
}

.tagline {
  margin-top: 0.35rem;
  color: #555;
  font-size: clamp(0.85rem, 3.5vw, 0.95rem);
}

/* Layout */
.container {
  max-width: var(--container-width);
  margin: auto;
  padding: 16px;
}

.container-narrow {
  max-width: 760px;
}

/* TYPOGRAPHY */
.section {
  margin: 40px 0;
}

h1,h2,h3 {
  line-height: 1.2;
  margin-top: 0;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

p {
  color: var(--color-text-muted);
}


/* LINKS */

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}


/* BUTTONS */

.button {
  display: inline-block;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: white;
  border: none;
  cursor: pointer;
}

.button:hover {
  background: var(--color-primary-hover);
}

.button-accent {
  background: var(--color-accent);
}

.button-accent:hover {
  background: var(--color-accent-hover);
}

.button:active { background: #1E40AF; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.button-accent:active { background: #B45309; }

/* ICON BUTTONS */

.icon-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  color: var(--color-text);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.icon-button:hover {
  background: #f3f4f6;
  border-color: #cbd5e1;
}

.icon-button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.icon-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.icon-button-image {
  width: 1rem;
  height: 1rem;
  display: block;
  pointer-events: none;
}

.icon-button-cross {
  color: #b91c1c;
}

.icon-button-cross:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

.icon-button-cross .icon-button-image {
  filter: invert(20%) sepia(77%) saturate(2811%) hue-rotate(346deg) brightness(81%) contrast(90%);
}

/* CARDS */

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}


/* NAVBAR */

.navbar {
  background: white;
  border-bottom: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
}

/* Game pages: navbar floats over the game without disrupting its layout */
.game-page .navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-text);
  text-decoration: none;
}

.nav-logo:hover { text-decoration: none; }

.nav-links a {
  margin-left: 16px;
}


/* FOOTER */

.footer {
  margin-top: 40px;
  padding: 20px;
  text-align: center;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}


/* MOBILE FRIENDLY */

@media (max-width:600px) {

  h1 {
    font-size: 1.6rem;
  }

  .nav-links {
    font-size: 0.85rem;
  }

}

.section-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  margin-bottom: 0.6rem;
}

/* Card grid - 2 cols on mobile, auto-fills wider on larger screens */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

@media (min-width: 500px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 750px) {
  .cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* Card */
.card {
  display: block;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  background: white;
  margin-bottom: 0;
  border-left: 4px solid var(--color-border);
  transition: box-shadow 0.12s ease;
}

/* Category accent — left border only, semantic not decorative */
.tools { border-left-color: #4f8ef7; }
.fun   { border-left-color: #f7b84f; }
.edu   { border-left-color: #4fbf7a; }
.utils { border-left-color: #a78bfa; }

.card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.card h3 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.card p {
  font-size: 0.78rem;
  color: #666;
  line-height: 1.35;
}

.show-all-card {
  border-left-style: dashed;
}

.show-all-card h3 {
  color: var(--color-primary);
}

.page-tagline {
  margin: 0 0 8px;
  color: var(--color-text-muted);
}

.page-intro {
  margin-bottom: 1.5rem;
}

.page-intro p {
  margin: 0.35rem 0 0;
}

.breadcrumb {
  display: inline-block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

/* Footer */
.no-footer .site-footer {
  display: none;
}

.site-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: #aaa;
  border-top: 1px solid #eee;
  margin-top: 0.5rem;
}
