/*
  Index Box: components
  Every value comes from tokens.css. Load tokens.css first.
*/

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

body.ib {
  margin: 0;
  background: var(--ib-paper);
  color: var(--ib-ink);
  font-family: var(--ib-font);
  font-size: var(--ib-text-body);
  line-height: var(--ib-leading);
  overflow-x: clip;
}

.ib-page { max-width: var(--ib-page); margin: 0 auto; padding: 0 var(--ib-space-4); }

/* Links: always underlined, petrol, darker on hover */
.ib a { color: var(--ib-link); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.ib a:hover { color: var(--ib-link-hover); text-decoration-thickness: 2px; }
.ib a:focus-visible, .ib button:focus-visible, .ib input:focus-visible, .ib select:focus-visible { outline: none; box-shadow: var(--ib-focus); }

/* Masthead: logo tile + wordmark left, italic motto right */
.ib-mast { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--ib-space-4); padding: var(--ib-space-3) 0 var(--ib-space-3); }
.ib-brand { display: flex; align-items: center; gap: var(--ib-space-2); text-decoration: none !important; color: var(--ib-petrol) !important; }
.ib-tile { width: 64px; height: 72px; flex: none; border-radius: 6px 6px 6px 22px; background: linear-gradient(160deg, var(--ib-sky) 0%, var(--ib-sky-deep) 100%); position: relative; overflow: hidden; }
.ib-tile svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ib-wordmark { font-family: var(--ib-serif); font-size: var(--ib-text-mark); line-height: 1; letter-spacing: -0.01em; }
.ib-motto { font-family: var(--ib-serif); font-style: italic; font-size: var(--ib-text-small); text-align: right; color: var(--ib-ink); line-height: 1.35; margin: 0; }

/* Nav band */
.ib-nav { display: flex; align-items: center; gap: var(--ib-space-1); background: var(--ib-petrol); border-radius: var(--ib-radius-band); padding: 0 var(--ib-space-2); min-height: 34px; overflow-x: auto; scrollbar-width: none; }
.ib-nav::-webkit-scrollbar { display: none; }
.ib-nav a { color: var(--ib-on-petrol) !important; text-decoration: none !important; padding: 5px 10px; white-space: nowrap; font-size: var(--ib-text-body); }
.ib-nav a:hover, .ib-nav a[aria-current] { background: var(--ib-petrol-deep); text-decoration: underline !important; }
.ib-nav .ib-nav-end { margin-left: auto; }

/* Two-column document: text left, index box right */
.ib-doc { display: grid; grid-template-columns: minmax(0, 1fr) var(--ib-index); gap: var(--ib-space-5); padding: var(--ib-space-4) 0 var(--ib-space-6); align-items: start; }
.ib-doc--single { grid-template-columns: minmax(0, var(--ib-measure)); }
.ib-main > *:first-child { margin-top: 0; }

/* The index box: the signature frame */
.ib-index { border: var(--ib-frame); border-radius: var(--ib-radius-box); padding: var(--ib-space-4) var(--ib-space-4) var(--ib-space-3); background: var(--ib-paper); }
.ib-index h2 { font-size: var(--ib-text-h3); text-align: center; margin: 0 0 var(--ib-space-3); }
.ib-index ul { margin: 0; padding-left: 20px; line-height: 1.5; }
.ib-index ul ul { list-style: circle; padding-left: 22px; }
.ib-index a { text-decoration: none; }
.ib-index a:hover { text-decoration: underline; }

/* Type */
.ib-h1 { font-size: var(--ib-text-hero); line-height: 1.15; margin: 0 0 var(--ib-space-3); font-weight: 700; }
.ib-h2 { font-size: var(--ib-text-h2); line-height: 1.25; margin: var(--ib-space-6) 0 var(--ib-space-3); font-weight: 700; }
.ib-h3 { font-size: var(--ib-text-h3); margin: var(--ib-space-5) 0 var(--ib-space-2); font-weight: 700; }
.ib-lead { font-size: var(--ib-text-lead); margin: 0 0 var(--ib-space-4); }
.ib-meta { font-size: var(--ib-text-small); color: var(--ib-soft); }
.ib-eyebrow { font-family: var(--ib-mono); font-size: var(--ib-text-micro); color: var(--ib-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.ib code, .ib-code { font-family: var(--ib-mono); font-size: 0.92em; background: var(--ib-wash); padding: 1px 4px; }
.ib-num { font-family: var(--ib-mono); font-variant-numeric: tabular-nums; }

/* Raised gray system buttons */
.ib-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: var(--ib-text-small); line-height: 1.2; color: var(--ib-ink) !important; text-decoration: none !important; white-space: nowrap; padding: 3px 10px; border: 1px solid var(--ib-bevel-edge); border-radius: var(--ib-radius-btn); background: linear-gradient(var(--ib-bevel-top), var(--ib-bevel-bottom)); box-shadow: var(--ib-shadow-btn); cursor: pointer; }
.ib-btn:hover { background: linear-gradient(var(--ib-paper), var(--ib-bevel-top)); }
.ib-btn:active { background: var(--ib-bevel-press); box-shadow: var(--ib-shadow-press); }
.ib-btn--go { color: var(--ib-on-petrol) !important; background: linear-gradient(var(--ib-petrol-soft), var(--ib-petrol)); border-color: var(--ib-petrol-deep); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.ib-btn--go:hover { background: linear-gradient(var(--ib-petrol), var(--ib-petrol-deep)); }
.ib-btn--big { font-size: var(--ib-text-body); padding: 6px 16px; }
.ib-btns { display: flex; flex-wrap: wrap; gap: var(--ib-space-2); align-items: center; }

/* Boxes */
.ib-box { border: var(--ib-rule); padding: var(--ib-space-4); background: var(--ib-paper); }
.ib-box--framed { border: var(--ib-frame); }
.ib-box--wash { background: var(--ib-wash); border-color: var(--ib-wash-2); }
.ib-note { background: var(--ib-note); border-left: 4px solid var(--ib-note-edge); padding: var(--ib-space-3) var(--ib-space-4); margin: var(--ib-space-4) 0; }
.ib-note strong:first-child { margin-right: 4px; }
.ib-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--ib-space-4); }
.ib-card h3 { margin: 0 0 var(--ib-space-1); font-size: var(--ib-text-h3); }
.ib-card p { margin: 0; color: var(--ib-soft); font-size: var(--ib-text-small); }

/* Badges */
.ib-badge { display: inline-block; font-family: var(--ib-mono); font-size: var(--ib-text-micro); padding: 1px 6px; border: 1px solid var(--ib-petrol-soft); color: var(--ib-petrol); background: var(--ib-wash); white-space: nowrap; vertical-align: middle; }
.ib-badge--ok { border-color: var(--ib-ok); color: var(--ib-ok); background: var(--ib-ok-soft); }

/* Data tables */
.ib-table-wrap { overflow-x: auto; }
.ib-table { width: 100%; border-collapse: collapse; font-size: var(--ib-text-small); }
.ib-table th, .ib-table td { border: var(--ib-rule); padding: 5px 10px; text-align: left; }
.ib-table thead th { background: var(--ib-petrol); color: var(--ib-on-petrol); border-color: var(--ib-petrol); font-weight: 700; }
.ib-table tbody tr:nth-child(even) td { background: var(--ib-wash); }
.ib-table td.ib-num, .ib-table th.ib-num { text-align: right; }

/* Lists in prose */
.ib-list { padding-left: 22px; margin: 0 0 var(--ib-space-4); }
.ib-list li { margin-bottom: 2px; }

/* Forms */
.ib-form { display: grid; gap: var(--ib-space-4); }
.ib-field { display: grid; gap: var(--ib-space-1); }
.ib-label { font-weight: 700; font-size: var(--ib-text-small); }
.ib-hint { font-size: var(--ib-text-micro); color: var(--ib-faint); }
.ib-input, .ib-select { font: inherit; font-size: var(--ib-text-body); color: var(--ib-ink); background: var(--ib-paper); border: 1px solid var(--ib-bevel-edge); border-radius: var(--ib-radius-input); padding: 6px 8px; width: 100%; box-shadow: inset 0 1px 2px rgba(18, 22, 25, 0.12); }
.ib-check { display: flex; gap: var(--ib-space-2); align-items: flex-start; font-size: var(--ib-text-small); }
.ib-check input { margin-top: 4px; accent-color: var(--ib-petrol); }
.ib-fieldset { border: var(--ib-rule); padding: var(--ib-space-3) var(--ib-space-4) var(--ib-space-4); margin: 0; }
.ib-fieldset legend { font-weight: 700; padding: 0 6px; }

/* Pricing */
.ib-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--ib-space-4); align-items: stretch; }
.ib-plan { border: var(--ib-rule); padding: var(--ib-space-4); display: flex; flex-direction: column; gap: var(--ib-space-3); }
.ib-plan--pick { border: var(--ib-frame); }
.ib-plan-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--ib-space-2); }
.ib-plan-name { font-size: var(--ib-text-h3); font-weight: 700; margin: 0; }
.ib-price { font-family: var(--ib-serif); font-size: 36px; line-height: 1; margin: 0; }
.ib-price small { font-family: var(--ib-font); font-size: var(--ib-text-small); color: var(--ib-soft); }
.ib-plan ul { margin: 0; padding-left: 20px; font-size: var(--ib-text-small); flex: 1; }

/* Article */
.ib-article { max-width: var(--ib-measure); }
.ib-article p { margin: 0 0 var(--ib-space-4); }
.ib-byline { font-size: var(--ib-text-small); color: var(--ib-soft); border-bottom: var(--ib-rule); padding-bottom: var(--ib-space-3); margin-bottom: var(--ib-space-5); }
.ib-pre { font-family: var(--ib-mono); font-size: var(--ib-text-small); background: var(--ib-wash); border: var(--ib-rule); padding: var(--ib-space-3) var(--ib-space-4); overflow-x: auto; white-space: pre; line-height: 1.5; }
.ib-figure { margin: var(--ib-space-5) 0; border: var(--ib-rule); padding: var(--ib-space-3); }
.ib-figure svg { display: block; width: 100%; height: auto; }
.ib-figure figcaption { font-family: var(--ib-serif); font-style: italic; font-size: var(--ib-text-small); color: var(--ib-soft); margin-top: var(--ib-space-2); }

/* Footer: link row + the italic last-updated stamp */
.ib-foot { border-top: var(--ib-rule); padding: var(--ib-space-4) 0 var(--ib-space-6); font-size: var(--ib-text-small); }
.ib-foot-links { display: flex; flex-wrap: wrap; gap: var(--ib-space-1) var(--ib-space-4); justify-content: center; margin-bottom: var(--ib-space-3); }
.ib-stamp { font-style: italic; text-align: center; color: var(--ib-ink); margin: 0; }

@media (max-width: 860px) {
  .ib-doc { grid-template-columns: minmax(0, 1fr); }
  .ib-mast { align-items: center; }
  .ib-motto { font-size: var(--ib-text-micro); }
}
@media (max-width: 480px) {
  .ib-wordmark { font-size: 30px; }
  .ib-tile { width: 48px; height: 54px; border-radius: 5px 5px 5px 16px; }
  .ib-motto { max-width: 130px; }
}
