/* Cloud Computing Project — documentation site */

:root {
  --bg: #f7f8fa;
  --bg-elevated: #ffffff;
  --bg-sunken: #eef0f4;
  --text: #1b1f27;
  --text-dim: #565f70;
  --text-faint: #8890a0;
  --border: #e2e5ec;
  --accent: #2f5fd6;
  --accent-dim: #eef2fd;
  --accent-text: #1c3fa0;
  --code-bg: #eef0f4;
  --code-text: #b3261e;
  --shadow: 0 1px 2px rgba(20, 24, 34, 0.04), 0 4px 16px rgba(20, 24, 34, 0.05);

  --green-bg: #e6f6ec;
  --green-text: #146c3a;
  --amber-bg: #fdf2df;
  --amber-text: #8a5a00;
  --red-bg: #fbe9e9;
  --red-text: #a3271c;
  --slate-bg: #eef0f4;
  --slate-text: #565f70;

  --radius: 10px;
  --sidebar-w: 260px;
  --content-max: 880px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161c;
    --bg-elevated: #1b1e26;
    --bg-sunken: #101217;
    --text: #e7e9ee;
    --text-dim: #a4abbb;
    --text-faint: #6d7488;
    --border: #2a2e3a;
    --accent: #7c9dff;
    --accent-dim: #1e2740;
    --accent-text: #a9bdff;
    --code-bg: #22262f;
    --code-text: #ff9d8a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35);

    --green-bg: #12301f;
    --green-text: #7fe0a8;
    --amber-bg: #3a2c0d;
    --amber-text: #ffc46b;
    --red-bg: #3a1616;
    --red-text: #ff9086;
    --slate-bg: #232734;
    --slate-text: #a4abbb;
  }
}

:root[data-theme="dark"] {
  --bg: #14161c;
  --bg-elevated: #1b1e26;
  --bg-sunken: #101217;
  --text: #e7e9ee;
  --text-dim: #a4abbb;
  --text-faint: #6d7488;
  --border: #2a2e3a;
  --accent: #7c9dff;
  --accent-dim: #1e2740;
  --accent-text: #a9bdff;
  --code-bg: #22262f;
  --code-text: #ff9d8a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35);

  --green-bg: #12301f;
  --green-text: #7fe0a8;
  --amber-bg: #3a2c0d;
  --amber-text: #ffc46b;
  --red-bg: #3a1616;
  --red-text: #ff9086;
  --slate-bg: #232734;
  --slate-text: #a4abbb;
}

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
}

code {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.12em 0.4em;
  border-radius: 5px;
}

pre {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
}
pre code { background: none; color: var(--text); padding: 0; }

/* ---------- layout shell ---------- */

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 22px 18px 32px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .brand {
  display: block;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 2px;
}
.sidebar .brand:hover { text-decoration: none; }
.sidebar .tagline {
  color: var(--text-faint);
  font-size: 12.5px;
  margin-bottom: 22px;
}

.nav-group { margin-bottom: 18px; }
.nav-group h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 0 0 6px 8px;
  font-weight: 600;
}
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group li { margin: 1px 0; }
.nav-group a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.35;
}
.nav-group a:hover { background: var(--bg-sunken); text-decoration: none; color: var(--text); }
.nav-group a.active { background: var(--accent-dim); color: var(--accent-text); font-weight: 600; }

.nav-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-faint);
}
.nav-dot.done { background: #2fa860; }
.nav-dot.partial { background: #d9932a; }
.nav-dot.planned { background: #9098ab; }

main {
  flex: 1;
  min-width: 0;
  padding: 44px 40px 90px;
  display: flex;
  justify-content: center;
}

.content {
  width: 100%;
  max-width: var(--content-max);
}

/* ---------- typography ---------- */

.eyebrow {
  color: var(--accent-text);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

h1 {
  font-size: 34px;
  line-height: 1.2;
  margin: 0 0 10px;
  letter-spacing: -0.015em;
}

.lede {
  font-size: 17px;
  color: var(--text-dim);
  max-width: 680px;
  margin: 0 0 28px;
}

h2 {
  font-size: 22px;
  margin: 44px 0 14px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  letter-spacing: -0.01em;
}
.content > h2:first-of-type { border-top: none; padding-top: 0; }

h3 {
  font-size: 16.5px;
  margin: 26px 0 10px;
}

p { margin: 0 0 14px; color: var(--text); }
.content p { color: var(--text); }

ul, ol { padding-left: 22px; margin: 0 0 14px; }
li { margin-bottom: 4px; }

hr { border: none; border-top: 1px solid var(--border); margin: 36px 0; }

/* ---------- status badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.badge.done { background: var(--green-bg); color: var(--green-text); }
.badge.done::before { background: var(--green-text); }
.badge.partial { background: var(--amber-bg); color: var(--amber-text); }
.badge.partial::before { background: var(--amber-text); }
.badge.planned { background: var(--slate-bg); color: var(--slate-text); }
.badge.planned::before { background: var(--slate-text); }
.badge.risk { background: var(--red-bg); color: var(--red-text); }
.badge.risk::before { background: var(--red-text); }

.status-line { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; flex-wrap: wrap; }

/* ---------- cards / grid ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin: 20px 0 8px;
}

.card {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }

.card .card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}

.card .card-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.06em;
}

.card h4 {
  margin: 0 0 6px;
  font-size: 15.5px;
  color: var(--text);
}

.card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--radius); }

table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--bg-sunken); color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
td { color: var(--text); }
.table-wrap table td, .table-wrap table th { white-space: normal; }

/* ---------- callouts ---------- */

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--bg-elevated);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 14.5px;
}
.callout p:last-child { margin-bottom: 0; }
.callout.warn { border-left-color: var(--amber-text); }
.callout.risk { border-left-color: var(--red-text); }
.callout.done { border-left-color: var(--green-text); }
.callout strong.tag {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 5px;
}

/* ---------- key/value & spec blocks ---------- */

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 18px 0;
}
.kv-grid .kv {
  background: var(--bg-elevated);
  padding: 13px 16px;
}
.kv .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 4px; }
.kv .v { font-size: 15px; font-weight: 600; }
.kv .v small { font-weight: 400; color: var(--text-dim); font-size: 12px; display: block; margin-top: 2px; }

/* ---------- footer nav ---------- */

.page-footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13.5px;
}
.page-footer a { color: var(--text-dim); }
.page-footer .next { text-align: right; }
.page-footer .arrow { color: var(--text-faint); }

/* ---------- misc ---------- */

.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 20px; }
.pill {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.topbar {
  display: none;
}

@media (max-width: 880px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: relative;
    height: auto;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px 18px;
  }
  main { padding: 30px 20px 70px; }
  h1 { font-size: 28px; }
}

/* ---------- figures ---------- */

.fig {
  margin: 0 0 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
}

/* The diagrams are drawn on a light ground, so they keep a white plate in
   dark mode instead of inverting into an unreadable grey-on-grey. */
.fig a {
  display: block;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}
.fig a:hover { text-decoration: none; }

.fig img {
  display: block;
  width: 100%;
  height: auto;
}

.fig figcaption {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg-elevated);
}
.fig figcaption b { color: var(--text); font-weight: 600; }
.fig figcaption .zoom {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-faint);
}

/* Let the wide 1900x900 workflow panels break out of the text column once
   there is room for them; below that they simply fill the column. */
@media (min-width: 1460px) {
  .fig--wide { margin-left: -120px; margin-right: -120px; }
}

/* ---------- formulas ---------- */

.formula {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-sunken);
  padding: 14px 18px;
  margin: 0 0 12px;
  font-size: 17px;
}
.formula .fname {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--accent-text);
}
.formula .fnote {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-dim);
}
.formula i { font-family: Georgia, "Times New Roman", serif; font-size: 18px; }

.frac {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  font-size: 15px;
}
.frac .num { border-bottom: 1px solid currentColor; padding: 0 6px 2px; }
.frac .den { padding: 2px 6px 0; }
