/* ============================================
   Simpliguides — shared stylesheet
   Inherits Simplicalcs design language
   ============================================ */

:root {
  --bg:           #ffffff;
  --bg-card:      #f8f8f8;
  --text:         #1a1a1a;
  --text-muted:   #6b6b6b;
  --border:       #e0e0e0;
  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --success:      #16a34a;
  --warning:      #d97706;
  --step-num:     #2563eb;
  --copy-bg:      #f1f5f9;
  --copy-border:  #cbd5e1;
  --radius:       6px;
  --max-width:    680px;
}

[data-theme="dark"] {
  --bg:           #111111;
  --bg-card:      #1e1e1e;
  --text:         #e8e8e8;
  --text-muted:   #9a9a9a;
  --border:       #2e2e2e;
  --accent:       #3b82f6;
  --accent-hover: #60a5fa;
  --copy-bg:      #1a2232;
  --copy-border:  #2e3f58;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  padding: 0 1rem;
}

/* ---- Header ---- */
header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
}

.site-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-name:hover { color: var(--text); }

.home-icon {
  display: none;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

@media (min-width: 600px) {
  .home-icon { display: block; }
}

/* ---- Header search ---- */
.header-search-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
}

.header-search-input {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  padding: 8px 14px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

/* Kill the browser's built-in search icon and clear button */
.header-search-input::-webkit-search-decoration,
.header-search-input::-webkit-search-cancel-button,
.header-search-input::-webkit-search-results-button,
.header-search-input::-webkit-search-results-decoration {
  display: none;
}

.header-search-input:focus { border-color: var(--accent); }

.header-search-input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.header-search-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  list-style: none;
  z-index: 200;
  max-height: 280px;
  overflow-y: auto;
}

.header-search-results.visible { display: block; }

.header-search-results li a {
  display: block;
  padding: 9px 14px;
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  transition: background-color 0.15s;
}

.header-search-results li a:hover {
  background: var(--bg);
  color: var(--accent-hover);
}

.header-search-results .no-match {
  display: block;
  padding: 9px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- Share button + Theme toggle ---- */
.share-btn,
.theme-toggle {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
  line-height: 1;
}

.share-btn:hover,
.theme-toggle:hover { opacity: 0.75; }

.theme-toggle { font-size: 1.2rem; }

/* Share toast notification */
.share-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--text);
  color: var(--bg);
  font-size: 0.85rem;
  padding: 8px 18px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 9999;
  white-space: nowrap;
}

.share-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Main content ---- */
main {
  max-width: var(--max-width);
  margin: 0 auto 3rem;
}

/* ---- Guide meta (above title) ---- */
.guide-category {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.guide-category a {
  color: var(--text-muted);
  text-decoration: none;
}

.guide-category a:hover { color: var(--accent); }

h1 {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.guide-intro {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
}

/* ---- What you'll need ---- */
.prereqs {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.prereqs p { color: var(--text-muted); }
.prereqs strong { color: var(--text); }

/* ---- Steps ---- */
.steps { margin-bottom: 2rem; }

.step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.75rem;
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.step-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.step-body p {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.step-body p:last-child { margin-bottom: 0; }

/* ---- Copy block ---- */
.copy-block {
  background: var(--copy-bg);
  border: 1px solid var(--copy-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  font-family: 'Menlo', 'Courier New', monospace;
  font-size: 0.875rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  word-break: break-all;
}

.copy-block code { flex: 1; }

.copy-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--copy-border);
  border-radius: var(--radius);
  padding: 3px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-muted);
  white-space: nowrap;
}

.copy-btn:hover { background: var(--border); color: var(--text); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }

/* ---- Note / tip callout ---- */
.note {
  border-left: 3px solid var(--accent);
  padding: 0.6rem 1rem;
  background: var(--bg-card);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0.75rem 0;
}

/* ---- Section headings ---- */
.section-heading {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* ---- Variations & Troubleshooting ---- */
.variation, .trouble-item {
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.variation strong, .trouble-item strong {
  display: block;
  margin-bottom: 0.25rem;
}

/* ---- Ad slot ---- */
.ad-slot {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 2.5rem 0;
}

/* ---- Footer ---- */
footer {
  max-width: var(--max-width);
  margin: 0 auto 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

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

/* ---- Home page cards ---- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}

.category-card:hover { border-color: var(--accent); }

.category-card .icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.category-card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.25rem; }
.category-card p { font-size: 0.8rem; color: var(--text-muted); }

/* ---- Responsive ---- */
@media (max-width: 480px) {
  h1 { font-size: 1.35rem; }
  .step { gap: 0.75rem; }
}
