/* Safe Thaw Estimator — theme.css
   High-contrast kitchen/safety theme with bold time cards and tap-friendly steppers.
   No external fonts; system fonts only. */

:root {
  /* Color palette */
  --bg: #0f172a;
  --bg-surface: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #22c55e;
  --accent-danger: #ef4444;
  --accent-warm: #f97316;
  
  /* Spacing */
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  
  /* Typography */
  --font-head: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  
  /* Border radius */
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  
  /* Focus outline */
  --focus-ring: 0 0 0 3px rgba(34, 197, 94, 0.5);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
}

.skip-link:focus {
  left: var(--space-md);
  top: var(--space-md);
  background: var(--accent);
  color: #000;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  z-index: 100;
}

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

/* Header */
.site-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding: var(--space-md) 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.site-header .brand a {
  color: var(--text);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
}

.site-header nav ul {
  display: flex;
  gap: var(--space-md);
  list-style: none;
}

.site-header nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  font-weight: 500;
  transition: color 0.2s ease;
}

.site-header nav a:hover,
.site-header nav a:focus,
.site-header nav a[aria-current="page"] {
  color: var(--text);
  background-color: rgba(255,255,255,0.08);
}

.site-header nav a:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Main content */
.main {
  padding: var(--space-xl) 0;
}

/* Hero section */
.hero {
  text-align: center;
  padding: var(--space-xl) 0 var(--space-lg);
}

.hero h1 {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto var(--space-lg);
}

.btn-primary {
  display: inline-block;
  background-color: var(--accent);
  color: #000;
  padding: var(--space-md) var(--space-xl);
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.btn-primary:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Section headings */
.section-heading {
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid rgba(255,255,255,0.1);
}

/* How it works grid */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

.step-card {
  background-color: var(--bg-surface);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  text-align: center;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--accent);
  color: #000;
  border-radius: 50%;
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: var(--space-md);
}

.step-card h3 {
  font-size: 1.125rem;
  margin-bottom: var(--space-sm);
}

.step-card p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* Calculator section */
.calculator {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin: var(--space-xl) 0;
}

.calculator-form {
  display: grid;
  gap: var(--space-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.form-label {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
}

.form-select,
.form-input {
  background-color: var(--bg);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text);
  padding: var(--space-md);
  border-radius: var(--radius);
  font-size: 1rem;
  width: 100%;
}

.form-select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* Numeric steppers */
.stepper-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.stepper-btn {
  width: 3.5rem;
  height: 3.5rem;
  min-width: 3.5rem;
  min-height: 3.5rem;
  background-color: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-size: 1.5rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.stepper-btn:hover {
  background-color: #16a34a;
}

.stepper-btn:active {
  transform: scale(0.95);
}

.stepper-btn:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

.stepper-input {
  flex: 1;
  background-color: var(--bg);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text);
  padding: var(--space-md);
  border-radius: var(--radius);
  font-size: 1.25rem;
  font-family: var(--font-mono);
  text-align: center;
  width: 100%;
}

.stepper-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* Method toggle */
.method-toggle {
  display: flex;
  gap: var(--space-sm);
  background-color: var(--bg);
  border-radius: var(--radius);
  padding: var(--space-sm);
  border: 1px solid rgba(255,255,255,0.2);
}

.method-toggle button {
  flex: 1;
  padding: var(--space-md);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.method-toggle button.active {
  background-color: var(--accent);
  color: #000;
}

.method-toggle button:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Results card (BOLD time card) */
.results-card {
  background: linear-gradient(135deg, var(--bg-surface) 0%, #25334a 100%);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-top: var(--space-xl);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.2);
}

.results-card h3 {
  font-family: var(--font-head);
  font-size: 1.5rem;
  margin-bottom: var(--space-lg);
  color: var(--accent);
}

.time-display {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.time-value {
  font-family: var(--font-mono);
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.time-unit {
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: 600;
}

.method-badge {
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  background-color: rgba(255,255,255,0.1);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--space-lg);
}

.method-badge.cold-water {
  background-color: rgba(239, 68, 68, 0.2);
  color: var(--accent-danger);
  border: 1px solid var(--accent-danger);
}

.method-badge.fridge {
  background-color: rgba(34, 197, 94, 0.2);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.refresh-count {
  font-size: 1.25rem;
  color: var(--text-muted);
}

.refresh-count strong {
  color: var(--text);
  font-weight: 700;
}

/* Safety guardrails */
.safety-guardrails {
  background-color: rgba(34, 197, 94, 0.08);
  border-radius: var(--radius);
  padding: var(--space-lg);
  margin-top: var(--space-lg);
}

.safety-guardrails h4 {
  font-family: var(--font-head);
  font-size: 1.125rem;
  margin-bottom: var(--space-md);
  color: var(--accent);
}

.safety-guardrails ul {
  list-style: none;
}

.safety-guardrails li {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: baseline;
}

.safety-guardrails li:last-child {
  border-bottom: none;
}

.safety-label {
  font-weight: 600;
  color: var(--text);
  margin-right: var(--space-sm);
}

.safety-value {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 700;
}

/* Cold-water refresh timer section */
.refresh-timer-section {
  background-color: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin: var(--space-xl) 0;
}

.timer-display {
  text-align: center;
  margin: var(--space-xl) 0;
}

.timer-value {
  font-family: var(--font-mono);
  font-size: 5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  margin-bottom: var(--space-sm);
}

.timer-label {
  font-size: 1.25rem;
  color: var(--text-muted);
}

.timer-controls {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
}

.timer-btn {
  padding: var(--space-md) var(--space-xl);
  font-size: 1.125rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.timer-btn:active {
  transform: scale(0.95);
}

.timer-btn:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

.timer-btn.start {
  background-color: var(--accent);
  color: #000;
}

.timer-btn.stop {
  background-color: var(--accent-danger);
  color: #fff;
}

.timer-alert {
  display: none;
  margin-top: var(--space-lg);
  padding: var(--space-lg);
  background-color: rgba(239, 68, 68, 0.2);
  border: 2px solid var(--accent-danger);
  border-radius: var(--radius);
  text-align: center;
}

.timer-alert.visible {
  display: block;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.timer-alert h4 {
  font-family: var(--font-head);
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
  color: var(--accent-danger);
}

.timer-alert p {
  color: var(--text-muted);
}

/* Thaw guidance tables */
.thaw-guidance {
  margin: var(--space-xl) 0;
}

.table-section {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.table-section h3 {
  font-family: var(--font-head);
  font-size: 1.25rem;
  margin-bottom: var(--space-lg);
  color: var(--text);
}

.table-section table {
  width: 100%;
  border-collapse: collapse;
}

.table-section th,
.table-section td {
  padding: var(--space-sm) var(--space-md;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.table-section th {
  font-weight: 600;
  color: var(--text-muted);
}

.table-section td {
  color: var(--text);
}

.table-section tr:last-child td {
  border-bottom: none;
}

.general-guidance {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background-color: var(--bg-surface);
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-content h2 {
  font-family: var(--font-head);
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
  color: var(--text);
}

.modal-content .modal-intro {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.modal-content .disclaimer-block {
  margin: var(--space-lg) 0;
}

.modal-content .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.modal-btn {
  padding: var(--space-md) var(--space-xl);
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.modal-btn:active {
  transform: scale(0.95);
}

.modal-btn:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

.modal-btn.primary {
  background-color: var(--accent);
  color: #000;
}

.modal-btn.secondary {
  background-color: var(--bg);
  color: var(--text);
}

/* Footer */
.site-footer {
  background-color: var(--bg-surface);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: var(--space-xl) 0;
  margin-top: var(--space-xl);
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.footer-content p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.disclaimer-text {
  margin-top: var(--space-md);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.disclaimer-text strong {
  color: var(--text);
}

/* Responsive */
@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.5rem;
  }
  
  .time-value {
    font-size: 3rem;
  }
  
  .step-card {
    padding: var(--space-md);
  }
  
  .calculator {
    padding: var(--space-md);
  }
  
  .stepper-btn {
    width: 3rem;
    height: 3rem;
    min-width: 3rem;
    min-height: 3rem;
    font-size: 1.25rem;
  }
  
  .timer-value {
    font-size: 3.5rem;
  }
}

/* High contrast preference */
@media (prefers-contrast: more) {
  :root {
    --text: #000;
    --bg: #fff;
    --bg-surface: #e5e7eb;
    --text-muted: #374151;
  }
  
  .btn-primary,
  .stepper-btn,
  .timer-btn.start {
    background-color: #000;
    color: #fff;
  }
  
  .method-badge.cold-water {
    border-color: #000;
    color: #000;
  }
}

/* Reduced motion preference */
@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;
  }
}

/* Print styles */
@media print {
  body {
    background: #fff;
    color: #000;
  }
  
  .site-header,
  .site-footer,
  .btn-primary,
  .stepper-btn,
  .method-toggle,
  .timer-controls,
  .modal-overlay {
    display: none !important;
  }
  
  .container {
    max-width: 100%;
    padding: 0;
  }
  
  .results-card {
    border: 2px solid #000;
  }
}
