:root{
  --bg:#ffffff;
  --fg:#111111;
  --muted:#555555;
  --line:#e7e7e7;
  --panel:#fafafa;
  --code:#0b0b0b;
  --codefg:#f4f4f4;

  --max: 980px;
  --r: 14px;

  --shadow: 0 1px 0 rgba(0,0,0,.06);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background:var(--bg);
  color:var(--fg);
  line-height:1.45;
}

a{ color:inherit; text-decoration:none; }

/* =========================================================
   TOP BAR
   ========================================================= */

.topbar{
  position: sticky;
  top:0;
  background:#000;
  border-bottom:1px solid #111;
  z-index:5;
}

.topbar-inner{
  max-width: var(--max);
  margin:0 auto;
  padding: 14px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
}

.brand .name{
  color:#fff;
  font-weight:700;
  letter-spacing:.2px;
}

/* White pill, bold black text, optically centred */
.brand .tag{
  background:#fff;
  color:#000;
  border:1px solid #ddd;
  padding:4px 12px;
  border-radius:999px;
  font-weight:700;
  font-size:12px;
  letter-spacing:.02em;

  display:flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  white-space:nowrap;
}

/* =========================================================
   NAVIGATION
   ========================================================= */

.nav{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.nav a{
  font-size:13px;
  font-weight:650;
  color:#fff;
  background:#000;
  padding:7px 10px;
  border-radius:10px;
  border:1px solid #222;
  transition:.15s;
}

.nav a:hover{
  background:#111;
  border-color:#333;
}

.nav a.active{
  background:#fff;
  color:#c00000;   /* red text */
  border-color:#fff;
}


/* =========================================================
   GLOBAL PAGE RHYTHM (shared across pages)
   ========================================================= */

.container{
  max-width:var(--max);
  margin:0 auto;
  padding:24px 18px 60px;
}

.hero{
  padding: 22px 0 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

section{
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
section:last-child{ border-bottom: none; }

/* =========================================================
   HERO FIGURE (Demo / explanatory pages)
   Large image inserted under the hero banner.
   ========================================================= */

.hero-figure{
  max-width: 92ch;          /* match main content column */
  margin: 22px auto 32px;   /* centre it + give breathing room */
  padding: 0;
}

.hero-figure img{
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  box-shadow: 0 18px 36px rgba(0,0,0,0.12);
}

h1{
  font-size:34px;
  margin:0 0 10px;
  letter-spacing:-.3px;
}

.lede{
  color:var(--muted);
  max-width:75ch;
  margin-bottom:16px;
}

.section-title{
  font-size:12px;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:8px;
}

/* Useful paragraph helpers */
.p{
  color: var(--muted);
  max-width: 92ch;
}
.small{
  font-size: 12px;
  color: var(--muted);
}

/* =========================================================
   TWO-COLUMN PAGE LAYOUT (aside + main)
   Reuse this on any page that needs the sidebar.
   ========================================================= */

.page{
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 18px 60px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: start;
}

@media (max-width: 980px){
  .page{ grid-template-columns: 1fr; }
}

.aside{
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 14px;
  position: sticky;
  top: 92px;
}

/* Mobile fix for sticky side panel overlay */
@media (max-width: 980px){
  .aside{
    position: static !important;
    top: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    width: 100% !important;
  }
}

/* Sidebar navigation */
.toc-title{
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}

.toc a{
  display:block;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  text-decoration:none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
}

.toc a:hover{
  background: var(--panel);
  border-color: var(--line);
  color: var(--fg);
}

.toc a small{
  display:block;
  font-weight: 600;
  opacity: .9;
  margin-top: 3px;
}

.mini{
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.mini .k{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
  margin: 0 0 10px;
}

.bullet{
  border:1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 10px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 12.8px;
  line-height: 1.35;
  font-weight: 650;
}

/* =========================================================
   CHIPS
   ========================================================= */

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:14px 0;
}

.chip{
  border:1px solid var(--line);
  background:var(--panel);
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  color:var(--muted);
}

/* =========================================================
   STRUCTURAL ELEMENTS (Actor / Action / Time / Outcome)
   ========================================================= */

.structure-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:12px 0;
}

.structure-chip{
  background:#fff;
  border:1px solid var(--line);
  border-radius:999px;
  padding:6px 14px;
  font-size:12.5px;
  font-weight:700;
  color:#000;
  box-shadow:var(--shadow);
}

/* =========================================================
   CARDS / GRID
   ========================================================= */

.grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}

@media(max-width:860px){
  .grid{ grid-template-columns:1fr; }
}

.card{
  border:1px solid var(--line);
  background:var(--panel);
  border-radius:var(--r);
  padding:14px;
  box-shadow:var(--shadow);
}

.card h3{
  margin:0 0 8px;
  font-size:14px;
}

.card ul{
  padding-left:18px;
  margin:0;
  color:var(--muted);
}

/* =========================================================
   CALLOUTS
   ========================================================= */

.callout{
  border:1px solid var(--line);
  border-radius:var(--r);
  background:#fff;
  padding:14px;
  max-width: 92ch;
}

.callout strong{
  display:block;
  margin-bottom:6px;
}

.callout p{
  margin:0;
  color:var(--muted);
}

/* =========================================================
   ASCII VISUALS (quiet, non-decorative)
   ========================================================= */

.ascii{
  border:1px solid var(--line);
  background: var(--panel);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  max-width: 92ch;
  overflow:auto;
  margin: 12px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--fg);
  white-space: pre;
}

/* =========================================================
   IDENTITY CARD (Contact page)
   ========================================================= */

.identity-card{
  display:flex;
  gap:14px;
  align-items:center;
  padding:14px;
  border:1px solid var(--line);
  border-radius: var(--r);
  background: #fff;
  box-shadow: var(--shadow);
  max-width: 92ch;
}

.identity-photo{
  width:92px;
  height:92px;
  border-radius:999px;
  object-fit:cover;
  border:1px solid var(--line);
  flex:0 0 auto;
  background: var(--panel);
}

.identity-meta{ min-width:0; }

.identity-name{
  margin:0 0 4px 0;
  font-size:14px;
  font-weight:700;
  letter-spacing:.2px;
}

.identity-cred{
  margin:0 0 6px 0;
  color: var(--muted);
  font-size:12.5px;
  font-weight:650;
}

.identity-role{
  margin:0;
  color: var(--muted);
  font-size:12.5px;
  max-width:72ch;
}

@media (max-width: 600px){
  .identity-card{ align-items:flex-start; }
  .identity-photo{ width:76px; height:76px; }
}

/* =========================================================
   MONO TEMPLATE BLOCK (email templates etc.)
   ========================================================= */

.mono{
  border:1px solid var(--line);
  border-radius: var(--r);
  overflow:hidden;
  box-shadow: var(--shadow);
  background:#fff;
  max-width: 92ch;
}

.mono .bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel);
  border-bottom:1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.mono pre{
  margin:0;
  padding: 12px 14px;
  background: #0b0b0b;
  color: rgba(255,255,255,0.92);
  overflow:auto;
  line-height:1.35;
  font-size:12.5px;
  max-height: 520px;
}

/* Buttons used in template bars etc. */
.btn-lite{
  appearance:none;
  border:1px solid var(--line);
  background:#fff;
  color: var(--fg);
  font-weight: 750;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 10px;
  cursor:pointer;
  white-space: nowrap;
}

.btn-lite:hover{ background: var(--panel); }

/* Email link style */
.email-link{
  font-weight: 800;
  text-decoration: none;
  border-bottom: 1px solid rgba(0,0,0,.18);
}
.email-link:hover{ border-bottom-color: rgba(0,0,0,.38); }

/* =========================================================
   CODE BLOCK (existing)
   ========================================================= */

.codeblock{
  background:var(--code);
  color:var(--codefg);
  border:1px solid #141414;
  border-radius:var(--r);
  overflow:hidden;
}

.codeblock pre{
  margin:0;
  padding:14px;
  font-size:12px;
  line-height:1.45;
}

/* =========================================================
   FOOTER
   ========================================================= */

.footer{
  margin-top:30px;
  padding-top:18px;
  border-top:1px solid var(--line);
  display:flex;
  justify-content:space-between;
  flex-wrap:wrap;
  color:var(--muted);
  font-size:12px;
}

.badge{
  background:var(--panel);
  border:1px solid var(--line);
  padding:6px 10px;
  border-radius:999px;
}

/* =========================================================
   STRUCTURAL DIAGNOSTICS PAGE (section emphasis + TOC tracking)
   ========================================================= */

body.structural-diagnostics main section{
  margin: 18px 0;
  padding: 18px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: var(--shadow);
}

body.structural-diagnostics main section .section-title{
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
}

/* Give headings and content breathing room */
body.structural-diagnostics main section .h2{
  margin-top: 8px;
  margin-bottom: 12px;
}

body.structural-diagnostics main section ul{
  margin-top: 10px;
  margin-bottom: 10px;
  padding-left: 18px;
}

body.structural-diagnostics main section table{
  margin-top: 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  overflow: hidden;
}

/* Make ASCII blocks a bit more present inside the card */
body.structural-diagnostics main section .ascii{
  margin-top: 12px;
  margin-bottom: 12px;
}

/* “You are here” highlight in the left TOC (used by the JS) */
body.structural-diagnostics .toc a.active{
  background: var(--panel);
  border-color: var(--line);
  color: var(--fg);
  border-left: 3px solid rgba(0,0,0,.35);
  padding-left: 10px;
}
