/* Modern CSS for Favicon Lookup Service - Inspired by Zed.dev */

:root {
  /* Colors */
  --color-background: #0d0e0f;
  --color-surface: #1a1d20;
  --color-surface-elevated: #2a2e32;
  --color-border: #3a3f44;
  --color-border-focus: #5a6570;

  --color-text-primary: #f4f4f5;
  --color-text-secondary: #a1a8b0;
  --color-text-tertiary: #6b737d;

  --color-accent: #0ea5e9;
  --color-accent-hover: #0284c7;
  --color-success: #10b981;
  --color-success-hover: #059669;
  --color-error: #ef4444;
  --color-warning: #f59e0b;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
  --gradient-surface: linear-gradient(135deg, #1a1d20 0%, #2a2e32 100%);

  /* Typography */
  --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: 1.5;
}

body {
  font-family: var(--font-sans);
  background: var(--color-background);
  color: var(--color-text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-align: center;
}

h1 {
  font-size: 3.5rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-sm);
}

h2 {
  font-size: 2.25rem;
  margin-bottom: var(--space-md);
}

h3 {
  font-size: 1.875rem;
  margin-bottom: var(--space-md);
}

h4 {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

h5 {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--space-lg);
}

p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
  text-align: center;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover:not(.btn) {
  color: var(--color-accent-hover);
}

code {
  font-family: var(--font-mono);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.875rem;
  color: var(--color-accent);
}

/* Main Layout - Flexbox Container */
.main-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* Hero Section - Flexbox Layout */
.hero-section {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) var(--space-md);
}

/* Dotted background pattern */
.has-dotted-background {
  background-image: linear-gradient(to bottom, var(--color-background), transparent), url('./dotted-background.png');
  background-position: center top;
  background-repeat: no-repeat, repeat;
  background-size: 100% 100%, auto;
  position: relative;
}

.has-dotted-background::after {
  content: '';
  position: absolute;
  top: calc(50% + 2px);
  bottom: 0;
  left: 0;
  right: 0;
  background-image: linear-gradient(to bottom, transparent, var(--color-background));
  z-index: 1;
}

.has-dotted-background .hero-content {
  position: relative;
  z-index: 2;
}

.hero-content {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xl);
}

/* Preview Container */
.preview-container {
  width: 100%;
  background: var(--gradient-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}

.favicon-preview {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  background: #ffffff;
  border: 1px solid var(--color-border);
  padding: var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.favicon-preview::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: linear-gradient(45deg, #f8f9fa 25%, transparent 25%),
    linear-gradient(-45deg, #f8f9fa 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f8f9fa 75%),
    linear-gradient(-45deg, transparent 75%, #f8f9fa 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
  border-radius: var(--radius-md);
  opacity: 0.3;
  z-index: 1;
}

.favicon-preview img {
  position: relative;
  z-index: 2;
}

.favicon-preview img {
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
}

/* Section Layout - Flexbox */
.section {
  width: 100%;
  padding: var(--space-3xl) var(--space-md);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-content {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
}

/* Form Demo - Flexbox Layout */
.form-demo {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-group {
  width: 100%;
  max-width: 600px;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s ease;
  display: flex;
  align-items: stretch;
}

.input-group:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.input-group input {
  flex: 1;
  padding: var(--space-lg);
  border: none;
  background: transparent;
  color: var(--color-text-primary);
  font-size: 1rem;
  outline: none;
}

.input-group input::placeholder {
  color: var(--color-text-tertiary);
}

.input-group button {
  padding: var(--space-lg) var(--space-xl);
  border: none;
  background: var(--color-accent);
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

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

.input-group button:disabled {
  background: var(--color-border);
  cursor: not-allowed;
}

.input-group button.is-loading {
  position: relative;
}

.input-group button.is-loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: var(--space-sm);
}

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

/* API Usage Section */
.api-usage {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
}

/* Code blocks */
.code-block {
  width: 100%;
  max-width: 100%;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin: var(--space-md) 0;
}

.code-block__header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-sm) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.code-block__content {
  padding: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  color: var(--color-text-primary);
}

/* URL syntax highlighting */
.url-method {
  color: #3b82f6;
  font-weight: 600;
}

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

.url-param {
  color: #f59e0b;
}

/* Footer - Flexbox */
footer {
  width: 100%;
  background: var(--color-background);
  border-top: 1px solid var(--color-border);
  padding: var(--space-2xl) var(--space-md);
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

footer p {
  color: var(--color-text-tertiary);
  font-size: 0.875rem;
  margin: 0;
  text-align: center;
}

/* Responsive design */
@media (max-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }

  .hero-section {
    padding: var(--space-2xl) var(--space-md);
  }

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

  .input-group button {
    border-top: 1px solid var(--color-border);
  }

  .section {
    padding: var(--space-xl) var(--space-md);
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }

  .hero-section {
    padding: var(--space-xl) var(--space-md);
  }

  .preview-container {
    padding: var(--space-lg);
  }
}

/* Animation utilities */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

/* Focus styles for accessibility */
.input-group:focus-within {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

hgroup {
  margin-bottom: var(--space-lg);

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