/* Blog posts, hubs and free tools. Loaded after main.css on generated pages. */

.post-page .post,
.tool-page .post {
  max-width: 760px;
  margin: 0 auto;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 18px;
}
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--brand); }
.crumbs span:last-child { color: var(--text-dim); }

.post-kicker {
  color: var(--brand) !important;
  font-weight: 700;
  font-size: 0.85rem !important;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.post h1 {
  font-size: clamp(2rem, 4.2vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.post-meta {
  font-size: 0.9rem !important;
  color: var(--text-dim) !important;
  margin-bottom: 26px;
}

.post-hero {
  margin: 0 0 28px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-alt);
  aspect-ratio: 3 / 2;
}
.post-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

.post-tldr {
  background: var(--brand-soft);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.post-tldr p { color: var(--text) !important; margin: 0; }
@media (prefers-color-scheme: dark) {
  .post-tldr { background: rgba(200, 16, 46, 0.12); }
}

.post-jump a {
  display: inline-flex;
  font-weight: 700;
  color: var(--brand);
  font-size: 0.95rem;
}

.post h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.65rem);
  margin-top: 40px;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}
.post h3 {
  font-size: 1.12rem;
  margin-top: 24px;
  margin-bottom: 10px;
}
.post p, .post li { color: var(--text-muted); font-size: 1.04rem; line-height: 1.75; }
.post p { margin-bottom: 14px; }
.post a:not(.btn):not(.btn-store):not(.post-card):not(.tool-card) { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.post strong { color: var(--text); }

.post ul, .post ol {
  margin: 12px 0 18px;
  padding-left: 1.4em;
  display: grid;
  gap: 8px;
}
.post ul { list-style: disc outside; }
.post ol { list-style: decimal outside; }
.post li::marker { color: var(--brand); font-weight: 700; }

.post-tip {
  border-left: 3px solid var(--brand);
  background: var(--bg-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 18px 0;
}
.post-tip p { margin: 0; color: var(--text) !important; }

.table-wrap {
  overflow-x: auto;
  margin: 16px 0 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.post table { width: 100%; border-collapse: collapse; font-size: 0.95rem; min-width: 460px; }
.post caption { text-align: left; padding: 12px 14px 0; color: var(--text-dim); font-size: 0.88rem; }
.post th, .post td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.post thead th { background: var(--bg-alt); color: var(--text); font-weight: 700; font-size: 0.86rem; }
.post tbody th { color: var(--text); font-weight: 600; }
.post td { color: var(--text-muted); }
.post tbody tr:last-child th, .post tbody tr:last-child td { border-bottom: 0; }

/* Recipe card */
.recipe-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 26px 18px;
  margin: 30px 0 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.recipe-box h2 { margin-top: 0 !important; }
.recipe-facts, .recipe-nutrition {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin: 8px 0 6px;
}
.recipe-facts div, .recipe-nutrition div {
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.recipe-facts dt, .recipe-nutrition dt { font-size: 0.78rem; color: var(--text-dim); font-weight: 600; }
.recipe-facts dd, .recipe-nutrition dd { margin: 2px 0 0; font-weight: 700; color: var(--text); }
.recipe-steps li { padding-left: 4px; }
.recipe-note { font-size: 0.86rem !important; color: var(--text-dim) !important; margin-top: 10px; }

/* FAQ inside posts reuses .faq-item from main.css */
.post-faq .faq-item { margin-bottom: 10px; }
.post-faq .faq-item .answer p { margin: 0; }

/* CTA */
.post-cta {
  margin: 44px 0 10px;
  padding: 30px 26px;
  border-radius: var(--radius-lg);
  background: #0E0F12;
  color: #fff;
  text-align: center;
}
.post-cta h2 { color: #fff; margin-top: 0 !important; }
.post-cta p { color: rgba(255, 255, 255, 0.78) !important; max-width: 52ch; margin: 0 auto 18px; }
.post-cta .cta-stores { justify-content: center; }
.post-cta .btn-store { background: #fff; color: #0E0F12; }
.post-cta .btn-store:hover { background: var(--brand); color: #fff; }
.post-cta .btn-store strong, .post-cta .btn-store small { color: inherit; }

/* Cards and grids */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  margin: 14px 0 10px;
}
.post-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: transform 0.2s var(--easing), box-shadow 0.2s var(--easing);
  text-decoration: none !important;
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.post-card img, .post-card-ph { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; background: var(--bg-alt); }
.post-card-body { display: grid; gap: 6px; padding: 14px 16px 18px; }
.post-card-kicker { font-size: 0.76rem; font-weight: 700; color: var(--brand); }
.post-card-title { font-weight: 700; color: var(--text); line-height: 1.3; }
.post-card-excerpt { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 14px 0 10px;
}
.tool-card {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none !important;
  transition: border-color 0.2s var(--easing), transform 0.2s var(--easing);
}
.tool-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.tool-card-icon { font-size: 0; color: var(--brand); }
.tool-card-icon svg { width: 26px; height: 26px; }
.tool-card-title { font-weight: 700; color: var(--text); }
.tool-card-text { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

.post-related, .post-tools { margin-top: 40px; }

.home-blog .post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 0; }
.home-blog .tool-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.home-blog .tool-card { align-content: start; }
.home-blog-sub { font-size: 1.2rem; margin: 44px 0 16px; }
.home-blog-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }
@media (max-width: 960px) {
  .home-blog .post-grid, .home-blog .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .home-blog .post-grid, .home-blog .tool-grid { grid-template-columns: minmax(0, 1fr); }
  .home-blog-actions { flex-direction: column; align-items: stretch; }
  .home-blog .post-grid > .post-card:nth-child(n+4) { display: none; }
  .home-blog .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Hubs */
.hub-page .container > section { margin-top: 44px; padding: 0; }
.post-faq, .post-related, .post-tools { padding: 0; }
.hub-head { max-width: 760px; }
.hub-head h1 { font-size: clamp(2rem, 4.2vw, 2.9rem); line-height: 1.12; letter-spacing: -0.02em; margin-bottom: 14px; }
.hub-page h2 { font-size: 1.5rem; }

/* Tool widget base */
.tool-widget {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
  margin: 10px 0 34px;
}
.tool-widget .tw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.tool-widget label { display: grid; gap: 6px; font-size: 0.86rem; font-weight: 600; color: var(--text); }
.tool-widget input, .tool-widget select, .tool-widget textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
}
.tool-widget textarea { min-height: 160px; resize: vertical; line-height: 1.5; }
.tool-widget input:focus, .tool-widget select:focus, .tool-widget textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.tool-widget .tw-result {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--text);
}
@media (prefers-color-scheme: dark) {
  .tool-widget .tw-result { background: rgba(200, 16, 46, 0.12); }
}
.tool-widget .tw-big { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.tool-widget .tw-muted { color: var(--text-muted); font-size: 0.92rem; }
.tool-widget .btn { margin-top: 14px; }

@media (max-width: 720px) {
  .doc-page.post-page, .doc-page.tool-page, .doc-page.hub-page { padding-top: 110px; }
  .recipe-box { padding: 20px 16px 12px; }
  .tool-widget { padding: 18px 16px; }
  .post-cta { padding: 26px 18px; }
  .header-cta { display: none; }
}

/* ---------- Tool-specific styles (below) ---------- */

.tool-widget [hidden] { display: none !important; }
.tool-widget .tw-grid + .tw-grid, .tool-widget .tw-grid + label, .tool-widget label + .tw-grid { margin-top: 14px; }
.tool-widget fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.tool-widget legend { font-size: 0.86rem; font-weight: 600; color: var(--text); padding: 0; margin-bottom: 10px; }
.tool-widget .tw-big { margin: 2px 0 6px; line-height: 1.15; }
.tool-widget .tw-result > p:last-child { margin-bottom: 0; }
.tool-widget .tw-small { font-size: 0.82rem !important; margin-top: 12px; }
.tool-widget .tw-hint { font-size: 0.84rem !important; color: var(--text-dim) !important; margin: 10px 0 0; }

.tool-widget .tw-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tool-widget fieldset .tw-chips { margin-top: 0; }
.tool-widget .tw-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s var(--easing), border-color 0.15s var(--easing), color 0.15s var(--easing);
}
.tool-widget .tw-chip:hover { border-color: var(--brand); }
.tool-widget .tw-chip[aria-pressed="true"],
.tool-widget .tw-chip:has(input:checked) { background: var(--brand); border-color: var(--brand); color: #fff; }
.tool-widget .tw-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; padding: 0; pointer-events: none; }
.tool-widget .tw-chip:focus-visible,
.tool-widget .tw-chip:has(input:focus-visible) { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }

.tool-widget .tw-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 6px; }
.tool-widget .tw-stat { display: grid; gap: 3px; align-content: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; }
.tool-widget .tw-stat-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.tool-widget .tw-stat-value { font-size: 1.1rem; font-weight: 800; color: var(--text); letter-spacing: -0.01em; }
.tool-widget .tw-stat-sub { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }
.tool-widget .tw-stat.is-main { border-color: var(--brand); }

.tool-widget .tw-note {
  margin: 12px 0 4px;
  padding: 10px 14px;
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface);
  color: var(--text) !important;
  font-size: 0.93rem !important;
  line-height: 1.55;
}
.tool-widget .tw-note.is-warn { border-left-color: #D97706; }

.tool-widget .tw-ref { margin-top: 16px; }
.tool-widget .tw-ref-title { font-size: 0.86rem !important; font-weight: 700; color: var(--text) !important; margin: 14px 0 8px; }
.tool-widget .tw-ref-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 0; }
.tool-widget .tw-ref-list div { background: var(--surface); border-radius: var(--radius-sm); padding: 8px 11px; }
.tool-widget .tw-ref-list dt { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.tool-widget .tw-ref-list dd { margin: 1px 0 0; font-weight: 700; color: var(--text); }

.tool-widget .tw-table { margin: 14px 0 0; background: var(--surface); }
.tool-widget .tw-table table { min-width: 360px; font-size: 0.9rem; }
.tool-widget .tw-table th, .tool-widget .tw-table td { padding: 8px 12px; }
.tool-widget .tw-table tr.is-near th, .tool-widget .tw-table tr.is-near td { background: var(--brand); color: #fff; }

.tool-widget .tw-lines { list-style: none; padding-left: 0; margin: 8px 0 0; gap: 6px; }
.tool-widget .tw-lines li { background: var(--surface); border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text); font-size: 1rem; line-height: 1.5; }
.tool-widget .tw-lines li.is-same { color: var(--text-muted); }
.tool-widget .tw-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.tool-widget .tw-actions .btn { margin-top: 0; }

.tool-widget .tw-timer { margin-top: 18px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); text-align: center; background: var(--bg-alt); }
.tool-widget .tw-timer-display { font-size: clamp(2.8rem, 12vw, 4rem); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1.1; }
.tool-widget .tw-timer-display.is-running { color: var(--brand); }
.tool-widget .tw-timer-display.is-done { color: var(--brand); animation: tw-pulse 1s ease-in-out 3; }
.tool-widget .tw-timer .tw-actions { justify-content: center; }
.tool-widget .tw-timer .tw-actions .btn { min-width: 120px; }
.tool-widget .tw-timer-msg { margin: 12px 0 0 !important; font-weight: 700; color: var(--text) !important; min-height: 1.5em; }
@keyframes tw-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .tool-widget .tw-timer-display.is-done { animation: none; } }

.tool-widget .tw-subs { display: grid; gap: 10px; margin-top: 10px; max-height: 640px; overflow-y: auto; padding-right: 2px; }
.tool-widget .tw-sub { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 15px; background: var(--bg-alt); }
.tool-widget .tw-sub p { margin: 0; font-size: 0.95rem; line-height: 1.55; }
.tool-widget .tw-sub-name { font-weight: 700; color: var(--text) !important; }
.tool-widget .tw-sub-use { color: var(--text) !important; margin-top: 3px !important; }
.tool-widget .tw-sub-use span { color: var(--brand); font-weight: 700; }
.tool-widget .tw-sub-note { font-size: 0.87rem !important; margin-top: 4px !important; }
.tool-widget [data-count] { margin: 14px 0 0; }

.tool-widget .tw-add { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 16px; }
.tool-widget .tw-add .btn { margin-top: 0; }
.tool-widget .tw-empty { margin: 0; color: var(--text-muted) !important; }
.tool-widget .tw-recipes { display: grid; gap: 10px; margin-top: 8px; }
.tool-widget a.tw-recipe {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text) !important;
  text-decoration: none !important;
  transition: border-color 0.15s var(--easing);
}
.tool-widget a.tw-recipe:hover { border-color: var(--brand); }
.tool-widget .tw-recipe img, .tool-widget .tw-recipe-ph { width: 96px; height: 64px; object-fit: cover; border-radius: 8px; background: var(--bg-alt); display: block; }
.tool-widget .tw-recipe-body { display: grid; gap: 4px; min-width: 0; }
.tool-widget .tw-recipe-title { font-weight: 700; line-height: 1.3; }
.tool-widget .tw-recipe-meta, .tool-widget .tw-recipe-missing { font-size: 0.84rem; color: var(--text-muted); line-height: 1.4; }
.tool-widget .tw-bar { display: block; height: 5px; border-radius: 999px; background: var(--border); overflow: hidden; }
.tool-widget .tw-bar span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }

@media (prefers-color-scheme: dark) {
  .tool-widget .tw-note.is-warn { border-left-color: #F59E0B; }
}

@media (max-width: 480px) {
  .tool-widget .tw-stats { grid-template-columns: 1fr 1fr; }
  .tool-widget .tw-stat-value { font-size: 1rem; }
  .tool-widget .tw-actions .btn { width: auto; min-width: 0; flex: 1 1 0; }
  .tool-widget .tw-timer { padding: 16px 12px; }
  .tool-widget .tw-add { grid-template-columns: 1fr; }
  .tool-widget .tw-add .btn { width: 100%; }
  .tool-widget a.tw-recipe { grid-template-columns: 72px 1fr; gap: 10px; }
  .tool-widget .tw-recipe img, .tool-widget .tw-recipe-ph { width: 72px; height: 54px; }
}
.tool-widget .tw-block { margin-top: 14px; }
