/* BTC Cycle Lab — what every content page shares: base, focus, the site
   header and footer, the page title row, the instrument key.
   Tokens come from tokens.css, linked before this file. */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-weight: 300;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
b, strong { font-weight: 600; }
a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- focus: one ring everywhere ---------- */
:focus-visible {
  outline: 2px solid var(--orange-hot);
  outline-offset: 3px;
  border-radius: 6px;
}
main:focus { outline: none; }

/* ---------- skip link ---------- */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--orange); color: var(--on-orange);
  font-weight: 600; font-size: 14px; text-decoration: none;
  padding: 10px 16px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 10px; }

/* ---------- site header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 80;
  display: flex; align-items: center; flex-wrap: wrap;
  column-gap: clamp(14px, 2.4vw, 30px);
  min-height: var(--header-h);
  padding: 10px clamp(16px, 4vw, 48px);
  background: rgba(11, 14, 21, .92);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: 0 0 auto; }
.brand-coin {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  font-weight: 700; color: #1a1205;
  background: radial-gradient(circle at 32% 28%, #ffd27a, var(--orange) 62%, #c46f08);
  box-shadow: 0 0 16px rgba(247, 147, 26, .45), inset 0 -2px 5px rgba(0, 0, 0, .3);
}
.brand-word { font-family: var(--disp); font-weight: 300; font-size: 13.5px; letter-spacing: .14em; white-space: nowrap; }
.brand-word b { font-weight: 700; color: var(--orange); }

.site-nav { display: flex; align-items: center; gap: clamp(4px, 1.4vw, 18px); margin-right: auto; }
.site-nav a {
  position: relative; text-decoration: none; white-space: nowrap;
  font-size: 14px; font-weight: 400; color: var(--dim);
  padding: 8px 8px; border-radius: var(--radius-sm);
  transition: color .15s;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: 2px; height: 2px;
  border-radius: 2px; background: var(--orange);
}
.site-nav .phone-only { display: none; }

.site-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 13px; color: var(--text);
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px;
  background: rgba(11, 14, 21, .6);
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); animation: live-pulse 1.8s infinite; }
.live-pill[data-live="off"] .live-dot { background: var(--dim); animation: none; }
@keyframes live-pulse { 50% { opacity: .45; } }

.site-cta {
  text-decoration: none; white-space: nowrap; font-size: 13.5px; font-weight: 400; color: var(--text);
  border: 1px solid rgba(247, 147, 26, .55); border-radius: 999px; padding: 7px 16px;
  transition: background .15s;
}
.site-cta:hover { background: rgba(247, 147, 26, .14); }

.site-menu-btn {
  display: none; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--body); font-size: 14px; font-weight: 400; color: var(--text);
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 0 16px; min-height: 40px;
}
.site-menu-btn::before {
  content: ""; width: 14px; height: 10px; flex: 0 0 auto;
  background:
    linear-gradient(currentColor, currentColor) top / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) bottom / 100% 2px no-repeat;
}

/* Small laptops: the report button would wrap the row; the footer links it. */
@media (max-width: 1100px) {
  .site-actions .site-cta { display: none; }
}

/* Phone and tablet: the links move behind the Menu button — but only when
   scripting is on (html.js). Without it they stay visible as a second row. */
@media (max-width: 900px) {
  .site-header { row-gap: 6px; }
  .site-brand { margin-right: auto; order: 1; }
  .site-actions { order: 2; }
  .site-menu-btn { order: 3; }
  .site-actions .site-cta { display: none; }
  .site-nav .phone-only { display: block; }
  .site-nav {
    order: 5; flex: 1 0 100%; margin: 0;
    flex-wrap: wrap; gap: 2px 6px; padding: 2px 0 6px;
  }
  .site-nav a { padding: 10px 10px; }
  html.js .site-menu-btn { display: inline-flex; }
  html.js .site-nav { display: none; }
  html.js .site-nav.open {
    display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap;
    gap: 0; padding: 6px 0 10px; border-top: 1px solid var(--line);
  }
  html.js .site-nav.open a {
    font-size: 16px; padding: 0 6px; min-height: 46px;
    display: flex; align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, .05); border-radius: 0;
  }
  html.js .site-nav.open a:last-child { border-bottom: 0; }
  html.js .site-nav.open a[aria-current="page"]::after {
    left: 0; right: auto; top: 12px; bottom: 12px; width: 2px; height: auto;
  }
  html.js .site-nav.open a[aria-current="page"] { padding-left: 14px; }
}
@media (max-width: 420px) {
  .site-header { padding-left: 14px; padding-right: 14px; }
  .brand-word { font-size: 12px; letter-spacing: .1em; }
  .live-pill { font-size: 12px; padding: 5px 10px; gap: 6px; }
  .site-menu-btn { padding: 0 13px; }
}

/* ---------- page title row (tool pages) ---------- */
.page-head {
  max-width: 1180px; margin: 0 auto;
  padding: clamp(22px, 4vh, 40px) clamp(14px, 3vw, 32px) 6px;
}
.page-head h1 {
  font-family: var(--disp); font-weight: 700; line-height: 1.15;
  font-size: clamp(24px, 3.2vw, 36px);
}
.page-head .page-sub { color: var(--dim); font-size: 14.5px; margin-top: 8px; max-width: 78ch; }

/* ---------- instrument key ---------- */
.instrument-key {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); margin: 0 0 30px;
}
.instrument-key > summary {
  cursor: pointer; list-style: none; padding: 13px 18px;
  font-size: 14px; font-weight: 400; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.instrument-key > summary::-webkit-details-marker { display: none; }
.instrument-key > summary::before {
  content: "+"; font-family: var(--mono); color: var(--orange-hot); width: 1ch; flex: 0 0 auto;
}
.instrument-key[open] > summary::before { content: "−"; }
.instrument-key .ik-body { padding: 0 18px 16px; }
.instrument-key .ik-body > p { color: var(--dim); font-size: 14px; max-width: 76ch; margin-bottom: 12px; }
.instrument-key dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px 22px; }
.instrument-key dt { font-weight: 600; font-size: 14px; }
.instrument-key dt span { font-family: var(--mono); font-weight: 400; font-size: 11.5px; color: var(--orange-hot); margin-left: 8px; white-space: nowrap; }
.instrument-key dd { color: var(--dim); font-size: 13.5px; line-height: 1.55; margin-top: 2px; }

/* ---------- site footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); margin-top: 30px;
  padding: 34px clamp(16px, 4vw, 48px) 40px;
  color: var(--dim); font-size: 13px; line-height: 1.7;
}
.site-footer-inner {
  max-width: 1180px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(200px, 1.2fr) 1fr 1.6fr; gap: 26px 40px;
}
.site-footer h2 {
  font-family: var(--mono); font-weight: 600; font-size: 11.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text); margin-bottom: 8px;
}
.site-footer ul { list-style: none; }
.site-footer li a { text-decoration: none; display: inline-block; padding: 3px 0; }
.site-footer li a:hover { color: var(--text); text-decoration: underline; }
.site-footer .foot-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--text); }
.site-footer .foot-legal { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 16px; font-size: 12.5px; }
@media (max-width: 760px) {
  .site-footer-inner { grid-template-columns: 1fr 1fr; }
  .site-footer-inner > :first-child, .site-footer-inner > .foot-sources { grid-column: 1 / -1; }
  .site-footer li a { padding: 8px 0; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  .live-dot { animation: none; }
}

/* Phones: brand and Menu only. Brand, price and Menu together need about
   430 px; the price is also on the page itself. */
@media (max-width: 480px) {
  .site-actions { display: none; }
}
