/* ─── writing.css — /writing/ page styles ───────────────────────────────── */

/* ── PAGE HERO ───────────────────────────────────────────────────────────── */

.page-hero {
  position: relative;
  padding: 11rem 5vw 4rem;
  background: var(--ink);
  overflow: hidden;
}

.page-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#page-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
}

.page-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(10,10,10,0.5) 0%, rgba(10,10,10,0.94) 100%);
  z-index: 1;
}

.page-hero-content {
  position: relative;
  z-index: 2;
  max-width: 860px;
}

.page-hero-content .label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 1.25rem;
}

.page-hero-content h1 {
  font-size: clamp(3rem, 8vw, 7rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.92;
  margin-bottom: 0;
  opacity: 0;
  transform: translateY(50px);
  animation: pageUp 0.9s 0.25s var(--ease) forwards;
}

@keyframes pageUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ── SECTION TABS ─────────────────────────────────────────────────────────── */

.section-tabs {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-tabs-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  gap: 0;
}

.section-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 1rem 1.25rem;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.section-tab:hover {
  color: var(--white);
}

.section-tab.active {
  color: var(--white);
  border-bottom-color: var(--accent);
}

/* ── WRITING MAIN ─────────────────────────────────────────────────────────── */

.writing-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 2rem 6rem;
}

/* ── INTRO TEXT ───────────────────────────────────────────────────────────── */

#blog_intro {
  margin-bottom: 1.5rem;
}

#blog_intro p {
  font-size: 0.97rem;
  line-height: 1.8;
  color: var(--white);
  max-width: 680px;
}

#blog_intro p b {
  color: var(--white);
  font-weight: 600;
}

#blog_intro h2, #blog_intro h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  margin: 1.5rem 0 0.5rem;
}

#blog_intro h3 { font-size: 0.95rem; }

#blog_intro ul {
  padding-left: 1.25rem;
  color: var(--white);
  font-size: 0.97rem;
  line-height: 2;
}

#blog_intro a {
  color: rgba(100, 160, 255, 0.85);
  text-decoration: none;
}
#blog_intro a:hover { text-decoration: underline; }

#blog_intro hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 1.5rem 0;
}

/* ── POST CARD — wraps nav bars + article as one unit ─────────────────────── */

.post-card {
  border-radius: 6px;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.38);
  overflow: hidden;
  margin: 0.5rem 0 1.5rem;
  position: relative;
}

/* ── POST NAVIGATION ──────────────────────────────────────────────────────── */

.post-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 3rem;
  background: #ece9e2;
}

#post-nav-top  .post-nav { border-bottom: 1px solid rgba(0, 0, 0, 0.09); }
#post-nav-bottom .post-nav { border-top:  1px solid rgba(0, 0, 0, 0.09); }

.post-nav-btn {
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 4px;
  padding: 0.4rem 1rem;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 500;
  color: #1a1a1a;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.post-nav-btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.35);
}

.post-nav-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.post-nav-center {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.74rem;
  color: rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  flex-shrink: 0;
}

.post-nav-sep { opacity: 0.35; }

.post-nav-text-btn {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 0.74rem;
  color: rgba(0, 0, 0, 0.45);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.post-nav-text-btn:hover:not(:disabled) { color: #0a0a0a; }
.post-nav-text-btn:disabled { opacity: 0.25; cursor: not-allowed; }

.post-nav-browse        { color: #8b1a1a; opacity: 0.85; }
.post-nav-browse:hover  { opacity: 1; }

/* ── BROWSE DROPDOWN ──────────────────────────────────────────────────────── */

#browse-dropdown {
  position: absolute;
  z-index: 300;
  background: #f5f3ee;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.28);
  max-height: 52vh;
  overflow-y: auto;
  font-size: 0.83rem;
  line-height: 1;
  color: #1a1a1a;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.18) transparent;
}

.browse-header {
  padding: 0.75rem 1.25rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(0, 0, 0, 0.09);
  position: sticky;
  top: 0;
  background: #f5f3ee;
}

.browse-item {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.55rem 1.25rem;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  text-decoration: none;
  color: inherit;
}

.browse-item:hover { background: rgba(0, 0, 0, 0.05); }
.browse-item.current { background: rgba(139, 26, 26, 0.07); }

.browse-date {
  font-size: 0.72rem;
  color: rgba(0, 0, 0, 0.38);
  white-space: nowrap;
  flex-shrink: 0;
}

.browse-title { color: #1a1a1a; line-height: 1.35; }

/* ── POST CONTENT — document card ─────────────────────────────────────────── */

#preview_area {
  background: #f5f3ee;
  padding: 2.5rem 3rem 2rem;
  color: #1a1a1a;
}

#preview_area hr {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  margin: 1.5rem 0;
}

#blog_body {
  font-size: 0.97rem;
  line-height: 1.8;
}

.blog_title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  color: #0a0a0a;
}

.post-dateline {
  display: flex;
  align-items: baseline;
  gap: 0;
  margin-bottom: 0.4rem;
  line-height: 1;
}

.post-year {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 800;
  color: #8b1a1a;
  letter-spacing: -0.02em;
}

.post-month-day {
  font-size: 1.3rem;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.42);
}

#blog_body p    { margin-bottom: 1rem; max-width: 700px; }
#blog_body ul,
#blog_body ol   { padding-left: 1.5rem; margin-bottom: 1rem; max-width: 700px; }
#blog_body li   { margin-bottom: 0.35rem; }
#blog_body h1   { font-size: 1.5rem; font-weight: 700; margin: 1.75rem 0 0.75rem; color: #0a0a0a; }
#blog_body h2   { font-size: 1.25rem; font-weight: 700; margin: 1.5rem 0 0.65rem; color: #111; }
#blog_body h3   { font-size: 1.05rem; font-weight: 600; margin: 1.25rem 0 0.5rem; color: #111; }
#blog_body hr   { border: none; border-top: 1px solid rgba(0,0,0,0.1); margin: 1.5rem 0; }
#blog_body img  { max-width: 100%; height: auto; border-radius: 4px; margin: 1rem 0; display: block; }

/* pull in dark text from email-formatted HTML; set links to a readable dark blue */
#blog_body *   { color: #1a1a1a; }
#blog_body a   { color: #1a4a9a !important; text-decoration: none; transition: color 0.2s; }
#blog_body a:hover { color: #0033cc !important; text-decoration: underline; }

#blog_body .blog_title  { color: #0a0a0a !important; }
#blog_body .post-year   { color: #8b1a1a !important; }

.clickable {
  cursor: pointer;
  color: #8b1a1a !important;
}

/* ── PERMALINK AREA ───────────────────────────────────────────────────────── */

#permalink {
  color: rgba(0, 0, 0, 0.38);
  font-size: 0.82rem;
  font-family: monospace;
}

#preview_area a { color: #1a4a9a !important; }

/* ── PATENTS ──────────────────────────────────────────────────────────────── */

.patent-meta {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.patent-num {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.patent-num a {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a4a9a !important;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.patent-num a:hover { text-decoration: underline; }

.patent-badge {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b4a00;
  background: #fff3cd;
  border: 1px solid #e6c96e;
  border-radius: 3px;
  padding: 0.2rem 0.55rem;
}

.patent-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 1.25rem;
  margin: 0;
}

.patent-dl dt {
  font-size: 0.76rem;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.42);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  padding: 0.1rem 0;
}

.patent-dl dd {
  font-size: 0.83rem;
  color: #2a2a2a;
  margin: 0;
  padding: 0.1rem 0;
}

.patent-abstract {
  font-size: 0.95rem;
  line-height: 1.8;
  color: #1a1a1a;
  max-width: 700px;
  margin-bottom: 1.5rem;
}

.patent-view-link {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 500;
  color: #1a4a9a !important;
  text-decoration: none;
  border: 1px solid rgba(26, 74, 154, 0.28);
  border-radius: 4px;
  padding: 0.35rem 0.85rem;
  transition: background 0.2s, border-color 0.2s;
}

.patent-view-link:hover {
  background: rgba(26, 74, 154, 0.06);
  border-color: rgba(26, 74, 154, 0.5);
  text-decoration: none !important;
}

/* Patent body — section headings, claims, figure grid */

#blog_body .patent-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.38) !important;
  margin: 2rem 0 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.09);
}

.patent-summary {
  font-size: 0.95rem;
  line-height: 1.82;
  color: #1a1a1a;
  max-width: 700px;
  margin-bottom: 0.25rem;
}

.patent-claims {
  font-size: 0.87rem;
  line-height: 1.72;
  color: #2a2a2a;
  max-width: 700px;
  padding-left: 1.4rem;
  margin: 0 0 0.25rem;
}

.patent-claims li { margin-bottom: 0.65rem; }

.patent-figures {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.6rem;
  margin: 0.5rem 0 1.25rem;
}

.patent-figure {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.patent-figure img {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 640px) {
  .patent-figures { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ── BLOG INDEX / BROWSE LIST ─────────────────────────────────────────────── */

#blog_index {
  margin-top: 2rem;
  padding: 1.5rem 1.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  max-height: 55vh;
  overflow-y: auto;
  font-size: 0.84rem;
  line-height: 2.1;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.ind {
  display: block;
  padding-left: 0;
}

#blog_index a {
  color: rgba(100, 160, 255, 0.75);
  text-decoration: none;
}
#blog_index a:hover {
  color: var(--white);
  text-decoration: underline;
}

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .page-hero { padding: 9rem 1.5rem 3rem; }
  .writing-main { padding: 2rem 1.25rem 4rem; }
  .section-tabs-inner { padding: 0 1rem; }
  .section-tab { padding: 0.875rem 0.875rem; font-size: 0.72rem; }
  .post-nav-center { display: none; }
  .post-nav { padding: 0.75rem 1.25rem; }
  #preview_area { padding: 1.75rem 1.5rem 1.5rem; }
}
