/* ============================================
   farisaurus.com — Stylesheet
   Theme: Catppuccin Mocha
   ============================================ */

/* --- CSS Variables (Catppuccin Mocha) --- */
:root {
  /* Base */
  --ctp-base: #1e1e2e;
  --ctp-mantle: #181825;
  --ctp-crust: #11111b;

  /* Surface */
  --ctp-surface0: #313244;
  --ctp-surface1: #45475a;
  --ctp-surface2: #585b70;

  /* Overlay */
  --ctp-overlay0: #6c7086;
  --ctp-overlay1: #7f849c;
  --ctp-overlay2: #9399b2;

  /* Text */
  --ctp-text: #cdd6f4;
  --ctp-subtext0: #a6adc8;
  --ctp-subtext1: #bac2de;

  /* Accents */
  --ctp-blue: #89b4fa;
  --ctp-lavender: #b4befe;
  --ctp-mauve: #cba6f7;
  --ctp-green: #a6e3a1;
  --ctp-peach: #fab387;
  --ctp-yellow: #f9e2af;
  --ctp-red: #f38ba8;
  --ctp-teal: #94e2d5;

  /* Shadows */
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(137, 180, 250, 0.3);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 48px;
  --space-2xl: 80px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 50px;

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 18px;
  line-height: 1.6;
  color: var(--ctp-text);
  background-color: var(--ctp-base);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--ctp-blue);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--ctp-lavender);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ctp-lavender);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --- Skip Link --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  background: var(--ctp-surface0);
  color: var(--ctp-text);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  z-index: 9999;
  font-weight: 600;
}

.skip-link:focus {
  top: var(--space-md);
}

/* --- Particles Background --- */
.particles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  0% {
    transform: translateY(100vh) translateX(0);
    opacity: 0;
  }
  15% {
    opacity: 0.35;
  }
  85% {
    opacity: 0.35;
  }
  100% {
    transform: translateY(-10vh) translateX(20px);
    opacity: 0;
  }
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav.visible {
  transform: translateY(0);
}

.nav-inner {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(49, 50, 68, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-pill);
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid rgba(137, 180, 250, 0.1);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--ctp-text);
  font-weight: 700;
  font-size: 16px;
}

.nav-logo:hover {
  color: var(--ctp-lavender);
}

.nav-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: var(--space-lg);
}

.nav-links a {
  color: var(--ctp-subtext0);
  font-size: 14px;
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-pill);
}

.nav-links a:hover {
  color: var(--ctp-text);
  background: rgba(180, 190, 254, 0.1);
}

/* --- Hero --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  z-index: 1;
}

.hero-content {
  max-width: 680px;
  animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-logo-wrap {
  margin-bottom: var(--space-lg);
}

.hero-logo-img {
  width: 280px;
  max-width: 80vw;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 0 30px rgba(203, 166, 247, 0.3));
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-logo-img:hover {
  transform: scale(1.05);
}

.hero-subtitle {
  font-size: 20px;
  color: var(--ctp-subtext0);
  margin-bottom: var(--space-lg);
  font-weight: 400;
}

.hero-intro {
  font-size: 16px;
  color: var(--ctp-subtext1);
  margin-bottom: var(--space-xl);
  line-height: 1.7;
}

.hero-buttons {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

/* Ko-fi hero button — matches .btn-primary */
.btn-kofi {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--ctp-crust);
  background: var(--ctp-blue);
  border: 2px solid var(--ctp-blue);
  text-decoration: none;
  cursor: pointer;
  min-height: 48px;
  transition: var(--transition);
}

.btn-kofi:hover {
  background: var(--ctp-lavender);
  border-color: var(--ctp-lavender);
  color: var(--ctp-crust);
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.kofi-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Footer Ko-fi link */
.footer-kofi-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ctp-subtext0);
  font-weight: 600;
  font-size: 15px;
  position: relative;
}

.footer-kofi-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--ctp-lavender);
  transition: width 0.3s ease;
}

.footer-kofi-link:hover {
  color: var(--ctp-text);
}

.footer-kofi-link:hover::after {
  width: 100%;
}

.kofi-icon-sm {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.hero-scroll-hint {
  position: absolute;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s infinite;
}

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

.scroll-arrow {
  display: block;
  width: 20px;
  height: 20px;
  border-right: 2px solid var(--ctp-subtext0);
  border-bottom: 2px solid var(--ctp-subtext0);
  transform: rotate(45deg);
  opacity: 0.5;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  min-height: 48px;
}

.btn-primary {
  background: var(--ctp-blue);
  color: var(--ctp-crust);
  border-color: var(--ctp-blue);
}

.btn-primary:hover {
  background: var(--ctp-lavender);
  border-color: var(--ctp-lavender);
  color: var(--ctp-crust);
  transform: scale(1.05);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: transparent;
  color: var(--ctp-blue);
  border-color: var(--ctp-blue);
}

.btn-secondary:hover {
  background: rgba(137, 180, 250, 0.1);
  color: var(--ctp-lavender);
  border-color: var(--ctp-lavender);
  transform: scale(1.05);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* --- Container --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* --- Section Title --- */
.section-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.section-icon {
  font-size: 28px;
}

/* --- Tools Section --- */
.tools {
  position: relative;
  padding: var(--space-2xl) 0;
  z-index: 1;
}

.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

/* --- Tool Card --- */
.tool-card {
  background: var(--ctp-surface0);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(50px);
}

.tool-card.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.tool-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-card-hover);
}

.tool-card:hover .tool-image img {
  transform: scale(1.05);
}

.tool-card.disabled {
  opacity: 0.7;
}

.tool-card.disabled:hover {
  transform: translateY(-4px);
}

.tool-image {
  position: relative;
  height: 180px;
  overflow: hidden;
  background: var(--ctp-crust);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.tool-status {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-live {
  background: var(--ctp-green);
  color: var(--ctp-crust);
}

.status-coming-soon {
  background: var(--ctp-peach);
  color: var(--ctp-crust);
}

.status-experimental {
  background: var(--ctp-yellow);
  color: var(--ctp-crust);
}

.tool-content {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.tool-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--ctp-text);
}

.tool-desc {
  font-size: 15px;
  color: var(--ctp-subtext0);
  line-height: 1.6;
  margin-bottom: var(--space-lg);
  flex-grow: 1;
}

.tool-link {
  align-self: flex-start;
  padding: 10px 24px;
  font-size: 14px;
  min-height: 42px;
}

/* --- Dino Game Section --- */
.dino-section {
  position: relative;
  padding: var(--space-2xl) 0;
  z-index: 1;
}

/* Game card: centered widget with rounded corners and shadow */
.game-card {
  position: relative;
  max-width: 720px;
  margin: var(--space-xl) auto 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--ctp-surface0);
  border: 1px solid rgba(137, 180, 250, 0.08);
  box-shadow: var(--shadow-card);
}

/* Canvas fills the card width; aspect-ratio preserved by CSS */
#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  background: var(--ctp-crust);
  cursor: pointer;
}

/* HUD: score + best, anchored inside the card */
.game-hud {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-xs);
  pointer-events: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--ctp-subtext1);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.game-score {
  font-size: 18px;
  color: var(--ctp-text);
}

.game-high-score {
  font-size: 13px;
  color: var(--ctp-subtext0);
}

/* Overlays: fill the entire card, clipped by overflow:hidden on parent */
.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  background: rgba(17, 17, 27, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.game-over-overlay {
  gap: var(--space-sm);
}

/* [hidden] must override display:flex */
.game-overlay[hidden],
.game-over-overlay[hidden] {
  display: none;
}

.game-start-btn {
  font-size: 18px;
  padding: 14px 36px;
}

.game-instructions {
  color: var(--ctp-subtext0);
  font-size: 14px;
  text-align: center;
}

.game-over-text {
  font-size: 28px;
  font-weight: 700;
  color: var(--ctp-mauve);
  text-shadow: 0 0 20px rgba(203, 166, 247, 0.4);
}

.game-final-score {
  font-size: 18px;
  color: var(--ctp-text);
  margin-bottom: var(--space-sm);
}

/* --- Footer --- */
.footer {
  position: relative;
  z-index: 1;
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--ctp-surface0);
  text-align: center;
}

.footer-text {
  color: var(--ctp-subtext0);
  font-size: 15px;
  margin-bottom: var(--space-md);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  list-style: none;
}

.footer-links a {
  color: var(--ctp-subtext0);
  font-size: 15px;
  font-weight: 600;
  position: relative;
}

.footer-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--ctp-lavender);
  transition: width 0.3s ease;
}

.footer-links a:hover {
  color: var(--ctp-text);
}

.footer-links a:hover::after {
  width: 100%;
}

/* --- Utilities --- */
.hide-mobile {
  display: none;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .particle {
    display: none;
  }

  .tool-card {
    opacity: 1;
    transform: none;
  }
}

/* --- Mobile (< 768px) comprehensive overrides --- */
@media (max-width: 767px) {

  /* Base */
  body {
    font-size: 16px;
  }

  /* Container: tighter side padding */
  .container {
    padding: 0 var(--space-sm);
  }

  /* ---- Navigation ---- */
  .nav {
    padding: var(--space-xs) var(--space-sm);
  }

  .nav-inner {
    padding: var(--space-xs) var(--space-md);
    gap: var(--space-sm);
  }

  .nav-logo-text {
    display: none;
  }

  .nav-logo-img {
    width: 24px;
    height: 24px;
  }

  .nav-links {
    gap: var(--space-xs);
  }

  .nav-links a {
    font-size: 12px;
    padding: var(--space-xs) 10px;
  }

  /* ---- Hero ---- */
  .hero {
    min-height: auto;
    padding: var(--space-xl) var(--space-sm) var(--space-2xl);
  }

  .hero-logo-img {
    width: 200px;
    max-width: 70vw;
  }

  .hero-subtitle {
    font-size: 18px;
    margin-bottom: var(--space-md);
  }

  .hero-intro {
    font-size: 15px;
    margin-bottom: var(--space-lg);
    line-height: 1.6;
  }

  .hero-buttons {
    flex-direction: column;
    gap: var(--space-sm);
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
  }

  .hero-buttons .btn,
  .hero-buttons .btn-kofi {
    width: 100%;
  }

  /* ---- Section titles ---- */
  .section-title {
    font-size: 26px;
    margin-bottom: var(--space-lg);
  }

  .section-icon {
    font-size: 22px;
  }

  /* ---- Tools ---- */
  .tools {
    padding: var(--space-xl) 0;
  }

  .tool-image {
    height: 160px;
  }

  .tool-content {
    padding: var(--space-md);
  }

  .tool-title {
    font-size: 20px;
  }

  .tool-desc {
    font-size: 14px;
  }

  /* ---- Dino Game ---- */
  .dino-section {
    padding: var(--space-xl) 0;
  }

  .game-card {
    margin-top: var(--space-lg);
    border-radius: var(--radius-md);
  }

  .game-hud {
    top: var(--space-sm);
    right: var(--space-sm);
    font-size: 12px;
    gap: 2px;
  }

  .game-score {
    font-size: 14px;
  }

  .game-high-score {
    font-size: 11px;
  }

  .game-start-btn {
    font-size: 16px;
    padding: 12px 28px;
  }

  .game-instructions {
    font-size: 12px;
    padding: 0 var(--space-md);
  }

  .game-over-text {
    font-size: 22px;
  }

  .game-final-score {
    font-size: 16px;
  }

  /* ---- Footer ---- */
  .footer {
    padding: var(--space-lg) 0;
  }

  .footer-text {
    font-size: 14px;
  }

  .footer-links {
    gap: var(--space-md);
    flex-wrap: wrap;
  }

  .footer-links li {
    display: inline-flex;
  }

  .footer-links a,
  .footer-kofi-link {
    font-size: 14px;
  }
}

/* --- Responsive --- */
@media (min-width: 480px) {
  .hero-logo-img {
    width: 320px;
  }

  .hero-subtitle {
    font-size: 22px;
  }

  .section-title {
    font-size: 36px;
  }
}

@media (min-width: 768px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-intro {
    font-size: 18px;
  }

  .hero-buttons {
    gap: var(--space-lg);
  }

  .btn {
    padding: 14px 32px;
    font-size: 17px;
  }

  .hide-mobile {
    display: inline;
  }
}

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

  .hero-logo-img {
    width: 360px;
  }
}

/* --- High contrast mode support --- */
@media (prefers-contrast: high) {
  .btn-primary {
    border-width: 3px;
  }

  .tool-card {
    border: 1px solid var(--ctp-surface2);
  }
}
