/* Shared styles for every page. Page-specific styles live in each page's <style> block. */

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; }
main { overflow-x: clip; }
img, video { max-width: 100%; display: block; }
::selection { background: rgba(229, 83, 31, .25); }

/* Keyboard focus that is easy to see on light and dark backgrounds */
a:focus-visible, button:focus-visible {
  outline: 3px solid #E5531F;
  outline-offset: 2px;
  border-radius: 8px;
}

/* "Skip to content" link for keyboard and screen-reader users */
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: #0F172A; color: #fff; padding: 10px 14px; border-radius: 8px;
  font: 600 14px Inter, system-ui, sans-serif; text-decoration: none;
}
.skip:focus { top: 12px; }

/* Sections fade up as they scroll into view (only when JavaScript is running) */
.js main > section { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.js main > section.rv-in { opacity: 1; transform: none; }

/* Animations pause while their section is off screen */
.is-off, .is-off * { animation-play-state: paused !important; }

/* Hand-drawn highlights sit behind the text */
[data-rn] { position: relative; }
.rough-annotation { pointer-events: none; }

/* ---------- Responsive layout ---------- */

/* Large monitors: keep lines readable instead of stretching edge to edge */
@media (min-width: 1500px) {
  main#content { max-width: 1320px; margin: 0 auto; }
}
@media (min-width: 2200px) {
  main#content { max-width: 1440px; }
}

/* Home: the five steps share one row whenever there is room */
.steps5 { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 14px !important; }

/* Build vs buy: the decision flow turns vertical when its card is narrow */
.cq { container-type: inline-size; }
@container (max-width: 860px) {
  .flow { flex-direction: column; align-items: stretch !important; gap: 4px !important; }
  .flow > div { flex: none !important; width: 100%; max-width: 440px; align-self: center; box-sizing: border-box; }
  .flow > div[style*="clip-path"] { width: 230px; height: 112px !important; align-self: center; }
  .flow > svg { transform: rotate(90deg); align-self: center; margin: 6px 0; }
}

/* Build vs buy: the pipeline steps shrink on narrow cards */
section[aria-label^="Version 1"] { container-type: inline-size; }
@container (max-width: 520px) {
  .pipe .node { width: 40px !important; height: 40px !important; font-size: 15px !important; }
  .pipe button > span:nth-child(2) { font-size: 11.5px !important; line-height: 1.25; overflow-wrap: anywhere; }
  .pipe button > span:nth-child(3) { display: none; }
  .pipe { gap: 2px !important; }
  section[aria-label^="Version 1"] [aria-hidden="true"][style*="top:29px"] { top: 20px !important; left: 20px !important; right: 20px !important; }
  section[aria-label^="Version 1"] .token { top: 6px !important; }
}

/* Journey: chapter year labels only where there's room for them */
.segs { container-type: inline-size; }
@container (max-width: 560px) {
  .segs button > span:last-child { display: none !important; }
}

/* Tablets and phones: the sidebar becomes a top bar with the menu as a grid */
@media (max-width: 799px), (max-height: 500px) and (orientation: landscape) and (max-width: 1000px) {
  main h1 { font-size: 38px !important; }
  main { padding: 22px 18px 96px !important; }
  aside { max-width: none !important; min-width: 0 !important; flex-basis: 100% !important; box-sizing: border-box; padding: 14px 16px !important; gap: 12px !important; }
  aside nav { display: grid !important; grid-template-columns: repeat(6, minmax(0, 1fr)); min-width: 0; max-width: 100%; gap: 6px !important; }
  aside nav a { justify-content: center; text-align: center; white-space: normal; line-height: 1.2; padding: 8px 6px !important; font-size: 13.5px; min-height: 38px; box-sizing: border-box; }
  aside nav a > span, aside nav a > svg { display: none; }
  aside div[style*="border-radius:14px;padding:16px"] { display: none !important; }
  aside a[download] { padding: 10px !important; }
  #sayo > div { right: 10px !important; bottom: 10px !important; }
  #sayo svg { width: 58px; height: 68px; }
}

/* Phones */
@media (max-width: 520px) {
  main h1 { font-size: 32px !important; }
  main h2 { font-size: 24px !important; }
  aside nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  aside nav a { padding: 8px 4px !important; font-size: 13px; }
  /* Roomy desktop cards get tighter padding */
  main section[style*="padding:30px"], main section[style*="padding:32px"], main section[style*="padding:28px"] { padding: 20px 16px !important; }
  main div[style*="padding:30px"], main div[style*="padding:28px"] { padding: 20px 16px !important; }
  .orbit-wrap { width: 270px !important; height: 270px !important; margin: 0 auto; }
}
@media (max-width: 400px) {
  .orbit-wrap { width: 216px !important; height: 216px !important; }
  .orbit-wrap > div:nth-child(2) { inset: 30px !important; }
  .orbit-wrap .bob { font-size: 22px !important; right: -18px !important; bottom: -4px !important; }
}

/* Short screens, such as a phone held sideways */
@media (max-height: 500px) and (orientation: landscape) {
  #sayo svg { width: 52px; height: 61px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js main > section { opacity: 1; transform: none; transition: none; }
}
