/*
 * Design tokens and components lifted out of the captured STUDIO CSS, so
 * hand-built pages sit next to the imported ones without looking foreign.
 *
 * Values are measured, not invented: the colour and font tokens are STUDIO's
 * own :root variables, the type scale is what the 48 pages actually use
 * (14/16/18/20/40/45/54px), and the breakpoints are the four STUDIO was
 * designed against.
 *
 * Captured pages are styled by uuid (.sd[data-s-…]) and never touch these
 * classes, so the two systems cannot collide.
 */

:root {
  /* brand — the same values STUDIO emits as --s-color-* */
  --bb-teal: #167e7c;
  --bb-teal-mid: #23948e;
  --bb-teal-light: #7ec3bf;
  --bb-teal-deep: #0c6d6c;
  --bb-gold: #eab528;
  --bb-navy: #021839;
  --bb-ink: #202020;
  --bb-grey: #737476;          /* the AA-passing grey, see fixups.mjs */
  --bb-rule: #e3e6ea;
  --bb-surface: #ffffff;
  --bb-surface-soft: #f3f5f7;

  --bb-gradient-teal: linear-gradient(90deg, #036260, #57ada8);
  --bb-gradient-gold: linear-gradient(90deg, #dca100, #e7bf51);
  --bb-gradient-soft: linear-gradient(135deg, #dcffff, #fff0c6);

  --bb-font: 'Noto Sans JP', sans-serif;

  /* type scale, as used across the site */
  --bb-text-xs: 14px;
  --bb-text-sm: 16px;
  --bb-text-md: 18px;
  --bb-text-lg: 20px;
  --bb-text-section: 40px;
  --bb-text-display: 54px;

  --bb-radius: 16px;
  --bb-radius-pill: 999px;
  --bb-measure: 850px;         /* the content width STUDIO settles on */
}

/* ----------------------------------------------------------------- layout */
.bb {
  font-family: var(--bb-font);
  color: var(--bb-navy);
  line-height: 1.5;
}

/*
 * STUDIO's reset hits every element inside .render-canvas by tag name with
 * color:#333, font-family:sans-serif and line-height:1. A directly matching
 * rule beats an inherited value, so inheritance has to be handed back before
 * anything below can take effect. :where() keeps this at .bb's own
 * specificity, so it never reaches the captured pages.
 */
.bb :where(h1, h2, h3, h4, h5, h6, p, ul, ol, li, table, thead, tbody, tr, th, td,
  a, span, strong, em, small, figure, figcaption, blockquote, div, section) {
  color: inherit;
  font-family: inherit;
  line-height: inherit;
}

.bb-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  width: 100%;
  padding: 80px 32px 40px;
}

/* The header is position:fixed, so the first section has to clear it. */
.bb > .bb-section:first-child { padding-top: 148px; }

.bb-section--soft { background: var(--bb-surface-soft); }
.bb-section--teal { background: var(--bb-gradient-teal); color: #fff; }
.bb-section--wash { background: var(--bb-gradient-soft); }

.bb-measure {
  width: 100%;
  max-width: var(--bb-measure);
}

.bb-grid {
  display: grid;
  gap: 24px;
  width: 100%;
  max-width: var(--bb-measure);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* ------------------------------------------------------------------- type */
.bb-display {
  margin: 0;
  font-size: var(--bb-text-display);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.bb-h2 {
  margin: 0;
  font-size: var(--bb-text-section);
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

/* The pill heading the /howto pages use for a section title. */
.bb-pill {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  margin: 0 0 24px;
  padding: 10px 24px;
  border-radius: var(--bb-radius);
  background: var(--bb-teal-deep);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
}

.bb-lead {
  margin: 0;
  font-size: var(--bb-text-lg);
  font-weight: 500;
}

.bb-body {
  margin: 0;
  font-size: var(--bb-text-sm);
  font-weight: 400;
}

.bb-body strong { font-weight: 900; }

.bb-note {
  margin: 0;
  font-size: var(--bb-text-xs);
  color: var(--bb-grey);
}

/* ---------------------------------------------------------------- surface */
.bb-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border-radius: var(--bb-radius);
  background: var(--bb-surface);
  box-shadow: 0 1px 3px rgba(2, 24, 57, 0.08);
}

.bb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--bb-text-sm);
}

.bb-table th,
.bb-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--bb-rule);
  text-align: left;
}

.bb-table th { font-weight: 900; }

/* ---------------------------------------------------------------- actions */
.bb-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 48px;
  border: 0;
  border-radius: var(--bb-radius);
  font-family: var(--bb-font);
  font-size: var(--bb-text-md);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.2s cubic-bezier(0.4, 0.4, 0, 1);
}

.bb-button:hover { filter: brightness(1.06); }

/* Dark text on the gold, as on the CTA bar — white fails WCAG AA here. */
.bb-button--gold { background: var(--bb-gold); color: #3a2c00; }
.bb-button--teal { background: var(--bb-teal); color: #fff; }
.bb-button--ghost {
  background: transparent;
  color: var(--bb-teal);
  box-shadow: inset 0 0 0 2px currentColor;
}

/* On the dark section the teal outline disappears into the background. */
.bb-section--teal .bb-button--ghost { color: #fff; }

/* ------------------------------------------------------------ breakpoints */
/* The same four widths STUDIO lays the captured pages out against. */
@media screen and (max-width: 1140px) {
  .bb-section { padding: 80px 24px 40px; }
}

@media screen and (max-width: 840px) {
  :root {
    --bb-text-display: 40px;
    --bb-text-section: 30px;
  }
  .bb-section { gap: 32px; }
}

@media screen and (max-width: 540px) {
  .bb > .bb-section:first-child { padding-top: 124px; }
  :root {
    --bb-text-display: 32px;
    --bb-text-section: 24px;
    --bb-text-lg: 18px;
  }
  .bb-section { padding: 56px 20px 32px; }
  .bb-pill { font-size: 20px; padding: 8px 18px; }
  .bb-button { width: 100%; padding: 14px 24px; }
}

@media screen and (max-width: 320px) {
  .bb-section { padding: 48px 16px 24px; }
}

/* --------------------------------------------------------------- sitemap */
.bb-toc {
  display: grid;
  gap: 8px 32px;
  width: 100%;
  max-width: var(--bb-measure);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.bb-toc a {
  font-size: var(--bb-text-sm);
  font-weight: 700;
  color: var(--bb-teal);
  text-decoration: none;
}

.bb-toc a:hover { text-decoration: underline; }

.bb-list {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--bb-measure);
  margin: 0;
  padding: 0;
  list-style: none;
}

.bb-list > li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--bb-rule);
}

.bb-list a {
  font-size: var(--bb-text-md);
  font-weight: 700;
  color: var(--bb-teal);
  text-decoration: none;
}

.bb-list a:hover { text-decoration: underline; }

.bb-list .bb-note { flex: 1 1 100%; }

.bb-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--bb-grey);
}

/* Nested children, e.g. the fourteen /howto pages under their parent. */
.bb-sublist {
  display: grid;
  gap: 6px 24px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  flex: 1 1 100%;
  margin: 10px 0 2px;
  padding: 0 0 0 18px;
  border-left: 2px solid var(--bb-rule);
  list-style: none;
}

.bb-sublist a { font-size: var(--bb-text-sm); }

.bb-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--bb-radius-pill);
  background: var(--bb-surface-soft);
  color: var(--bb-grey);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ----------------------------------------------------------------- blocks */
.bb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 32px;
}

.bb-steps {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: var(--bb-measure);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: bb-step;
}

.bb-steps > li {
  display: grid;
  gap: 4px 20px;
  grid-template-columns: 44px 1fr;
  align-items: start;
}

.bb-steps > li::before {
  counter-increment: bb-step;
  content: counter(bb-step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bb-teal);
  color: #fff;
  font-size: var(--bb-text-sm);
  font-weight: 700;
}

.bb-steps h3 {
  margin: 0;
  font-size: var(--bb-text-lg);
  font-weight: 700;
}

.bb-steps p { grid-column: 2; margin: 0; font-size: var(--bb-text-sm); }

/* Native accordion — no JavaScript, and it prints and links correctly. */
.bb-faq {
  width: 100%;
  max-width: var(--bb-measure);
}

.bb-faq details {
  border-bottom: 1px solid var(--bb-rule);
}

.bb-faq summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 18px 0;
  font-size: var(--bb-text-md);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.bb-faq summary::-webkit-details-marker { display: none; }

.bb-faq summary::before {
  content: 'Q';
  color: var(--bb-teal);
  font-weight: 900;
}

.bb-faq details[open] summary { color: var(--bb-teal); }

.bb-faq div {
  display: flex;
  gap: 12px;
  padding: 0 0 20px;
  font-size: var(--bb-text-sm);
}

.bb-faq div::before {
  content: 'A';
  color: var(--bb-gold);
  font-weight: 900;
}

.bb-media {
  display: grid;
  gap: 32px 48px;
  width: 100%;
  max-width: var(--bb-measure);
  grid-template-columns: 1fr 1fr;
  align-items: center;
}

.bb-media--reverse > :first-child { order: 2; }

.bb-media img {
  width: 100%;
  height: auto;
  border-radius: var(--bb-radius);
}

@media screen and (max-width: 840px) {
  .bb-media { grid-template-columns: 1fr; }
  .bb-media--reverse > :first-child { order: 0; }
}
