@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Menlo, monospace;

  /* Bright architectural palette: warm paper, crisp white, carbon ink */
  --bg-canvas: #f7f6f2;
  --bg-surface: #ffffff;
  --bg-subtle: #f0efe9;
  --bg-tint: #f4f6f9;

  --ink-primary: #111315;
  --ink-secondary: #3f444a;
  --ink-muted: #6e757c;
  --ink-faint: #9aa0a6;

  --rule-strong: #111315;
  --rule-hairline: #dfddd4;
  --rule-subtle: #eceae2;

  /* Purposeful signal colors — engineering specification style */
  --signal-blue: #1d4ed8;
  --signal-blue-bg: #eff4ff;
  --signal-blue-border: #bfdbfe;

  --signal-green: #15803d;
  --signal-green-bg: #f0fdf4;
  --signal-green-border: #bbf7d0;

  --signal-amber: #b45309;
  --signal-amber-bg: #fffbeb;
  --signal-amber-border: #fde68a;

  --signal-red: #b91c1c;
  --signal-red-bg: #fef2f2;
  --signal-red-border: #fecaca;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--ink-primary);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* TOP ARCHITECTURAL HEADER */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--rule-hairline);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-mark {
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-decoration: none;
  color: var(--ink-primary);
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chapter-nav {
  display: flex;
  align-items: center;
  height: 100%;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--rule-hairline);
  background: var(--bg-canvas);
  margin-left: 16px;
  height: 32px;
}

.lang-btn {
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0 10px;
  height: 100%;
  cursor: pointer;
  color: var(--ink-muted);
  transition: background-color 0.12s ease, color 0.12s ease;
}

.lang-btn:first-child {
  border-right: 1px solid var(--rule-hairline);
}

.lang-btn.active {
  background: var(--ink-primary);
  color: #ffffff;
}

.demo-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  margin-left: 12px;
  background: var(--signal-blue);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  border: 1px solid var(--signal-blue);
  transition: background-color 0.12s ease;
}

.demo-cta:hover {
  background: #1e40af;
}

html[data-lang="id"] [data-en] {
  display: none !important;
}

html[data-lang="en"] [data-id] {
  display: none !important;
}

.chapter-link {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 60px;
  padding: 0 16px;
  text-decoration: none;
  color: var(--ink-secondary);
  font-size: 0.84rem;
  font-weight: 500;
  border-left: 1px solid var(--rule-subtle);
  border-bottom: 2px solid transparent;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.chapter-link:last-child {
  border-right: 1px solid var(--rule-subtle);
}

.chapter-link:hover {
  background-color: var(--bg-canvas);
  color: var(--ink-primary);
}

.chapter-link.active {
  color: var(--ink-primary);
  font-weight: 600;
  background-color: var(--bg-canvas);
  border-bottom-color: var(--ink-primary);
}

.chapter-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
}

.chapter-link.active .chapter-num {
  color: var(--signal-blue);
  font-weight: 600;
}

/* PAGE CONTAINER */
.page-wrap {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 32px 88px;
  flex: 1;
}

/* EDITORIAL PAGE HEADER */
.doc-header {
  border-bottom: 2px solid var(--rule-strong);
  padding-bottom: 28px;
  margin-bottom: 40px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  align-items: end;
}

.doc-kicker {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--signal-blue);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.12;
  color: var(--ink-primary);
  margin-bottom: 16px;
}

.doc-lead {
  font-size: 1.12rem;
  color: var(--ink-secondary);
  line-height: 1.58;
  max-width: 720px;
}

.doc-meta-box {
  background: var(--bg-surface);
  border: 1px solid var(--rule-hairline);
  padding: 16px 20px;
  font-size: 0.82rem;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule-subtle);
}

.meta-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.meta-row:first-child {
  padding-top: 0;
}

.meta-label {
  font-family: var(--font-mono);
  color: var(--ink-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.meta-val {
  font-weight: 600;
  color: var(--ink-primary);
  text-align: right;
}

/* SECTION STRUCTURE */
.section-block {
  margin-bottom: 52px;
}

.section-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule-hairline);
  padding-bottom: 10px;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
}

.section-index {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  text-transform: uppercase;
}

/* STRUCTURAL PANELS & GRIDS */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--rule-hairline);
  padding: 28px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* SPEC CARDS (ARCHITECTURAL, NO SLOP) */
.spec-card {
  background: var(--bg-surface);
  border: 1px solid var(--rule-hairline);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.spec-card-head {
  margin-bottom: 16px;
}

.spec-num {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-muted);
  display: block;
  margin-bottom: 6px;
}

.spec-heading {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
  color: var(--ink-primary);
}

.spec-body {
  font-size: 0.9rem;
  color: var(--ink-secondary);
  line-height: 1.55;
}

.spec-foot {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--rule-subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  display: flex;
  justify-content: space-between;
}

/* 2x2 QUADRANT MATRIX */
.quadrant-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--rule-hairline);
  padding: 32px;
}

.quadrant-layout {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
  align-items: stretch;
}

.y-axis-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  border-right: 1px solid var(--rule-strong);
  padding-right: 12px;
}

.quadrant-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  border: 1px solid var(--rule-hairline);
}

.q-cell {
  padding: 28px;
  border: 1px solid var(--rule-hairline);
  background: var(--bg-surface);
  position: relative;
  transition: background-color 0.15s ease;
}

.q-cell.q-sweetspot {
  background: var(--signal-blue-bg);
  border: 2px solid var(--signal-blue);
}

.q-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 3px 8px;
  display: inline-block;
  margin-bottom: 10px;
  border: 1px solid var(--rule-hairline);
  background: var(--bg-canvas);
  color: var(--ink-secondary);
}

.q-cell.q-sweetspot .q-tag {
  background: var(--signal-blue);
  color: #ffffff;
  border-color: var(--signal-blue);
}

.q-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.q-subtitle {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-muted);
  margin-bottom: 14px;
}

.q-list {
  list-style: none;
  font-size: 0.88rem;
  color: var(--ink-secondary);
  margin-bottom: 16px;
}

.q-list li {
  padding: 4px 0;
  border-bottom: 1px dashed var(--rule-subtle);
}

.q-list li:last-child {
  border-bottom: none;
}

.q-verdict {
  font-size: 0.82rem;
  padding: 10px 12px;
  background: var(--bg-canvas);
  border-left: 3px solid var(--ink-muted);
  color: var(--ink-primary);
}

.q-cell.q-sweetspot .q-verdict {
  background: #ffffff;
  border-left-color: var(--signal-blue);
}

.x-axis-bar {
  margin-left: 60px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--rule-strong);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

/* DATA TABLES */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface);
  border: 1px solid var(--rule-hairline);
  font-size: 0.88rem;
}

.spec-table th {
  background: var(--bg-subtle);
  color: var(--ink-primary);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule-hairline);
  border-right: 1px solid var(--rule-hairline);
  font-size: 0.82rem;
}

.spec-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule-subtle);
  border-right: 1px solid var(--rule-subtle);
  vertical-align: top;
  color: var(--ink-secondary);
}

.spec-table td strong {
  color: var(--ink-primary);
}

.spec-table tr:hover td {
  background-color: #fafaf7;
}

/* TAGS & BADGES */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-yes {
  background: var(--signal-green-bg);
  color: var(--signal-green);
  border: 1px solid var(--signal-green-border);
}

.badge-blue {
  background: var(--signal-blue-bg);
  color: var(--signal-blue);
  border: 1px solid var(--signal-blue-border);
}

.badge-amber {
  background: var(--signal-amber-bg);
  color: var(--signal-amber);
  border: 1px solid var(--signal-amber-border);
}

.badge-no {
  background: var(--signal-red-bg);
  color: var(--signal-red);
  border: 1px solid var(--signal-red-border);
}

.badge-muted {
  background: var(--bg-subtle);
  color: var(--ink-muted);
  border: 1px solid var(--rule-hairline);
}

/* OPERATIONAL INSTRUMENT FRAGMENTS (AUTHENTIC APP PREVIEWS) */
.instrument-frame {
  background: var(--bg-surface);
  border: 1px solid var(--rule-hairline);
}

.instrument-bar {
  background: var(--bg-subtle);
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule-hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-secondary);
}

.instrument-body {
  padding: 20px;
}

.mono-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* TIMELINE / QUEUE SIMULATION BARS */
.schedule-row {
  display: grid;
  grid-template-columns: 190px 1fr 140px;
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule-subtle);
  font-size: 0.85rem;
}

.schedule-row:last-child {
  border-bottom: none;
}

.track-bar {
  height: 30px;
  background: var(--bg-canvas);
  border: 1px solid var(--rule-hairline);
  position: relative;
  display: flex;
  align-items: center;
}

.track-block {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}

/* CALLOUT BOX */
.editorial-note {
  background: var(--bg-surface);
  border: 1px solid var(--rule-hairline);
  border-left: 4px solid var(--ink-primary);
  padding: 20px 24px;
  margin: 24px 0;
}

.editorial-note.blue {
  border-left-color: var(--signal-blue);
}

.editorial-note.red {
  border-left-color: var(--signal-red);
}

.editorial-note h4 {
  font-size: 0.96rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--ink-primary);
}

.editorial-note p {
  font-size: 0.9rem;
  color: var(--ink-secondary);
}

/* CHAPTER FOOTER NAVIGATION */
.chapter-pager {
  margin-top: 64px;
  border-top: 2px solid var(--rule-strong);
  padding-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.pager-card {
  background: var(--bg-surface);
  border: 1px solid var(--rule-hairline);
  padding: 20px 24px;
  text-decoration: none;
  color: var(--ink-primary);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.pager-card:hover {
  border-color: var(--ink-primary);
  background: #ffffff;
}

.pager-card.next {
  text-align: right;
  grid-column: 2;
}

.pager-dir {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.pager-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.pager-desc {
  font-size: 0.84rem;
  color: var(--ink-secondary);
}

.site-footer {
  border-top: 1px solid var(--rule-hairline);
  background: var(--bg-surface);
  padding: 24px 32px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
}

@media (max-width: 920px) {
  .doc-header { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4, .quadrant-grid, .chapter-pager { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; height: auto; padding: 12px 16px; gap: 10px; }
  .chapter-nav { flex-wrap: wrap; width: 100%; }
  .chapter-link { height: 40px; flex: 1; justify-content: center; }
  .schedule-row { grid-template-columns: 1fr; }
}
