/* PoemBridge shared header - the single header implementation for all pages.
   Loaded on every page by deploy_prep_site.py (header.css), so standalone
   legal/info pages and generated poem pages never drift apart.
   Desktop nav links live in HEADER_HTML only; the mobile drawer clones that
   same DOM (see app.js), so there is exactly one source of menu items. */
.pb-header{position:fixed;z-index:90;top:0;left:0;right:0;display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px clamp(16px,4vw,48px);color:#fff;background:rgba(23,33,38,.88);border-bottom:1px solid rgba(255,255,255,.10);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)}
.pb-header .brand{display:flex;align-items:center;gap:10px;font-weight:750;font-size:17px;color:inherit;white-space:nowrap}
.pb-header .brand-logo{height:40px;width:auto;display:block;border-radius:6px}
/* Reset legal.css's `.nav a` pill buttons, which would otherwise bleed into
   the shared header nav on the 9 standalone pages (legal.css loads first). */
.pb-header .nav{display:flex;align-items:center;gap:26px;margin:0;flex-wrap:nowrap;font-size:14px}
.pb-header .nav a{color:rgba(255,255,255,.82);white-space:nowrap;border:0;background:transparent;border-radius:0;padding:0;margin:0;font-weight:400;text-decoration:none}
.pb-header .nav a:hover,.pb-header .nav a[aria-current="page"]{color:#fff}
.pb-header .nav a[aria-current="page"]{font-weight:800;text-decoration:underline;text-underline-offset:5px}
.pb-header .header-actions{display:flex;align-items:center;gap:10px}
.pb-header .header-action{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:9px 16px;border-radius:999px;font:inherit;font-size:13px;font-weight:750;line-height:1.2;white-space:nowrap;text-decoration:none;cursor:pointer}
.pb-header .header-action.is-primary{background:#B0432F;color:#fff;border:1px solid #B0432F}
.pb-header .header-action.is-primary:hover{background:#9b3a28}
.pb-header .header-action.is-secondary{background:transparent;color:#FBF8F1;border:1px solid rgba(255,255,255,.38)}
.pb-header .header-action.is-secondary:hover{background:rgba(255,255,255,.12)}
.pb-header .user-menu{display:flex;align-items:center;gap:8px;padding:3px 4px 3px 6px;border-radius:999px;background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.22)}
.pb-header .user-menu[hidden]{display:none!important}
.pb-header .user-avatar{width:28px;height:28px;border-radius:50%;object-fit:cover;display:block;background:#fff}
.pb-header .user-name{font-size:13px;font-weight:700;max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pb-header .user-logout{padding:6px 11px;border-radius:999px;background:transparent;border:1px solid rgba(255,255,255,.35);color:inherit;font:inherit;font-size:12px;cursor:pointer}
body.light-header .pb-header{background:rgba(251,248,241,.94);color:#2F2A24;border-bottom:1px solid #E4DCCB}
body.light-header .pb-header .nav a{color:#6B6255}
body.light-header .pb-header .nav a:hover,body.light-header .pb-header .nav a[aria-current="page"]{color:#2F2A24}
body.light-header .pb-header .header-action.is-secondary{color:#2F2A24;border-color:#C9BFA9}
body.light-header .pb-header .header-action.is-secondary:hover{background:rgba(47,42,36,.07)}
body.light-header .pb-header .user-menu{background:rgba(47,42,36,.06);border-color:#E4DCCB}
body.light-header .pb-header .user-logout{border-color:#C9BFA9}

/* Hamburger + drawer (mobile only). */
.nav-toggle{display:none;align-items:center;justify-content:center;flex-direction:column;gap:5px;width:42px;height:42px;padding:0;border-radius:10px;background:transparent;border:1px solid rgba(255,255,255,.38);color:inherit;cursor:pointer}
.nav-toggle span{display:block;width:19px;height:2px;background:currentColor;border-radius:2px}
body.light-header .nav-toggle{border-color:#C9BFA9}
.pb-drawer-backdrop{position:fixed;inset:0;z-index:95;background:rgba(15,20,22,.48);opacity:0;pointer-events:none;transition:opacity .18s}
.pb-drawer-backdrop.is-open{opacity:1;pointer-events:auto}
.pb-drawer{position:fixed;z-index:96;top:0;right:0;bottom:0;width:min(320px,86vw);max-width:100%;display:flex;flex-direction:column;background:#FBF8F1;color:#2F2A24;box-shadow:-12px 0 40px rgba(0,0,0,.22);transform:translateX(102%);transition:transform .2s ease;overflow-y:auto;overscroll-behavior:contain;padding-bottom:env(safe-area-inset-bottom)}
.pb-drawer.is-open{transform:translateX(0)}
.pb-drawer-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 20px;border-bottom:1px solid #E4DCCB;font-weight:800;font-size:16px}
.pb-drawer-close{width:36px;height:36px;border-radius:50%;border:1px solid #E4DCCB;background:transparent;color:#2F2A24;font-size:22px;line-height:1;cursor:pointer}
.pb-drawer-links{padding:10px 12px;display:flex;flex-direction:column}
.pb-drawer-links a,.pb-drawer-links button,.pb-drawer-account a,.pb-drawer-account button{display:block;width:100%;padding:13px 12px;border:0;border-radius:9px;background:transparent;color:#2F2A24;font:inherit;font-size:15px;font-weight:650;text-align:left;text-decoration:none;cursor:pointer;word-break:break-word;overflow-wrap:anywhere}
.pb-drawer-links a:hover,.pb-drawer-links button:hover,.pb-drawer-account a:hover,.pb-drawer-account button:hover{background:rgba(54,88,74,.09)}
.pb-drawer-links a[aria-current="page"]{color:#36584A;font-weight:800}
.pb-drawer-account{padding:10px 12px 20px;border-top:1px solid #E4DCCB}
.pb-drawer-account .drawer-primary{background:#36584A;color:#fff;text-align:center;font-weight:800}

/* Standalone legal/info pages have no hero padding; clear the fixed header.
   The login page centres its card with `body{display:flex}`, which would lay
   out the injected header/footer/FAB as extra flex items in a row. Force
   block flow and centre the card with margins instead. */
body[data-pb-standalone]{display:block}
[data-pb-standalone] .wrap{padding-top:92px}
[data-pb-standalone] .card{margin:112px auto 48px;max-width:100%}
[data-pb-standalone] .crumb{padding-top:4px}

@media(max-width:920px){
  .pb-header{padding:10px 14px}
  .pb-header .nav{display:none}
  .pb-header .header-action{display:none}
  .pb-header .user-menu{display:none!important}
  .nav-toggle{display:inline-flex}
  .hero h1{font-size:clamp(30px,8.6vw,52px);line-height:1.04;letter-spacing:0;max-width:100%;overflow-wrap:break-word;word-break:break-word;hyphens:auto}
  .hero-content{max-width:100%;overflow-wrap:break-word}
  .page-hero.compact h1{font-size:clamp(30px,8vw,48px);overflow-wrap:break-word}
  [data-pb-standalone] .wrap{padding-top:84px}
  [data-pb-standalone] .card{margin:92px auto 40px}
}
@media(min-width:921px){
  .pb-drawer,.pb-drawer-backdrop{display:none!important}
}

/* ---- Global chrome widgets: favorites dialog + lucky-draw FAB -------------
   Single implementation, loaded on every page (including the standalone
   legal/info pages, which do not load styles.css). var() fallbacks keep it
   working where no design tokens are defined (e.g. account/login.html). */
.fav-bar{display:flex;margin:0 0 20px}
.fav-btn{display:inline-flex;align-items:center;gap:7px;padding:9px 16px;border-radius:999px;border:1px solid var(--line,#E4DCCB);background:#fffdf8;color:var(--ink,#2F2A24);font:inherit;font-size:14px;font-weight:750;cursor:pointer;transition:color .15s ease,border-color .15s ease,background .15s ease}
.fav-btn:hover{color:var(--cinnabar,#B0432F);border-color:var(--cinnabar,#B0432F)}
.fav-btn:disabled{opacity:.55;cursor:default}
.fav-btn .heart{font-size:15px;line-height:1}
.fav-btn.is-active{background:var(--cinnabar,#B0432F);border-color:var(--cinnabar,#B0432F);color:#fff}
.fav-btn.is-active:hover{color:#fff;opacity:.92}
.user-fav-btn{padding:7px 13px;font-size:13px;background:transparent}
.fav-overlay{position:fixed;inset:0;z-index:80;display:none;align-items:flex-start;justify-content:center;padding:9vh 16px;background:rgba(20,27,31,.46);backdrop-filter:blur(3px)}
.fav-overlay.is-open{display:flex}
.fav-panel{display:flex;flex-direction:column;width:min(560px,100%);max-height:78vh;border:1px solid var(--line,#E4DCCB);border-radius:14px;background:var(--paper-soft,#FBF8F1);box-shadow:var(--shadow,0 24px 70px rgba(20,27,31,.16));overflow:hidden}
.fav-panel header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 20px;border-bottom:1px solid var(--line,#E4DCCB)}
.fav-panel h2{margin:0;font-family:Georgia,"Songti SC","Noto Serif CJK SC",serif;font-size:21px}
.fav-panel h2 .en{font-family:Inter,ui-sans-serif,system-ui,sans-serif;font-size:12px;font-weight:500;color:var(--muted,#7A7163)}
.fav-close{flex:none;width:34px;height:34px;border-radius:50%;border:1px solid var(--line,#E4DCCB);background:transparent;color:var(--muted,#7A7163);font-size:20px;line-height:1;cursor:pointer}
.fav-close:hover{color:var(--ink,#2F2A24);border-color:var(--ink,#2F2A24)}
.fav-list{overflow:auto;padding:8px 12px 14px}
.fav-item{display:flex;align-items:center;gap:10px;padding:10px 8px;border-bottom:1px solid var(--line,#E4DCCB)}
.fav-item:last-child{border-bottom:none}
.fav-link{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.fav-title{color:var(--ink,#2F2A24);font-weight:750;font-size:16px}
.fav-item:hover .fav-title{color:var(--cinnabar,#B0432F)}
.fav-meta{color:var(--muted,#7A7163);font-size:12px}
.fav-remove{flex:none;width:28px;height:28px;border-radius:50%;border:1px solid var(--line,#E4DCCB);background:transparent;color:var(--muted,#7A7163);font-size:16px;line-height:1;cursor:pointer}
.fav-remove:hover{color:var(--cinnabar,#B0432F);border-color:var(--cinnabar,#B0432F)}
.fav-remove:disabled{opacity:.5;cursor:default}
.fav-note{padding:28px 12px;text-align:center;color:var(--muted,#7A7163);font-size:14px;line-height:1.9}
.fav-browse{color:var(--jade,#36584A);font-weight:750;text-decoration:underline}
.hero-panel.daily-loading > *:not(.daily-loading-note){visibility:hidden}
.daily-loading-note{margin:10px 0 0;color:var(--muted,#7A7163);font-size:14px}
.lottery-fab{position:fixed;right:20px;bottom:calc(20px + env(safe-area-inset-bottom));z-index:60;display:none;align-items:center;gap:8px;max-width:min(78vw,320px);min-height:48px;padding:0 18px;border:none;border-radius:999px;background:var(--cinnabar,#B0432F);color:#fff;font:inherit;font-size:14px;font-weight:750;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;box-shadow:0 10px 30px rgba(20,27,31,.28);cursor:pointer}
.lottery-fab .dice{font-size:18px;line-height:1}
.lottery-fab .fab-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lottery-fab:active{transform:translateY(1px)}
.lottery-fab[aria-busy="true"]{opacity:.9;cursor:default}
@media(max-width:920px){.lottery-fab{display:inline-flex}}
