/* ════════════════════════════════════════════════════════════════════
   PromptAI — shared site chrome (top bar + tab bar + menus + sheet)
   Used by education.html and archive.html so every page wears the same
   header as the briefing home (index.html). Also carries the shared
   briefing building blocks (canvas, cards, panels, section dividers)
   so the inner pages match the home layout exactly.
   ════════════════════════════════════════════════════════════════════ */
:root {
  --accent:#1a73e8; --accent-2:#1967d2; --accent-subtle:#e8f0fe;
  --bg:#ffffff; --bg-subtle:#f1f3f4;
  --text:#202124; --text-2:#5f6368; --text-3:#80868b;
  --border:#dadce0; --border-soft:#e8eaed; --card:#ffffff;
  --shadow:0 1px 2px rgba(60,64,67,0.1),0 1px 3px rgba(60,64,67,0.08);
  --shadow-hover:0 1px 3px rgba(60,64,67,0.18),0 4px 8px rgba(60,64,67,0.12);
  --serif:'Roboto Serif',Georgia,serif;
}
/* PromptAI blue — cool tinted canvas, navy ink, saturated blue accent */
:root[data-theme="promptai"] {
  --accent:#2563eb; --accent-2:#1d4ed8; --accent-subtle:#dbeafe;
  --bg:#f3f6fc; --bg-subtle:#e7edf8; --card:#ffffff;
  --text:#0a1628; --text-2:#44546e; --text-3:#8294ad;
  --border:#ccd8ea; --border-soft:#dde6f3;
  --shadow:0 1px 2px rgba(10,22,40,0.08),0 2px 6px rgba(10,22,40,0.06);
  --shadow-hover:0 2px 6px rgba(10,22,40,0.14),0 8px 20px rgba(10,22,40,0.1);
}
/* Slate & teal — warm paper canvas, stone ink, deep teal accent */
:root[data-theme="slate"] {
  --accent:#0f766e; --accent-2:#0d5d57; --accent-subtle:#d8efe9;
  --bg:#f7f5f1; --bg-subtle:#edeae3; --card:#fffefb;
  --text:#1c1917; --text-2:#57534e; --text-3:#a8a29e;
  --border:#d6d1c7; --border-soft:#e5e1d8;
  --shadow:0 1px 2px rgba(28,25,23,0.08),0 2px 6px rgba(28,25,23,0.05);
  --shadow-hover:0 2px 6px rgba(28,25,23,0.13),0 8px 20px rgba(28,25,23,0.09);
}

/* ── TOP BAR ── */
.topbar {
  position:sticky; top:0; z-index:60; background:var(--bg);
  height:64px; display:flex; align-items:center; gap:8px;
  padding:0 16px; border-bottom:1px solid var(--border-soft);
}
.topbar .icon-btn {
  width:40px; height:40px; border-radius:50%; border:none; background:none;
  display:flex; align-items:center; justify-content:center; color:var(--text-2);
  transition:background .15s; cursor:pointer; flex:none;
}
.topbar .icon-btn:hover { background:var(--bg-subtle); }
.topbar .icon-btn svg { width:22px; height:22px; fill:currentColor; }
.brand { display:flex; align-items:center; gap:9px; padding:0 6px; user-select:none; }
.brand-mark { width:30px; height:30px; flex:none; display:block; }
.brand-mark svg { width:30px; height:30px; display:block; }
.brand-text { font-family:var(--serif); font-size:1.45rem; line-height:1; letter-spacing:-0.3px; color:var(--text); font-weight:600; }
.brand-text b { color:var(--accent); font-weight:600; }
.topbar-spacer { flex:1; }
.search-wrap { flex:1 1 auto; max-width:720px; margin:0 8px; position:relative; display:flex; align-items:center; }
.search-wrap svg { position:absolute; left:16px; width:20px; height:20px; fill:var(--text-2); pointer-events:none; }
.topbar #pai-search, .search-wrap #pai-search {
  width:100%; height:46px; border:1px solid transparent; background:var(--bg-subtle);
  border-radius:24px; padding:0 18px 0 46px; font-size:0.95rem; color:var(--text); font-family:inherit;
  transition:background .15s,box-shadow .15s,border-color .15s;
}
.topbar #pai-search::placeholder, .search-wrap #pai-search::placeholder { color:var(--text-3); }
.topbar #pai-search:focus, .search-wrap #pai-search:focus { outline:none; background:var(--card); border-color:var(--border-soft); box-shadow:var(--shadow); }
.topbar-actions { display:flex; align-items:center; gap:4px; flex:none; }
#search-toggle { display:none; }
.signin-btn {
  display:flex; align-items:center; gap:8px; height:40px; padding:0 18px; border-radius:20px;
  border:1px solid var(--border); background:var(--card); color:var(--accent); font-weight:500; font-size:0.9rem;
  font-family:inherit; cursor:pointer; transition:background .15s,box-shadow .15s;
}
.signin-btn:hover { background:var(--accent-subtle); box-shadow:var(--shadow); }
.subscribe-cta {
  height:40px; padding:0 18px; border-radius:20px; border:none; background:var(--accent);
  color:#fff; font-weight:500; font-size:0.9rem; font-family:inherit; cursor:pointer; flex:none;
  transition:background .15s, box-shadow .15s;
}
.subscribe-cta:hover { background:var(--accent-2); box-shadow:var(--shadow); }
.avatar-btn {
  width:36px; height:36px; border-radius:50%; border:none; color:#fff; font-weight:600; font-size:0.9rem;
  display:none; align-items:center; justify-content:center; background:var(--accent); cursor:pointer;
}

/* ── menus (theme / subscribe / language) ──
   FIXED so they stay glued under the sticky top bar after scrolling
   (they used to be absolute → opened off-screen once you scrolled). */
.theme-menu, .sub-menu, .lang-menu {
  position:fixed; top:60px; right:16px; background:var(--card); border:1px solid var(--border-soft);
  border-radius:14px; box-shadow:var(--shadow-hover); z-index:80; display:none;
}
.theme-menu { padding:8px; width:240px; right:12px; }
.theme-menu.open, .sub-menu.open, .lang-menu.open { display:block; }
.theme-menu h5, .lang-menu h5 { font-size:0.72rem; text-transform:uppercase; letter-spacing:0.06em; color:var(--text-3); padding:6px 10px 8px; font-weight:500; }
.theme-opt, .lang-opt { display:flex; align-items:center; gap:11px; width:100%; padding:9px 10px; border:none; background:none; border-radius:9px; text-align:left; color:var(--text); font-size:0.9rem; cursor:pointer; font-family:inherit; }
.theme-opt:hover, .lang-opt:hover { background:var(--bg-subtle); }
.theme-opt .sw { width:30px; height:18px; border-radius:5px; flex:none; display:flex; overflow:hidden; box-shadow:inset 0 0 0 1px rgba(0,0,0,0.07); }
.theme-opt .sw i { flex:1; }
.theme-opt .chk, .lang-opt .chk { margin-left:auto; color:var(--accent); opacity:0; font-weight:700; }
.theme-opt.active .chk, .lang-opt.active .chk { opacity:1; }
.lang-opt.active { color:var(--accent); }
.lang-menu { padding:8px; width:240px; max-height:min(70vh,460px); overflow-y:auto; }
.lang-opt .flag { font-size:1.15rem; line-height:1; width:22px; text-align:center; flex:none; }
.lang-opt .native { color:var(--text-3); font-size:0.8rem; margin-left:2px; }
.sub-menu { padding:16px; width:288px; }
.sub-menu h5 { font-family:var(--serif); font-size:1.05rem; font-weight:600; margin-bottom:4px; color:var(--text); }
.sub-menu .sub-lead { font-size:0.8rem; color:var(--text-2); line-height:1.5; margin-bottom:12px; }
.sub-menu form { display:flex; flex-direction:column; gap:8px; }
.sub-menu input { height:42px; border:1px solid var(--border); border-radius:10px; padding:0 14px; font-size:0.9rem; background:var(--card); color:var(--text); font-family:inherit; }
.sub-menu input:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-subtle); }
.sub-menu button { height:42px; border-radius:10px; border:none; background:var(--accent); color:#fff; font-weight:600; font-size:0.9rem; font-family:inherit; cursor:pointer; }
.sub-menu button:hover { background:var(--accent-2); }
.sub-menu .sub-note { font-size:0.72rem; color:var(--text-3); margin-top:9px; line-height:1.5; }

/* ── TAB BAR ── */
.tabs {
  position:sticky; top:64px; z-index:55; background:var(--bg);
  border-bottom:1px solid var(--border-soft);
  display:flex; align-items:center; gap:2px;
  height:48px; padding:0 max(16px,calc((100% - 1100px)/2)); overflow-x:auto; scrollbar-width:none;
}
.tabs::-webkit-scrollbar { display:none; }
.tab {
  position:relative; height:48px; padding:0 16px; flex:none;
  display:inline-flex; align-items:center; gap:7px; white-space:nowrap;
  font-family:inherit; font-size:0.94rem; font-weight:500; color:var(--text-2);
  border:none; background:none; border-bottom:3px solid transparent; margin-bottom:-1px; cursor:pointer;
  transition:color .12s, border-color .12s;
}
.tab:hover { color:var(--text); }
.tab.active { color:var(--accent); border-bottom-color:var(--accent); }

/* ── SIGN-IN SHEET ── */
.sheet-overlay { display:none; position:fixed; inset:0; z-index:150; background:rgba(32,33,36,0.4); }
.sheet-overlay.open { display:block; }
.sheet { position:fixed; top:0; right:0; height:100vh; width:min(400px,100vw); background:var(--bg); box-shadow:-8px 0 40px rgba(0,0,0,0.16); transform:translateX(100%); transition:transform .25s ease; z-index:151; display:flex; flex-direction:column; }
.sheet.open { transform:none; }
.sheet-h { display:flex; align-items:center; justify-content:space-between; padding:20px 22px; border-bottom:1px solid var(--border-soft); }
.sheet-h h3 { font-size:1.1rem; font-weight:500; font-family:var(--serif); }
.sheet-b { padding:24px 22px; overflow-y:auto; }
.sheet-b p.lead-copy { font-size:0.9rem; color:var(--text-2); line-height:1.6; margin-bottom:20px; }
.field { margin-bottom:14px; }
.field label { display:block; font-size:0.8rem; font-weight:500; color:var(--text-2); margin-bottom:6px; }
.field input { width:100%; height:44px; border:1px solid var(--border); border-radius:10px; padding:0 14px; font-size:0.92rem; background:var(--card); color:var(--text); font-family:inherit; }
.field input:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-subtle); }
.sheet-btn { width:100%; height:46px; border-radius:10px; border:none; background:var(--accent); color:#fff; font-weight:600; font-size:0.95rem; margin-top:6px; font-family:inherit; cursor:pointer; }
.sheet-btn:hover { background:var(--accent-2); }
.sheet-btn:disabled { opacity:0.6; cursor:default; }
.modal-x { width:34px; height:34px; border-radius:50%; border:none; background:none; font-size:1.3rem; color:var(--text-2); display:flex; align-items:center; justify-content:center; cursor:pointer; }
.modal-x:hover { background:var(--bg-subtle); }
.signed-card { text-align:center; padding:10px 0 20px; }
.signed-card .big-av { width:64px; height:64px; border-radius:50%; background:var(--accent); color:#fff; font-size:1.6rem; font-weight:600; display:flex; align-items:center; justify-content:center; margin:0 auto 14px; }

/* account sheet — login/signup tabs + saved-data lists */
.acct-tabs { display:flex; gap:6px; background:var(--bg-subtle); border-radius:12px; padding:4px; margin-bottom:18px; }
.acct-tab { flex:1; height:38px; border:none; border-radius:9px; background:none; font-family:inherit; font-size:0.88rem; font-weight:500; color:var(--text-2); cursor:pointer; }
.acct-tab.active { background:var(--card); color:var(--accent); box-shadow:var(--shadow); }
.acct-err { color:#c5221f; font-size:0.82rem; line-height:1.5; min-height:0; margin:2px 0 6px; }
.acct-h { font-family:var(--serif); font-size:0.98rem; font-weight:600; color:var(--text); margin:20px 0 10px; padding-top:18px; border-top:1px solid var(--border-soft); }
.acct-empty { font-size:0.82rem; color:var(--text-3); line-height:1.55; }
.acct-list { display:flex; flex-direction:column; }
.acct-item { display:flex; flex-direction:column; gap:2px; padding:9px 10px; margin:0 -10px; border-radius:10px; }
.acct-item:hover { background:var(--bg-subtle); }
.acct-item .t { font-size:0.86rem; font-weight:500; color:var(--text); line-height:1.35; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.acct-item .m { font-size:0.72rem; color:var(--text-3); }
.acct-offline { display:inline-block; margin-top:10px; font-size:0.7rem; color:#b06000; background:#fef7e0; border-radius:8px; padding:4px 10px; }

/* ── TOAST ── */
#toast { position:fixed; bottom:26px; left:50%; transform:translateX(-50%) translateY(20px); background:#202124; color:#fff; padding:12px 22px; border-radius:10px; font-size:0.88rem; opacity:0; pointer-events:none; transition:all .25s; z-index:300; }
#toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* ════ SHARED BRIEFING BUILDING BLOCKS (home + Learn AI + Archive) ════ */
.canvas { display:grid; grid-template-columns:minmax(0,1fr) 336px; gap:36px; padding:28px 24px 80px; max-width:1100px; margin:0 auto; }
.main { min-width:0; max-width:760px; }

/* page title */
.sec-title { display:flex; align-items:center; gap:11px; font-family:var(--serif); font-size:1.7rem; font-weight:600; color:var(--text); letter-spacing:-0.3px; margin:6px 0 8px; }
.sec-title .bar { width:4px; height:26px; border-radius:3px; background:var(--accent); flex:none; }
.sec-sub { font-size:0.95rem; color:var(--text-2); margin:0 0 18px 15px; max-width:640px; line-height:1.55; }

/* big section divider (Top stories / Fresh from research / …) */
.sec-divider { margin:42px 0 18px; }
.sec-divider .sec-kick { display:flex; align-items:center; gap:10px; font-size:0.7rem; font-weight:700; letter-spacing:0.12em; text-transform:uppercase; color:var(--accent); margin-bottom:6px; }
.sec-divider .sec-kick::before { content:''; width:18px; height:3px; border-radius:2px; background:var(--accent); }
.sec-divider .sec-row { display:flex; align-items:baseline; gap:14px; }
.sec-divider h3 { font-family:var(--serif); font-size:1.5rem; font-weight:600; letter-spacing:-0.3px; color:var(--text); white-space:nowrap; }
.sec-divider .line { flex:1; height:1px; background:var(--border-soft); align-self:center; }
.sec-divider a { font-size:0.84rem; color:var(--accent); font-weight:500; white-space:nowrap; }

/* chips */
.chips {
  position:sticky; top:112px; z-index:40; background:var(--bg);
  display:flex; gap:8px; flex-wrap:wrap; align-items:center;
  margin:0 0 16px; padding:14px 0 13px; border-bottom:1px solid var(--border-soft);
}
.chip {
  height:32px; padding:0 16px; border-radius:16px; border:1px solid var(--border);
  background:var(--card); color:var(--text-2); font-size:0.82rem; font-weight:500;
  display:inline-flex; align-items:center; gap:6px; transition:all .12s; cursor:pointer; font-family:inherit;
}
.chip:hover { background:var(--bg-subtle); }
.chip.active { background:var(--accent-subtle); color:var(--accent); border-color:transparent; }

/* story-style cards */
.stack { display:flex; flex-direction:column; }
.card {
  background:var(--card); border:1px solid var(--border-soft); border-radius:12px;
  box-shadow:var(--shadow); padding:18px 20px; margin-bottom:12px; cursor:pointer;
  transition:box-shadow .15s, border-color .15s;
}
.card:hover { box-shadow:var(--shadow-hover); }
.card-src { display:flex; align-items:center; gap:8px; margin-bottom:9px; }
.card-src img { width:16px; height:16px; border-radius:3px; flex:none; }
.card-src .name { font-size:0.78rem; color:var(--text-2); font-weight:500; }
.card-src .dot { width:3px; height:3px; border-radius:50%; background:var(--text-3); }
.card-src .topic { font-size:0.72rem; color:var(--accent); font-weight:500; }
.card-row { display:flex; gap:18px; align-items:flex-start; }
.card-body { flex:1; min-width:0; }
.card h4 { font-family:var(--serif); font-size:1.06rem; line-height:1.32; font-weight:500; color:var(--text); letter-spacing:-0.1px; margin-bottom:8px; }
.card:hover h4 { text-decoration:underline; text-decoration-color:var(--border); text-underline-offset:2px; }
.card .excerpt { font-size:0.86rem; color:var(--text-2); line-height:1.5; margin-bottom:10px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.card-meta { display:flex; align-items:center; gap:10px; font-size:0.76rem; color:var(--text-3); }
.card-thumb { width:128px; height:96px; border-radius:10px; object-fit:cover; flex:none; background:var(--bg-subtle); }

/* right rail */
.rightrail { display:flex; flex-direction:column; gap:18px; position:sticky; top:88px; align-self:start; }
.panel { background:var(--card); border:1px solid var(--border-soft); border-radius:14px; box-shadow:var(--shadow); overflow:hidden; }
.panel-h { padding:16px 18px 4px; font-size:0.95rem; font-weight:500; display:flex; align-items:center; gap:8px; color:var(--text); }
.panel-h svg { width:18px; height:18px; fill:var(--accent); }
.panel-b { padding:8px 18px 18px; }
.news-promo { background:linear-gradient(150deg,var(--accent),var(--accent-2)); color:#fff; padding:22px; }
.news-promo h4 { font-family:var(--serif); font-size:1.2rem; font-weight:600; margin-bottom:6px; }
.news-promo p { font-size:0.85rem; opacity:0.92; line-height:1.5; margin-bottom:14px; }
.news-promo form { display:flex; flex-direction:column; gap:8px; }
.news-promo input { height:42px; border-radius:10px; border:none; padding:0 14px; font-size:0.88rem; font-family:inherit; }
.news-promo input:focus { outline:2px solid rgba(255,255,255,0.6); }
.news-promo button { height:42px; border-radius:10px; border:none; background:#fff; color:var(--accent); font-weight:600; font-size:0.9rem; font-family:inherit; cursor:pointer; }
.news-promo button:hover { background:rgba(255,255,255,0.92); }
.news-promo .note { font-size:0.72rem; opacity:0.8; margin-top:2px; }
.about-panel p { font-size:0.84rem; color:var(--text-2); line-height:1.6; margin-bottom:10px; }
.about-panel ul { list-style:none; margin:0 0 4px; padding:0; display:flex; flex-direction:column; gap:7px; }
.about-panel li { display:flex; gap:8px; font-size:0.8rem; color:var(--text-2); line-height:1.5; }
.about-panel li::before { content:'→'; color:var(--accent); font-weight:700; flex:none; }

/* load more */
.load-more-wrap { display:flex; justify-content:center; padding:14px 0 4px; }
.load-more {
  height:42px; padding:0 30px; border-radius:21px; border:1px solid var(--border);
  background:var(--card); color:var(--accent); font-weight:500; font-size:0.9rem; font-family:inherit; cursor:pointer;
  display:inline-flex; align-items:center; gap:8px; transition:background .15s, box-shadow .15s;
}
.load-more:hover { background:var(--accent-subtle); box-shadow:var(--shadow); }
.load-more svg { width:16px; height:16px; fill:currentColor; }

/* slim shared footer */
.site-foot { border-top:1px solid var(--border-soft); background:var(--bg); }
.site-foot-inner { max-width:1100px; margin:0 auto; padding:26px 24px 30px; display:flex; flex-wrap:wrap; gap:14px 28px; align-items:center; justify-content:space-between; font-size:0.8rem; color:var(--text-3); }
.site-foot-inner nav { display:flex; gap:18px; flex-wrap:wrap; }
.site-foot-inner a { color:var(--text-2); }
.site-foot-inner a:hover { color:var(--accent); }

.empty { text-align:center; color:var(--text-3); padding:60px 20px; font-size:0.9rem; }

/* ── responsive ── */
@media (max-width:1120px){ .canvas{ grid-template-columns:minmax(0,1fr); } .rightrail{ display:none; } }
@media (max-width:900px){
  .tabs{ padding:0 10px; }
  .search-wrap{ display:none; }
  .topbar-spacer{ flex:1; }
  #search-toggle{ display:flex; }
  /* mobile search: tap the magnifier to drop the search bar under the top bar */
  .topbar.search-open .search-wrap{
    display:flex; position:fixed; top:64px; left:0; right:0; z-index:59;
    margin:0; max-width:none; padding:10px 12px; background:var(--bg);
    border-bottom:1px solid var(--border-soft); box-shadow:var(--shadow);
  }
  .topbar.search-open .search-wrap svg{ left:28px; }
  .canvas{ padding:18px 16px 70px; }
}
@media (min-width:901px){ .topbar-spacer{ display:none; } }
@media (max-width:560px){
  .brand-text{ font-size:1.25rem; }
  .signin-btn{ padding:0 12px; }
  .signin-btn span{ display:none; }
  .subscribe-cta{ padding:0 14px; font-size:0.84rem; }
  .topbar{ padding:0 10px; gap:4px; }
  .card{ padding:15px 16px; }
  .card-thumb{ width:96px; height:74px; }
  .sec-title{ font-size:1.45rem; }
  .sec-divider h3{ font-size:1.3rem; }
}

/* ── LIGHT PAGE HEADER + CHIPS (legacy helpers kept for compatibility) ── */
.page-head { background:var(--bg); border-bottom:1px solid var(--border-soft); }
.page-head-inner { max-width:1100px; margin:0 auto; padding:30px 24px 0; }
.page-chips { display:flex; gap:8px; flex-wrap:wrap; padding-bottom:16px; }
.page-chips .chip { height:36px; padding:0 18px; border-radius:18px; font-size:0.86rem; }

/* ── GOOGLE TRANSLATE: hide its chrome, keep ours ── */
.goog-te-banner-frame, .goog-te-gadget-icon, #goog-gt-tt, .goog-te-balloon-frame, .skiptranslate iframe { display:none !important; }
body { top:0 !important; position:static !important; }
.goog-text-highlight, font.goog-text-highlight { background:none !important; box-shadow:none !important; }
.goog-tooltip { display:none !important; }
