/* =============================================
   PAPER & EMBER — LearnAgent v2 Design System
   Warm off-white paper, single amber accent,
   Chinese-first typography for long-form reading.
   ============================================= */

/* === Design Tokens === */

:root {
  /* surfaces */
  --bg: #faf7f0;            /* warm cream paper */
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f5f0e3;
  --surface-hover: #f0eadc;
  --surface-glass: #ffffff;

  /* text */
  --text: #1c1c1e;
  --text-muted: #6b6b73;
  --text-subtle: #9a958c;
  --text-strong: #0a0a0c;

  /* lines */
  --line: #ebe5d4;
  --line-strong: #d4cbb5;

  /* single brand accent */
  --accent: #b45309;        /* burnt amber, AA on cream */
  --accent-hover: #92400e;
  --accent-soft: #fdf3e3;
  --accent-glow: rgba(180, 83, 9, 0.15);

  /* legacy color tokens kept for backward compat in markup */
  --lime: #4d7c4d;
  --orange: #b85a25;
  --teal: #2d6e6a;
  --sand: #8a6f3a;
  --dark: #1c1c1e;

  /* shadows: subtle, paper-like */
  --shadow-sm: 0 1px 2px rgba(20, 14, 0, 0.04);
  --shadow: 0 2px 8px rgba(20, 14, 0, 0.05);
  --shadow-lg: 0 8px 24px rgba(20, 14, 0, 0.06);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* === Base === */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'palt' 1;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.18s ease;
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  display: block;
}

/* === Shell === */

.site-shell {
  width: min(1140px, calc(100vw - 32px));
  margin: 0 auto;
  padding-bottom: 64px;
}

/* === Header === */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 4px 18px;
  margin: 0 0 32px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(250, 247, 240, 0.9);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text-strong);
}

.brand strong {
  display: block;
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: 0.01em;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  font-size: 0.94rem;
  font-weight: 500;
}

.site-nav a {
  color: var(--text);
}

.site-nav a:hover {
  color: var(--accent);
}

/* === Headings === */

h1, h2, h3, h4 {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', Georgia, serif;
  color: var(--text-strong);
  letter-spacing: 0;
  font-weight: 700;
}

/* === Hero === */

.hero {
  padding: 56px 8px 40px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}

.hero-copy {
  max-width: 760px;
}

.hero h1,
.page-hero h1 {
  margin: 14px 0 18px;
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
  line-height: 1.35;
  color: var(--text-strong);
  text-wrap: balance;
}

.hero p,
.page-hero p {
  margin: 0;
  color: var(--text);
  font-size: 1.06rem;
  line-height: 1.8;
  max-width: 65ch;
}

.hero p + p,
.page-hero p + p {
  margin-top: 12px;
}

.update-note {
  font-size: 0.84rem !important;
  color: var(--text-subtle) !important;
  letter-spacing: 0.02em;
  margin-top: 16px !important;
}

/* === Eyebrow === */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  color: var(--accent);
}

/* === Buttons === */

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 8px;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.96rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.button-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.button-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.button-secondary {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* === Hero Metrics (compact stats line) === */

.hero-metrics {
  display: flex;
  gap: 36px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--line);
}

.hero-metrics div {
  min-width: 100px;
}

.hero-metrics strong {
  display: block;
  font-family: 'Noto Serif SC', serif;
  font-size: 1.4rem;
  color: var(--text-strong);
}

.hero-metrics span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* === Section Blocks === */

.section-block,
.page-hero,
.contact-panel,
.doc-layout {
  padding: 40px 8px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

.section-block:first-of-type,
.page-hero:first-of-type {
  border-top: none;
}

.page-hero {
  padding-top: 32px;
  padding-bottom: 24px;
  margin-bottom: 8px;
}

.page-hero-compact h1 {
  font-size: clamp(1.7rem, 2.6vw, 2.4rem);
  margin: 8px 0 12px;
}

.section-heading {
  margin-bottom: 28px;
  max-width: 760px;
}

.section-heading h2 {
  margin: 8px 0 8px;
  font-size: clamp(1.4rem, 2.2vw, 1.85rem);
  color: var(--text-strong);
}

.section-heading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* === Path Selector (homepage) === */

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

.path-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
}

.path-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.path-card-tag {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.path-card h3 {
  margin: 0;
  font-size: 1.18rem;
  color: var(--text-strong);
}

.path-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.path-card-arrow {
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 600;
}

/* === 30-day path block === */

.path-30 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.path-30 article {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.path-30 article h3 {
  margin: 0 0 10px;
  font-size: 1.12rem;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.path-30 article h3 span {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  font-weight: 700;
}

.path-30 article p {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.path-30 ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.85;
}

.path-30 ul a {
  color: var(--text);
  border-bottom: 1px solid transparent;
}

.path-30 ul a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* === Newsletter / subscribe === */

.subscribe-box {
  background: var(--accent-soft);
  border: 1px solid #f5dfb8;
  border-radius: var(--radius-md);
  padding: 28px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: center;
}

.subscribe-box h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.subscribe-box p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.subscribe-form {
  display: flex;
  gap: 8px;
}

.subscribe-form input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: var(--text);
}

.subscribe-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.subscribe-form button {
  padding: 0 20px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.subscribe-form button:hover {
  background: var(--accent-hover);
}

.subscribe-note {
  font-size: 0.82rem !important;
  color: var(--text-subtle) !important;
  margin-top: 10px !important;
}

/* === Doc Grid & Cards === */

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
  word-break: break-word;
  transition: all 0.2s ease;
}

.doc-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.doc-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-subtle);
}

.doc-card h3 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.4;
}

.doc-card h3 a {
  color: var(--text-strong);
}

.doc-card h3 a:hover {
  color: var(--accent);
}

.doc-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.doc-card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.doc-card li {
  margin: 0.25rem 0;
}

.doc-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 8px;
  font-size: 0.88rem;
}

.doc-card-actions a {
  color: var(--accent);
  font-weight: 600;
}

.doc-card-actions span {
  color: var(--text-subtle);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

/* === Section Accents (kept neutral, just subtle wash) === */

.accent-foundations,
.accent-playbooks,
.accent-compare,
.accent-ai-agents,
.accent-openclaw,
.accent-claude-code,
.accent-resources,
.accent-comparisons,
.accent-agent-frameworks {
  /* unified neutral, no rainbow */
}

/* === Recent updates list === */

.recent-updates-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}

.recent-update-item {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}

.recent-update-item:last-child {
  border-bottom: none;
}

.recent-update-date {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--text-subtle);
  flex-shrink: 0;
  min-width: 64px;
}

.recent-update-info {
  flex: 1;
  min-width: 0;
}

.recent-update-info a {
  font-weight: 600;
  color: var(--text-strong);
  margin-right: 10px;
}

.recent-update-info a:hover {
  color: var(--accent);
}

.recent-update-info span {
  font-size: 0.82rem;
  color: var(--text-subtle);
}

.badge-new {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-family: 'Inter', sans-serif;
}

/* === Library Section Block (per-section listing) === */

.library-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.library-section-head h2 {
  margin: 6px 0 4px;
  font-size: 1.5rem;
}

.library-section-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.library-section-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-subtle);
}

/* === Contact === */

.contact-panel {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 32px;
}

.contact-copy h2 {
  margin-top: 0;
}

.contact-copy p {
  color: var(--text-muted);
}

.service-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.service-pills span {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 0.84rem;
  color: var(--text-muted);
}

.contact-form {
  display: grid;
  gap: 14px;
}

.field-grid {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.field-grid > label {
  flex: 1;
}

.contact-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  padding: 11px 14px;
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.contact-form textarea {
  resize: vertical;
  min-height: 140px;
}

.contact-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.contact-form button {
  min-height: 46px;
  padding: 0 26px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.contact-form button:hover {
  background: var(--accent-hover);
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* === Doc Layout === */

.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 48px;
  padding-top: 24px;
}

.doc-sidebar {
  display: grid;
  gap: 14px;
  align-self: start;
  position: sticky;
  top: 88px;
  order: 2;
  font-size: 0.9rem;
}

.sidebar-panel {
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.sidebar-panel span {
  display: block;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-subtle);
  margin-bottom: 4px;
}

.sidebar-panel strong {
  color: var(--text-strong);
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sidebar-panel a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
}

.link-list a {
  color: var(--text);
}

.link-list a:hover {
  color: var(--accent);
}

.doc-content {
  min-width: 0;
}

.doc-article {
  min-width: 0;
}

/* === Prose (article body) — long-form Chinese reading === */

.prose {
  font-size: 17px;
  line-height: 1.95;
  color: var(--text);
  max-width: 72ch;
}

.prose > :first-child {
  margin-top: 0;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', Georgia, serif;
  line-height: 1.4;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
  color: var(--text-strong);
  font-weight: 700;
}

.prose h2 {
  font-size: 1.5rem;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--line);
}

.prose h3 {
  font-size: 1.22rem;
}

.prose p,
.prose li,
.prose blockquote {
  line-height: 1.95;
}

.prose p {
  margin: 1.1em 0;
}

.prose ul,
.prose ol {
  padding-left: 1.4rem;
}

.prose li {
  margin: 0.4rem 0;
}

.prose a {
  color: var(--accent);
  border-bottom: 1px solid rgba(180, 83, 9, 0.3);
  transition: border-color 0.2s ease;
}

.prose a:hover {
  border-bottom-color: var(--accent);
}

.prose blockquote {
  margin: 1.4rem 0;
  padding: 0.9rem 1.2rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 0 8px 8px 0;
}

.prose blockquote p {
  margin: 0.4em 0;
}

.prose pre,
.prose code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.prose pre {
  overflow-x: auto;
  padding: 18px 20px;
  border-radius: 10px;
  background: #1c1c1e;
  color: #e8e3d6;
  font-size: 0.88rem;
  line-height: 1.65;
  border: 1px solid #2c2c2e;
}

.prose pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border: none;
  font-size: inherit;
}

.prose :not(pre) > code {
  padding: 0.12rem 0.42rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 0.88em;
  border: 1px solid #f5dfb8;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6rem 0;
  font-size: 0.94rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.prose th,
.prose td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.prose th {
  background: var(--surface-soft);
  color: var(--text-strong);
  font-weight: 700;
  font-family: inherit;
}

.prose tr:last-child td {
  border-bottom: none;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

.prose img {
  border-radius: 8px;
  margin: 1.5rem auto;
}

/* === Article-level FAQ === */

.faq-block {
  display: grid;
  gap: 8px;
  max-width: 760px;
}

.faq-block article {
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.faq-block article:last-child {
  border-bottom: none;
}

.faq-block h2,
.faq-block h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 1.05rem;
}

.faq-block h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.faq-block p {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.96rem;
  line-height: 1.75;
}

/* === Footer === */

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 28px 4px 0;
  margin-top: 56px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.site-footer strong {
  font-family: 'Noto Serif SC', serif;
  font-size: 1rem;
  color: var(--text-strong);
}

.site-footer p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  max-width: 480px;
}

.site-footer a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer a:hover {
  color: var(--accent);
}

.site-footer div:last-child {
  display: flex;
  gap: 22px;
}

/* === Back Link === */

.back-link {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.back-link::before {
  content: "← ";
  margin-right: 4px;
}

.back-link:hover {
  color: var(--accent);
}

/* === Subscribe inline (footer-of-article) === */

.article-subscribe {
  margin-top: 48px;
  padding: 28px;
  background: var(--accent-soft);
  border: 1px solid #f5dfb8;
  border-radius: var(--radius-md);
}

.article-subscribe h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.article-subscribe p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.94rem;
}

/* === Responsive === */

@media (max-width: 960px) {
  .site-header {
    padding: 16px 4px;
  }

  .doc-layout,
  .contact-panel,
  .path-30,
  .subscribe-box {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .path-selector {
    grid-template-columns: 1fr;
  }

  .doc-sidebar {
    position: static;
    order: 1;
  }

  .doc-content {
    order: 2;
  }

  .hero-metrics {
    gap: 24px;
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 15px;
  }

  .site-shell {
    width: min(100vw - 24px, 1140px);
  }

  .site-header {
    flex-wrap: wrap;
    gap: 12px;
  }

  .site-nav {
    width: 100%;
    gap: 18px;
  }

  .hero {
    padding: 36px 4px 28px;
  }

  .field-grid,
  .contact-form-footer,
  .subscribe-form {
    flex-direction: column;
    align-items: stretch;
  }

  .site-footer div:last-child {
    flex-direction: column;
    gap: 10px;
  }

  .prose {
    font-size: 16px;
    line-height: 1.9;
  }

  .doc-grid {
    grid-template-columns: 1fr;
  }
}
