/* Ubuntu Web — Firefox app. All selectors scoped under .app-browser.
 * Browser chrome uses Yaru tokens (light+dark safe); page content keeps
 * its own authored colors, like real websites. */

/* ================= titlebar overrides (tab strip lives there) ================= */

.app-browser .header-left { flex: 1; min-width: 0; align-self: stretch; }
.app-browser .header-title { display: none; }
.app-browser .titlebar { border-bottom: none; }

.app-browser .bw-tabstrip {
  display: flex;
  align-items: flex-end;
  height: 100%;
  flex: 1;
  min-width: 0;
}
.app-browser .bw-tabs {
  display: flex;
  align-items: flex-end;
  flex: 0 1 auto;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}
.app-browser .bw-tab {
  flex: 1 1 180px;
  min-width: 54px;
  max-width: 190px;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 5px 0 10px;
  border-radius: 8px 8px 0 0;
  color: var(--fg-dim);
  font-size: 12.5px;
  position: relative;
  text-align: left;
}
.app-browser .bw-tab:hover:not(.active) { background: var(--hover); }
.app-browser .bw-tab.active { background: var(--win-bg); color: var(--fg); }
.app-browser .bw-tab-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-browser .bw-tab-close {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-dim);
}
.app-browser .bw-tab-close:hover { background: var(--btn-hover); color: var(--fg); }
.app-browser .bw-tab:not(.active):not(:hover) .bw-tab-close { opacity: 0; }
.app-browser .bw-newtab-btn {
  flex: none;
  width: 28px;
  height: 28px;
  margin: 0 4px 3px 4px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-dim);
}
.app-browser .bw-newtab-btn:hover { background: var(--hover); color: var(--fg); }

/* favicon dot + loading spinner */
.app-browser .bw-fav {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.app-browser .bw-fav.loading {
  border-radius: 50%;
  border: 2px solid rgba(var(--accent-rgb), 0.25);
  border-top-color: var(--accent);
  background: transparent !important;
  animation: bw-spin 0.8s linear infinite;
}
@keyframes bw-spin { to { transform: rotate(360deg); } }

/* ================= toolbar ================= */

.app-browser .bw-toolbar {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 8px 6px;
  background: var(--win-bg);
  border-bottom: 1px solid var(--border);
}
.app-browser .bw-navbtn {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
}
.app-browser .bw-navbtn:hover { background: var(--hover); }
.app-browser .bw-navbtn:active { background: var(--active); }
.app-browser .bw-navbtn:disabled { opacity: 0.35; pointer-events: none; }
.app-browser .bw-urlbar {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  margin: 0 6px;
  padding: 0 10px;
  background: var(--entry-bg);
  border-radius: 6px;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.12s ease, background 0.12s ease;
}
.app-browser .bw-urlbar:focus-within {
  outline-color: rgba(var(--accent-rgb), 0.8);
  background: var(--view-bg);
}
.app-browser .bw-lock { flex: none; display: inline-flex; color: var(--fg-dim); }
.app-browser .bw-url-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--fg);
}
.app-browser .bw-url-input::placeholder { color: var(--fg-faint); }
.app-browser .bw-offline-badge { flex: none; display: inline-flex; color: #cd8f00; }
.app-browser .bw-offline-badge[hidden] { display: none; }

/* thin accent progress bar under the toolbar */
.app-browser .bw-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 3;
}
.app-browser .bw-progress.show { opacity: 1; }
.app-browser .bw-progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

/* ================= view host / downloads bar ================= */

.app-browser .bw-viewhost {
  flex: 1;
  min-height: 0;
  position: relative;
  background: var(--view-bg);
}
.app-browser .bw-view { position: absolute; inset: 0; overflow: auto; }
.app-browser .bw-view[hidden] { display: none; }
.app-browser .bw-page { min-height: 100%; }

.app-browser .bw-downloads {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--win-bg);
  border-top: 1px solid var(--border);
}
.app-browser .bw-downloads[hidden] { display: none; }
.app-browser .bw-dl-icon { flex: none; display: inline-flex; color: var(--accent); }
.app-browser .bw-dl-icon.done { color: #2b9348; }
.app-browser .bw-dl-body { flex: 1; min-width: 0; }
.app-browser .bw-dl-name {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-browser .bw-dl-track {
  height: 4px;
  border-radius: 4px;
  background: var(--btn-bg);
  margin: 4px 0 3px;
  overflow: hidden;
}
.app-browser .bw-dl-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.1s linear;
}
.app-browser .bw-dl-status { font-size: 11.5px; color: var(--fg-dim); }
.app-browser .bw-dl-close {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-dim);
}
.app-browser .bw-dl-close:hover { background: var(--hover); color: var(--fg); }

/* ================= internal pages (token-themed: newtab, search, problem) ================= */

.app-browser .bw-newtab {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}
.app-browser .bw-nt-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  width: min(640px, 100%);
}
.app-browser .bw-nt-logo svg { width: 84px; height: 84px; display: block; }
.app-browser .bw-nt-word {
  font-size: 22px;
  font-weight: 500;
  color: var(--fg-dim);
  letter-spacing: 0.02em;
}
.app-browser .bw-nt-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--view-bg);
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.12s ease;
}
.app-browser .bw-nt-pill:focus-within { outline-color: rgba(var(--accent-rgb), 0.8); }
.app-browser .bw-nt-mag { display: inline-flex; color: var(--fg-faint); }
.app-browser .bw-nt-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  font-size: 15px;
  color: var(--fg);
}
.app-browser .bw-nt-input::placeholder { color: var(--fg-faint); }
.app-browser .bw-nt-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}
.app-browser .bw-nt-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 14px 8px 12px;
  border-radius: 10px;
}
.app-browser .bw-nt-tile:hover { background: var(--hover); }
.app-browser .bw-nt-tile-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.app-browser .bw-nt-tile-label { font-size: 12.5px; color: var(--fg-dim); }

/* search results */
.app-browser .bw-search { padding: 24px 34px 48px; }
.app-browser .bw-sr-head {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 640px;
  margin-bottom: 8px;
}
.app-browser .bw-sr-logo svg { width: 34px; height: 34px; display: block; }
.app-browser .bw-sr-pill { height: 40px; flex: 1; box-shadow: none; }
.app-browser .bw-sr-count { font-size: 12.5px; color: var(--fg-faint); margin: 10px 0 20px 48px; }
.app-browser .bw-sr-item { max-width: 640px; margin: 0 0 24px 48px; }
.app-browser .bw-sr-url { font-size: 12px; color: var(--fg-dim); }
.app-browser .bw-sr-title {
  display: inline-block;
  font-size: 17px;
  color: #0061e0;
  cursor: pointer;
  margin: 2px 0 3px;
}
:root[data-scheme="dark"] .app-browser .bw-sr-title { color: #6cb2ff; }
.app-browser .bw-sr-title:hover { text-decoration: underline; }
.app-browser .bw-sr-desc { font-size: 13px; color: var(--fg-dim); line-height: 1.5; }
.app-browser .bw-sr-empty { margin: 26px 0 0 48px; }
.app-browser .bw-sr-empty-title { font-size: 16px; font-weight: 600; }
.app-browser .bw-sr-empty-sub { font-size: 13px; color: var(--fg-dim); margin-top: 6px; }

/* problem pages (error / offline) */
.app-browser .bw-problem { display: flex; justify-content: center; padding: 64px 28px; }
.app-browser .bw-pb-card { width: min(520px, 100%); }
.app-browser .bw-pb-glyph { color: #cd8f00; margin-bottom: 14px; }
.app-browser .bw-pb-glyph svg { width: 34px; height: 34px; }
.app-browser .bw-pb-title { font-size: 22px; font-weight: 600; line-height: 1.3; margin-bottom: 12px; }
.app-browser .bw-pb-lead { color: var(--fg-dim); font-size: 14px; line-height: 1.5; margin-bottom: 12px; }
.app-browser .bw-pb-list { margin: 0 0 8px 20px; }
.app-browser .bw-pb-list li { color: var(--fg-dim); font-size: 13.5px; margin: 5px 0; }
.app-browser .bw-pb-wifi { font-size: 12.5px; color: var(--fg-faint); margin-top: 4px; }
.app-browser .bw-pb-actions { display: flex; justify-content: flex-end; margin-top: 22px; }
.app-browser .bw-pb-retry {
  background: #0061e0;
  color: #fff;
  padding: 8px 24px;
  border-radius: 6px;
  font-weight: 600;
}
.app-browser .bw-pb-retry:hover { background: #0250bb; }
.app-browser .bw-pb-retry:active { background: #054096; }

/* about dialog body (wrapper carries .app-browser itself) */
.app-browser.bw-about { padding: 4px 0 2px; }
.app-browser.bw-about .bw-about-logo svg { width: 56px; height: 56px; margin: 0 auto; display: block; }
.app-browser.bw-about .bw-about-name { font-size: 19px; font-weight: 700; margin-top: 8px; }
.app-browser.bw-about .bw-about-ver { font-size: 13px; color: var(--fg-dim); margin-top: 2px; }
.app-browser.bw-about .bw-about-note { font-size: 12px; color: var(--fg-faint); margin-top: 10px; white-space: pre-line; }

/* ================= authored websites (fixed colors in both schemes) ================= */

/* ---- ubuntu.com ---- */
.app-browser .bw-ubuntu { background: #fff; color: #111; display: flex; flex-direction: column; }
.app-browser .bw-ub-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #772953;
  color: #fff;
  padding: 0 24px;
  height: 48px;
  font-size: 13.5px;
  flex: none;
}
.app-browser .bw-ub-brand { font-weight: 700; letter-spacing: 0.01em; }
.app-browser .bw-ub-navsep { width: 1px; height: 20px; background: rgba(255, 255, 255, 0.35); }
.app-browser .bw-ub-brand2 { font-weight: 400; }
.app-browser .bw-ub-navlink { color: rgba(255, 255, 255, 0.85); cursor: pointer; }
.app-browser .bw-ub-navlink:hover { color: #fff; text-decoration: underline; }
.app-browser .bw-ub-hero {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 52px 48px;
  background: linear-gradient(100deg, #772953 0%, #5e2750 55%, #2c001e 100%);
  color: #fff;
}
.app-browser .bw-ub-hero-text { flex: 1; min-width: 0; max-width: 560px; }
.app-browser .bw-ub-h1 { font-size: 42px; font-weight: 300; line-height: 1.1; }
.app-browser .bw-ub-sub { font-size: 20px; font-weight: 300; color: #e9b8cd; margin: 6px 0 14px; }
.app-browser .bw-ub-lead { font-size: 15px; line-height: 1.55; color: rgba(255, 255, 255, 0.9); margin-bottom: 22px; }
.app-browser .bw-ub-download {
  background: #E95420;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 26px;
  border-radius: 4px;
}
.app-browser .bw-ub-download:hover { background: #f26b3d; }
.app-browser .bw-ub-download:active { background: #cd4a1c; }
.app-browser .bw-ub-meta { font-size: 12px; color: rgba(255, 255, 255, 0.6); margin-top: 12px; }
.app-browser .bw-ub-hero-art { flex: none; }
.app-browser .bw-ub-hero-art svg { width: 180px; height: 180px; display: block; opacity: 0.95; }
.app-browser .bw-ub-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  padding: 34px 40px;
  background: #f7f7f7;
  flex: 1;
}
.app-browser .bw-ub-card {
  background: #fff;
  border: 1px solid #d9d9d9;
  border-top: 3px solid #E95420;
  border-radius: 4px;
  padding: 18px;
}
.app-browser .bw-ub-card h3 { font-size: 15.5px; font-weight: 600; margin-bottom: 8px; color: #111; }
.app-browser .bw-ub-card p { font-size: 13px; line-height: 1.5; color: #555; }
.app-browser .bw-ub-footer { background: #262626; color: #a5a5a5; font-size: 12px; padding: 16px 40px; }

/* ---- wikipedia ---- */
.app-browser .bw-wiki { background: #fff; color: #202122; }
.app-browser .bw-wp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid #a2a9b1;
  background: #fff;
}
.app-browser .bw-wp-globe { display: inline-flex; }
.app-browser .bw-wp-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 19px;
  letter-spacing: 0.04em;
  color: #202122;
}
.app-browser .bw-wp-tag { font-size: 10.5px; color: #54595d; letter-spacing: 0.02em; }
.app-browser .bw-wp-search {
  font-size: 12.5px;
  color: #72777d;
  border: 1px solid #a2a9b1;
  border-radius: 3px;
  padding: 5px 12px;
  background: #fff;
}
.app-browser .bw-wp-body { display: flex; align-items: stretch; }
.app-browser .bw-wp-rail {
  flex: none;
  width: 158px;
  padding: 16px 14px;
  font-size: 12.5px;
  background: #f8f9fa;
  border-right: 1px solid #eaecf0;
}
.app-browser .bw-wp-raillink { color: #3366cc; margin: 7px 0; cursor: pointer; }
.app-browser .bw-wp-raillink:hover { text-decoration: underline; }
.app-browser .bw-wp-article {
  flex: 1;
  min-width: 0;
  padding: 18px 30px 48px;
  line-height: 1.6;
  font-size: 14px;
}
.app-browser .bw-wp-article p { margin: 0 0 12px; }
.app-browser .bw-wp-h1 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 27px;
  font-weight: 400;
  border-bottom: 1px solid #a2a9b1;
  padding-bottom: 4px;
}
.app-browser .bw-wp-h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 20px;
  font-weight: 400;
  border-bottom: 1px solid #eaecf0;
  padding-bottom: 3px;
  margin: 18px 0 10px;
}
.app-browser .bw-wp-from { font-size: 12px; color: #54595d; margin: 5px 0 16px; }
.app-browser .bw-wp-link { color: #3366cc; cursor: pointer; }
.app-browser .bw-wp-link:hover { text-decoration: underline; }
.app-browser .bw-wp-infobox {
  float: right;
  width: 250px;
  margin: 0 0 16px 22px;
  border: 1px solid #a2a9b1;
  background: #f8f9fa;
  font-size: 12px;
  padding: 8px 10px;
  line-height: 1.45;
}
.app-browser .bw-wp-ib-title { text-align: center; font-weight: 700; font-size: 14px; padding: 2px 0 8px; }
.app-browser .bw-wp-ib-logo svg { width: 110px; height: 110px; display: block; margin: 0 auto; }
.app-browser .bw-wp-ib-cap { text-align: center; color: #54595d; font-size: 11px; padding: 6px 0 8px; }
.app-browser .bw-wp-ib-row { display: flex; gap: 8px; padding: 4px 0; border-top: 1px solid #eaecf0; }
.app-browser .bw-wp-ib-k { flex: none; width: 88px; font-weight: 700; }
.app-browser .bw-wp-ib-v { flex: 1; min-width: 0; }
.app-browser .bw-wp-stubnote {
  background: #f8f9fa;
  border: 1px solid #a2a9b1;
  padding: 8px 12px;
  font-size: 12.5px;
  font-style: italic;
  color: #54595d;
  margin: 4px 0 14px;
}
.app-browser .bw-wp-refs { font-size: 12px; color: #54595d; border-top: 1px solid #eaecf0; margin-top: 22px; padding-top: 8px; }

/* ---- planet.ubuntu.com ---- */
.app-browser .bw-planet { background: #fdfbfc; color: #333; }
.app-browser .bw-pl-head { background: #772953; color: #fff; padding: 24px 30px; }
.app-browser .bw-pl-head h1 { font-size: 24px; font-weight: 300; }
.app-browser .bw-pl-tag { font-size: 12.5px; color: rgba(255, 255, 255, 0.75); margin-top: 4px; }
.app-browser .bw-pl-list { max-width: 760px; margin: 0 auto; padding: 26px 22px 48px; }
.app-browser .bw-pl-post {
  background: #fff;
  border: 1px solid #e4dbe0;
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.app-browser .bw-pl-meta { display: flex; align-items: center; gap: 10px; }
.app-browser .bw-pl-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.app-browser .bw-pl-author { font-weight: 600; font-size: 13.5px; color: #333; }
.app-browser .bw-pl-date { font-size: 12px; color: #8a8a8a; }
.app-browser .bw-pl-title { font-size: 17px; font-weight: 600; color: #772953; margin: 12px 0 6px; }
.app-browser .bw-pl-body { font-size: 13.5px; line-height: 1.55; color: #444; }
.app-browser .bw-pl-more { display: inline-block; font-size: 12.5px; color: #a05a7c; margin-top: 10px; cursor: pointer; }
.app-browser .bw-pl-more:hover { text-decoration: underline; }

/* ---- omgubuntu.co.uk ---- */
.app-browser .bw-omg { background: #f2f2f2; color: #222; }
.app-browser .bw-om-head {
  background: #131313;
  color: #fff;
  padding: 18px 26px;
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.app-browser .bw-om-logo { display: flex; align-items: baseline; gap: 6px; }
.app-browser .bw-om-omg { color: #ff6b1c; font-weight: 800; font-size: 23px; letter-spacing: -0.01em; }
.app-browser .bw-om-ub { color: #fff; font-weight: 300; font-size: 23px; }
.app-browser .bw-om-tagline { font-size: 12px; color: #9a9a9a; }
.app-browser .bw-om-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  padding: 22px 26px 44px;
}
.app-browser .bw-om-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.app-browser .bw-om-thumb { height: 110px; position: relative; }
.app-browser .bw-om-chip {
  position: absolute;
  left: 10px;
  bottom: 10px;
  background: #ff6b1c;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 3px;
  padding: 2px 8px;
}
.app-browser .bw-om-card h3 { font-size: 14.5px; font-weight: 600; line-height: 1.35; padding: 12px 14px 6px; color: #191919; }
.app-browser .bw-om-meta { font-size: 11.5px; color: #888; padding: 0 14px 14px; }

/* ---- example.com ---- */
.app-browser .bw-example {
  background: #f0f0f2;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 20px;
}
.app-browser .bw-ex-card {
  background: #fdfdff;
  border-radius: 8px;
  padding: 36px 44px;
  max-width: 600px;
  box-shadow: 2px 3px 7px 2px rgba(0, 0, 0, 0.02);
  color: #111;
}
.app-browser .bw-ex-card h1 { font-size: 26px; margin-bottom: 14px; color: #222; }
.app-browser .bw-ex-card p { font-size: 14px; line-height: 1.6; color: #333; margin-bottom: 10px; }
.app-browser .bw-ex-link { color: #38488f; cursor: pointer; }
.app-browser .bw-ex-link:hover { text-decoration: underline; }
