/* ==========================================================================
   AI Adoption Designs — learning journal
   ========================================================================== */

:root {
  --bg: #0d1117;
  --bg-alt: #141a22;
  --bg-raised: #1a2129;
  --border: #2a313c;
  --text: #cdd6e0;
  --text-dim: #8b96a3;
  --text-faint: #5b6472;
  --accent: #4fd1c5;
  --accent-dim: #2f6e68;
  --accent-contrast: #06201d;
  --warn: #e3b341;
  --link: #6fb3ff;
  --code-bg: #0a0e13;
  --shadow: rgba(0, 0, 0, 0.4);
  --radius: 6px;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --maxw: 880px;
}

[data-theme="light"] {
  --bg: #fbfbfa;
  --bg-alt: #f3f3f1;
  --bg-raised: #ffffff;
  --border: #dddbd6;
  --text: #22262b;
  --text-dim: #5a6168;
  --text-faint: #8a9099;
  --accent: #0f8a7e;
  --accent-dim: #c9efe9;
  --accent-contrast: #ffffff;
  --warn: #9a6400;
  --link: #0b5fb0;
  --code-bg: #f3f3f1;
  --shadow: rgba(20, 20, 20, 0.08);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: no-preference) {
  a, button, .tab-btn, .theme-toggle {
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  }
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

code, pre, kbd, .mono {
  font-family: var(--mono);
}

h1, h2, h3, h4 {
  font-family: var(--mono);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; margin-top: 2.2rem; }
h3 { font-size: 1.05rem; color: var(--text); margin-top: 1.6rem; }

p { color: var(--text); }
.dim { color: var(--text-dim); }

/* ---- Layout shell ---- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-row {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
}

.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.brand:hover { text-decoration: none; }
.brand .prompt { color: var(--accent); }

.header-spacer { flex: 1; }

.theme-toggle {
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--accent-dim);
}

/* ---- Topic tab nav (top-level) ---- */

.topic-nav {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  gap: 0.25rem;
  padding: 0 1.25rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.topic-nav a {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.topic-nav a:hover {
  color: var(--text);
  text-decoration: none;
}
.topic-nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- Main content ---- */

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
}

.page-head {
  margin-bottom: 1.5rem;
}

.topic-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.5rem;
}

.page-head h1 {
  margin: 0 0 0.5rem;
}

.page-dek {
  color: var(--text-dim);
  font-size: 1.02rem;
  max-width: 640px;
}

/* ---- Sub-tabs within a topic ---- */

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1.75rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab-btn {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn[aria-selected="true"] {
  color: var(--accent);
  border-color: var(--border);
  border-bottom-color: var(--bg);
  background: var(--bg-raised);
}

.tab-panel {
  outline: none;
}
.tab-panel[hidden] {
  display: none;
}

/* ---- Cards (landing page topics) ---- */

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.75rem;
}

.topic-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.topic-card:hover {
  border-color: var(--accent-dim);
}

.topic-index {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.78rem;
}

.topic-card h3 {
  margin: 0;
  font-size: 1.02rem;
}

.topic-card p {
  color: var(--text-dim);
  font-size: 0.92rem;
  margin: 0;
  flex: 1;
}

.topic-card .card-link {
  font-family: var(--mono);
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

.status-pill {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-faint);
  align-self: flex-start;
}
.status-pill.done {
  color: var(--accent);
  border-color: var(--accent-dim);
}

/* ---- Code blocks ---- */

.code-block {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1.1rem 0;
  overflow: hidden;
}

.code-block .code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.8rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.code-block .code-lang {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.copy-btn {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
}
.copy-btn:hover {
  color: var(--text);
  border-color: var(--accent-dim);
}
.copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent-dim);
}

pre {
  margin: 0;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
}
pre code {
  font-family: var(--mono);
  background: none;
}

:not(pre) > code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-size: 0.88em;
}

/* minimal manual syntax tones (no JS highlighter dependency) */
.tok-kw { color: #d08cff; }
[data-theme="light"] .tok-kw { color: #8250df; }
.tok-str { color: #9fd98c; }
[data-theme="light"] .tok-str { color: #1a7f37; }
.tok-com { color: var(--text-faint); font-style: italic; }
.tok-fn { color: var(--link); }
.tok-num { color: var(--warn); }

/* ---- Terminal-style callout ---- */

.terminal {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 1.1rem 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-dim);
}
.terminal .line::before {
  content: "$ ";
  color: var(--accent);
}
.terminal .out {
  color: var(--text-faint);
  padding-left: 1.1rem;
}

/* ---- Notes / callout boxes ---- */

.callout {
  border-left: 3px solid var(--accent-dim);
  background: var(--bg-raised);
  padding: 0.8rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.1rem 0;
  font-size: 0.95rem;
}
.callout.warn {
  border-left-color: var(--warn);
}
.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }

.placeholder {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--text-faint);
  font-size: 0.85rem;
  font-family: var(--mono);
  background: var(--bg-alt);
}

/* ---- Diagram figure ---- */

figure.diagram {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
figure.diagram svg {
  width: 100%;
  height: auto;
  display: block;
}
figure.diagram figcaption {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 0.6rem;
  text-align: center;
}

/* ---- Tables ---- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.1rem 0;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
}
th {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

ul, ol {
  color: var(--text);
  padding-left: 1.3rem;
}
li {
  margin-bottom: 0.4rem;
}

/* ---- Footer ---- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.25rem 2.5rem;
  text-align: center;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.78rem;
}

/* ---- Focus visibility ---- */

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Responsive ---- */

@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  main { padding: 1.75rem 1rem 4rem; }
  .header-row { padding: 0.75rem 1rem; }
}
