/* ============================================================================
   Variables
   ========================================================================== */

:root {
  /* Colors - Core */
  --color-background: #07171c; /* deep, muted background to frame pixel art */
  --color-surface: #0d242a;    /* elevated surfaces (cards, panels) */
  --color-surface-soft: #112e35;

  --color-text: #f6f8f9;
  --color-text-muted: #a3b6ba;
  --color-border-subtle: rgba(255, 255, 255, 0.08);

  /* Palette inspired by River Legends theme */
  --color-forest: #123c2b;      /* deep forest green */
  --color-sky: #77b6ea;         /* soft sky blue */
  --color-earth: #7a5c3b;       /* earthy brown */
  --color-teal: #1d6a73;        /* muted teal water */
  --color-sunset: #f28b50;      /* warm sunset orange accent */

  /* Semantic colors */
  --color-primary: var(--color-teal);
  --color-primary-soft: rgba(29, 106, 115, 0.2);
  --color-success: #4caf50;
  --color-warning: #ffb300;
  --color-danger: #e53935;

  /* Neutral grays (cool, subtle) */
  --gray-50: #0b181b;
  --gray-100: #14272c;
  --gray-200: #1f363d;
  --gray-300: #29464f;
  --gray-400: #3c5d68;
  --gray-500: #607985;
  --gray-600: #8ba0a9;
  --gray-700: #aebcc1;
  --gray-800: #d3dde0;
  --gray-900: #f2f6f7;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Press Start 2P", "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; /* use pixel/retro display if available */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-base: 1rem;    /* 16px */
  --font-size-lg: 1.125rem;  /* 18px */
  --font-size-xl: 1.5rem;    /* 24px */
  --font-size-2xl: 1.875rem; /* 30px */
  --font-size-3xl: 2.25rem;  /* 36px */

  --line-height-tight: 1.2;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.8;

  /* Spacing scale (0–96px) */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Radii - slightly soft to contrast pixel art without losing retro feel */
  --radius-none: 0;
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Shadows - subtle, atmospheric */
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-subtle: 0 6px 18px rgba(0, 0, 0, 0.35);

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-normal: 200ms ease-out;
  --transition-slow: 320ms ease-out;

  /* Layout */
  --container-max-width: 1120px;
  --container-padding-x: var(--space-4);

  /* Focus outline */
  --focus-ring-color: rgba(119, 182, 234, 0.9);
  --focus-ring-width: 2px;
  --focus-ring-offset: 2px;
}

/* ============================================================================
   Reset / Normalize
   ========================================================================== */

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

html, body {
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100vh;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
  image-rendering: pixelated; /* support retro pixel art style */
  image-rendering: crisp-edges;
}

picture img {
  width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  border: none;
  padding: 0;
  background: none;
}

ul, ol {
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6, p, figure {
  margin: 0;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

legend {
  padding: 0;
}

/* ============================================================================
   Base Styles
   ========================================================================== */

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  background: radial-gradient(circle at top, #13313c 0, #040b0d 55%, #020608 100%);
  color: var(--color-text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

main {
  display: block;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: var(--line-height-tight);
  color: var(--color-sky);
  letter-spacing: 0.03em;
}

h1 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-4);
}

h2 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-3);
}

h3 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-3);
}

h4 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-2);
}

h5 {
  font-size: var(--font-size-base);
  margin-bottom: var(--space-2);
}

h6 {
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-2);
}

p {
  margin-bottom: var(--space-3);
  color: var(--color-text-muted);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--color-sky);
  text-decoration: none;
  transition: color var(--transition-normal), opacity var(--transition-normal);
}

a:hover {
  color: var(--color-sunset);
}

a:active {
  opacity: 0.85;
}

strong, b {
  font-weight: 600;
}

code, pre {
  font-family: var(--font-mono);
}

pre {
  margin: 0;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  margin: var(--space-6) 0;
}

/* ============================================================================
   Accessibility & Motion
   ========================================================================== */

:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

:focus:not(:focus-visible) {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

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

.sr-only-focusable:focus,
.sr-only-focusable:active {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ============================================================================
   Utilities
   ========================================================================== */

/* Layout */
.container {
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding-x);
  padding-right: var(--container-padding-x);
}

.section {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
}

.section--tight {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
}

/* Flex helpers */
.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.flex-column {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-xs { gap: var(--space-2); }
.gap-sm { gap: var(--space-3); }
.gap-md { gap: var(--space-4); }
.gap-lg { gap: var(--space-6); }

/* Grid helpers */
.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Alignment */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

/* Simple spacing utilities */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-xs { margin-top: var(--space-2); }
.mt-sm { margin-top: var(--space-3); }
.mt-md { margin-top: var(--space-4); }
.mt-lg { margin-top: var(--space-6); }
.mb-xs { margin-bottom: var(--space-2); }
.mb-sm { margin-bottom: var(--space-3); }
.mb-md { margin-bottom: var(--space-4); }
.mb-lg { margin-bottom: var(--space-6); }

/* Visual helpers */
.shadow-soft {
  box-shadow: var(--shadow-soft);
}

.rounded-md {
  border-radius: var(--radius-md);
}

.bg-surface {
  background-color: var(--color-surface);
}

.bg-surface-soft {
  background: radial-gradient(circle at top, #163944 0, #0d242a 60%, #07171c 100%);
}

/* ============================================================================
   Components
   ========================================================================== */

/* Buttons */
.button,
button.button,
input[type="submit"].button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(3, 13, 16, 0.6);
  background: linear-gradient(135deg, var(--color-primary) 0%, #174f56 40%, #0c2e32 100%);
  color: #fdfdfd;
  font-family: var(--font-display);
  font-size: var(--font-size-sm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), var(--shadow-subtle);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-normal), opacity var(--transition-fast);
}

.button--secondary {
  background: linear-gradient(135deg, var(--color-forest) 0%, #0f2c21 100%);
}

.button--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: none;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), var(--shadow-soft);
  opacity: 0.96;
}

.button:active {
  transform: translateY(0);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 3px 10px rgba(0, 0, 0, 0.5);
}

.button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

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

/* Inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  background-color: rgba(5, 16, 18, 0.9);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  line-height: 1.4;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal), background-color var(--transition-normal);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--gray-500);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--color-sky);
  box-shadow: 0 0 0 1px rgba(119, 182, 234, 0.5);
}

input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Cards - for showcasing pixel scenes, features, fish species etc. */
.card {
  position: relative;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, rgba(13, 36, 42, 0.98), rgba(5, 16, 18, 0.98));
  border: 1px solid rgba(222, 247, 255, 0.05);
  box-shadow: var(--shadow-soft);
  padding: var(--space-5);
  overflow: hidden;
}

.card--frosted {
  background: linear-gradient(145deg, rgba(11, 33, 38, 0.85), rgba(6, 18, 20, 0.95));
  backdrop-filter: blur(18px);
}

.card__title {
  margin-bottom: var(--space-2);
}

.card__meta {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gray-600);
  margin-bottom: var(--space-2);
}

.card__body {
  color: var(--color-text-muted);
}

/* Media frame - for pixel art scenes */
.pixel-frame {
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 0 4px rgba(1, 6, 8, 0.9), 0 18px 40px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  background: radial-gradient(circle at top, #274b54 0, #07171c 60%);
}

.pixel-frame img {
  width: 100%;
}

/* Tag / Pill for fish types, weather, fly types */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(4, 17, 19, 0.92);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gray-700);
}

.pill--primary {
  border-color: rgba(119, 182, 234, 0.7);
  background: rgba(17, 65, 84, 0.85);
  color: #e3f3ff;
}

/* Simple badge for status indicators */
.badge-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  margin-right: 0.4rem;
  background-color: var(--color-sunset);
}

/* ============================================================================
   Interactive Atmosphere Helpers
   ========================================================================== */

/* Soft gradient overlay that can be positioned over hero backgrounds */
.atmosphere-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 20% 0%, rgba(119, 182, 234, 0.24) 0, transparent 55%),
              radial-gradient(circle at 80% 100%, rgba(242, 139, 80, 0.22) 0, transparent 50%);
  mix-blend-mode: screen;
}

/* Gentle water shimmer for callouts or buttons (requires keyframes elsewhere if used) */
.water-shimmer {
  position: relative;
  overflow: hidden;
}

.water-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.16) 40%, transparent 80%);
  opacity: 0;
  transform: translateX(-40%);
  pointer-events: none;
  transition: opacity var(--transition-normal), transform 500ms ease-out;
}

.water-shimmer:hover::after {
  opacity: 1;
  transform: translateX(40%);
}

@media (prefers-reduced-motion: reduce) {
  .water-shimmer::after,
  .water-shimmer:hover::after {
    transition: none;
    opacity: 0;
    transform: none;
  }
}
