/* Bloom Guide - shell styles
   Designed to feel native inside the Bloom Hub dialog (iframe). */

:root {
  /* Bloom brand palette (shared colors) */
  --bloom-yellow: #FEE400;
  --bloom-light-orange: #F9B62B;
  --bloom-dark-orange: #FF7112;
  --bloom-red: #E40D0E;
  --bloom-purple: #9400D9;

  --accent: var(--bloom-dark-orange);
  --accent-hover: #e25f06;
  --accent-soft: var(--bloom-light-orange);
  --accent-soft2: var(--bloom-yellow);
  --text: #000000;
  --text-secondary: #4f4f4f;
  --text-faint: #8a8a8a;
  --divider: #e8e8e8;
  --hover-bg: #faf7f3;
  --active-bg: #fff3e8;
  --bg: #ffffff;
  --radius: 6px;
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand-name { font-size: 16px; font-weight: 600; }
.brand-sub { font-weight: 400; color: var(--text-secondary); }

.mode-tabs { display: flex; gap: 4px; }

.mode-tab {
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 12px 6px;
  cursor: pointer;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.search-wrap { position: relative; margin-left: auto; width: 280px; }

.lang-select {
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: #fff;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 6px 6px;
  cursor: pointer;
  outline: none;
}
.lang-select:hover { border-color: var(--accent-soft); color: var(--text); }
.lang-select:focus { border-color: var(--accent); }

/* Embedded in the Bloom Hub dialog: the host overlays its own open/close
   icons top-right, keep that corner free. */
body.embedded .topbar { padding-right: 104px; }

.translation-note {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 760px;
  margin: 0 0 18px;
  padding: 8px 12px;
  border: 1px solid #f0e2b6;
  background: #fdf8e7;
  border-radius: var(--radius);
  font-size: 12.5px;
  color: #7a6420;
}

#search-input {
  width: 100%;
  font-family: var(--font);
  font-size: 14px;
  padding: 7px 10px;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  outline: none;
}
#search-input:focus { border-color: var(--accent); }

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 360px;
  max-height: 380px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0,0,0,0.12);
  z-index: 50;
}

.search-result {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--divider);
  padding: 10px 12px;
  cursor: pointer;
  font-family: var(--font);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--hover-bg); }
.search-result .sr-title { font-size: 14px; font-weight: 600; color: var(--text); }
.search-result .sr-path { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.search-result .sr-snippet { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }
.search-result .sr-snippet mark { background: #fff1c2; padding: 0 1px; }
.search-empty { padding: 14px 12px; font-size: 12px; color: var(--text-secondary); }

/* ---------- Layout ---------- */

.layout { display: flex; flex: 1; min-height: 0; }

/* ---------- Sidebar ---------- */

.sidebar {
  width: 250px;
  flex-shrink: 0;
  overflow-y: auto;
  border-right: 1px solid var(--divider);
  padding: 14px 8px 24px;
}

.nav-category { margin-bottom: 6px; }

.nav-category-title {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: none;
  padding: 7px 8px;
  cursor: pointer;
  text-align: left;
}
.nav-category-title .chev {
  transition: transform 0.15s;
  color: var(--text-faint);
  flex-shrink: 0;
}
.nav-category.collapsed .chev { transform: rotate(-90deg); }
.nav-category.collapsed .nav-articles { display: none; }

.nav-articles { margin: 0; padding: 0; list-style: none; }

.nav-article {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 8px 6px 26px;
  border-radius: var(--radius);
  cursor: pointer;
}
.nav-article:hover { background: var(--hover-bg); color: var(--text); }
.nav-article.active { background: var(--active-bg); color: var(--accent); font-weight: 600; }

/* ---------- Content ---------- */

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 40px 60px;
  min-width: 0;
}

.breadcrumb {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--text-faint); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 6px; }

.article { max-width: 760px; }

.article h1 { font-size: 27px; font-weight: 600; margin: 0 0 6px; }
.article .article-desc { font-size: 15.5px; color: var(--text-secondary); margin: 0 0 24px; }
.article h2 { font-size: 19.5px; font-weight: 600; margin: 30px 0 10px; }
.article h3 { font-size: 16px; font-weight: 600; margin: 22px 0 8px; }
.article p, .article li { font-size: 15px; line-height: 1.65; color: var(--text); }
.article a { color: var(--accent); }
.article code {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  background: #f4f4f4;
  border-radius: 4px;
  padding: 1px 5px;
}
.article pre {
  background: #f7f7f7;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
}
.article pre code { background: none; padding: 0; }
.article img {
  max-width: 100%;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
}
.article blockquote {
  margin: 14px 0;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--hover-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.article blockquote p { margin: 0; font-size: 14.5px; }
.article table { border-collapse: collapse; width: 100%; margin: 14px 0; }
.article th, .article td {
  border-bottom: 1px solid var(--divider);
  text-align: left;
  padding: 9px 10px;
  font-size: 14px;
}
.article th { font-weight: 600; color: var(--text-secondary); font-size: 13px; }

/* Screenshot placeholder (image not yet captured) */
.img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  margin: 14px 0;
  border: 1.5px dashed #f0d3b6;
  border-radius: var(--radius);
  background: #fffaf4;
  color: var(--text-faint);
  font-size: 12.5px;
  text-align: center;
  padding: 20px;
}

/* Prev / next */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  max-width: 760px;
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--divider);
}
.pager a {
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  max-width: 48%;
}
.pager a span { display: block; font-size: 11px; color: var(--text-faint); margin-bottom: 2px; }
.pager .next { margin-left: auto; text-align: right; }

/* Home / section landing */
.landing h1 { font-size: 27px; font-weight: 600; margin: 0 0 4px; }
.landing .landing-sub { color: var(--text-secondary); margin: 0 0 24px; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  max-width: 860px;
}
.cat-card {
  border: 1px solid var(--divider);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  background: none;
  text-align: left;
  font-family: var(--font);
}
.cat-card:hover { border-color: var(--accent-soft); background: var(--hover-bg); }
.cat-card .cc-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.cat-card .cc-desc { font-size: 13.5px; color: var(--text-secondary); line-height: 1.5; }
.cat-card .cc-count { font-size: 12px; color: var(--text-faint); margin-top: 8px; }

.loading, .notfound { color: var(--text-secondary); padding: 40px; }

/* ---------- What's New ---------- */

.wn-card {
  max-width: 760px;
  border: 1px solid var(--divider);
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}
.wn-card-body { padding: 16px 20px 18px; }
.wn-hero { display: block; cursor: pointer; background: var(--hover-bg); }
.wn-hero img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  object-position: top;
}
.wn-more {
  display: block;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 9px 16px;
  margin-top: 6px;
  cursor: pointer;
}
.wn-more:hover { border-color: var(--accent-soft); background: var(--hover-bg); }
.wn-card h2 { font-size: 19px; font-weight: 600; margin: 8px 0 6px; }
.wn-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wn-date { font-size: 13px; color: var(--text-faint); }
.wn-body { font-size: 15px; }
.wn-body ul { margin: 8px 0; padding-left: 20px; }
.wn-link { font-size: 14px; color: var(--accent); text-decoration: none; cursor: pointer; }
.wn-link:hover { text-decoration: underline; }
.wn-title { color: var(--text); text-decoration: none; cursor: pointer; }
.wn-title:hover { color: var(--accent); }

.chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 9px;
}
.chip-label { background: var(--active-bg); color: var(--accent-hover); }
.chip-tag { background: #f4f4f4; color: var(--text-secondary); cursor: pointer; }
.chip-tag:hover { background: var(--active-bg); color: var(--accent-hover); }

/* Article layout: main column + What's-new rail on the right */
.article-layout {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 36px;
}
.article-main { flex: 1 1 560px; min-width: 0; max-width: 760px; }
.article-main .article, .article-main .pager { max-width: none; }

.article-aside {
  flex: 0 0 320px;
  position: sticky;
  top: 12px;
}
@media (max-width: 1080px) {
  .article-aside { flex: 1 1 100%; position: static; max-width: 480px; }
}

.ru-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}
.ru-card {
  display: flex;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--divider);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  text-decoration: none;
  background: #fff;
}
.ru-card:hover { border-color: var(--accent-soft); background: var(--hover-bg); }
.ru-thumb {
  width: 104px;
  height: 70px;
  flex-shrink: 0;
  object-fit: cover;
  object-position: top;
  border-radius: 6px;
  border: 1px solid var(--divider);
}
.ru-thumb-fallback {
  display: block;
  background: linear-gradient(135deg, var(--accent-soft2), var(--accent));
  border: none;
}
.ru-text { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ru-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ru-card:hover .ru-card-title { color: var(--accent); }
.ru-date { font-size: 11px; color: var(--text-faint); }

/* ---------- Lightbox ---------- */

.zoomable { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 16, 12, 0.82);
  cursor: zoom-out;
  padding: 28px;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 94%;
  max-height: 94%;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  background: #fff;
}
.lightbox-close {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 30px;
  line-height: 1;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.8;
}
.lightbox-close:hover { opacity: 1; }

/* ---------- Footer ---------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px;
  border-top: 1px solid var(--divider);
  font-size: 11px;
  color: var(--text-faint);
  flex-shrink: 0;
}

.ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 11.5px;
  color: var(--text-faint);
  background: #f7f7f7;
  border: 1px solid var(--divider);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: default;
}

/* ---------- Narrow widths (dialog can be resized) ---------- */

@media (max-width: 720px) {
  .sidebar { display: none; }
  .content { padding: 20px; }
  .search-wrap { width: 180px; }
  .brand-sub { display: none; }
}
