/* ══════════════════════════════════════════════
   LEARNCLOUD.PRO — Master Stylesheet
   Design: A·Teal — Playfair Display + Source Serif 4
   ══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,700;1,500&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,600;1,8..60,300;1,8..60,400&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── Reset ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* ── Tokens ─────────────────────────────────── */
body {
  --bg:            #ffffff;
  --surface:       #f0f4f2;
  --surface-2:     #e8efec;
  --border:        #d0ddd8;
  --border-2:      #baced3;
  --text:          #141c1a;
  --text-2:        #2b3a36;
  --text-3:        #54706a;
  --accent:        #1a6b5c;
  --accent-2:      #22876f;
  --accent-3:      #155246;
  --accent-bg:     #e6f4ef;
  --accent-bg-2:   #d0eae1;
  --tag-bg:        #daeee6;
  --tag-text:      #134f42;
  --warn-bg:       #fef9ec;
  --warn-border:   #e8c84a;
  --danger-bg:     #fdf0ee;
  --danger-border: #e07060;
  --danger-text:   #7a2a20;
  --code-bg:       #f2f5f3;
  --code-border:   #d4e0da;
  --pre-bg:        #0f1a17;
  --pre-text:      #c8ddd7;
  --white:         #ffffff;
  --shadow-sm:     0 1px 4px rgba(20,60,50,0.07);
  --shadow-md:     0 4px 16px rgba(20,60,50,0.09);
  --radius:        7px;
  --radius-lg:     12px;
  --max-article:   700px;
  --max-site:      960px;

  font-family: 'Source Serif 4', serif;
  font-size: 18px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

/* ══════════════════════════════════════════════
   SITE HEADER
   ══════════════════════════════════════════════ */
.site-header {
  background: var(--bg);
  border-bottom: 2px solid var(--text);
  position: sticky; top: 0; z-index: 100;
}
.site-header .inner {
  max-width: var(--max-site); margin: 0 auto;
  padding: 0 32px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
.site-logo {
  font-family: 'Playfair Display', serif;
  font-size: 20px; font-weight: 700;
  color: var(--text); letter-spacing: -0.3px;
}
.site-logo span { color: var(--accent); }

.site-nav { display: flex; gap: 24px; }
.site-nav a {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  color: var(--text-3); letter-spacing: 0.3px;
  transition: color 0.15s;
}
.site-nav a:hover,
.site-nav a.active { color: var(--text); }

.header-social { display: flex; gap: 2px; }
.header-social a {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 6px;
  color: var(--text-3); transition: color 0.15s, background 0.15s;
}
.header-social a:hover { color: var(--accent); background: var(--accent-bg); }
.header-social svg { width: 16px; height: 16px; }

/* ══════════════════════════════════════════════
   SHARED COMPONENTS
   ══════════════════════════════════════════════ */

/* Breadcrumb */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px; color: var(--text-3);
  margin-bottom: 32px;
}
.breadcrumb a { color: var(--accent); transition: opacity 0.15s; }
.breadcrumb a:hover { opacity: 0.75; }
.breadcrumb svg { width: 13px; height: 13px; opacity: 0.45; }

/* Tags */
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tag {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--tag-text); background: var(--tag-bg);
  padding: 3px 9px; border-radius: 3px; display: inline-block;
}

/* Avatar */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 600; flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ══════════════════════════════════════════════
   ARTICLE PAGE
   ══════════════════════════════════════════════ */
.article-layout {
  max-width: var(--max-site);
  margin: 0 auto;
  padding: 52px 32px 80px;
}

/* Article header */
.article-title {
  font-family: 'Playfair Display', serif;
  font-size: 42px; font-weight: 700;
  color: var(--text); line-height: 1.17; letter-spacing: -0.5px;
  margin-bottom: 18px;
}
.article-subtitle {
  font-size: 20px; font-weight: 300; font-style: italic;
  color: var(--text-2); line-height: 1.55; margin-bottom: 28px;
}
.article-byline {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 36px;
}
.byline-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 600; color: var(--text);
}
.byline-meta {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px; color: var(--text-3);
}

/* Hero image */
.hero-image-wrap {
  margin-bottom: 40px; border-radius: var(--radius-lg);
  overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.hero-image-wrap img { width: 100%; max-height: 420px; object-fit: cover; display: block; }
.hero-image-caption {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px; color: var(--text-3);
  padding: 10px 14px; background: var(--surface);
  border-top: 1px solid var(--border); text-align: center; font-style: italic;
}

/* ── Article Body ────────────────────────────── */
.article-body p {
  font-size: 19px; line-height: 1.82;
  color: var(--text-2); margin-bottom: 26px; font-weight: 300;
}
.article-body p:last-child { margin-bottom: 0; }

.article-body h2 {
  font-family: 'Playfair Display', serif;
  font-size: 28px; font-weight: 700; color: var(--text);
  margin: 52px 0 16px; letter-spacing: -0.3px; line-height: 1.25;
}
.article-body h3 {
  font-family: 'Playfair Display', serif;
  font-size: 21px; font-weight: 500; font-style: italic; color: var(--text);
  margin: 36px 0 12px; line-height: 1.3;
}
.article-body h4 {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 600; color: var(--text);
  text-transform: uppercase; letter-spacing: 0.6px; margin: 28px 0 10px;
}

/* Inline */
.article-body strong  { font-weight: 600; color: var(--text); }
.article-body em      { font-style: italic; }
.article-body u       { text-underline-offset: 3px; }
.article-body s       { opacity: 0.55; }
.article-body mark    { background: #d4f0e4; color: var(--text); padding: 1px 3px; border-radius: 2px; }
.article-body sup,
.article-body sub     { font-size: 13px; font-family: 'DM Sans', sans-serif; }
.article-body abbr    { text-decoration: underline dotted; cursor: help; }

/* Links */
.article-body a {
  color: var(--accent); text-decoration: underline;
  text-decoration-color: var(--accent-bg-2); text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}
.article-body a:hover { text-decoration-color: var(--accent); }

/* Inline code */
.article-body code {
  font-family: 'DM Mono', monospace; font-size: 14px;
  background: var(--code-bg); border: 1px solid var(--code-border);
  border-radius: 4px; padding: 2px 6px; color: var(--text);
}

/* Code block */
.article-body pre {
  background: var(--pre-bg); border-radius: var(--radius);
  padding: 22px 24px; overflow-x: auto; margin: 32px 0;
  border: 1px solid #1e2e2a; box-shadow: var(--shadow-md);
}
.article-body pre code {
  font-family: 'DM Mono', monospace; font-size: 13.5px;
  background: none; border: none; padding: 0;
  color: var(--pre-text); line-height: 1.7;
}
/* Syntax: wrap tokens in <span class="kw|st|cm|nm|op"> */
.article-body pre .kw { color: #7dd3b0; }
.article-body pre .st { color: #a8d8a8; }
.article-body pre .cm { color: #546e65; font-style: italic; }
.article-body pre .nm { color: #e0b87a; }
.article-body pre .op { color: #89c4b0; }

/* Blockquote */
.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 6px 0 6px 24px; margin: 36px 0;
  font-style: italic; color: var(--text-2);
}
.article-body blockquote p { margin-bottom: 0; font-size: 20px; line-height: 1.65; }
.article-body blockquote cite {
  display: block; margin-top: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-style: normal; color: var(--text-3);
}
.article-body blockquote cite::before { content: "— "; }

/* HR */
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 44px 0; }
.article-body hr.fancy { border: none; text-align: center; margin: 44px 0; }
.article-body hr.fancy::after {
  content: "· · ·";
  font-family: 'Playfair Display', serif;
  font-size: 20px; color: var(--accent); letter-spacing: 8px;
}

/* Unordered list */
.article-body ul { list-style: none; margin: 0 0 26px 0; }
.article-body ul li {
  font-size: 19px; line-height: 1.75; color: var(--text-2);
  margin-bottom: 8px; font-weight: 300; padding-left: 20px; position: relative;
}
.article-body ul li::before {
  content: ""; position: absolute; left: 0; top: 13px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.article-body ul ul { margin: 8px 0 4px 0; }
.article-body ul ul li::before { background: var(--border-2); }

/* Ordered list */
.article-body ol { list-style: decimal; margin: 0 0 26px 22px; }
.article-body ol li {
  font-size: 19px; line-height: 1.75; color: var(--text-2);
  margin-bottom: 8px; font-weight: 300;
}
.article-body ol li::marker {
  color: var(--accent); font-weight: 600;
  font-family: 'DM Sans', sans-serif; font-size: 15px;
}
.article-body ol ol { margin-top: 8px; margin-bottom: 4px; }
.article-body li strong { font-weight: 600; color: var(--text); }

/* Definition list */
.article-body dl { margin: 0 0 26px; }
.article-body dt {
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 600;
  color: var(--text); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 16px;
}
.article-body dd {
  font-size: 17px; color: var(--text-2);
  margin-left: 20px; margin-top: 4px; line-height: 1.65; font-weight: 300;
}

/* Table */
.article-body .table-wrap {
  overflow-x: auto; margin: 32px 0;
  border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.article-body table { width: 100%; border-collapse: collapse; font-family: 'DM Sans', sans-serif; font-size: 14px; }
.article-body thead { background: var(--surface-2); }
.article-body th {
  padding: 12px 16px; text-align: left; font-weight: 600;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text); border-bottom: 2px solid var(--border);
}
.article-body td {
  padding: 12px 16px; color: var(--text-2);
  border-bottom: 1px solid var(--border); line-height: 1.5; vertical-align: top;
}
.article-body tr:last-child td { border-bottom: none; }
.article-body tbody tr:hover { background: var(--surface); }
.article-body td code { font-size: 12px; padding: 1px 5px; }

/* Figure */
.article-body figure { margin: 36px 0; }
.article-body figure img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.article-body figcaption {
  font-family: 'DM Sans', sans-serif; font-size: 13px; color: var(--text-3);
  text-align: center; margin-top: 10px; font-style: italic; line-height: 1.5;
}

/* Callouts */
.callout {
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px; margin: 32px 0;
  font-family: 'DM Sans', sans-serif; font-size: 15px; line-height: 1.65; color: var(--text-2);
}
.callout.info    { background: var(--accent-bg); border-color: var(--accent); }
.callout.info strong { color: var(--accent); }
.callout.warn    { background: var(--warn-bg); border-color: var(--warn-border); }
.callout.warn strong { color: #6a4f00; }
.callout.danger  { background: var(--danger-bg); border-color: var(--danger-border); }
.callout.danger strong { color: var(--danger-text); }

/* Details / summary */
.article-body details { border: 1px solid var(--border); border-radius: var(--radius); margin: 28px 0; overflow: hidden; }
.article-body summary {
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 600; color: var(--text);
  padding: 14px 18px; background: var(--surface);
  cursor: pointer; user-select: none;
  list-style: none; display: flex; align-items: center; gap: 8px; transition: background 0.15s;
}
.article-body summary:hover { background: var(--surface-2); }
.article-body summary::before {
  content: "▶"; font-size: 10px; color: var(--accent);
  transition: transform 0.2s; display: inline-block;
}
.article-body details[open] summary::before { transform: rotate(90deg); }
.article-body details .details-body {
  padding: 16px 18px; font-family: 'DM Sans', sans-serif;
  font-size: 15px; color: var(--text-2); line-height: 1.65; border-top: 1px solid var(--border);
}

/* Keyboard shortcut */
.article-body kbd {
  font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 500;
  background: var(--white); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 4px; padding: 2px 7px; color: var(--text); box-shadow: 0 1px 0 var(--border);
}

/* ── Share Bar ────────────────────────────────── */
.share-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 24px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin: 48px 0 40px; flex-wrap: wrap;
}
.share-label {
  font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase; color: var(--text-3); margin-right: 4px;
}
.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
  padding: 7px 15px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--white); color: var(--text-2);
  cursor: pointer; transition: all 0.15s;
}
.share-btn:hover { background: var(--surface); border-color: var(--text-3); }
.share-btn svg { width: 14px; height: 14px; }
.share-btn.copied { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

/* ── Author Bio ───────────────────────────────── */
.author-bio {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px 26px; display: flex; gap: 18px; align-items: flex-start; margin-bottom: 40px;
}
.author-bio .avatar { width: 52px; height: 52px; font-size: 18px; }
.author-bio-name {
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 600;
  color: var(--text); margin-bottom: 5px;
}
.author-bio-text { font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--text-3); line-height: 1.6; }
.author-bio-links { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.author-bio-links a {
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500; color: var(--accent);
  text-decoration: underline; text-decoration-color: transparent; transition: text-decoration-color 0.15s;
}
.author-bio-links a:hover { text-decoration-color: var(--accent); }

/* ── Related Articles ─────────────────────────── */
.related-articles { margin-bottom: 40px; }
.related-articles h3 {
  font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase; color: var(--text-3); margin-bottom: 14px;
}
.related-list { display: flex; flex-direction: column; gap: 10px; }
.related-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  transition: background 0.15s, box-shadow 0.15s;
}
.related-item:hover { background: var(--surface); box-shadow: var(--shadow-sm); }
.related-item-tag {
  font-family: 'DM Sans', sans-serif; font-size: 10px; font-weight: 600;
  letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--tag-text); background: var(--tag-bg);
  padding: 2px 7px; border-radius: 3px; white-space: nowrap; margin-top: 2px;
}
.related-item-title {
  font-family: 'Playfair Display', serif; font-size: 16px; color: var(--text); line-height: 1.4; flex: 1;
}
.related-item:hover .related-item-title { color: var(--accent); }

/* ── Comments ─────────────────────────────────── */
.comments-section { margin-bottom: 40px; }
.comments-section h3 {
  font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase; color: var(--text-3); margin-bottom: 14px;
}
.comments-placeholder {
  padding: 24px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--text-3);
}

/* ── Back to Top ──────────────────────────────── */
.back-to-top {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500; color: var(--text-3);
  background: none; border: none; cursor: pointer; transition: color 0.15s; padding: 0; margin-bottom: 40px;
}
.back-to-top:hover { color: var(--accent); }
.back-to-top svg { width: 14px; height: 14px; }

/* ══════════════════════════════════════════════
   HOMEPAGE
   ══════════════════════════════════════════════ */

/* Hero — keeps --surface background intentionally */
.home-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 64px 32px 56px;
}
.home-hero .inner { max-width: var(--max-site); margin: 0 auto; }
.eyebrow {
  font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 600;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent); margin-bottom: 16px;
}
.home-hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(30px, 4vw, 44px); font-weight: 700;
  color: var(--text); line-height: 1.18; letter-spacing: -0.5px; margin-bottom: 14px; max-width: 640px;
}
.home-hero p {
  font-family: 'DM Sans', sans-serif; font-size: 16px; color: var(--text-3);
  line-height: 1.65; max-width: 480px;
}

/* Topic filter */
.topic-bar {
  max-width: var(--max-site); margin: 0 auto;
  padding: 24px 32px 0; display: flex; gap: 8px; flex-wrap: wrap;
}
.topic-btn {
  font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500;
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--white); color: var(--text-3); cursor: pointer; transition: all 0.15s;
}
.topic-btn:hover { border-color: var(--accent); color: var(--accent); }
.topic-btn.active { background: var(--accent); border-color: var(--accent); color: var(--white); }

/* Articles section — white bg inherited from body */
.articles-section { max-width: var(--max-site); margin: 0 auto; padding: 32px 32px 0; }
.section-label {
  font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px;
}

/* Cards */
.cards-list { display: flex; flex-direction: column; }
.card-item {
  padding: 24px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: all 0.15s;
}
.card-item:hover { background: var(--surface); margin: 0 -16px; padding: 24px 16px; }
.card-item:hover .card-title { color: var(--accent); }

.card-tags-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 8px; margin-bottom: 8px;
}
.card-tags-group { display: flex; gap: 6px; flex-wrap: wrap; }
.card-date {
  font-family: 'DM Sans', sans-serif; font-size: 12px; color: var(--text-3);
  white-space: nowrap; flex-shrink: 0;
}
.card-title {
  font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 500;
  color: var(--text); line-height: 1.32; margin-bottom: 7px; letter-spacing: -0.2px; transition: color 0.15s;
}
.card-excerpt {
  font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--text-3); line-height: 1.6;
}

/* ══════════════════════════════════════════════
   SITE FOOTER — keeps --surface background
   ══════════════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  margin-top: 80px; padding: 36px 32px;
}
.site-footer .inner {
  max-width: var(--max-site); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
}
.footer-left { font-family: 'DM Sans', sans-serif; font-size: 13px; color: var(--text-3); }
.footer-left strong { color: var(--text); font-weight: 600; }
.footer-social { display: flex; gap: 4px; }
.footer-social a {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 6px; color: var(--text-3); transition: all 0.15s;
}
.footer-social a:hover { color: var(--accent); background: var(--accent-bg); }
.footer-social svg { width: 16px; height: 16px; }

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .site-header .inner { padding: 0 16px; }
  .site-nav { display: none; }
  .article-layout { padding: 32px 16px 60px; }
  .article-title { font-size: 30px; }
  .article-subtitle { font-size: 18px; }
  .article-body p, .article-body li { font-size: 17px; }
  .article-body h2 { font-size: 23px; }
  .article-body pre { padding: 16px; }
  .home-hero { padding: 44px 16px 36px; }
  .topic-bar { padding: 20px 16px 0; }
  .articles-section { padding: 24px 16px 0; }
  .author-bio { flex-direction: column; gap: 12px; }
  .site-footer { margin-top: 48px; }
  .site-footer .inner { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .article-title { font-size: 26px; }
  .share-bar { gap: 6px; }
  .card-tags-row { flex-wrap: wrap; }
}
