/* Sourdough Planner — base styles */
/* Trimmed standalone version of ThisCalc shared styles */

/* Self-hosted fonts — no CDN fetch at runtime, works fully offline.
   Lora + Playfair Display are variable fonts (one file serves all weights);
   IBM Plex Mono ships one file per weight. font-display:swap avoids blocking
   first paint while fonts load. */
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/lora-var.woff2') format('woff2-variations'),
       url('../fonts/lora-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('../fonts/playfair-var.woff2') format('woff2-variations'),
       url('../fonts/playfair-var.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-600.woff2') format('woff2');
}

:root {
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #6c757d;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;
  --success: #16a34a;
  --warning: #ad7b1b;
  --error: #dc2626;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  --input-bg: #f1f5f9;
  --input-border: #cbd5e1;
  --affix-bg: #e2e8f0;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --border: #334155;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-light: #1e3a5f;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.4);
  --input-bg: #1e293b;
  --input-border: #334155;
  --affix-bg: #0f172a;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  transition: background-color 0.2s;
}

a { color: var(--accent); text-decoration: none; }

/* Visually-hidden but present in the accessibility tree. */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.5rem;
  z-index: 200;
  font-weight: 600;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { top: 0; outline: none; }

/* Header */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.site-tagline {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
}
@media (max-width: 640px) { .site-tagline { display: none; } }
.brand-this { font-weight: 700; color: var(--accent); }

.theme-toggle {
  background: var(--bg-secondary);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.125rem;
  color: var(--text);
  line-height: 1;
  flex-shrink: 0;
}
.theme-toggle::before { content: '\263E'; font-size: 1.1rem; }
.theme-toggle:not(:empty)::before { content: none; }

/* Layout */
.page-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem;
}
.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
.main-content { min-width: 0; }

/* Calculator card */
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.calc-card .tool-hero {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 1rem;
}
.calc-card .tool-hero-text { min-width: 0; }
.calc-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}
.last-reviewed-badge {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.2rem 0.75rem;
  margin-top: 0.5rem;
}
.tool-header-logo {
  width: auto;
  height: auto;
  max-width: 120px;
  max-height: 120px;
  object-fit: contain;
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .calc-card .tool-hero { flex-direction: column; align-items: flex-start; }
  .tool-header-logo { max-width: 100px; max-height: 100px; }
  .last-reviewed-badge { align-self: flex-start; }
}

/* Form elements */
input[type="number"],
input[type="text"],
input[type="search"],
input[type="datetime-local"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 1rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
@media (max-width: 480px) {
  input[type="number"], input[type="text"], input[type="search"],
  input[type="datetime-local"], input[type="date"], select {
    min-height: 44px;
    font-size: 16px; /* prevents iOS auto-zoom */
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
}

button:focus-visible, .btn:focus-visible, .theme-toggle:focus-visible,
.faq-question:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Content sections (SEO prose) */
.content-section { margin-top: 2rem; }
.content-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.content-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
}
.content-section p {
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.content-section ul, .content-section ol {
  margin: 0.5rem 0 1rem 1.25rem;
  color: var(--text-secondary);
}
.content-section li { margin-bottom: 0.375rem; }

/* FAQ */
.faq-section { margin-top: 2rem; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-question {
  width: 100%;
  background: none;
  border: none;
  padding: 1rem 0;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.faq-question::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.faq-item.open .faq-question::after { content: '-'; }
.faq-answer {
  display: none;
  padding: 0 0 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 0.9375rem;
}
.faq-item.open .faq-answer { display: block; }

/* Share */
.share-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.share-url { display: flex; gap: 0.5rem; }
.share-url input {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  background: var(--bg-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Footer */
.site-footer {
  max-width: var(--max-width);
  margin: 3rem auto 0;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-align: center;
}

/* A5 native-feel: hover styling only on devices that can truly hover.
   On touch, WebView :hover 'sticks' after a tap - every hover rule was
   moved here mechanically (bodies unchanged) so taps stay clean. */
@media (hover: hover) {
a:hover { color: var(--accent-hover); text-decoration: underline; }
.site-logo:hover { text-decoration: none; color: var(--accent); }
.theme-toggle:hover { background: var(--border); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary:hover { background: var(--border); }
}
