/* =========================================================
   Howuku archive — single stylesheet, no framework, no JS
   Target: fast Core Web Vitals, clean reading experience
   ========================================================= */

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

/* ----- Tokens ----- */
:root {
  --text:        #18181b;
  --text-muted:  #52525b;
  --text-faint:  #a1a1aa;
  --bg:          #ffffff;
  --bg-subtle:   #f4f4f5;
  --border:      #e4e4e7;
  --accent:      #2563eb;
  --accent-dark: #1d4ed8;
  --serif:       ui-serif, Georgia, "Times New Roman", serif;
  --sans:        system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius:      8px;
  --max-prose:   720px;
  --max-page:    1100px;
}

/* ----- Base ----- */
html { font-size: 17px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

img, video { max-width: 100%; height: auto; display: block; }

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

/* ----- Top bar ----- */
.hw-mida-topbar {
  background: #18181b;
  color: #d4d4d8;
  font-size: 13px;
}
.hw-mida-topbar-inner {
  max-width: var(--max-page);
  margin: 0 auto;
  padding: 9px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  justify-content: space-between;
}
.hw-mida-topbar-cta {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  font-size: 13px;
}
.hw-mida-topbar-cta:hover { text-decoration: underline; color: #fff; }

/* ----- Nav / breadcrumb ----- */
.hw-nav {
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}
.hw-nav-inner {
  max-width: var(--max-page);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 52px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}
.hw-nav-inner a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}
.hw-nav-inner a:hover { color: var(--text); }
.hw-nav-sep { color: var(--text-faint); user-select: none; }

/* ----- Page shell ----- */
.hw-page {
  max-width: var(--max-page);
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ----- Hero / home landing ----- */
.hw-landing-hero {
  padding: 56px 0 40px;
  max-width: 680px;
}
.hw-landing-title {
  font-size: clamp(1.75rem, 4.5vw, 2.5rem);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  color: var(--text);
}
.hw-landing-lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 0 0 28px;
  line-height: 1.65;
}
.hw-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ----- Buttons ----- */
.hw-btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  line-height: 1.4;
  cursor: pointer;
  transition: opacity .15s;
}
.hw-btn:hover { opacity: .88; }
.hw-btn-dark {
  background: var(--text);
  color: #fff !important;
  border: 1.5px solid var(--text);
}
.hw-btn-outline {
  background: transparent;
  color: var(--text) !important;
  border: 1.5px solid var(--border);
}
.hw-btn-outline:hover { border-color: #a1a1aa; }

/* Alias old class names used in partials */
.hw-mida-btn { display: inline-block; padding: 10px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 600; text-decoration: none !important; line-height: 1.4; }
.hw-mida-btn:hover { opacity: .88; }
.hw-mida-btn-primary { background: var(--text); color: #fff !important; border: 1.5px solid var(--text); }
.hw-mida-btn-ghost   { background: transparent; color: var(--text) !important; border: 1.5px solid var(--border); }
.hw-mida-btn-ghost:hover { border-color: #a1a1aa; }

/* ----- Blog index ----- */
.hw-index-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.hw-index-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 8px;
}
.hw-index-desc {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0;
}

.hw-post-list { list-style: none; margin: 0; padding: 0; }
.hw-post-list li {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}
.hw-post-list li:last-child { border-bottom: none; }
.hw-post-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
}
.hw-post-title:hover { color: var(--accent); }
.hw-post-excerpt {
  font-size: 14px;
  color: var(--text-muted);
  margin: 5px 0 0;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hw-post-meta {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.hw-tag {
  display: inline-block;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}

/* ----- Article ----- */
.hw-article-wrap {
  max-width: var(--max-prose);
  margin: 0 auto;
  padding: 40px 0 64px;
}

.hw-article-kicker {
  margin-bottom: 14px;
}

.hw-article-title {
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 20px;
  color: var(--text);
}

.hw-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--text-muted);
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.hw-byline-dot { color: var(--text-faint); }

.hw-provenance {
  font-size: 13px;
  color: var(--text-faint);
  font-style: italic;
  margin: 0 0 28px;
  padding: 12px 16px;
  border-left: 3px solid var(--border);
  background: var(--bg-subtle);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.hw-hero-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin-bottom: 32px;
  aspect-ratio: 16/9;
  object-fit: cover;
}

/* ----- Rich text body ----- */
.hw-richtext {
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
}

.hw-richtext > * + * { margin-top: 1.25em; }
.hw-richtext p { margin: 0 0 1.15em; }

.hw-richtext h2 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  margin: 2em 0 0.6em;
  color: var(--text);
}
.hw-richtext h3 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin: 1.75em 0 0.5em;
}
.hw-richtext h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.5em 0 0.4em;
}

.hw-richtext ul, .hw-richtext ol {
  margin: 0 0 1.15em;
  padding-left: 1.5em;
}
.hw-richtext li { margin-bottom: 0.35em; }

/* Images: strip inline dimensions at build time but belt + braces in CSS */
.hw-richtext img {
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  border-radius: 6px;
  margin: 1.5em 0;
}

/* Table scroll wrapper (added by build pipeline) */
.hw-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5em 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.hw-table-wrap table { margin: 0; border: none; }

.hw-richtext table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  white-space: nowrap;
}
.hw-richtext th {
  background: var(--bg-subtle);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.hw-richtext td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  white-space: normal;
}
.hw-richtext tr:last-child td { border-bottom: none; }

.hw-richtext pre, .hw-richtext code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
  font-size: 0.88em;
}
.hw-richtext pre {
  background: #18181b;
  color: #e4e4e7;
  padding: 18px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.6;
}
.hw-richtext :not(pre) > code {
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.hw-richtext blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5em 0;
  padding: 4px 0 4px 20px;
  color: var(--text-muted);
  font-style: italic;
}

.hw-richtext hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

/* Webflow figure wrappers */
.hw-richtext figure { margin: 1.5em 0; }
.hw-richtext figcaption {
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 6px;
  text-align: center;
  font-style: italic;
}

/* Webflow rich-text class */
.hw-richtext .w-richtext-align-center { text-align: center; }
.hw-richtext .w-richtext-figure-type-image { margin: 1.5em 0; }
.hw-richtext .w-richtext-figure-type-image div { display: flex; justify-content: center; }
.hw-richtext .w-richtext-figure-type-image img { max-width: 100% !important; height: auto !important; }

/* ----- In-article CTA card ----- */
.hw-mida-cta {
  margin: 48px 0;
  padding: 28px 28px 24px;
  border-radius: 12px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
}
.hw-mida-cta-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3b82f6;
  margin: 0 0 8px;
}
.hw-mida-cta-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
}
.hw-mida-cta-body {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0 0 18px;
  line-height: 1.6;
}
.hw-mida-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ----- Related posts ----- */
.hw-related {
  margin-top: 52px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.hw-related-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 0 0 16px;
}
.hw-related-list { list-style: none; margin: 0; padding: 0; }
.hw-related-list li { margin-bottom: 10px; }
.hw-related-list a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}
.hw-related-list a:hover { color: var(--accent); }

/* ----- Mida free tools panel ----- */
.hw-tools-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  margin: 32px 0;
  background: var(--bg-subtle);
}
.hw-tools-panel-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin: 0 0 10px;
}
.hw-tools-panel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hw-tools-panel-list li { margin: 0; }
.hw-tools-panel-list a {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 11px;
  transition: border-color .15s;
}
.hw-tools-panel-list a:hover { border-color: var(--accent); }

/* ----- Inline glossary links ----- */
.hw-gloss-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

/* ----- Site footer ----- */
.hw-mida-site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 40px 20px;
}
.hw-mida-site-footer-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}
.hw-mida-site-footer-copy {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 20px;
  line-height: 1.65;
}
.hw-mida-site-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* ----- 404 / center pages ----- */
.hw-centre {
  text-align: center;
  padding: 80px 20px;
  max-width: 480px;
  margin: 0 auto;
}
.hw-centre h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0 0 12px;
}
.hw-centre p { color: var(--text-muted); }

/* ----- Utility ----- */
.hw-muted { font-size: 14px; color: var(--text-muted); }

/* ----- Responsive ----- */
@media (max-width: 600px) {
  html { font-size: 16px; }
  .hw-page { padding: 24px 16px 60px; }
  .hw-article-wrap { padding: 28px 0 48px; }
  .hw-article-title { font-size: 1.65rem; }
  .hw-mida-cta { padding: 20px 18px; }
  .hw-richtext table { font-size: 13px; }
}
