/* =================================================================
   Emoquest article styles
   Conforms to design-guidelines.md (cream + ink + sky + clay,
   Istok Web, paper-grain texture, max 65ch reading column).
   This stylesheet is self-contained: tokens declared inline so
   articles can ship without depending on the landing-page CSS.
   ================================================================= */

:root {
  /* Color */
  --cream-50:  #FAF6EE;
  --cream-100: #F2EBDD;
  --ink-900:   #1F2433;
  --ink-700:   #3D4459;
  --ink-500:   #6B7280;
  --sky-400:   #9CC8DD;
  --sky-200:   #D5E8F1;
  --clay-500:  #C97B5F;
  --clay-600:  #B0664B;
  --clay-100:  #F5E3DA;
  --border:    #E5DECF;
  --shadow:    rgba(31, 36, 51, 0.06);

  /* Type */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1.0625rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5rem;
  --text-2xl:  2rem;
  --text-3xl:  2.75rem;
  --leading-tight:  1.15;
  --leading-snug:   1.35;
  --leading-normal: 1.55;
  --leading-loose:  1.75;

  /* Space */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--cream-50);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.12  0 0 0 0 0.14  0 0 0 0 0.20  0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
  color: var(--ink-900);
  font-family: "Istok Web", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

@media print {
  html, body { background-image: none; }
}

a {
  color: var(--ink-900);
  text-decoration: underline;
  text-decoration-color: var(--clay-500);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: var(--ink-900); }

mark {
  background: linear-gradient(transparent 60%, var(--sky-200) 60%);
  color: inherit;
  padding: 0 0.1em;
}

/* --- Article-page nav (matches landing-page nav tone) --- */
.article-nav {
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  background: var(--cream-50);
}
.article-nav .brand {
  font-weight: 700;
  color: var(--ink-900);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.article-nav ul { list-style: none; display: flex; gap: var(--space-6); margin: 0; padding: 0; }
.article-nav a { color: var(--ink-900); text-decoration: none; }
.article-nav a:hover { color: var(--clay-500); }

/* --- Article container (65ch reading column) --- */
.article-container {
  max-width: 65ch;
  margin: 0 auto;
  padding: var(--space-12) var(--space-6) var(--space-24);
}

.back-link {
  display: inline-block;
  font-size: var(--text-sm);
  color: var(--ink-700);
  text-decoration: none;
  margin-bottom: var(--space-8);
}
.back-link:hover { color: var(--clay-500); }

.article-header { margin-bottom: var(--space-8); }

.article-title {
  color: var(--ink-900);
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-3);
}

.article-meta {
  font-size: var(--text-sm);
  color: var(--ink-500);
  margin-bottom: var(--space-1);
}

.article-author {
  font-size: var(--text-sm);
  color: var(--ink-500);
}

.article-content > p:first-of-type {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  color: var(--ink-900);
}

.article-content p {
  margin: 0 0 var(--space-4);
  color: var(--ink-900);
}

.article-content h2 {
  color: var(--ink-900);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: var(--leading-tight);
  margin: var(--space-12) 0 var(--space-3);
}

.article-content h3 {
  color: var(--ink-900);
  font-size: var(--text-lg);
  font-weight: 700;
  margin: var(--space-8) 0 var(--space-2);
}

.article-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: var(--space-6) auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.article-content figure { margin: var(--space-6) 0; }
.article-content figcaption {
  font-size: var(--text-sm);
  color: var(--ink-500);
  text-align: center;
  margin-top: var(--space-2);
}

.article-content strong { color: var(--ink-900); font-weight: 700; }

.article-content blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-6);
  background: var(--clay-100);
  border-left: 3px solid var(--clay-500);
  font-size: var(--text-base);
  color: var(--ink-900);
}
.article-content blockquote p:last-child { margin-bottom: 0; }

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-6) 0;
  font-size: var(--text-sm);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.article-content th, .article-content td {
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  vertical-align: top;
  color: var(--ink-900);
}
.article-content tr:last-child td { border-bottom: none; }
.article-content th {
  background: var(--cream-100);
  font-weight: 700;
  color: var(--ink-900);
  border-bottom: 2px solid var(--border);
}

.article-content ul, .article-content ol {
  padding-left: var(--space-6);
  margin: 0 0 var(--space-4);
  list-style: revert;
}
.article-content li { margin-bottom: var(--space-2); color: var(--ink-900); }

.article-content details {
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) 0;
}
.article-content details:first-of-type { border-top: 1px solid var(--border); }
.article-content summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink-900);
  font-size: var(--text-base);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.article-content summary::-webkit-details-marker { display: none; }
.article-content summary::after {
  content: "+";
  color: var(--clay-500);
  font-weight: 700;
  font-size: var(--text-lg);
  margin-left: var(--space-4);
}
.article-content details[open] summary::after { content: "–"; }
.article-content details p { margin: var(--space-3) 0 var(--space-1); color: var(--ink-700); }

/* --- Footer --- */
.article-footer {
  max-width: 65ch;
  margin: var(--space-12) auto 0;
  padding: var(--space-6);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--ink-500);
  text-align: center;
}

@media (max-width: 600px) {
  .article-container { padding: var(--space-8) var(--space-4) var(--space-12); }
  .article-title { font-size: var(--text-xl); }
  .article-content h2 { font-size: var(--text-lg); }
}
