
:root {
  --sand:      #f7f3ed;
  --sand-dark: #ede8e0;
  --sand-mid:  #e2dbd0;
  --ink:       #1c1917;
  --ink-mid:   #44403c;
  --ink-light: #78716c;
  --ink-faint: #a8a29e;
  --orange:    #c2410c;
  --orange-bg: #fff7ed;
  --orange-bdr:#fed7aa;
  --green:     #15803d;
  --green-bg:  #f0fdf4;
  --green-bdr: #bbf7d0;
  --blue:      #1d4ed8;
  --blue-bg:   #eff6ff;
  --blue-bdr:  #bfdbfe;
  --yellow:    #92400e;
  --yellow-bg: #fffbeb;
  --yellow-bdr:#fde68a;
  --red:       #991b1b;
  --red-bg:    #fef2f2;
  --red-bdr:   #fecaca;
  --border:    #d6d3ce;
  --white:     #ffffff;
  --radius:    8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--sand);
  color: var(--ink-mid);
  font-family: 'Lora', Georgia, serif;
  font-size: 15px;
  line-height: 1.7;
}

h1,h2,h3,h4 { font-family: 'Syne', sans-serif; color: var(--ink); line-height: 1.15; }

.display-title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.display-title .hl { color: var(--orange); }

.section-title { font-size: 1.35rem; font-weight: 700; color: var(--ink); margin-bottom: 0.5rem; }

.section-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-label::before { content: ''; display: inline-block; width: 1.2rem; height: 1px; background: var(--orange); }

.prose { font-size: 0.93rem; line-height: 1.85; color: var(--ink-mid); }
.mono {
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  background: var(--sand-dark);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  color: var(--orange);
}

/* badges */
.badge-oam {
  display: inline-flex; align-items: center;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem; font-weight: 400; letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem; border-radius: 4px; border: 1px solid; white-space: nowrap;
}
.badge-green  { background: var(--green-bg);  color: var(--green);  border-color: var(--green-bdr); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue);   border-color: var(--blue-bdr); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow-bdr); }
.badge-orange { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-bdr); }
.badge-red    { background: var(--red-bg);    color: var(--red);    border-color: var(--red-bdr); }
.badge-sand   { background: var(--sand-dark); color: var(--ink-mid);border-color: var(--border); }

/* notices */
.notice { border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; border-left: 3px solid; }
.notice-label { font-family: 'DM Mono', monospace; font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 400; margin-bottom: 0.4rem; }
.notice-text  { font-size: 0.85rem; line-height: 1.75; }
.notice-orange { background: var(--orange-bg); border-color: var(--orange); }
.notice-orange .notice-label { color: var(--orange); }
.notice-orange .notice-text  { color: #78350f; }
.notice-blue { background: var(--blue-bg); border-color: var(--blue); }
.notice-blue .notice-label { color: var(--blue); }
.notice-blue .notice-text  { color: #1e3a8a; }
.notice-green { background: var(--green-bg); border-color: var(--green); }
.notice-green .notice-label { color: var(--green); }
.notice-green .notice-text  { color: #14532d; }
.notice-red { background: var(--red-bg); border-color: var(--red); }
.notice-red .notice-label { color: var(--red); }
.notice-red .notice-text  { color: #7f1d1d; }

/* sidebar */
.sidebar-nav { position: sticky; top: 1.5rem; }
.sidebar-heading { font-family: 'DM Mono', monospace; font-size: 0.58rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-faint); padding-bottom: 0.4rem; margin-bottom: 0.3rem; border-bottom: 1px solid var(--border); }
.sidebar-link { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.5rem; font-family: 'DM Mono', monospace; font-size: 0.72rem; color: var(--ink-light); text-decoration: none; border-radius: 4px; border-left: 2px solid transparent; transition: all 0.15s; line-height: 1.4; }
.sidebar-link:hover { color: var(--orange); background: var(--orange-bg); border-left-color: var(--orange-bdr); }
.sidebar-link.active { color: var(--orange); background: var(--orange-bg); border-left-color: var(--orange); }
.sidebar-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* hero */
.hero-sub { font-size: 0.95rem; color: var(--ink-light); line-height: 1.8; max-width: 64ch; font-style: italic; }

.metric-card { background: var(--sand); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.3rem; border-top: 3px solid var(--orange); height: 100%; }
.metric-val { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.8rem; color: var(--ink); line-height: 1; margin-bottom: 0.2rem; }
.metric-val .unit { font-size: 1rem; color: var(--orange); }
.metric-label { font-family: 'DM Mono', monospace; font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }

/* sloc */
.sloc-bar { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem 1.6rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.sloc-num { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 2.2rem; color: var(--orange); line-height: 1; flex-shrink: 0; }
.sloc-label { font-size: 0.85rem; color: var(--ink-mid); line-height: 1.5; }
.sloc-label strong { color: var(--ink); font-family: 'Syne', sans-serif; font-weight: 700; }
.sloc-pct { font-family: 'DM Mono', monospace; font-size: 0.7rem; background: var(--green-bg); color: var(--green); border: 1px solid var(--green-bdr); padding: 0.2rem 0.6rem; border-radius: 4px; flex-shrink: 0; }
.sloc-track { flex: 1; min-width: 80px; height: 6px; background: var(--sand-mid); border-radius: 3px; overflow: hidden; }
.sloc-fill { height: 100%; background: var(--orange); border-radius: 3px; width: 0; transition: width 1.4s cubic-bezier(.4,0,.2,1) 0.4s; }

/* arch diagram */
.arch-wrap { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.arch-caption { padding: 0.7rem 1.2rem; background: var(--sand); border-bottom: 1px solid var(--border); font-family: 'DM Mono', monospace; font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.arch-layers { padding: 1.2rem 1.5rem; }
.arch-layer-row { display: flex; align-items: stretch; margin-bottom: 0.8rem; gap: 0; }
.arch-layer-row:last-child { margin-bottom: 0; }
.arch-layer-tag { font-family: 'DM Mono', monospace; font-size: 0.58rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-faint); writing-mode: vertical-rl; transform: rotate(180deg); padding: 0.2rem 0.3rem; border-right: 1px solid var(--border); margin-right: 1rem; flex-shrink: 0; text-align: center; width: 28px; }
.arch-nodes { display: flex; flex-wrap: wrap; gap: 0.5rem; flex: 1; align-items: center; }
.arch-node { border: 1px solid var(--border); border-radius: 5px; padding: 0.5rem 0.8rem; background: var(--sand); transition: border-color 0.2s, box-shadow 0.2s; cursor: default; }
.arch-node:hover { border-color: var(--orange); box-shadow: 0 2px 8px rgba(194,65,12,0.08); }
.arch-node-name { font-family: 'DM Mono', monospace; font-size: 0.72rem; color: var(--ink); margin-bottom: 0.1rem; }
.arch-node-sub  { font-family: 'DM Mono', monospace; font-size: 0.6rem; color: var(--ink-faint); line-height: 1.4; }
.n-orange { border-color: var(--orange-bdr); background: var(--orange-bg); }
.n-orange .arch-node-name { color: var(--orange); }
.n-green  { border-color: var(--green-bdr); background: var(--green-bg); }
.n-green  .arch-node-name { color: var(--green); }
.n-blue   { border-color: var(--blue-bdr); background: var(--blue-bg); }
.n-blue   .arch-node-name { color: var(--blue); }
.n-red    { border-color: var(--red-bdr); background: var(--red-bg); }
.n-red    .arch-node-name { color: var(--red); }
.arch-sep { height: 1px; background: var(--border); margin: 0.6rem 0; }

/* tables */
.feat-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.feat-table th { font-family: 'DM Mono', monospace; font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); font-weight: 400; padding: 0.6rem 0.9rem; border-bottom: 2px solid var(--border); text-align: left; background: var(--sand); }
.feat-table td { padding: 0.75rem 0.9rem; border-bottom: 1px solid var(--sand-dark); color: var(--ink-mid); vertical-align: top; }
.feat-table tr:last-child td { border-bottom: none; }
.feat-table tr:hover td { background: var(--sand); }
.feat-table td:first-child { font-family: 'DM Mono', monospace; color: var(--ink); font-size: 0.78rem; }
.table-wrap { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; overflow-x: auto; }

/* flow */
.flow-list { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.flow-step { display: grid; grid-template-columns: 2.2rem 1fr auto; align-items: start; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--sand-dark); transition: background 0.15s; }
.flow-step:last-child { border-bottom: none; }
.flow-step:hover { background: var(--sand); }
.flow-num { font-family: 'DM Mono', monospace; font-size: 0.65rem; color: var(--ink-faint); padding-top: 0.1rem; text-align: right; }
.flow-title { font-family: 'Syne', sans-serif; font-weight: 600; font-size: 0.82rem; color: var(--ink); margin-bottom: 0.2rem; }
.flow-desc { font-size: 0.78rem; color: var(--ink-light); line-height: 1.6; }
.flow-badge { padding-top: 0.05rem; }

/* cards */
.feat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; height: 100%; transition: box-shadow 0.2s, border-color 0.2s; }
.feat-card:hover { border-color: var(--orange); box-shadow: 0 4px 16px rgba(194,65,12,0.07); }
.feat-card-icon { font-size: 1.3rem; margin-bottom: 0.6rem; }
.feat-card-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 0.85rem; color: var(--ink); margin-bottom: 0.4rem; }
.feat-card-desc { font-size: 0.78rem; color: var(--ink-light); line-height: 1.65; }

/* infra items */
.infra-item { display: flex; gap: 0.9rem; align-items: flex-start; padding: 1rem; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color 0.2s; height: 100%; }
.infra-item:hover { border-color: var(--orange); }
.infra-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 0.1rem; }
.infra-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 0.82rem; color: var(--ink); margin-bottom: 0.3rem; }
.infra-desc { font-size: 0.75rem; color: var(--ink-light); line-height: 1.6; }

/* tier cards */
.tier-card { border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; height: 100%; }
.tier-header { padding: 1rem 1.4rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.tier-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 0.9rem; color: var(--ink); }
.tier-body { padding: 1.2rem 1.4rem; background: var(--white); }

/* timeline */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 0.5rem; bottom: 0; width: 1px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 1.8rem; }
.tl-item::before { content: ''; position: absolute; left: -1.5rem; top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--white); border: 2px solid var(--orange); }
.tl-item.dim::before { border-color: var(--border); }
.tl-date { font-family: 'DM Mono', monospace; font-size: 0.65rem; color: var(--orange); margin-bottom: 0.2rem; }
.tl-item.dim .tl-date { color: var(--ink-faint); }
.tl-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 0.9rem; color: var(--ink); margin-bottom: 0.25rem; }
.tl-item.dim .tl-title { color: var(--ink-light); }
.tl-desc { font-size: 0.78rem; color: var(--ink-light); line-height: 1.65; }

.section-divider { height: 1px; background: var(--border); margin: 2.5rem 0; }
.doc-section { scroll-margin-top: 1.5rem; }

/* reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* responsive */
@media (max-width: 991px) {
  .sidebar-nav { position: static; margin-bottom: 2rem; }
  .arch-layer-tag { display: none; }
  .arch-layers { padding: 1rem; }
}
@media (max-width: 575px) {
  .display-title { font-size: 2rem; }
  .flow-step { grid-template-columns: 1fr; gap: 0.3rem; }
  .flow-num, .flow-badge { display: none; }
  .sloc-bar { flex-direction: column; align-items: flex-start; }
}
