/* ==============================================================
   essays.css — shared styles for /essays/ (the index and every
   individual essay page). Loaded *after* style.css, which owns the
   design tokens (--accent, --font-serif, …) and the site footer.

   These rules used to live in a <style> block inside essays.html.
   They moved here when each essay became its own page, so that the
   18 pages under /essays/ cannot drift apart.
   ============================================================== */

.essays-body { padding-top: 64px; }

/* --- Fixed sub-navigation bar --------------------------------- */
.subbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 64px; padding: 0 2rem;
  display: flex; align-items: center; gap: 1rem;
  background: var(--bar-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.subbar-inner {
  max-width: 780px; margin: 0 auto; width: 100%;
  display: flex; align-items: center; gap: 1rem;
}
.subbar-back {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.06em;
  color: var(--accent); border: 1px solid var(--accent-border);
  padding: 0.3rem 0.7rem; border-radius: var(--radius);
  transition: background var(--transition);
  white-space: nowrap;
}
.subbar-back:hover { background: var(--accent-dim); }
.subbar-title {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em;
  color: var(--text-muted); text-transform: uppercase; margin-left: auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --- Page hero ------------------------------------------------- */
.essays-hero { padding: 5rem 2rem 3rem; }
.essays-hero-inner { max-width: 780px; margin: 0 auto; }
.essays-eyebrow {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em;
  color: var(--accent); text-transform: uppercase; margin-bottom: 1.25rem;
}
.essays-h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.15;
  letter-spacing: -0.01em; margin-bottom: 1.5rem;
}
.essays-lead {
  font-family: var(--font-serif); font-weight: 300;
  font-size: 1.1rem; line-height: 1.9; color: var(--text-sub);
  border-left: 2px solid var(--accent); padding-left: 1.15rem;
}
.essays-lead a { color: var(--accent); border-bottom: 1px solid var(--accent-border); }

.toc {
  max-width: 780px; margin: 2.5rem auto 0; padding: 0 2rem;
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.toc a {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.04em;
  color: var(--text-sub); padding: 0.35rem 0.8rem;
  border: 1px solid var(--border-med); border-radius: 2px;
  transition: color var(--transition), border-color var(--transition);
}
.toc a:hover { color: var(--accent); border-color: var(--accent-border); }

.essays-main { max-width: 780px; margin: 0 auto; padding: 3.5rem 2rem 5rem; }

/* --- Index: one group of essays -------------------------------- */
.egroup { margin-bottom: 3.5rem; scroll-margin-top: 80px; }
.egroup-label {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em;
  color: var(--accent); text-transform: uppercase;
  padding-bottom: 0.9rem; margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

/* --- Index: one row per essay ---------------------------------- */
.elist { display: flex; flex-direction: column; gap: 1px; }
.erow {
  display: flex; align-items: center; gap: 1rem;
  scroll-margin-top: 80px;
  padding: 1.1rem 1.3rem; background: var(--bg-card);
  transition: background var(--transition);
}
.erow:hover { background: var(--bg-card-hover); }
.erow-main { flex: 1; min-width: 0; }
.erow-date {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 0.35rem;
}
.erow-title {
  font-family: var(--font-serif); font-size: 1.05rem; font-weight: 500;
  color: var(--text); line-height: 1.5;
}
.erow-tagline {
  font-size: 0.82rem; color: var(--text-sub); line-height: 1.6; margin-top: 0.3rem;
}
.erow-arrow {
  flex-shrink: 0; color: var(--accent); font-size: 0.9rem; opacity: 0.5;
  transition: opacity var(--transition), transform var(--transition);
}
.erow:hover .erow-arrow { opacity: 1; transform: translateX(2px); }

/* --- Article page ---------------------------------------------- */
.article { max-width: 780px; margin: 0 auto; padding: 5rem 2rem 3rem; }
.article-meta {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 1.1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
}
.article-cat { color: var(--accent); text-transform: uppercase; }
.article-meta-sep { color: var(--border-med); }
.article-h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.9rem, 5vw, 2.8rem); line-height: 1.25;
  letter-spacing: -0.01em; color: var(--text);
}
.article-lead {
  font-family: var(--font-serif); font-weight: 300;
  font-size: 1rem; line-height: 1.9; color: var(--text-sub);
  border-left: 2px solid var(--accent); padding-left: 1.15rem;
  margin-top: 1.6rem;
}
.article-body { font-family: var(--font-serif); margin-top: 2.5rem; }

/* --- Shared prose (used by both the article body and the index) - */
.ep {
  font-size: 1.02rem; line-height: 1.95; color: var(--text-sub);
  margin-bottom: 1.15rem;
}
.ep:last-child { margin-bottom: 0; }
.ep-rule {
  width: 40px; height: 1px; background: var(--border-med);
  margin: 1.75rem 0;
}
/* 長文的分節小標。2026-09 加入 —— 兩三千字的文章需要換氣的地方，
   短文時期沒有這個需求，所以原本沒有這條。 */
.ep-h {
  font-family: var(--font-body); font-weight: 500;
  font-size: 0.82rem; letter-spacing: 0.08em; text-transform: none;
  color: var(--accent); margin: 2.6rem 0 1.1rem;
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--border);
}
.ep-h:first-child { margin-top: 0; }
.article-body .ep b,
.article-body .ep strong { color: var(--text); font-weight: 500; }
.ep-list {
  list-style: none; margin: 0 0 1.15rem; padding: 0; counter-reset: li;
  display: flex; flex-direction: column; gap: 0.6rem;
}
.ep-list li {
  font-size: 0.98rem; line-height: 1.8; color: var(--text-sub);
  padding-left: 1.4rem; position: relative;
}
.ep-list li b { color: var(--text); font-weight: 500; }
.ep-list li::before {
  content: counter(li); counter-increment: li;
  position: absolute; left: 0; top: 0;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent);
}
.essay-hashtag {
  margin-top: 1.3rem; font-family: var(--font-body); font-size: 0.82rem;
  color: var(--accent); opacity: 0.85;
}
/* ASCII 示意圖。2026-09-03 加入 —— Passkey 那篇的流程圖需要等寬字體，
   而且窄螢幕要能自己橫向捲動，不能撐破頁面。 */
.ep-pre {
  font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.7;
  color: var(--text-sub); background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; margin: 0 0 1.15rem;
  overflow-x: auto; white-space: pre; -webkit-overflow-scrolling: touch;
}
.ep-pre b { color: var(--accent); font-weight: 500; }
.ep-pre-label {
  font-family: var(--font-body); font-size: 0.72rem; letter-spacing: 0.06em;
  color: var(--text-muted); margin: 0 0 0.5rem;
}

.essay-note {
  margin-top: 1.3rem; font-size: 0.78rem; font-family: var(--font-body);
  color: var(--text-muted); font-style: italic;
}

/* --- Article page: previous / next ------------------------------ */
.prevnext {
  max-width: 780px; margin: 0 auto; padding: 0 2rem 4rem;
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  border-top: 1px solid var(--border); padding-top: 2.5rem;
}
.pn {
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 1.1rem 1.3rem; background: var(--bg-card);
  transition: background var(--transition);
}
.pn:hover { background: var(--bg-card-hover); }
.pn--next { text-align: right; }
.pn-label {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em;
  color: var(--accent); text-transform: uppercase;
}
.pn-title {
  font-family: var(--font-serif); font-size: 0.95rem; color: var(--text);
  line-height: 1.5;
}
.pn-empty { background: transparent; }

.essays-foot {
  max-width: 780px; margin: 0 auto; padding: 0 2rem 5rem;
  text-align: center;
}
.essays-foot a {
  font-family: var(--font-body); font-size: 0.9rem; color: var(--accent);
  border: 1px solid var(--accent-border); border-radius: var(--radius);
  padding: 0.7rem 1.6rem; display: inline-block;
  transition: background var(--transition);
}
.essays-foot a:hover { background: var(--accent-dim); }

/* --- Static pages (privacy, contact) ---------------------------- */
.doc { max-width: 780px; margin: 0 auto; padding: 5rem 2rem 5rem; }
.doc h2 {
  font-family: var(--font-serif); font-size: 1.25rem; font-weight: 500;
  color: var(--text); line-height: 1.5;
  margin: 3rem 0 1.1rem; padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
}
.doc h2:first-of-type { margin-top: 2rem; }
.doc p, .doc li {
  font-family: var(--font-serif); font-size: 1rem; line-height: 1.95;
  color: var(--text-sub);
}
.doc p { margin-bottom: 1.15rem; }
.doc ul { list-style: none; margin: 0 0 1.15rem; padding: 0; }
.doc ul li { padding-left: 1.2rem; position: relative; margin-bottom: 0.6rem; }
.doc ul li::before {
  content: '—'; position: absolute; left: 0; top: 0; color: var(--accent);
}
.doc a { color: var(--accent); border-bottom: 1px solid var(--accent-border); }
.doc-updated {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.08em;
  color: var(--text-muted); margin-top: 3rem;
  padding-top: 1.5rem; border-top: 1px solid var(--border);
}

/* --- Footer links (added alongside the shared .footer) ---------- */
.footer-links {
  display: flex; flex-wrap: wrap; gap: 1rem;
  font-size: 0.75rem;
}
.footer-links a {
  color: var(--text-muted);
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--accent); }

@media (max-width: 600px) {
  .subbar, .essays-hero, .toc, .essays-main, .essays-foot,
  .article, .prevnext, .doc { padding-left: 1.25rem; padding-right: 1.25rem; }
  .essays-main, .article { padding-top: 2.5rem; }
  .subbar-title { display: none; }
  /* .subbar-title carried the margin-left:auto that right-aligned the bar. */
  .subbar-inner .theme-btn { margin-left: auto; }
  .prevnext { grid-template-columns: 1fr; }
  .pn--next { text-align: left; }
}
