@layer tbfn-reset, tbfn-type, tbfn-frame, tbfn-components, tbfn-small, tbfn-access;

@layer tbfn-reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { color-scheme: light; scroll-padding-top: 1.5rem; }
  body, figure, h1, h2, h3, p, dl, dd { margin: 0; }
  img { display: block; max-width: 100%; height: auto; }
  button, textarea { font: inherit; }
  button, summary { cursor: pointer; }
  a { color: inherit; }
  button, textarea, summary, a { -webkit-tap-highlight-color: #cceae5; }
}

@layer tbfn-type {
  :root {
    --tbfn-ink: #202927;
    --tbfn-muted: #485852;
    --tbfn-teal: #006c68;
    --tbfn-deep: #00524e;
    --tbfn-wash: #eef7f4;
    --tbfn-paper: #ffffff;
    --tbfn-tab: #d7ebe6;
    --tbfn-rule: #c6d7d0;
  }
  body {
    background: var(--tbfn-paper);
    color: var(--tbfn-ink);
    font-family: "Atkinson Hyperlegible Next", "Trebuchet MS", sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.65;
    overflow-wrap: break-word;
  }
  h1, h2, h3, dt, button, summary, .tbfn-wordmark, .tbfn-tab-title, .tbfn-recap-label {
    font-weight: 700;
  }
  h1 {
    font-size: clamp(2.5rem, 4.8vw, 4.7rem);
    font-weight: 700;
    line-height: 1.13;
    letter-spacing: -0.025em;
    max-width: 18ch;
    text-wrap: balance;
  }
  h2 {
    font-size: clamp(1.5rem, 2.1vw, 1.85rem);
    line-height: 1.25;
    font-weight: 650;
    color: var(--tbfn-deep);
    margin-block: 2.5rem 1rem;
    text-wrap: balance;
  }
  h3 { font-size: 1.25rem; line-height: 1.35; margin-block: 1.8rem 0.8rem; }
  p + p { margin-top: 1.05rem; }
  a { text-decoration-thickness: 0.07em; text-underline-offset: 0.2em; }
  a:hover { color: var(--tbfn-deep); text-decoration-thickness: 0.12em; }
  .tbfn-section-name { color: var(--tbfn-teal); font-size: 1rem; margin-bottom: 1.15rem; }
  .tbfn-lead { font-size: clamp(1.15rem, 1.8vw, 1.45rem); line-height: 1.55; color: var(--tbfn-muted); max-width: 55ch; margin-top: 1.4rem; }
  .tbfn-opening-fact { margin-top: 1.4rem; max-width: 54ch; color: var(--tbfn-ink); }
}

@layer tbfn-frame {
  .tbfn-masthead { border-bottom: 1px solid var(--tbfn-rule); background: #fff; }
  .tbfn-mast-inner { max-width: 1280px; margin: auto; min-height: 108px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1rem 2.8rem; }
  .tbfn-wordmark { display: inline-flex; gap: 0.9rem; align-items: center; min-height: 52px; text-decoration: none; font-size: 1.15rem; line-height: 1.18; color: var(--tbfn-deep); }
  .tbfn-paper-mark { width: 35px; height: 39px; display: block; position: relative; background: var(--tbfn-teal); box-shadow: -6px 6px 0 var(--tbfn-tab); }
  .tbfn-paper-mark::after { content: ""; position: absolute; width: 15px; height: 4px; background: white; left: 10px; top: 13px; box-shadow: 0 9px 0 white; }
  .tbfn-main { max-width: 1224px; padding: 0 2.8rem; margin-inline: auto; }
  .tbfn-opening { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr); align-items: center; column-gap: 4rem; padding-block: 4.5rem 4rem; }
  .tbfn-reading-layout { display: grid; grid-template-columns: 254px minmax(0, 700px); align-items: start; gap: 4.5rem; padding-block: 1rem 4.5rem; }
  .tbfn-reading { min-width: 0; max-width: 72ch; }
  .tbfn-reading > h2:first-child { margin-top: 0; }
  .tbfn-reading > p:first-child { margin-top: 0.2rem; }
  .tbfn-chapter-head { padding-block: 1.4rem 3.6rem; max-width: 1040px; }
  .tbfn-chapter-head h1 { max-width: 23ch; font-size: clamp(2.4rem, 4.4vw, 4rem); }
  .tbfn-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; color: var(--tbfn-muted); margin-bottom: 1.65rem; font-size: 1rem; }
  .tbfn-breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; }
  .tbfn-footer { background: var(--tbfn-wash); padding: 2.3rem 2.8rem 1.8rem; }
  .tbfn-footer-inner { max-width: 1135px; margin: auto; }
  .tbfn-footer p { max-width: 65ch; }
  .tbfn-footer nav { display: flex; flex-wrap: wrap; gap: 0.2rem 2rem; margin-block: 1rem; }
  .tbfn-footer a { display: inline-flex; min-height: 48px; align-items: center; font-size: 1rem; }
  .tbfn-footer-name { font-size: 1rem; color: var(--tbfn-muted); }
  .tbfn-missing { padding-block: 5rem 7rem; min-height: 65vh; }
  .tbfn-missing p { max-width: 60ch; margin-top: 1.5rem; }
  .tbfn-missing-file { margin-top: 3rem; max-width: 700px; }
  .tbfn-missing-index { margin-block: 1.5rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
  .tbfn-missing-index dt { color: var(--tbfn-deep); }
  .tbfn-missing-index a { display: flex; min-height: 48px; align-items: center; }
}

@layer tbfn-components {
  .tbfn-menu { position: relative; z-index: 10; min-width: 240px; }
  .tbfn-menu > summary { display: flex; align-items: center; justify-content: space-between; gap: 1.3rem; min-height: 52px; padding: 0.45rem 1.1rem; background: var(--tbfn-teal); color: #fff; list-style: none; }
  .tbfn-menu summary::-webkit-details-marker { display: none; }
  .tbfn-plus { font-size: 1.6rem; line-height: 1; }
  .tbfn-menu[open] .tbfn-plus { transform: rotate(45deg); }
  .tbfn-menu-sheet { position: absolute; right: 0; top: calc(100% + 12px); background: #fff; width: min(410px, calc(100vw - 2rem)); padding: 0.7rem 1.1rem 1rem; max-height: 70vh; overflow-y: auto; box-shadow: 0 12px 32px #21403926, -7px 7px 0 var(--tbfn-tab); }
  .tbfn-menu-group > summary { display: flex; align-items: center; min-height: 48px; padding: 0.3rem 0.4rem; color: var(--tbfn-deep); }
  .tbfn-menu-group > summary::before { content: "+"; margin-right: 0.7rem; width: 1rem; }
  .tbfn-menu-group[open] > summary::before { content: "−"; }
  .tbfn-menu ul { list-style: none; margin: 0; padding: 0 0 0.7rem 1.4rem; }
  .tbfn-menu li a { display: flex; align-items: center; min-height: 46px; padding: 0.3rem 0.4rem; font-size: 1rem; text-decoration: none; }
  .tbfn-menu a[aria-current="page"] { background: var(--tbfn-wash); text-decoration: underline; text-decoration-thickness: 2px; }
  .tbfn-solid-link { display: inline-flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 52px; padding: 0.6rem 1.25rem; background: var(--tbfn-teal); color: white; text-decoration: none; margin-top: 1.7rem; }
  .tbfn-solid-link:hover { background: var(--tbfn-deep); color: white; }
  .tbfn-photo { max-width: 100%; }
  .tbfn-photo-crop { border-radius: 50%; overflow: hidden; background: var(--tbfn-wash); aspect-ratio: 1; box-shadow: 12px 10px 0 var(--tbfn-tab); }
  .tbfn-photo img { width: 100%; height: 100%; object-fit: cover; }
  .tbfn-photo figcaption { font-size: 1rem; line-height: 1.45; margin: 1.4rem 0.5rem 0; color: var(--tbfn-muted); }
  .tbfn-photo--opening { width: 340px; justify-self: center; }
  .tbfn-photo--conversation { max-width: 310px; margin: 0 0 2.8rem auto; }
  .tbfn-photo--conversation .tbfn-photo-crop { border-radius: 42% 42% 20% 20%; }
  .tbfn-photo--cost { max-width: 280px; margin: 2rem auto 2.5rem; }
  .tbfn-contents, .tbfn-page-index { background: #fff; box-shadow: 0 4px 24px #26453b12, 8px 8px 0 var(--tbfn-wash); padding: 1.5rem 1.15rem 1.25rem; margin-top: 2.35rem; position: relative; }
  .tbfn-tab-title { position: absolute; top: -2rem; left: 0; background: var(--tbfn-tab); color: var(--tbfn-deep); min-height: 36px; padding: 0.25rem 1rem; line-height: 1.5; font-size: 1rem; }
  .tbfn-contents-group { border-bottom: 1px solid var(--tbfn-rule); }
  .tbfn-contents-group summary { min-height: 52px; padding-block: 0.6rem; font-size: 1.05rem; line-height: 1.4; }
  .tbfn-contents-group ul { list-style: none; margin: 0; padding: 0 0 0.5rem 0.4rem; }
  .tbfn-contents a, .tbfn-page-index a { display: flex; align-items: center; min-height: 48px; font-size: 1rem; line-height: 1.4; padding-block: 0.4rem; }
  .tbfn-contents > a { margin-top: 0.7rem; color: var(--tbfn-teal); }
  .tbfn-page-index nav { display: grid; row-gap: 0.35rem; }
  .tbfn-jot-link { margin-top: 1rem; background: var(--tbfn-wash); padding-inline: 0.6rem; color: var(--tbfn-deep); }
  .tbfn-index-slip { background: var(--tbfn-wash); position: relative; box-shadow: 6px 7px 0 #e4eeea; padding: 1.5rem 1.65rem; margin: 3.7rem 0 2.4rem; }
  .tbfn-slip-tab { position: absolute; top: -1.8rem; left: 0; background: var(--tbfn-teal); color: #fff; padding: 0.3rem 0.9rem; font-size: 1rem; line-height: 1.4; }
  .tbfn-index-slip p + p { margin: 0; }
  .tbfn-cite { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 0.4rem; margin: 0.1rem 0 0.3rem -0.4rem; color: var(--tbfn-teal); font-size: 1rem; }
  .tbfn-terms { margin: 1.6rem 0 2rem; }
  .tbfn-terms > div { display: grid; grid-template-columns: 155px minmax(0, 1fr); gap: 1rem; padding-block: 1.05rem; border-bottom: 1px solid var(--tbfn-rule); }
  .tbfn-terms dt { color: var(--tbfn-deep); line-height: 1.45; }
  .tbfn-terms dd { line-height: 1.6; }
  .tbfn-crosslinks { margin: 2rem 0; }
  .tbfn-crosslinks > p { font-size: 1rem; color: var(--tbfn-muted); }
  .tbfn-crosslinks ul { list-style: none; padding: 0; margin: 0.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
  .tbfn-crosslinks a { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; min-height: 48px; color: var(--tbfn-teal); }
  .tbfn-recap { margin-top: 3rem; padding: 1.5rem 1.65rem; background: var(--tbfn-teal); color: #fff; }
  .tbfn-recap-label { font-size: 1rem; line-height: 1.4; }
  .tbfn-recap p + p, .tbfn-carry-question p + p { margin-top: 0.55rem; }
  .tbfn-carry-question { background: var(--tbfn-wash); padding: 1.3rem 1.65rem; }
  .tbfn-sources { margin-top: 3rem; }
  .tbfn-sources h2 { font-size: 1.35rem; color: var(--tbfn-ink); }
  .tbfn-sources ol { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 0.8rem; }
  .tbfn-sources li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 0.5rem; align-items: start; }
  .tbfn-source-letter { color: var(--tbfn-muted); font-size: 1rem; line-height: 48px; }
  .tbfn-sources a { display: inline-flex; align-items: center; min-height: 48px; font-size: 1rem; line-height: 1.45; gap: 0.5rem; color: var(--tbfn-teal); }
  .tbfn-sources li p { color: var(--tbfn-muted); font-size: 1rem; line-height: 1.5; }
  .tbfn-notebook { margin-top: 2.8rem; background: var(--tbfn-wash); box-shadow: 7px 7px 0 #e2eeea; }
  .tbfn-notebook > summary { display: flex; justify-content: space-between; align-items: center; min-height: 60px; padding: 0.7rem 1.4rem; color: var(--tbfn-deep); list-style: none; }
  .tbfn-notebook summary::-webkit-details-marker { display: none; }
  .tbfn-notebook-body { padding: 0.5rem 1.4rem 1.5rem; }
  .tbfn-notebook-body label { display: block; margin: 1rem 0 0.65rem; font-variation-settings: "wght" 1.6, "wdth" 1; }
  .tbfn-notebook textarea { display: block; width: 100%; max-width: 100%; min-height: 12rem; padding: 0.8rem 1rem; resize: vertical; border: 1px solid #688c80; border-radius: 0; background: white; color: var(--tbfn-ink); line-height: 1.6; }
  .tbfn-notebook textarea::placeholder { color: var(--tbfn-muted); opacity: 1; }
  .tbfn-note-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1rem; }
  .tbfn-notebook button { border: 0; border-radius: 0; background: var(--tbfn-teal); color: #fff; min-height: 48px; padding: 0.6rem 1rem; text-align: left; }
  .tbfn-notebook button:hover { background: var(--tbfn-deep); }
  .tbfn-notebook .tbfn-add-question { background: #fff; color: var(--tbfn-deep); margin-top: 1rem; box-shadow: 3px 3px 0 var(--tbfn-tab); }
  #tbfn-note-status { margin-top: 1rem; font-size: 1rem; line-height: 1.5; color: var(--tbfn-muted); }
  .tbfn-page-turn { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 3rem; }
  .tbfn-page-turn a { display: flex; flex-direction: column; justify-content: center; min-height: 88px; text-decoration: none; color: var(--tbfn-deep); background: var(--tbfn-wash); padding: 1rem 1.1rem; line-height: 1.4; }
  .tbfn-page-turn a:hover { box-shadow: 4px 4px 0 var(--tbfn-tab); }
  .tbfn-page-turn a > span:first-child { font-size: 1rem; color: var(--tbfn-muted); margin-bottom: 0.4rem; }
  .tbfn-page--opening .tbfn-page-turn { grid-template-columns: 1fr; }
}

@layer tbfn-small {
  @media (min-width: 1000px) {
    .tbfn-page-index { position: sticky; top: 2.5rem; }
    .tbfn-page--definition .tbfn-terms { margin-left: 1rem; }
  }
  @media (max-width: 900px) {
    .tbfn-main { padding-inline: 1.7rem; }
    .tbfn-mast-inner { padding-inline: 1.7rem; }
    .tbfn-opening { column-gap: 2.5rem; grid-template-columns: minmax(0, 1.4fr) minmax(215px, 0.8fr); }
    .tbfn-photo--opening { width: 250px; }
    .tbfn-reading-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 2rem; }
    .tbfn-terms > div { grid-template-columns: 1fr; gap: 0.5rem; }
  }
  @media (max-width: 650px) {
    body { font-size: 18px; }
    .tbfn-mast-inner { flex-wrap: wrap; gap: 1.4rem; padding: 1.2rem 1.25rem; }
    .tbfn-wordmark { font-size: 1.1rem; }
    .tbfn-menu { min-width: 0; width: 100%; }
    .tbfn-menu > summary { min-height: 48px; font-size: 1rem; }
    .tbfn-menu-sheet { position: static; width: 100%; max-height: none; margin-top: 0.8rem; box-shadow: -5px 5px 0 var(--tbfn-tab); }
    .tbfn-menu li a { min-height: 48px; }
    .tbfn-main { padding-inline: 1.25rem; }
    .tbfn-opening { display: flex; flex-direction: column; align-items: flex-start; padding-block: 2.4rem 2.8rem; gap: 2.8rem; }
    h1 { font-size: 2.65rem; max-width: 16ch; }
    .tbfn-opening h1 { max-width: 16ch; }
    .tbfn-lead { font-size: 1.2rem; margin-top: 1.2rem; }
    .tbfn-photo--opening { width: 225px; align-self: center; }
    .tbfn-reading-layout { display: flex; flex-direction: column; gap: 2.5rem; padding-block: 0.6rem 3.4rem; }
    .tbfn-reading { width: 100%; max-width: 72ch; }
    .tbfn-contents, .tbfn-page-index { width: 100%; margin-top: 1.9rem; }
    .tbfn-chapter-head { padding-block: 0.8rem 2.2rem; }
    .tbfn-chapter-head h1 { font-size: 2.5rem; }
    .tbfn-breadcrumb { font-size: 1rem; gap: 0.4rem 0.6rem; margin-bottom: 1rem; }
    .tbfn-reading > h2:first-child { margin-top: 0.5rem; }
    .tbfn-index-slip { padding-inline: 1.15rem; margin-right: 5px; }
    .tbfn-slip-tab { max-width: 100%; }
    .tbfn-recap, .tbfn-carry-question { padding-inline: 1.2rem; }
    .tbfn-photo--conversation { max-width: 250px; margin-right: auto; }
    .tbfn-photo--cost { max-width: 230px; }
    .tbfn-notebook { margin-right: 7px; }
    .tbfn-notebook-body { padding-inline: 1rem; }
    .tbfn-page-turn { grid-template-columns: 1fr; gap: 0.7rem; }
    .tbfn-footer { padding: 2rem 1.25rem; }
    .tbfn-footer nav { display: grid; gap: 0.2rem; }
    .tbfn-missing { padding-block: 3rem 4rem; }
    .tbfn-missing-index { grid-template-columns: 1fr; }
  }
}

@layer tbfn-access {
  [hidden] { display: none !important; }
  :focus-visible { outline: 3px solid #006c68; outline-offset: 5px; }
  .tbfn-solid-link:focus-visible, .tbfn-menu > summary:focus-visible { outline-color: #184b40; outline-offset: 5px; }
  .tbfn-skip { position: absolute; top: 0.5rem; left: 1rem; z-index: 30; transform: translateY(-200%); background: #fff; color: var(--tbfn-deep); display: flex; align-items: center; min-height: 48px; padding: 0.6rem 1rem; }
  .tbfn-skip:focus { transform: translateY(0); }
  ::selection { background: #cae7de; color: #15332a; }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  }
  @media print {
    .tbfn-masthead, .tbfn-page-index, .tbfn-contents, .tbfn-notebook, .tbfn-page-turn, .tbfn-photo, .tbfn-footer nav, .tbfn-cite { display: none; }
    body { font-size: 18px; background: #fff; color: #000; }
    .tbfn-main { padding: 0; max-width: none; }
    .tbfn-reading-layout { display: block; }
    .tbfn-reading { max-width: none; }
    .tbfn-chapter-head, .tbfn-opening { padding-block: 1rem; display: block; }
    h1 { font-size: 2.5rem; }
    h2, h3 { break-after: avoid; }
    p { orphans: 3; widows: 3; }
    .tbfn-recap { background: #fff; color: #000; border-left: 4px solid #006c68; }
    .tbfn-sources { break-before: auto; }
  }
}
