/* ==========================================================================
   lnfiniteMonkeys - CSS Styles
   Terminal-inspired design with monospace fonts
   ========================================================================== */

/* CSS Custom Properties (Variables) */
:root {
  /* Color Palette */
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --light-color: #ecf0f1;
  --accent-color: #e74c3c;
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --dark-color: #34495e;
  --text-color: #2c3e50;
  --text-light: #7f8c8d;
  --white: #ffffff;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-dark: rgba(0, 0, 0, 0.2);
  
  /* Typography */
  --font-primary: 'Courier New', 'Consolas', 'Monaco', 'Lucida Console', monospace;
  --font-mono: 'Courier New', 'Consolas', 'Monaco', 'Lucida Console', monospace;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-xxl: 3rem;
  
  /* Breakpoints */
  --breakpoint-sm: 576px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 992px;
  --breakpoint-xl: 1200px;
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

/* ==========================================================================
   Reset and Base Styles
   ========================================================================== */

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

/* Remove default margin and padding */
* {
  margin: 0;
  padding: 0;
}

/* Prevent font size inflation */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  scroll-behavior: smooth;
}

/* Remove built-in form typography styles */
input,
button,
textarea,
select {
  font: inherit;
}

/* Remove list styles on ul, ol elements with a list role */
ul[role='list'],
ol[role='list'] {
  list-style: none;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  line-height: 1.5;
  font-family: var(--font-primary);
  font-size: 16px;
  color: var(--text-color);
  background-color: var(--light-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Make images easier to work with */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Improve media defaults */
img,
picture {
  font-style: italic;
  background-repeat: no-repeat;
  background-size: cover;
  shape-margin: 1rem;
}

/* Remove animations for people who've turned them off */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

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

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

@media (min-width: 576px) {
  .container {
    padding: 0 var(--spacing-lg);
  }
}

@media (min-width: 992px) {
  .container {
    padding: 0 var(--spacing-xl);
  }
}

/* Flexbox utilities */
.flex {
  display: flex;
}

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

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

.flex-between {
  justify-content: space-between;
}

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

/* Grid utilities */
.grid {
  display: grid;
}

.grid-center {
  place-items: center;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
  color: var(--primary-color);
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.125rem;
}

h6 {
  font-size: 1rem;
}

p {
  margin-bottom: var(--spacing-md);
  line-height: 1.6;
}

a {
  color: var(--secondary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover,
a:focus {
  color: var(--primary-color);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
}

/* Text utilities */
.text-center {
  text-align: center;
}

.text-large {
  font-size: 1.25rem;
}

.text-small {
  font-size: 0.875rem;
}

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

.text-primary {
  color: var(--primary-color);
}

.text-secondary {
  color: var(--secondary-color);
}

/* ==========================================================================
   Header and Navigation
   ========================================================================== */

header {
  background-color: var(--white);
  box-shadow: 0 2px 4px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md) 0;
}

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

.logo:hover {
  color: var(--secondary-color);
  text-decoration: none;
}

nav ul {
  display: flex;
  list-style: none;
  gap: var(--spacing-lg);
}

nav a {
  font-weight: 500;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

nav a:hover,
nav a:focus {
  background-color: var(--light-color);
  text-decoration: none;
}

/* ==========================================================================
   Main Content Areas
   ========================================================================== */

main {
  flex: 1;
  padding: var(--spacing-xl) 0;
}

.content-wrapper {
  min-height: calc(100vh - 200px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ==========================================================================
   Homepage Styles
   ========================================================================== */

.homepage {
  background: linear-gradient(135deg, var(--light-color) 0%, #ffffff 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--spacing-xxl) var(--spacing-md);
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@media (min-width: 768px) {
  .hero h1 {
    font-size: 4rem;
  }
}

.hero .subtitle {
  font-size: 1.25rem;
  color: var(--text-light);
  margin-bottom: var(--spacing-xxl);
  max-width: 600px;
}

/* Search Section */
.search-section {
  width: 100%;
  max-width: 600px;
  margin-bottom: var(--spacing-xxl);
}

.search-box {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: var(--spacing-lg) var(--spacing-xl);
  font-size: 1.125rem;
  border: 2px solid #ddd;
  border-radius: var(--radius-xl);
  background-color: var(--white);
  transition: all var(--transition-normal);
  box-shadow: 0 2px 8px var(--shadow);
}

.search-input:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 4px 12px var(--shadow-dark);
  transform: translateY(-2px);
}

.search-input::placeholder {
  color: var(--text-light);
}

.search-button {
  position: absolute;
  right: var(--spacing-sm);
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--secondary-color);
  color: var(--white);
  border: none;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.search-button:hover,
.search-button:focus {
  background-color: var(--primary-color);
  transform: translateY(-50%) scale(1.05);
}

/* ==========================================================================
   User Page Styles
   ========================================================================== */

.user-page {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--white);
}

.user-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--spacing-xxl) var(--spacing-md);
}

.user-content h1 {
  font-size: 2.5rem;
  margin-bottom: var(--spacing-lg);
  color: var(--white);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

@media (min-width: 768px) {
  .user-content h1 {
    font-size: 3.5rem;
  }
}

.user-content .meme-text {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

@media (min-width: 768px) {
  .user-content .meme-text {
    font-size: 2rem;
  }
}

.user-content .meme-subtext {
  font-size: 1.25rem;
  font-style: italic;
  margin-bottom: var(--spacing-xxl);
  opacity: 0.9;
}

/* ASCII Art Container */
.ascii-art {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: pre;
  margin: var(--spacing-xl) 0;
  padding: var(--spacing-lg);
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

@media (min-width: 768px) {
  .ascii-art {
    font-size: 0.875rem;
  }
}

/* ==========================================================================
   404 Page Styles
   ========================================================================== */

.error-page {
  background: linear-gradient(135deg, #fc4a1a 0%, #f7b733 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--white);
}

.error-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--spacing-xxl) var(--spacing-md);
}

.error-code {
  font-size: 6rem;
  font-weight: 700;
  margin-bottom: var(--spacing-lg);
  text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);
  animation: bounce 2s infinite;
}

@media (min-width: 768px) {
  .error-code {
    font-size: 8rem;
  }
}

.error-message {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-xl);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  max-width: 600px;
}

@media (min-width: 768px) {
  .error-message {
    font-size: 2rem;
  }
}

/* ==========================================================================
   Buttons and Interactive Elements
   ========================================================================== */

.btn {
  display: inline-block;
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.btn:focus {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--secondary-color);
  color: var(--white);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow-dark);
  text-decoration: none;
  color: var(--white);
}

.btn-secondary {
  background-color: transparent;
  color: var(--white);
  border: 2px solid var(--white);
}

.btn-secondary:hover,
.btn-secondary:focus {
  background-color: var(--white);
  color: var(--primary-color);
  text-decoration: none;
}

.btn-large {
  padding: var(--spacing-lg) var(--spacing-xxl);
  font-size: 1.125rem;
}

.btn-home {
  margin-top: var(--spacing-xl);
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
  background-color: var(--primary-color);
  color: var(--white);
  padding: var(--spacing-xl) 0;
  text-align: center;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
}

.footer-content p {
  margin-bottom: var(--spacing-sm);
  opacity: 0.9;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--spacing-lg);
  margin-top: var(--spacing-lg);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--white);
  opacity: 0.8;
  transition: opacity var(--transition-fast);
}

.footer-links a:hover,
.footer-links a:focus {
  opacity: 1;
}

/* ==========================================================================
   Animations
   ========================================================================== */

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

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Apply animations */
.hero > * {
  animation: fadeIn 1s ease-out;
}

.hero h1 {
  animation-delay: 0.2s;
}

.hero .subtitle {
  animation-delay: 0.4s;
}

.hero .search-section {
  animation-delay: 0.6s;
}

/* ==========================================================================
   Responsive Design - Mobile First
   ========================================================================== */

/* Small screens (phones) - base styles above */

/* Medium screens (tablets) */
@media (min-width: 768px) {
  :root {
    --spacing-md: 1.25rem;
    --spacing-lg: 2rem;
    --spacing-xl: 2.5rem;
    --spacing-xxl: 4rem;
  }
  
  .container {
    padding: 0 var(--spacing-xl);
  }
  
  .hero {
    padding: var(--spacing-xxl) var(--spacing-xl);
  }
  
  .search-input {
    font-size: 1.25rem;
    padding: var(--spacing-xl) var(--spacing-xxl);
  }
  
  nav ul {
    gap: var(--spacing-xl);
  }
}

/* Large screens (desktop) */
@media (min-width: 992px) {
  :root {
    --spacing-xxl: 5rem;
  }
  
  .hero h1 {
    font-size: 5rem;
  }
  
  .hero .subtitle {
    font-size: 1.5rem;
  }
  
  .user-content h1 {
    font-size: 4rem;
  }
  
  .user-content .meme-text {
    font-size: 2.5rem;
  }
  
  .error-code {
    font-size: 10rem;
  }
  
  .error-message {
    font-size: 2.5rem;
  }
}

/* Extra large screens */
@media (min-width: 1200px) {
  .container {
    max-width: 1400px;
  }
  
  .hero h1 {
    font-size: 6rem;
  }
  
  .search-section {
    max-width: 700px;
  }
}

/* ==========================================================================
   Accessibility and Focus States
   ========================================================================== */

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #000000;
    --secondary-color: #0066cc;
    --text-color: #000000;
    --shadow: rgba(0, 0, 0, 0.3);
  }
}

/* Focus visible for keyboard navigation */
.btn:focus-visible,
.search-input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
}

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

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary-color);
  color: var(--white);
  padding: 8px;
  text-decoration: none;
  z-index: 9999;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: 6px;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  h1, h2, h3, h4, h5, h6 {
    break-after: avoid;
  }
  
  .hero,
  .user-content,
  .error-content {
    background: none !important;
  }
  
  .btn {
    border: 1px solid black;
    background: none;
    color: black;
  }
  
  .search-section,
  .ascii-art {
    display: none;
  }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.hidden {
  display: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

.no-scroll {
  overflow: hidden;
}

/* Loading states */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--secondary-color);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

/* Optimize rendering for animations */
.btn,
.search-input,
.search-button {
  will-change: transform;
}

/* Optimize scrolling */
.hero,
.user-content,
.error-content {
  will-change: scroll-position;
}

/* End of stylesheet */