/* 2026-10-31 shared header (third design round): cream bar with a thin outline, category links,
   LINE 貼圖, 我的收藏, site search and a Say Hello button. Loaded after every general-page stylesheet.
   Independent quizzes keep their own headers and never load this file. */
body.se-site{--v3-line:#17362C;--v3-shadow:#17362C;--v3-paper:#FFFDF7;--v3-grid:rgba(23,54,44,.075);--v3-yolk:#FBBF24;--v3-on-yolk:#17362C}
html.dark body.se-site{--v3-line:#608773;--v3-shadow:#050C0A;--v3-paper:#152821;--v3-grid:rgba(246,245,235,.06)}
/* Shared page width, matching 山姆蛋名牌工具 (Sam's choice on 2026-10-31): a 4.2% gutter (at least 16px)
   and up to 1400px of content, the same edges as the name-badge workspace.
   Applies to the header, footer, homepage, directories, content pages and the standard item-page containers. */
body.se-site{--v3-page:min(1400px,calc(100% - 2 * max(16px,4.2vw)));--se-header-height:76px}
body.se-site :is(.container,.lab-home-wrap,.lab-item-toolbar,.lab-content-page,.directory-main,main.workbench,main.legacy-tool),body.se-site .lab-site-footer-inner{width:var(--v3-page);max-width:1400px;margin-inline:auto}
/* The quizzes directory used to sit 20px lower than 實用工具 and 小遊戲; align all three. */
body.se-site[data-se-page=quizzes] main.directory-main{padding-top:20px}
body.se-site .se-visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

body.se-site .lab-site-header.se-header-v3{position:relative;background:var(--se-bg);color:var(--se-ink);border-bottom:1.5px solid var(--v3-line)}
body.se-site .se-header-v3 .lab-site-header-inner{position:relative;display:flex;align-items:center;justify-content:space-between;width:var(--v3-page);max-width:1400px;min-width:0;height:var(--se-header-height);min-height:var(--se-header-height);margin-inline:auto;padding:0;gap:20px;flex-wrap:nowrap}
/* Keep the shared brand complete even on pages that do not load the legacy brand.css. */
body.se-site .se-header-v3 .samegg-brand{display:inline-flex;align-items:center;flex:0 0 auto;gap:10px;min-width:0;min-height:44px;margin:0;padding:0;border-radius:10px;color:var(--se-ink);line-height:1;text-decoration:none;letter-spacing:normal}
body.se-site .se-header-v3 .samegg-brand-logo{display:block;flex:0 0 44px;width:44px;height:44px;object-fit:contain;border-radius:11px;box-shadow:none}
body.se-site .se-header-v3 .samegg-brand-copy{display:flex;flex-direction:column;align-items:flex-start;gap:3px;min-width:0}
body.se-site .se-header-v3 .samegg-brand-name{font:700 18px/1.2 var(--se-font);color:var(--se-ink);white-space:nowrap}
body.se-site .se-header-v3 .samegg-brand:hover .samegg-brand-name{color:var(--se-link)}
body.se-site .se-header-v3 .samegg-brand-subtitle{display:block;font:600 11px/1.2 var(--se-font);letter-spacing:.14em;text-transform:uppercase;color:var(--se-muted);white-space:nowrap}

body.se-site .se-header-v3 .lab-primary-nav{flex:1;min-width:0;display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:nowrap}
body.se-site .se-header-v3 .se-nav-panel{flex:1;min-width:0;display:flex;align-items:center;gap:12px}
body.se-site .se-header-v3 .se-nav-links{display:flex;flex:0 0 auto;align-items:center;gap:2px;margin-right:auto}
body.se-site .se-header-v3 .se-nav-links>:is(a,button){position:relative;display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:8px 11px;border:0;border-radius:8px;background:transparent;color:var(--se-ink);font:500 15px/1.4 var(--se-font)!important;white-space:nowrap;text-decoration:none;cursor:pointer}
body.se-site .se-header-v3 .se-nav-links>:is(a,button):hover{background:var(--se-mint)}
body.se-site .se-header-v3 .se-nav-links>a[aria-current=page],body.se-site .se-header-v3 .se-nav-favorites[aria-pressed=true]{color:var(--se-link);font-weight:700!important}
body.se-site .se-header-v3 .se-nav-links>a[aria-current=page]::after,body.se-site .se-header-v3 .se-nav-favorites[aria-pressed=true]::after{content:'';position:absolute;left:11px;right:11px;bottom:4px;height:3px;border-radius:2px;background:var(--v3-yolk)}
body.se-site .se-header-v3 .se-nav-line{font-weight:700!important}
body.se-site .se-header-v3 .se-nav-new{font:700 11px/1.3 var(--se-font);letter-spacing:.04em;padding:1px 6px;border-radius:4px;border:1px solid #17362C;background:var(--v3-yolk);color:#17362C}
body.se-site .se-header-v3 .se-nav-count{min-width:25px;padding:2px 7px;border-radius:6px;background:var(--se-mint);color:var(--se-link);font:600 14px/1.6 var(--se-font);text-align:center;box-sizing:border-box}

body.se-site .se-header-v3 .se-nav-search{display:flex;flex:0 1 230px;align-items:center;gap:8px;width:230px;min-width:0;height:44px;padding:0 14px;border:1.5px solid var(--v3-line);border-radius:10px;background:var(--se-surface);color:var(--se-muted);margin:0}
body.se-site .se-header-v3 .se-nav-search:focus-within{outline:3px solid var(--se-focus);outline-offset:2px}
body.se-site .se-header-v3 .se-nav-search svg{flex:none}
body.se-site .se-header-v3 .se-nav-search input{flex:1 1 0;width:100%;min-width:0;height:100%;border:0;background:transparent;padding:0;color:var(--se-ink);font:400 14px/1.4 var(--se-font);outline:none}
body.se-site .se-header-v3 .se-nav-search input::placeholder{color:var(--se-muted);opacity:1}
body.se-site .se-header-v3 .se-nav-hello{display:inline-flex;flex:0 0 auto;align-items:center;min-height:44px;padding:0 18px;border-radius:10px;border:1.5px solid var(--v3-line);background:#17362C;color:#FFFAF0;box-shadow:3px 3px 0 #047857;font:700 15px/1 var(--se-font)!important;white-space:nowrap;text-decoration:none;transition:transform .18s ease,box-shadow .18s ease}
body.se-site .se-header-v3 .se-nav-hello:hover{color:#FFFAF0;transform:translate(-1px,-1px);box-shadow:4px 4px 0 #047857}
body.se-site .se-header-v3 .se-nav-hello:active{transform:translate(3px,3px);box-shadow:0 0 0 #047857}

body.se-site .se-header-v3 #site-theme-toggle{position:static;display:inline-flex;align-items:center;justify-content:center;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;padding:10px;border-radius:10px;border:1.5px solid var(--v3-line);background:var(--se-surface);color:#8A6000;cursor:pointer}
html.dark body.se-site .se-header-v3 #site-theme-toggle{background:#17362C;color:#FBBF24}
body.se-site .se-header-v3 :is(.se-search-toggle,.se-menu-toggle){display:none;position:static;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;align-items:center;justify-content:center;padding:0;border-radius:10px;border:1.5px solid var(--v3-line);background:var(--se-surface);color:var(--se-ink);cursor:pointer}
body.se-site .se-header-v3 .se-menu-toggle{background:#17362C;color:#FFFAF0}
body.se-site .se-header-v3 :is(a,button,input):focus-visible{outline:3px solid var(--se-focus);outline-offset:2px}
body.se-site .se-header-v3 .se-nav-search input:focus-visible{outline:none}
body.se-site .se-header-v3 .samegg-brand:active{opacity:.8}
body.se-site .se-header-v3 .se-nav-links>:is(a,button):active{background:var(--se-mint);color:var(--se-link)}
body.se-site .se-header-v3 :is(#site-theme-toggle,.se-search-toggle,.se-menu-toggle):active,body.se-site .se-header-v3 .se-menu-toggle[aria-expanded=true]{background:var(--se-mint);color:var(--se-ink);border-color:var(--se-link)}

/* Shared footer: 關於實驗室 joins Say Hello */
body.se-site .lab-site-footer .se-footer-links{display:flex;flex-wrap:wrap;align-items:center;gap:4px 24px}

/* Narrower screens collapse links, search and Say Hello into a panel under the bar */
@media(max-width:1199px){
 body.se-site{--se-header-height:68px}
 body.se-site .se-header-v3 .lab-site-header-inner{padding:0;gap:12px}
 body.se-site .se-header-v3 .lab-primary-nav,body.se-site .se-header-v3 .lab-primary-nav.is-open{position:static;flex:1;justify-content:flex-end;background:transparent;box-shadow:none;padding:0;gap:8px;width:auto}
 body.se-site .se-header-v3 .lab-primary-nav.is-open :is(#site-theme-toggle,.se-menu-toggle){position:static;top:auto;right:auto}
 body.se-site .se-header-v3 :is(.se-search-toggle,.se-menu-toggle){display:inline-flex}
 body.se-site .se-header-v3 .se-nav-panel{display:none}
 body.se-site .se-header-v3 .lab-primary-nav.is-open .se-nav-panel{display:flex;position:absolute;top:100%;left:0;right:0;z-index:60;flex-direction:column;align-items:stretch;gap:14px;max-height:calc(100vh - var(--se-header-height) - 2px);max-height:calc(100dvh - var(--se-header-height) - 2px);overflow-y:auto;overscroll-behavior:contain;scroll-padding:16px;padding:14px 20px max(22px,env(safe-area-inset-bottom,0px));background:var(--se-bg);border-bottom:1.5px solid var(--v3-line);border-radius:0 0 12px 12px;box-shadow:0 14px 24px rgba(0,0,0,.12)}
 body.se-site .se-header-v3 .lab-primary-nav.is-open .se-nav-search{order:-1;flex:0 0 auto;width:100%;height:48px;min-height:48px}
 body.se-site .se-header-v3 .lab-primary-nav.is-open .se-nav-search input{font-size:16px}
 body.se-site .se-header-v3 .lab-primary-nav.is-open .se-nav-links{flex-direction:column;align-items:stretch;gap:0;margin:0}
 body.se-site .se-header-v3 .lab-primary-nav.is-open .se-nav-links>:is(a,button){display:flex;min-height:48px;padding:10px 4px;border-radius:0;border-bottom:1px solid var(--se-border);font-size:16px!important;text-align:left}
 body.se-site .se-header-v3 .lab-primary-nav.is-open .se-nav-links>a[aria-current=page]::after,body.se-site .se-header-v3 .lab-primary-nav.is-open .se-nav-favorites[aria-pressed=true]::after{left:4px;right:auto;width:40px;bottom:6px}
 body.se-site .se-header-v3 .lab-primary-nav.is-open .se-nav-hello{justify-content:center;min-height:48px}
}
@media(max-width:420px){
 body.se-site .se-header-v3 .lab-site-header-inner{gap:8px}
 body.se-site .se-header-v3 .samegg-brand{gap:8px}
 body.se-site .se-header-v3 .samegg-brand-logo{width:38px;height:38px;flex-basis:38px}
 body.se-site .se-header-v3 .samegg-brand-name{font-size:15px}
 body.se-site .se-header-v3 .samegg-brand-subtitle{font-size:11px}
 body.se-site .se-header-v3 .lab-primary-nav{gap:6px}
}
/* Search remains the first item inside the menu on the narrowest phones. */
@media(max-width:359px){body.se-site .se-header-v3 .se-search-toggle{display:none}}
@media(prefers-reduced-motion:reduce){body.se-site .se-header-v3 .se-nav-hello{transition:none}body.se-site .se-header-v3 .se-nav-hello:is(:hover,:active){transform:none}}
/* 2026-11-01: 科技快報 is an external site: divider, softer colour, arrow, opens in a new tab */
body.se-site .se-header-v3 .se-nav-links>a.se-nav-news{margin-left:9px;color:var(--se-muted,#5b6b64);font-weight:500!important}
body.se-site .se-header-v3 .se-nav-links>a.se-nav-news::before{content:'';position:absolute;left:-5px;top:13px;bottom:13px;width:1px;background:var(--se-border,#d9e2dd)}
body.se-site .se-header-v3 .se-nav-links>a.se-nav-news:hover{color:var(--se-ink)}
body.se-site .se-header-v3 .se-nav-ext{flex:none;opacity:.7;transform:translateY(-1px)}
@media(max-width:1199px){body.se-site .se-header-v3 .lab-primary-nav.is-open .se-nav-links>a.se-nav-news{margin:12px 0 0;border-top:1px solid var(--se-border);border-bottom:0}body.se-site .se-header-v3 .lab-primary-nav.is-open .se-nav-links>a.se-nav-news::before{display:none}}

/* At 1200px the page is 1099px wide: trim spacing before the full desktop layout opens up. */
@media(min-width:1200px) and (max-width:1399px){
 body.se-site .se-header-v3 .lab-site-header-inner{gap:16px}
 body.se-site .se-header-v3 .se-nav-panel{gap:10px}
 body.se-site .se-header-v3 .se-nav-links{gap:0}
 body.se-site .se-header-v3 .se-nav-links>:is(a,button){padding-inline:8px}
 body.se-site .se-header-v3 .se-nav-search{flex-basis:clamp(200px,calc(15vw + 20px),230px);width:clamp(200px,calc(15vw + 20px),230px);padding-inline:10px}
 body.se-site .se-header-v3 .se-nav-hello{padding-inline:14px}
}

/* 2026-11-21: EN／中 language switch beside the theme control (lab-i18n.js). The page stays hidden
   only while English is being applied, and shows after 1.5 s even if the dictionary never arrives. */
html.se-lang-pending body.se-site{opacity:0;animation:se-lang-reveal 0s 1.5s forwards}
@keyframes se-lang-reveal{to{opacity:1}}
body.se-site .se-header-v3 .se-lang-toggle{position:static;display:inline-flex;align-items:center;justify-content:center;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border-radius:10px;border:1.5px solid var(--v3-line);background:var(--se-surface);color:var(--se-ink);font:700 14px/1 var(--se-font,inherit);letter-spacing:.02em;cursor:pointer}
body.se-site .se-header-v3 .se-lang-toggle:lang(zh-Hant){font-size:16px;letter-spacing:0}
html.dark body.se-site .se-header-v3 .se-lang-toggle{background:#17362C;color:#FFFAF0}
body.se-site .se-header-v3 .se-lang-toggle:active{background:var(--se-mint);color:var(--se-ink);border-color:var(--se-link)}
body.se-site .se-lang-note{width:var(--v3-page,min(1400px,92%));box-sizing:border-box;margin:12px auto 0;padding:8px 14px;border:1.5px dashed var(--se-border,#d9e2dd);border-radius:10px;background:var(--se-surface);color:var(--se-muted,#5b6b64);font-size:14px;line-height:1.5}
body.se-site main .se-lang-note{width:auto;margin:0 0 14px}
@media(max-width:1199px){body.se-site .se-header-v3 .se-lang-toggle{margin-left:auto}body.se-site .se-header-v3 .se-lang-toggle+#site-theme-toggle{margin-left:0}}
@media(max-width:359px){body.se-site .se-header-v3 .se-lang-toggle{flex-basis:40px;width:40px;min-width:40px}}
/* English wording is longer: the homepage hero and collage labels get room for it. */
html:lang(en) body.se-site.lab-home .lab-hero-copy h1{font-size:clamp(38px,4.8vw,72px)}
html:lang(en) body.se-site.lab-home .se-collage-card span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
html:lang(en) body.se-site.ip-page .ip-hero h1{font-size:clamp(32px,4.2vw,64px);letter-spacing:-.03em}
html:lang(en) body.se-site.ip-page .ip-name>span[lang=en]{display:none}
