/* ============================================================
   App-level layer for Cpike.Cms.Web
   The look & feel comes from the design system
   (_content/Cpike.Cms.DesignSystem/css/design-system.css).
   Use this file ONLY for app-specific overrides of design tokens
   and for the Blazor framework hooks below.

   Examples:
     :root { --accent: #0a84ff; }   override the brand accent
     :root { --r-lg: 16px; }        rounder cards app-wide
   ============================================================ */

/* ---- Blazor framework hooks (restyled onto design tokens) ---- */
.validation-message {
  color: var(--st-progress);
  font: var(--fw-book) var(--fs-caption) / var(--lh-snug) var(--font-sans);
}

.blazor-error-boundary {
  background: var(--st-progress);
  padding: var(--sp-6);
  color: var(--on-accent);
  border-radius: var(--r);
}

.blazor-error-boundary::after {
  content: "An error has occurred.";
}

.auth-pending {
  min-height: 100vh;
}

/* ============================================================
   Studio editor drawer + recipe editor
   Kept global (not CSS-isolated) so the drawer and its child
   RecipeEditor share the same field/label classes.
   ============================================================ */
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 70;
  animation: drawer-fade var(--dur-med) var(--ease-out);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(var(--drawer-w), 100%);
  z-index: 71;
  background: var(--surface-card);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: drawer-slide var(--dur-slow) var(--ease-out);
}

@keyframes drawer-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes drawer-slide {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .drawer-scrim, .drawer { animation: none; }
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-7) var(--sp-8);
  border-bottom: 1px solid var(--border-soft);
}

.drawer__eyebrow {
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.drawer__body {
  flex: 1;
  overflow: auto;
  padding: var(--sp-8);
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
}

.drawer__label {
  display: block;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: var(--sp-3);
}

.drawer__slug {
  font-size: var(--fs-micro);
  color: var(--text-tertiary);
  margin-top: var(--sp-2);
}

.drawer__error {
  background: var(--surface-inset);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  font-size: var(--fs-body-sm);
  color: var(--text-primary);
}

.drawer__foot {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-6) var(--sp-8);
  border-top: 1px solid var(--border-soft);
}

.drawer__note {
  flex: 1;
  font-size: var(--fs-micro);
  color: var(--text-tertiary);
  line-height: var(--lh-snug);
}

/* Recipe editor */
.recipe-ed {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border-soft);
}

.recipe-ed__meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

.recipe-ed__anchor {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-6);
}

.recipe-ed__anchor > div:first-child {
  flex: 1;
}

.recipe-ed__hydration {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding-bottom: var(--sp-3);
}

.recipe-ed__hydration-label {
  font-size: var(--fs-micro);
  color: var(--text-tertiary);
}

.recipe-ed__hydration-value {
  font-size: var(--fs-body-lg);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
}

.recipe-ed__list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.recipe-ed__list-head {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

.recipe-ed__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.recipe-ed__name { flex: 1 1 40%; }
.recipe-ed__qty { flex: 0 0 96px; }
.recipe-ed__unit { flex: 0 0 72px; }
.recipe-ed__pct { flex: 0 0 84px; }
.recipe-ed__role { flex: 0 0 110px; }

.recipe-ed__grams {
  flex: 0 0 64px;
  text-align: right;
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.recipe-ed__flourflag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-micro);
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
}

.recipe-ed__flourflag input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ============================================================
   Public reader (global: the body prose is injected as raw
   HTML from Markdown, so its element styles can't be scoped).
   ============================================================ */
.reader {
  padding: 44px 0 100px;
}

.reader__back {
  font-size: var(--fs-body-sm);
  color: var(--accent);
  margin-bottom: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.reader__eyebrow {
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
}

.reader__title {
  font-size: clamp(32px, 5vw, 44px);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 13px 0 16px;
}

.reader__byline {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  padding-bottom: 28px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border-soft);
}

.reader__date {
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
}

.reader__prose {
  font-size: var(--fs-reader);
  line-height: var(--lh-reader);
  color: var(--text-primary);
}

.reader__prose p { margin: 0 0 22px; }
.reader__prose h2 { font-size: var(--fs-h2); font-weight: var(--fw-semibold); letter-spacing: -0.02em; margin: 40px 0 14px; }
.reader__prose h3 { font-size: var(--fs-h3); font-weight: var(--fw-semibold); letter-spacing: -0.018em; margin: 38px 0 14px; }
.reader__prose ul, .reader__prose ol { margin: 0 0 22px; padding-left: 24px; }
.reader__prose li { margin-bottom: 9px; }
.reader__prose a { color: var(--text-link); }
.reader__prose blockquote {
  border-left: 3px solid var(--border-default);
  padding-left: 20px;
  margin: 0 0 22px;
  color: var(--text-secondary);
}
.reader__prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--surface-inset);
  padding: 2px 6px;
  border-radius: var(--r-xs);
}
.reader__prose pre {
  background: var(--surface-inset);
  padding: var(--sp-6);
  border-radius: var(--r-md);
  overflow: auto;
  margin: 0 0 22px;
}
.reader__prose pre code { background: none; padding: 0; }
.reader__prose img { max-width: 100%; border-radius: var(--r-md); }

/* Recipe rendering */
.recipe {
  margin-bottom: 34px;
}

.recipe__meta {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: 18px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 26px;
}

.recipe__chip {
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
  background: var(--surface-inset);
  padding: 10px 16px;
  border-radius: var(--r-md);
}

.recipe__chip b {
  display: block;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: var(--fw-semibold);
  margin-top: 4px;
  letter-spacing: -0.01em;
}

.recipe__scaler {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
}

.recipe__scaler .ds-text-input { width: 110px; }
.recipe__unit { color: var(--text-tertiary); }
.recipe__hydration { margin-left: auto; font-variant-numeric: tabular-nums; }

.recipe__table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
  font-size: var(--fs-body);
}

.recipe__table th {
  text-align: left;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--text-tertiary);
  padding: 8px 0;
  border-bottom: 1px solid var(--border-default);
}

.recipe__table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}

.recipe__num { text-align: right; font-variant-numeric: tabular-nums; }

.recipe__group { margin-bottom: 22px; }

.recipe__group-head {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--tr-label);
  margin-bottom: 10px;
}

.recipe__list {
  margin: 0 0 22px;
  padding-left: 20px;
}

.recipe__list li {
  margin-bottom: 9px;
  font-size: var(--fs-body);
  line-height: 1.5;
}

/* Explainer + not-found */
.explainer { padding: 44px 0 100px; }
.explainer__back { font-size: var(--fs-body-sm); color: var(--accent); text-decoration: none; }
.explainer__title {
  font-size: clamp(32px, 5vw, 44px);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.03em;
  margin: 24px 0 24px;
}
.explainer__prose { font-size: var(--fs-reader); line-height: var(--lh-reader); color: var(--text-primary); }
.explainer__prose p { margin: 0 0 22px; }

.site-missing { padding: 80px 0 100px; text-align: center; }
.site-missing__title {
  font-size: var(--fs-h2);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tr-tight);
  margin: 0 0 12px;
}
.site-missing__body { color: var(--text-secondary); font-size: var(--fs-body-lg); }
.site-missing__body a { color: var(--text-link); }
