/* Recipe Grabber Pro - Mobile-first, accessible */

:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --success: #3fb950;
  --error: #f85149;
  --border: #30363d;
  --radius: 8px;
  --font: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-size: 18px;
  --min-tap: 44px;
}

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--font-size);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* Header */
.header {
  padding: 1.5rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 1rem;
}

/* Main */
.main {
  flex: 1;
  padding: 1.5rem 1rem;
  max-width: 56rem;
  margin: 0 auto;
  width: 100%;
}

/* Form */
.input-section {
  margin-bottom: 1.5rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  min-height: var(--min-tap);
  transition: border-color 0.15s ease;
}

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

.input:hover {
  border-color: var(--text-muted);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.25);
}

.input[aria-invalid="true"] {
  border-color: var(--error);
}

.hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.error {
  font-size: 0.9375rem;
  color: var(--error);
  margin: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--min-tap);
  padding: 0 1.5rem;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.4);
}

.btn:focus:not(:focus-visible) {
  box-shadow: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-copy {
  padding: 0.5rem 1rem;
  min-height: 36px;
  font-size: 0.875rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.loading p {
  margin: 1rem 0 0;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error box */
.error-box {
  padding: 1.25rem;
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid var(--error);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.error-box #error-message {
  margin: 0 0 0.5rem;
  color: var(--error);
  font-weight: 500;
}

.error-tip {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

/* Result */
.result {
  margin-top: 1rem;
}

.result-title {
  font-size: 1.25rem;
  margin: 0 0 1rem;
  color: var(--text);
}

.result-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .result-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.panel-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.panel-content {
  padding: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 1rem;
  line-height: 1.6;
  max-height: 50vh;
  overflow-y: auto;
  -webkit-user-select: text;
  user-select: text;
}

.panel-content:focus {
  outline: none;
}

.copy-feedback {
  margin: 0.75rem 0 0;
  font-size: 0.9375rem;
  color: var(--success);
}

/* Footer */
.footer {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
}

.footer p {
  margin: 0;
}
