/* Exnir — design system.
 *
 * One stylesheet for every template. Change a token here and the whole desk
 * follows. Nothing is fetched: no webfonts, no icon CDN, no third-party CSS.
 *
 * Identity
 * --------
 * Finance (navy paper), Trading (long/short green-red, the X as a chart),
 * Economics (serif briefs, gold rules). The product is the intersection.
 *
 * Layout
 * ------
 * Gemini Notebook's three columns — Sources | Brief | Studio — without a
 * chat composer. The right column is a Dovetail-style tape: the video, then
 * what the abstract marked as relevant.
 *
 * Theming
 * -------
 * Every token is declared twice on purpose:
 *
 *     --page: #F4F1EA;                        <- fallback
 *     --page: light-dark(#F4F1EA, #0B1016);   <- the real declaration
 *
 * A browser too old to parse light-dark() keeps the first, so it still
 * renders. The toggle pins color-scheme on <html>; every token follows.
 */

:root {
  color-scheme: light dark;

  --page:      #F4F1EA;  --page:      light-dark(#F4F1EA, #0B1016);
  --surface:   #FFFdf8;  --surface:   light-dark(#FFFdf8, #141A22);
  --sunken:    #EBE6DA;  --sunken:    light-dark(#EBE6DA, #1C2430);
  --hover:     #E4DED0;  --hover:     light-dark(#E4DED0, #222B38);
  --row-hover: #F7F3EA;  --row-hover: light-dark(#F7F3EA, #1A222C);
  --line:      #E2DCCC;  --line:      light-dark(#E2DCCC, #243040);
  --line-2:    #D8D0BE;  --line-2:    light-dark(#D8D0BE, #2C394A);

  --ink:       #101820;  --ink:       light-dark(#101820, #E8E4D8);
  --ink-hover: #1C2A3A;  --ink-hover: light-dark(#1C2A3A, #FFFFFF);
  --on-ink:    #F4F1EA;  --on-ink:    light-dark(#F4F1EA, #101820);
  --muted:     #5C5A54;  --muted:     light-dark(#5C5A54, #9AA3AD);
  --faint:     #8A8680;  --faint:     light-dark(#8A8680, #6E7782);

  --brand:       #1A365D;  --brand:       light-dark(#1A365D, #8FA8C8);
  --brand-tint:  #E8EEF5;  --brand-tint:  light-dark(#E8EEF5, #1A2433);
  --on-brand:    #F4F1EA;  --on-brand:    light-dark(#F4F1EA, #101820);
  --gold:        #8A6A32;  --gold:        light-dark(#8A6A32, #D4B06A);
  --gold-tint:   #F3EBDA;  --gold-tint:   light-dark(#F3EBDA, #2A2418);
  --gold-line:   #E2D2B0;  --gold-line:   light-dark(#E2D2B0, #3B3420);

  /* Alias: existing components still say --violet. It is the brand ink now. */
  --violet:      var(--brand);
  --violet-tint: var(--brand-tint);
  --on-violet:   var(--on-brand);
  --teal:        #1F5F73;  --teal:        light-dark(#1F5F73, #7DB6C8);
  --cream:       var(--gold-tint);
  --cream-line:  var(--gold-line);

  --red:        #9B2C2C;  --red:        light-dark(#9B2C2C, #E58A7A);
  --red-tint:   #F8E8E4;  --red-tint:   light-dark(#F8E8E4, #2C1614);
  --green:      #1F6B45;  --green:      light-dark(#1F6B45, #62C48E);
  --green-tint: #E6F3EB;  --green-tint: light-dark(#E6F3EB, #12251B);
  --amber:      var(--gold);
  --amber-tint: var(--gold-tint);
  --blue:       var(--teal);
  --blue-tint:  #E4EEF2;  --blue-tint:  light-dark(#E4EEF2, #15242A);

  --radius:    10px;
  --radius-sm: 7px;
  --radius-xs: 5px;
  --chrome:    96px;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           Georgia, "Times New Roman", Times, serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
           Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark;  }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body {
  background: var(--page); color: var(--ink);
  font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px;
    text-decoration-color: color-mix(in srgb, var(--brand) 35%, transparent); }
a:hover { text-decoration-color: var(--brand); }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 3px;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -0.015em; line-height: 1.25;
             color: var(--ink); margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 600; }

/* ------------------------------------------------------------- brand */
.brand { display: inline-flex; align-items: center; gap: 10px;
         margin-right: 18px; white-space: nowrap; }
.brand-mark { display: block; width: 28px; height: 28px; flex: none; }
.brand-mark .bg { fill: var(--ink); }
.brand-mark .arm-a { stroke: var(--page); stroke-linecap: round; }
.brand-mark .arm-b, .brand-mark .tick { stroke: var(--gold); stroke-linecap: round;
                                        stroke-linejoin: round; fill: none; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--serif); font-size: 18px; font-weight: 650;
              letter-spacing: -0.02em; }
.brand-domains { color: var(--gold); font-family: var(--sans); font-weight: 500;
                 font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
                 margin: 3px 0 0; }
.logo { font-size: 17px; font-weight: 700; letter-spacing: -0.02em;
        margin-right: 18px; white-space: nowrap; }
.logo small { color: var(--faint); font-weight: 400; font-size: 12px;
              letter-spacing: 0; margin-left: 7px; }

/* ------------------------------------------------------------- top nav */
.topnav {
  display: flex; align-items: center; gap: 2px;
  padding: 10px 20px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: sticky; top: 0; z-index: 6;
  overflow-x: auto; scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav button.nav {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  background: none; border: none; color: var(--muted); font-family: var(--sans);
  font-size: 13.5px; font-weight: 500; padding: 7px 11px;
  border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
}
.topnav button.nav:hover { background: var(--hover); color: var(--ink); }
.topnav button.nav.active { background: var(--hover); color: var(--ink); }
.nav .count { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.user-slot {
  display: inline-flex; align-items: center; gap: 8px;
  padding-left: 12px; flex: none;
}
.user { color: var(--muted); font-size: 13px; white-space: nowrap; }
.btn-logout {
  flex: none; background: none; border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); color: var(--muted);
  font-family: var(--sans); font-size: 12.5px; font-weight: 500;
  padding: 5px 10px; cursor: pointer; white-space: nowrap;
}
.btn-logout:hover { background: var(--hover); color: var(--ink);
                    border-color: var(--line); }
.btn-logout:disabled { opacity: .6; cursor: wait; }
.workspace-chip { margin-left: auto; }
.workspace-chip:empty { display: none; }

/* ------------------------------------------------------------- theme */
.theme-toggle {
  flex: none; margin-left: 10px; width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); color: var(--muted); cursor: pointer;
  font-size: 14px; line-height: 1; font-family: var(--sans);
}
.theme-toggle:hover { background: var(--hover); color: var(--ink); }
body.auth .theme-toggle { position: fixed; top: 18px; right: 18px; margin: 0;
                          background: var(--surface); }

/* ------------------------------------------------------------- notice */
.notice {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 20px; background: var(--gold-tint);
  border-bottom: 1px solid var(--gold-line);
}
.tape { display: flex; gap: 20px; overflow-x: auto; font-family: var(--mono);
        font-size: 12.5px; white-space: nowrap; scrollbar-width: none;
        color: var(--muted); }
.tape::-webkit-scrollbar { display: none; }
.tape b { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------- desk */
.desk { padding: 0; max-width: none; }
.screen { display: none; }
.screen.active { display: block; }
.screen.desk-screen.active {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) minmax(300px, 380px);
  min-height: calc(100vh - var(--chrome));
  align-items: stretch;
}
.screen.desk-wide.active {
  display: block;
  padding: 28px 32px 48px;
  max-width: 1120px;
  margin: 0 auto;
}

.desk-sources, .desk-doc, .desk-studio {
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.desk-sources {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 16px 14px 28px;
}
.desk-doc {
  background: var(--page);
  padding: 22px 28px 40px;
}
.desk-studio {
  background: var(--surface);
  border-left: 1px solid var(--line);
  padding: 16px 16px 28px;
}

.desk-col-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 650; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--faint);
  margin: 0 0 10px;
}
.desk-col-sub { color: var(--muted); font-size: 12.5px; margin: 0 0 14px;
                max-width: none; }
.desk-col-count { font-family: var(--mono); letter-spacing: 0;
                  text-transform: none; margin-left: auto; }
.rail-label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
              color: var(--faint); margin: 16px 0 8px; font-weight: 650; }

h2 { font-size: 26px; margin-bottom: 6px; }
h3 { font-size: 15px; }
.sub { color: var(--muted); font-size: 13.5px; margin: 0 0 20px;
       max-width: 76ch; }

.num, td.num, .value { font-family: var(--mono);
                       font-variant-numeric: tabular-nums; }
.up { color: var(--green); } .down { color: var(--red); }
.muted { color: var(--muted); }

.page-foot, .desk-foot {
  margin: 0; padding: 14px 24px 18px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px; line-height: 1.6;
  background: var(--surface);
}

/* ------------------------------------------------------------- sources */
.source-item {
  display: block; width: 100%; text-align: left;
  background: none; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 10px 10px;
  cursor: pointer; color: inherit; font: inherit;
  margin: 0 0 4px;
}
.source-item:hover { background: var(--hover); }
button.source-item { cursor: pointer; }
div.source-item { cursor: default; }
.source-item.active {
  background: var(--brand-tint); border-color: var(--line);
}
.source-kind {
  display: inline-block; font-size: 10px; font-weight: 650;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 3px;
}
.source-title {
  display: block; font-size: 13.5px; font-weight: 600;
  line-height: 1.35; color: var(--ink);
}
.source-meta {
  display: block; margin-top: 4px; font-size: 12px; color: var(--muted);
}

/* ------------------------------------------------------------- citations */
.cited-doc { max-width: 72ch; }
.cited-sources { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.cite {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--brand); color: var(--on-brand);
  font-family: var(--mono); font-size: 10px; font-weight: 650;
  line-height: 1;
}
.cite-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 4px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface);
  font-size: 12px; color: var(--muted);
}

/* ------------------------------------------------------------- studio / tape */
.studio-player { margin-bottom: 16px; }
.studio-player-meta { display: flex; flex-wrap: wrap; gap: 8px 12px;
                      align-items: baseline; margin-top: 8px; font-size: 13px; }
.player-frame {
  position: relative; width: 100%; padding-top: 56.25%;
  background: #101820; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line);
}
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%;
                       border: 0; }
.studio-highlights h3 { margin: 0 0 10px; }
.highlight {
  background: var(--page); border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm); padding: 10px 12px; margin: 0 0 8px;
}
.highlight-kicker {
  font-size: 11px; font-weight: 650; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 6px;
}
.highlight-quote { font-family: var(--serif); font-size: 14.5px; line-height: 1.5;
                   color: var(--ink); }
.highlight-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.hl-ticker {
  background: var(--gold-tint); color: var(--ink);
  padding: 0 3px; border-radius: 3px;
}

/* ------------------------------------------------------------- controls */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 200px; }
.video-tools { margin-bottom: 16px; }

select, input[type=text], input[type=email], input[type=password] {
  background: var(--sunken); color: var(--ink); font-family: var(--sans);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 14px;
}
select:hover, input:hover { border-color: var(--faint); }
select:focus, input:focus { background: var(--surface); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }

.btn {
  background: var(--surface); color: var(--ink); font-family: var(--sans);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 8px 13px; cursor: pointer; font-size: 13.5px; font-weight: 500;
  line-height: 1.25;
}
.btn:hover { background: var(--sunken); border-color: var(--faint); }
.btn.primary { background: var(--ink); border-color: var(--ink);
               color: var(--on-ink); }
.btn.primary:hover { background: var(--ink-hover);
                     border-color: var(--ink-hover); }
.btn.accent { background: var(--brand); border-color: var(--brand);
              color: var(--on-brand); }
.btn.accent:hover { filter: brightness(1.12); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); border-color: transparent;
                   color: var(--ink); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); background: var(--red-tint); }
.btn:disabled { opacity: .45; cursor: wait; }

/* ------------------------------------------------------------- surfaces */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
         gap: 12px; margin: 18px 0; }
.kpis-compact { grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.kpis-compact .card { padding: 10px 12px; }
.kpis-compact .value { font-size: 18px; margin-top: 2px; }
.card { background: var(--surface); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 15px 17px; }
.card .label { color: var(--muted); font-size: 12.5px; }
.card .value { font-size: 25px; font-weight: 600; letter-spacing: -0.02em;
               margin-top: 5px; line-height: 1.15; }

.panel { background: var(--surface); border: 1px solid var(--line);
         border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; }
.panel h3 { margin: 0 0 12px; }

/* ------------------------------------------------------------- tables */
#ov-signals, #ov-events, #signal-list, #video-list, #post-list, #thesis-list,
#runs, #user-list, #token-list, #workspace-list, #audit-list { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { color: var(--muted); font-weight: 500; text-align: left; font-size: 12.5px;
     padding-bottom: 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 12px; vertical-align: top; text-align: left; }
th { padding: 0 12px 10px; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child,  td:last-child  { padding-right: 0; }
tbody tr:hover td { background: var(--row-hover); }
tr.video-row { cursor: pointer; }

/* ------------------------------------------------------------- badges */
.badge { display: inline-block; padding: 3px 8px; border-radius: var(--radius-xs);
         font-size: 12px; font-weight: 500; background: var(--brand-tint);
         color: var(--brand); white-space: nowrap; }
.badge.ENTRY, .badge.BULLISH, .badge.ANALYZED, .badge.up {
  background: var(--green-tint); color: var(--green); }
.badge.EXIT, .badge.BEARISH, .badge.FAILED, .badge.CANCELLED {
  background: var(--red-tint); color: var(--red); }
.badge.WATCH, .badge.NEUTRAL, .badge.QUEUED, .badge.NO_TRANSCRIPT {
  background: var(--gold-tint); color: var(--gold); }
.badge.HIGH { background: var(--blue-tint); color: var(--teal); }
.badge.LONG, .badge.REALISED { background: var(--green-tint);
                               color: var(--green); }
.badge.SHORT, .badge.INVALIDATED { background: var(--red-tint);
                                   color: var(--red); }
.badge.SUPERSEDED, .badge.EXPIRED { background: var(--sunken);
                                    color: var(--muted); }

.ticker-badge .stance { margin-left: 4px; font-size: 10px; vertical-align: 1px; }
.stance.bull { color: var(--green); }
.stance.bear { color: var(--red); }
.stance.flat { color: var(--gold); }

details.signal-history { margin-top: 8px; }
details.signal-history summary { cursor: pointer; font-size: 12.5px; }
details.signal-history ul { margin: 6px 0 0 1.1em; padding: 0;
                            font-size: 12.5px; color: var(--muted); }
details.signal-history li { margin: 3px 0; }

.chip { font-size: 11.5px; background: var(--surface); color: var(--muted);
        border: 1px solid var(--line-2); border-radius: var(--radius-xs);
        padding: 2px 9px; white-space: nowrap; }
.chip.eod { background: var(--gold-tint); color: var(--gold);
           border-color: var(--gold-line); }

.stale { background: var(--gold-tint); color: var(--gold); padding: 11px 14px;
         border-radius: var(--radius); font-size: 13.5px; margin: 14px 0; }
.empty { color: var(--muted); padding: 8px 0; }

/* ------------------------------------------------------------- markdown */
.md h1, .md h2, .md h3 { font-size: 15px; color: var(--ink); margin: 16px 0 6px; }
.md ul { margin: 4px 0 12px 18px; padding: 0; }
.md p { margin: 6px 0; }

/* ------------------------------------------------------------- chat (hidden from nav) */
#chat-log { display: flex; flex-direction: column; gap: 10px; max-height: 460px;
            overflow-y: auto; padding-right: 4px; margin-bottom: 14px; }
.msg { padding: 11px 14px; border-radius: 12px; max-width: 88%; font-size: 14px; }
.msg.user { background: var(--brand); color: var(--on-brand);
           align-self: flex-end; }
.msg.user a { color: inherit;
              text-decoration-color: color-mix(in srgb, currentColor 50%, transparent); }
.msg.bot { background: var(--sunken); border: 1px solid var(--line);
           align-self: flex-start; }
.msg .tools { margin-top: 9px; font-family: var(--mono); font-size: 11.5px;
              color: var(--muted); border-top: 1px solid var(--line-2);
              padding-top: 8px; }
.msg.user .tools { color: inherit; opacity: .78;
                   border-top-color: color-mix(in srgb, currentColor 30%, transparent); }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.suggest .btn { font-size: 13px; padding: 7px 12px; }
.suggest .btn.ghost { background: var(--surface); border-color: var(--line-2);
                      color: var(--ink); }
.suggest .btn.ghost:hover { background: var(--sunken); border-color: var(--faint); }

/* ------------------------------------------------------------- toast */
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink);
         color: var(--on-ink); padding: 12px 17px; border-radius: var(--radius);
         font-size: 13.5px; opacity: 0; transform: translateY(8px);
         transition: all .22s ease; pointer-events: none; z-index: 20;
         max-width: 380px; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--red); color: var(--on-brand); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ------------------------------------------------------------- auth */
body.auth { background: var(--page); display: grid; place-items: center;
            padding: 24px; }
.auth-brand { display: flex; flex-direction: column; align-items: flex-start;
              gap: 10px; margin-bottom: 18px; }
.auth-card { width: min(430px, 100%); padding: 32px; border-radius: var(--radius);
             background: var(--surface); border: 1px solid var(--line); }
.auth-card h1 { font-family: var(--serif); font-size: 28px; margin: 0 0 4px; }
.auth-card h1.brand-name { margin: 0; }
.auth-card .sub { margin: 0 0 24px; font-size: 13.5px; }
.auth-card label { display: block; font-size: 12.5px; color: var(--muted);
                   margin-bottom: 6px; }
.auth-card input { width: 100%; }
.auth-card button { width: 100%; margin-top: 14px; }
.auth-alt { margin: 10px 0 0; text-align: center; }
.auth-alt .linkish {
  background: none; border: none; padding: 0; margin: 0; width: auto;
  color: var(--brand); font: inherit; font-size: 13px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.auth-rule { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.auth-msg { margin-top: 14px; font-size: 13px; min-height: 18px;
            color: var(--muted); }
.auth-msg.err { color: var(--red); }
.auth-msg.ok  { color: var(--green); }
.auth-card footer { margin-top: 24px; font-size: 12.5px; color: var(--muted); }
.auth-card details { margin-top: 18px; font-size: 12.5px; color: var(--muted); }
.auth-card details summary { cursor: pointer; }
.auth-card details p { margin: 8px 0 0; line-height: 1.55; }
code { font-family: var(--mono); background: var(--sunken);
       border: 1px solid var(--line-2); border-radius: var(--radius-xs);
       padding: 2px 6px; font-size: .92em; user-select: all;
       word-break: break-all; }

/* ------------------------------------------------------------- narrow */
@media (max-width: 1100px) {
  .screen.desk-screen.active {
    display: flex; flex-direction: column;
    min-height: 0;
  }
  .desk-sources, .desk-doc, .desk-studio {
    border: 0; border-bottom: 1px solid var(--line);
  }
  .desk-sources { max-height: 280px; }
  .desk-studio { max-height: none; }
}
@media (max-width: 760px) {
  .topnav { padding: 10px 14px; }
  .topnav .user { display: none; }
  .topnav .btn-logout { padding: 5px 8px; }
  .brand { margin-right: 10px; }
  .brand-domains { display: none; }
  .logo { margin-right: 10px; }
  .logo small { display: none; }
  .notice { padding: 8px 14px; }
  .screen.desk-wide.active { padding: 20px 14px 40px; }
  #ov-signals table, #signal-list table, #video-list table, #runs table {
    min-width: 560px; }
  .msg { max-width: 100%; }
}

/* ---------------------------------------------------------------------------
   Disclosure rows: a thesis per asset, a digest day, a published piece.
--------------------------------------------------------------------------- */

.thesis {
  border-bottom: 1px solid var(--line);
}
.thesis:last-child { border-bottom: 0; }

.thesis > summary {
  cursor: pointer;
  padding: 12px 4px;
  list-style: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}
.thesis > summary .when { margin-left: auto; font-size: 12.5px; }
.thesis > summary > div { flex-basis: 100%; margin-left: 1.35em; }
.thesis > summary::-webkit-details-marker { display: none; }
.thesis > summary::before {
  content: "\25B8";
  display: inline-block;
  width: 1em;
  color: var(--faint);
  transition: transform .15s ease;
}
.thesis[open] > summary::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) {
  .thesis > summary::before { transition: none; }
}
.thesis > summary:hover { background: var(--row-hover); }
.thesis > summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.thesis-body {
  padding: 4px 4px 16px 1.6em;
  color: var(--ink);
}
.thesis-body > p { margin: 8px 0; }

.thesis-body,
.video-analysis,
.mdbody {
  max-width: 72ch;
  line-height: 1.65;
  font-size: 14.5px;
  font-family: var(--serif);
  color: var(--ink);
}
.video-analysis,
.mdbody {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}
.thesis-body h1, .thesis-body h2, .thesis-body h3,
.video-analysis h1, .video-analysis h2, .video-analysis h3,
.mdbody h1, .mdbody h2, .mdbody h3 {
  font-family: var(--serif);
  margin: 18px 0 4px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.thesis-body > :first-child, .video-analysis > :first-child,
.mdbody > :first-child { margin-top: 4px; }
.thesis-body h1, .video-analysis h1, .mdbody h1 {
  font-size: 17px; font-weight: 650; }
.thesis-body h2, .video-analysis h2, .mdbody h2 {
  font-size: 15px; font-weight: 650; }
.thesis-body h3, .video-analysis h3, .mdbody h3 {
  font-size: 13px; font-weight: 600; color: var(--muted);
  font-family: var(--sans); letter-spacing: 0.04em; text-transform: uppercase; }
.thesis-body p, .video-analysis p, .mdbody p { margin: 4px 0 10px; }
.thesis-body ul, .video-analysis ul, .mdbody ul {
  margin: 4px 0 10px; padding-left: 1.25em; }
.thesis-body ul ul, .video-analysis ul ul, .mdbody ul ul {
  margin: 2px 0 2px; }
.thesis-body li, .video-analysis li, .mdbody li { margin: 3px 0; }
.thesis-body li::marker, .video-analysis li::marker, .mdbody li::marker {
  color: var(--faint); }
.thesis-body a, .video-analysis a, .mdbody a { color: var(--brand); }
