/* ==========================================================================
   Railside Cottage build guide - styles
   Everything is scoped to .sbp-guide so it can be dropped into any page.

   1. THEME TOKENS - change these to restyle the whole guide.
      They read the Signal Box Prints brand variables (--sb-*) from brand.css
      when that file is loaded first, and fall back to the same values if not.
   2. LAYOUT AND COMPONENTS - use the tokens only. No colours or fonts below.
   ========================================================================== */

/* 1. Theme tokens ---------------------------------------------------------- */
.sbp-guide {
  --g-paper:        transparent;                /* let the site's textured paper show through */
  --g-ink:          var(--sb-ink, #1B1F23);     /* main text */
  --g-muted:        var(--sb-grey, #5A5F66);    /* secondary text */
  --g-accent:       var(--sb-green, #1E5B3E);   /* brand green: headings accents, part letters */
  --g-on-accent:    var(--sb-white, #FFFFFF);   /* text on green */
  --g-card:         #FBF4E2;                    /* part cards, table */
  --g-card-border:  #E2D6B8;
  --g-rule:         #E2D6B8;                    /* dividers */

  --g-font-display: var(--sb-font-display, "Quicksand", "Nunito", "Segoe UI", system-ui, sans-serif);
  --g-font-body:    var(--sb-font-body, system-ui, -apple-system, "Segoe UI", sans-serif);
  --g-font-mono:    ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --g-radius-card:  14px;
  --g-radius-small: 6px;
  --g-max-width:    980px;
  --g-gutter:       max(16px, env(safe-area-inset-left, 0px));
}

/* 2. Layout and components -------------------------------------------------- */
.sbp-guide { background: var(--g-paper); color: var(--g-ink); font: 400 1rem/1.6 var(--g-font-body); }
.sbp-guide *, .sbp-guide *::before, .sbp-guide *::after { box-sizing: border-box; }
.sbp-guide img { max-width: 100%; height: auto; display: block; }
.sbp-guide .guide-wrap { max-width: var(--g-max-width); margin: 0 auto; padding-block: 2.5rem 4rem;
  padding-left: var(--g-gutter); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

.sbp-guide h1, .sbp-guide h2, .sbp-guide h3 { font-family: var(--g-font-display); font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; margin: 0; text-wrap: balance; }
.sbp-guide h1 { font-size: clamp(2.3rem, 6vw, 3.4rem); }
.sbp-guide h2 { font-size: 1.75rem; }
.sbp-guide h3 { font-size: 1.25rem; }
.sbp-guide p { margin: 0; max-width: 65ch; }
.sbp-guide ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; max-width: 62ch; }

.sbp-guide .guide-eyebrow { font: 700 0.8rem/1 var(--g-font-display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--g-accent); }
.sbp-guide .guide-mono { font-family: var(--g-font-mono); font-size: 0.9em; font-variant-numeric: tabular-nums; }

/* Header */
.sbp-guide .guide-header { display: grid; gap: 1.5rem; }
.sbp-guide .guide-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 2rem; align-items: center; }
.sbp-guide .guide-hero-text { display: grid; gap: 1rem; min-width: 0; }
.sbp-guide .guide-lede { font-size: 1.12rem; color: var(--g-muted); }
.sbp-guide .guide-hero img { width: 100%; }

/* Sections */
.sbp-guide .guide-section { margin-top: 3.5rem; display: grid; gap: 1.25rem; }
.sbp-guide .guide-section-head { display: grid; gap: 0.5rem; border-bottom: 1px solid var(--g-rule); padding-bottom: 0.75rem; }
.sbp-guide .guide-small { font-size: 0.95rem; color: var(--g-muted); }

/* Build / Parts tabs: styles live in site.css (shared with the home page); spacing here */
.sbp-guide .tabs { margin-top: 2.5rem; }
.sbp-guide .tabs ~ .guide-section { margin-top: 1.75rem; }
.sbp-guide .tabs ~ .guide-panel > .guide-section:first-child { margin-top: 1.75rem; }

/* Part letter badge, like a kit sprue code */
.sbp-guide .guide-code { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 0.3em;
  border-radius: var(--g-radius-small); background: var(--g-accent); color: var(--g-on-accent);
  font: 700 0.85em/1 var(--g-font-display); vertical-align: 0.06em; }

/* Parts grid */
.sbp-guide .guide-parts { list-style: none; margin: 0; padding: 0; max-width: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.sbp-guide .guide-part { background: var(--g-card); border: 1px solid var(--g-card-border); border-radius: var(--g-radius-card);
  padding: 0.9rem; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; gap: 0.6rem; min-width: 0; }
.sbp-guide .guide-part-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.sbp-guide .guide-part-top .guide-code { font-size: 1.05rem; }
.sbp-guide .guide-qty { font: 700 0.95rem/1 var(--g-font-mono); color: var(--g-muted); }
.sbp-guide .guide-part-img { aspect-ratio: 4 / 3; min-width: 0; }
.sbp-guide .guide-part-img img { width: 100%; height: 100%; object-fit: contain; }
.sbp-guide .guide-part-text { display: grid; gap: 0.2rem; }
.sbp-guide .guide-part-text p { font-size: 0.92rem; color: var(--g-muted); }
.sbp-guide .guide-part-text .guide-mono { font-size: 0.8rem; color: var(--g-muted); }

/* Printing columns */
.sbp-guide .guide-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.25rem 2.5rem; }
.sbp-guide .guide-cols > div { display: grid; gap: 0.5rem; align-content: start; min-width: 0; }

/* Steps */
.sbp-guide .guide-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: 0.92rem; color: var(--g-muted); }
.sbp-guide .guide-swatch { display: inline-block; width: 0.9em; height: 0.9em; border-radius: 3px; vertical-align: -0.1em; margin-right: 0.35em; }
.sbp-guide .guide-swatch-new { background: #7DB89C; }   /* matches the green in the step pictures */
.sbp-guide .guide-swatch-done { background: #CBC7BF; }  /* matches the grey in the step pictures */
.sbp-guide .guide-steps { list-style: none; margin: 0; padding: 0; max-width: none; display: grid; gap: 0; }
.sbp-guide .guide-step { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 2rem; align-items: center; padding-block: 2rem; border-top: 1px solid var(--g-rule); }
.sbp-guide .guide-step:first-child { border-top: 0; }
.sbp-guide .guide-step-body { display: grid; gap: 0.8rem; min-width: 0; }
.sbp-guide .guide-step-num { font: 700 3rem/0.9 var(--g-font-display); color: var(--g-accent); font-variant-numeric: tabular-nums; }
.sbp-guide .guide-note { font-size: 0.95rem; color: var(--g-muted); padding-left: 0.9rem; border-left: 3px solid var(--g-card-border); }

/* Blend-file table */
.sbp-guide .guide-table-wrap { overflow-x: auto; background: var(--g-card); border: 1px solid var(--g-card-border); border-radius: var(--g-radius-card); }
.sbp-guide table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 0.93rem; }
.sbp-guide th, .sbp-guide td { text-align: left; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--g-rule); vertical-align: top; }
.sbp-guide th { font: 700 0.75rem/1.2 var(--g-font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--g-muted); }
.sbp-guide tr:last-child td { border-bottom: 0; }
.sbp-guide td.guide-objs { font-family: var(--g-font-mono); font-size: 0.82rem; }
.sbp-guide .guide-tag { font: 700 0.72rem/1 var(--g-font-display); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; color: var(--g-muted); }
.sbp-guide .guide-tag-kit { color: var(--g-accent); }

.sbp-guide .guide-footer { margin-top: 3.5rem; padding-top: 1rem; border-top: 1px solid var(--g-rule); font-size: 0.9rem; color: var(--g-muted); }

@media (max-width: 720px) {
  .sbp-guide .guide-hero, .sbp-guide .guide-step { grid-template-columns: minmax(0, 1fr); }
  .sbp-guide .guide-step { gap: 1rem; }
  .sbp-guide .guide-step-num { font-size: 2.5rem; }
}
