/* ============================================================
   Base — site-wide reset, layout, header/footer, page chrome
   Intentionally lightweight: no design system, no JS, no CSS
   framework. Phase 0 styling — adjust the brand palette here
   when the visual identity is finalized.
   ============================================================ */

/* ── Reset + box model ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ── Brand tokens ── */
:root {
  --brand-bg: #0f172a;
  --brand-fg: #f8fafc;
  --brand-accent: #16a34a;
  --brand-accent-hover: #15803d;
  --text: #1f2937;
  --text-muted: #6b7280;
  --bg: #ffffff;
  --bg-soft: #f9fafb;
  --border: #e5e7eb;
  --container: 64rem;
  --radius: 0.375rem;
}

/* ── Body + typography defaults ── */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--brand-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 2rem; font-weight: 700; margin: 0 0 1rem; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 700; margin: 1.5rem 0 0.75rem; line-height: 1.3; }
h3 { font-size: 1.25rem; font-weight: 600; margin: 1.25rem 0 0.5rem; }

/* ── Header ── */
.site-header {
  background: var(--brand-bg);
  color: var(--brand-fg);
  border-bottom: 1px solid #1e293b;
}
.site-header__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.site-header__logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-fg);
  text-decoration: none;
}
.site-header__logo:hover { text-decoration: none; opacity: 0.85; }
.site-header__nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.site-header__nav a {
  color: var(--brand-fg);
  font-size: 0.95rem;
  opacity: 0.85;
}
.site-header__nav a:hover { opacity: 1; text-decoration: none; }

/* ── Footer ── */
.site-footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.site-footer__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 2rem 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}
.site-footer h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin: 0 0 0.5rem;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 0.4rem; }
.site-footer__legal {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
}

/* ── Main container ── */
.site-main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* ── Product page ── */
.product__cover img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.product__price {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 1rem 0;
}
.product__price-current {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}
.product__price-old {
  font-size: 1.1rem;
  color: var(--text-muted);
  text-decoration: line-through;
}
.product__properties {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}
.product__properties th,
.product__properties td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.product__properties th {
  font-weight: 600;
  width: 30%;
  color: var(--text-muted);
}
.product__gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}
.product__gallery img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── Buy form ── */
.buy-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
  align-items: center;
}
.buy-form__email {
  flex: 1 1 220px;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}
.buy-form__email:focus {
  outline: 2px solid var(--brand-accent);
  outline-offset: -1px;
  border-color: var(--brand-accent);
}
.buy-form__submit {
  padding: 0.625rem 1.5rem;
  background: var(--brand-accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  transition: background 0.15s;
}
.buy-form__submit:hover:not(:disabled) { background: var(--brand-accent-hover); }
.buy-form__submit:disabled { opacity: 0.6; cursor: not-allowed; }
.buy-form__error {
  flex-basis: 100%;
  margin: 0;
  padding: 0.625rem 0.875rem;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

/* ── Collection (product grid) ── */
.collection__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}
.product-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.15s, transform 0.15s;
}
.product-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
  text-decoration: none;
}
.product-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.product-card__body { padding: 0.875rem 1rem; }
.product-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text);
}
.product-card__price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-accent);
}

/* ── Blog ── */
.blog__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
  list-style: none;
  padding: 0;
}
.blog__item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: #fff;
  transition: box-shadow 0.15s;
}
.blog__item:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06); }
.blog__item h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.blog__item h3 a { color: var(--text); }
.blog__item h3 a:hover { color: var(--brand-accent); text-decoration: none; }
.blog__item-excerpt {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* ── Article ── */
.article__breadcrumb {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}
.article__breadcrumb a { color: var(--text-muted); }
.article__breadcrumb a:hover { color: var(--brand-accent); }
.article__title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  line-height: 1.25;
}
.article__meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* ── Home / index ── */
.home__hero {
  text-align: center;
  padding: 3rem 1rem;
  background: linear-gradient(135deg, #f0f9ff 0%, #ecfdf5 100%);
  border-radius: var(--radius);
  margin-bottom: 2rem;
}
.home__hero h1 { margin: 0 0 0.5rem; }
.home__hero p { color: var(--text-muted); margin: 0; font-size: 1.1rem; }

/* ── 404 ── */
.notfound {
  text-align: center;
  padding: 4rem 1rem;
}
.notfound h1 { font-size: 4rem; margin: 0; color: var(--brand-accent); }
.notfound p { color: var(--text-muted); margin: 0.5rem 0 1.5rem; }
/* ============================================================
   Prose — rich content styles for article bodies
   Scoped under .prose to avoid leaking into other components.
   ============================================================ */

/* ── Headings ── */
.prose h2 { font-size: 1.5rem; font-weight: 700; margin: 2rem 0 0.75rem; }
.prose h3 { font-size: 1.25rem; font-weight: 600; margin: 1.75rem 0 0.5rem; }
.prose h4 { font-size: 1.125rem; font-weight: 600; margin: 1.25rem 0 0.5rem; }
.prose h5 { font-size: 1rem; font-weight: 600; margin: 1rem 0 0.25rem; }
.prose h6 { font-size: 0.875rem; font-weight: 600; margin: 1rem 0 0.25rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Paragraphs ── */
.prose p { margin-bottom: 1rem; }

/* ── Blockquotes ── */
.prose blockquote {
  border-left: 4px solid #d1d5db;
  padding: 0.75rem 1rem;
  margin: 1.25rem 0;
  color: #4b5563;
  background: #f9fafb;
  border-radius: 0 0.375rem 0.375rem 0;
}
.prose blockquote p { margin-bottom: 0.5rem; }
.prose blockquote p:last-child { margin-bottom: 0; }

/* ── GitHub-style callouts ── */
.prose .markdown-alert {
  padding: 1rem 1rem 1rem 1.25rem;
  margin: 1.25rem 0;
  border-left: 4px solid;
  border-radius: 0 0.5rem 0.5rem 0;
}
.prose .markdown-alert > :first-child { margin-top: 0; }
.prose .markdown-alert > :last-child { margin-bottom: 0; }
.prose .markdown-alert .markdown-alert-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 600; margin-bottom: 0.5rem;
}

.prose .markdown-alert-note       { border-color: #3b82f6; background: #eff6ff; }
.prose .markdown-alert-note .markdown-alert-title { color: #1d4ed8; }

.prose .markdown-alert-tip        { border-color: #22c55e; background: #f0fdf4; }
.prose .markdown-alert-tip .markdown-alert-title  { color: #15803d; }

.prose .markdown-alert-important  { border-color: #a855f7; background: #faf5ff; }
.prose .markdown-alert-important .markdown-alert-title { color: #7e22ce; }

.prose .markdown-alert-warning    { border-color: #f59e0b; background: #fffbeb; }
.prose .markdown-alert-warning .markdown-alert-title { color: #b45309; }

.prose .markdown-alert-caution    { border-color: #ef4444; background: #fef2f2; }
.prose .markdown-alert-caution .markdown-alert-title { color: #dc2626; }

/* ── Lists ── */
.prose ul, .prose ol { padding-left: 1.75rem; margin: 1rem 0; }
.prose li { margin-bottom: 0.375rem; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }

/* ── Tables (GFM) ── */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9375rem;
}
.prose thead th {
  text-align: left;
  font-weight: 600;
  padding: 0.625rem 0.75rem;
  border-bottom: 2px solid #d1d5db;
  background: #f9fafb;
}
.prose tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}
.prose tbody tr:last-child td { border-bottom: none; }

/* ── Code ── */
.prose code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.875em;
  background: #f3f4f6;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  color: #1f2937;
}
.prose pre {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  background: #1f2937;
  border-radius: 0.5rem;
  overflow-x: auto;
  line-height: 1.6;
}
.prose pre code {
  background: transparent;
  padding: 0;
  color: #e5e7eb;
  font-size: 0.875rem;
}

/* ── Horizontal rules ── */
.prose hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 2rem 0;
}

/* ── Task lists ── */
.prose .contains-task-list { list-style: none; padding-left: 0; }
.prose .task-list-item { display: flex; align-items: baseline; gap: 0.5rem; }
.prose .task-list-item input[type="checkbox"] {
  margin: 0;
  accent-color: #16a34a;
}

/* ── Footnotes ── */
.prose .footnotes {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
  font-size: 0.875rem;
  color: #6b7280;
}
.prose .footnote-ref { font-size: 0.75em; vertical-align: super; }

/* ── Images ── */
.prose img { border-radius: 0.5rem; margin: 1.5rem 0; }

/* ── KaTeX overrides ── */
.prose .katex-display {
  margin: 1.5rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0;
}
.prose .katex { font-size: 1.1em; }
.prose .katex-error {
  color: #dc2626;
  font-family: monospace;
  font-size: 0.875rem;
}

/* ── Download action (free download flow #75) ── */
.download-action { margin: 1.5rem 0; }
.download-action__btn {
  display: inline-block;
  padding: 0.875rem 2rem;
  text-decoration: none;
  font-size: 1.05rem;
}
.download-action__btn:hover { text-decoration: none; }
.download-action__hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
