/* ============================================================
   hao123.it — 方案E「阿佩罗 · 遮阳棚」
   橙色首屏 + 扇贝遮阳棚 + 奶油内容区 + 深蓝工具条
   替换文件：wp-content/themes/WebStack-hao123/assets/css/hao123-layout.css
   ============================================================ */

:root {
  --hao-orange: #F2600D;        /* 主橙（阿佩罗橙） */
  --hao-orange-deep: #D14E05;   /* 深橙（遮阳棚条纹/悬停） */
  --hao-orange-dark: #B8490A;   /* 小字号橙（浅底上可读） */
  --hao-orange-tint: #FAECE7;   /* 橙色浅底 */
  --hao-orange-line: #F3C39F;   /* 橙色描边 */
  --hao-bg: #FAF1E3;            /* 奶油底 */
  --hao-card: #FFFFFF;
  --hao-border: #E8DCC8;
  --hao-navy: #042C53;          /* 深蓝色块 */
  --hao-navy-2: #0C447C;
  --hao-navy-3: #185FA5;
  --hao-navy-text: #E6F1FB;
  --hao-navy-muted: #85B7EB;
  --hao-text: #2C2C2A;
  --hao-text-2: #444441;
  --hao-muted: #888780;
  --hao-hero-sub: #FFD9BE;      /* 橙底上的次级文字 */
  --hao-sidebar: 240px;
  --hao-radius: 14px;
}

html { scroll-behavior: smooth; }
body.page-body { background: var(--hao-bg); color: var(--hao-text); font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; }
.page-container { display: block !important; width: 100%; min-height: 100vh; }
.page-container .hao-main { display: block !important; position: relative !important; width: auto !important; min-width: 0; margin-left: var(--hao-sidebar); padding: 0; background: var(--hao-bg); }
.hao-main *, .hao-sidebar *, .hao-mobile-header *, .hao-mobile-drawer *, .hao-bottom-nav *, .hao-tools-band * { box-sizing: border-box; }

/* ---------- 左侧栏：浅色化，橙色只做点缀 ---------- */
.hao-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--hao-sidebar); background: #FFFFFF; color: var(--hao-text); border-right: 1px solid var(--hao-border); overflow-x: hidden; overflow-y: auto; z-index: 50; }
.hao-brand { display: flex; flex-direction: column; gap: 3px; padding: 28px 24px 22px; color: var(--hao-orange-dark) !important; text-decoration: none !important; border-bottom: 1px solid var(--hao-border); }
.hao-brand strong { font-size: 25px; line-height: 1.1; letter-spacing: -.5px; color: var(--hao-orange); }
.hao-brand span { font-size: 12.5px; color: var(--hao-muted); }
.hao-sidebar-nav { padding: 15px 13px 36px; }
.hao-sidebar-nav ul, .hao-mobile-drawer ul { margin: 0; padding: 0; list-style: none; }
.hao-sidebar-nav > ul > li { margin: 3px 0; }
.hao-sidebar-nav a, .hao-sidebar-nav summary { display: flex; align-items: center; justify-content: flex-start; gap: 11px; min-height: 44px; padding: 9px 13px; border-radius: 12px; color: var(--hao-text-2) !important; font-size: 14.5px; font-weight: 600; text-align: left; text-decoration: none !important; cursor: pointer; list-style: none; }
.hao-sidebar-nav summary::-webkit-details-marker, .hao-mobile-drawer summary::-webkit-details-marker { display: none; }
.hao-sidebar-nav a:hover, .hao-sidebar-nav summary:hover { background: var(--hao-orange-tint); color: var(--hao-orange-dark) !important; }
.hao-sidebar-nav > ul > li:first-child > a { background: var(--hao-orange-tint); border: 1px solid var(--hao-orange-line); color: var(--hao-orange-dark) !important; }
.hao-nav-dot { width: 8px; height: 8px; margin-right: 3px; flex: 0 0 auto; border-radius: 50%; background: var(--hao-orange); box-shadow: 0 0 0 4px var(--hao-orange-tint); }
.hao-sidebar-nav a > span:last-child:not(.hao-nav-dot) { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--hao-muted); }
.hao-sidebar-nav details > ul { padding: 2px 0 5px 20px; }
.hao-sidebar-nav details > ul a { min-height: 34px; padding: 6px 12px; font-size: 13px; font-weight: 500; }
.hao-more-nav > details > summary { color: var(--hao-muted) !important; }

/* ---------- 首屏：橙色英雄区 + 遮阳棚 ---------- */
.hao-search-shell { display: block; position: relative; margin: 0; padding: 30px 36px 34px; border: 0; border-radius: 0; background: var(--hao-orange); box-shadow: none; }
.hao-search-shell::after { content: ""; position: absolute; left: 0; right: 0; bottom: -18px; height: 18px; pointer-events: none; background-image: radial-gradient(circle 21px at 22px 0, var(--hao-orange) 20px, rgba(0,0,0,0) 21px), radial-gradient(circle 21px at 22px 0, var(--hao-orange-deep) 20px, rgba(0,0,0,0) 21px); background-size: 88px 18px, 88px 18px; background-position: 0 0, 44px 0; background-repeat: repeat-x; }

/* 问候语（由 hao123-ui.js 注入） */
.hao-hero-head { margin: 0 0 16px; text-align: center; }
.hao-hero-greet { margin: 0 0 4px; color: #FFFFFF; font-size: 27px; line-height: 1.25; font-weight: 700; letter-spacing: .3px; }
.hao-hero-meta { margin: 0; color: var(--hao-hero-sub); font-size: 13px; }
.hao-hero-meta span:empty { display: none; }
.hao-hero-meta span + span:not(:empty)::before { content: " · "; }

/* 搜索引擎切换 */
.hao-search-engines { display: flex; justify-content: center; align-items: center; gap: 6px; min-width: 0; margin: 0 0 12px; overflow-x: auto; scrollbar-width: none; }
.hao-search-engines::-webkit-scrollbar { display: none; }
.hao-engine { position: relative; min-width: max-content; border: 0; border-radius: 999px; background: transparent; color: var(--hao-hero-sub); padding: 6px 14px; font-size: 13.5px; cursor: pointer; }
.hao-engine:hover { color: #FFFFFF; }
.hao-engine.is-active { background: #FFFFFF; color: var(--hao-orange-dark); font-weight: 700; }
.hao-engine.is-active:after { display: none; }

/* 搜索框 */
.hao-search-form { display: flex; max-width: 560px; height: 52px; margin: 0 auto; border: 0; border-radius: 15px; background: #FFFFFF; overflow: hidden; box-shadow: 0 6px 20px rgba(122, 46, 0, .18); }
.hao-search-form input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 0 20px; background: transparent; color: var(--hao-text); font-size: 15px; }
.hao-search-form input::placeholder { color: #A9A296; }
.hao-search-form button { flex: 0 0 92px; border: 0; background: var(--hao-navy); color: var(--hao-navy-text); font-size: 15px; font-weight: 700; cursor: pointer; }
.hao-search-form button:hover { background: var(--hao-navy-2); }
.hao-search-form button span:first-child { font-size: 22px; line-height: 1; vertical-align: -2px; }
.hao-search-button-text { margin-left: 5px; }

/* 快速直达（原移动端标签，桌面端也启用） */
.hao-quick-tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.hao-quick-tabs a { min-width: max-content; padding: 7px 15px; border-radius: 999px; background: var(--hao-orange-deep); color: #FFE3D1; text-decoration: none; font-size: 13px; }
.hao-quick-tabs a:hover { background: var(--hao-orange-dark); color: #FFFFFF; }

/* ---------- 内容区：奶油底 + 白卡片 ---------- */
.hao-sections { padding: 36px 32px 30px; }
.hao-section-group { scroll-margin-top: 20px; }
.hao-group-head { margin: 26px 0 2px; }
.hao-group-head h2 { margin: 0; color: var(--hao-text); font-size: 22px; font-weight: 800; }
.hao-section { margin: 24px 0 32px; scroll-margin-top: 20px; }
.hao-section:first-child { margin-top: 0; }
.hao-section-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.hao-section-head h1, .hao-section-head h2 { display: flex; align-items: center; gap: 11px; margin: 0; color: var(--hao-text); font-size: 19px; line-height: 1.3; font-weight: 800; }
.hao-section-head h1:before, .hao-section-head h2:before { content: ""; width: 5px; height: 21px; flex: 0 0 auto; border-radius: 9px; background: var(--hao-orange); }
.hao-section-head > a { color: var(--hao-muted); text-decoration: none; white-space: nowrap; font-size: 13.5px; }
.hao-section-head > a:hover { color: var(--hao-orange-dark); }
.hao-site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 13px; }
.hao-site-card { min-width: 0; min-height: 70px; display: flex; align-items: center; gap: 12px; padding: 12px 15px; border: 1px solid var(--hao-border); border-radius: var(--hao-radius); background: var(--hao-card); color: var(--hao-text) !important; text-decoration: none !important; box-shadow: 0 1px 4px rgba(120, 72, 30, .04); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.hao-site-card:hover, .hao-site-card:focus-visible { transform: translateY(-2px); border-color: var(--hao-orange-line); box-shadow: 0 10px 24px rgba(146, 74, 22, .12); }
.hao-site-media { position: relative; width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 11px; overflow: hidden; background: var(--hao-orange-tint); color: var(--hao-orange-dark); font-size: 12px; font-weight: 800; }
.hao-site-fallback { position: absolute; inset: 0; display: grid; place-items: center; }
.hao-site-logo { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; background: #fff; }
.hao-site-media.is-fallback .hao-site-logo { display: none; }
.hao-site-name { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 14.5px; line-height: 1.35; font-weight: 700; overflow-wrap: anywhere; }
.hao-mode-text .hao-site-card { justify-content: center; text-align: center; background: #FDF8EF; }
.hao-mode-text .hao-site-name { font-weight: 600; }

/* ---------- 深蓝工具条（由 hao123-ui.js 注入） ---------- */
.hao-tools-band { margin: 28px -32px; padding: 16px 32px 18px; background: var(--hao-navy); }
.hao-tools-title { display: flex; align-items: center; gap: 8px; margin: 0 0 11px; color: var(--hao-navy-muted); font-size: 13px; font-weight: 700; }
.hao-tools-title .fa { color: var(--hao-orange); font-size: 15px; }
.hao-tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.hao-tool-chip { display: block; padding: 11px 12px; border-radius: 10px; background: var(--hao-navy-2); color: var(--hao-navy-text) !important; text-align: center; text-decoration: none !important; font-size: 13.5px; font-weight: 600; transition: background .15s ease; }
.hao-tool-chip:hover { background: var(--hao-navy-3); }

/* ---------- 归档页 / 分页 ---------- */
.hao-archive { min-height: 65vh; }
.hao-pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 28px 0; }
.hao-pagination .page-numbers { min-width: 38px; height: 38px; display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--hao-border); border-radius: 10px; background: #fff; color: var(--hao-text); text-decoration: none; }
.hao-pagination .page-numbers:hover { border-color: var(--hao-orange-line); color: var(--hao-orange-dark); }
.hao-pagination .current { background: var(--hao-orange); color: #fff; border-color: var(--hao-orange); }
.hao-empty { grid-column: 1 / -1; padding: 22px; border-radius: var(--hao-radius); background: #fff; color: var(--hao-muted); }

/* ---------- 页脚：深蓝收尾 ---------- */
.hao-main footer.main-footer { margin: 34px 0 0; padding: 20px 32px; border-top: 0; background: var(--hao-navy); }
.hao-main footer.main-footer, .hao-main footer.main-footer .footer-text { color: var(--hao-navy-muted); }
.hao-main footer.main-footer a { color: #B5D4F4; }

/* ---------- 底部快捷栏（由 hao123-ui.js 注入，仅手机显示） ---------- */
.hao-bottom-nav { display: none; }

/* ---------- 移动端隐藏件 ---------- */
.hao-mobile-header, .hao-mobile-drawer, .hao-drawer-backdrop { display: none; }

/* ============================================================ */
@media (max-width: 1050px) and (min-width: 768px) {
  :root { --hao-sidebar: 210px; }
  .hao-search-shell { padding: 26px 22px 30px; }
  .hao-sections { padding-left: 22px; padding-right: 22px; }
  .hao-tools-band { margin-left: -22px; margin-right: -22px; padding-left: 22px; padding-right: 22px; }
  .hao-main footer.main-footer { padding-left: 22px; padding-right: 22px; }
}

/* ============================================================ */
@media (max-width: 767px) {
  :root { --hao-mobile-top: 64px; }
  body.page-body { background: var(--hao-bg); padding-top: var(--hao-mobile-top); padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .page-container { position: static !important; }
  .hao-sidebar { display: none; }
  .page-container .hao-main { position: relative !important; top: auto !important; width: 100% !important; margin-left: 0; padding: 0; }

  /* 顶栏 */
  .hao-mobile-header { position: fixed; inset: 0 0 auto; z-index: 900; height: var(--hao-mobile-top); display: flex; align-items: center; justify-content: space-between; padding: 0 15px; border-bottom: 1px solid var(--hao-border); background: rgba(255, 250, 240, .96); backdrop-filter: blur(12px); }
  .hao-mobile-brand { display: flex; align-items: center; gap: 10px; color: var(--hao-text) !important; text-decoration: none !important; }
  .hao-mobile-brand span, .hao-mobile-drawer header a span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--hao-orange); color: #fff; font-size: 19px; font-weight: 800; }
  .hao-mobile-brand strong { font-size: 18px; }
  #hao-menu-toggle { width: 44px; height: 44px; display: grid; align-content: center; gap: 5px; padding: 10px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; }
  #hao-menu-toggle i { display: block; width: 22px; height: 2px; border-radius: 2px; background: var(--hao-orange-dark); }

  /* 首屏 */
  .hao-search-shell { margin: 0; padding: 18px 14px 24px; }
  .hao-hero-head { margin-bottom: 12px; }
  .hao-hero-greet { font-size: 20px; }
  .hao-hero-meta { font-size: 11.5px; }
  .hao-search-engines { display: flex; justify-content: flex-start; gap: 4px; margin-bottom: 10px; }
  .hao-engine { padding: 5px 11px; font-size: 12.5px; }
  .hao-search-form { height: 50px; border-radius: 13px; }
  .hao-search-form input { padding: 0 14px; font-size: 14px; }
  .hao-search-form button { flex-basis: 58px; }
  .hao-search-button-text { display: none; }
  .hao-search-shell::after { bottom: -14px; height: 14px; background-image: radial-gradient(circle 16px at 16px 0, var(--hao-orange) 15px, rgba(0,0,0,0) 16px), radial-gradient(circle 16px at 16px 0, var(--hao-orange-deep) 15px, rgba(0,0,0,0) 16px); background-size: 64px 14px, 64px 14px; background-position: 0 0, 32px 0; }
  .hao-quick-tabs { justify-content: flex-start; flex-wrap: nowrap; gap: 7px; margin: 12px 0 0; overflow-x: auto; scrollbar-width: none; }
  .hao-quick-tabs::-webkit-scrollbar { display: none; }
  .hao-quick-tabs a { padding: 6px 13px; font-size: 12.5px; }

  /* 内容 */
  .hao-sections { padding: 26px 12px 16px; }
  .hao-group-head { margin: 20px 0 0; }
  .hao-group-head h2 { font-size: 18px; }
  .hao-section { margin: 20px 0 26px; scroll-margin-top: 76px; }
  .hao-section-group { scroll-margin-top: 76px; }
  .hao-section-head { margin-bottom: 12px; }
  .hao-section-head h1, .hao-section-head h2 { gap: 8px; font-size: 16.5px; }
  .hao-section-head h1:before, .hao-section-head h2:before { width: 4px; height: 18px; }
  .hao-section-head > a { font-size: 12.5px; }
  .hao-site-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  .hao-mode-logo .hao-site-card, .hao-card-logo { min-height: 108px; padding: 12px 5px 10px; flex-direction: column; justify-content: center; gap: 8px; text-align: center; }
  .hao-mode-logo .hao-site-media, .hao-card-logo .hao-site-media { width: 44px; height: 44px; flex-basis: 44px; border-radius: 13px; }
  .hao-site-name { width: 100%; font-size: 12.5px; line-height: 1.3; }
  .hao-mode-text .hao-site-card, .hao-card-text { min-height: 56px; padding: 8px 6px; justify-content: center; text-align: center; background: #FDF8EF; }
  .hao-mode-text .hao-site-name, .hao-card-text .hao-site-name { font-size: 13px; font-weight: 600; }

  .hao-tools-band { margin: 22px -12px; padding: 14px 12px 15px; }
  .hao-tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .hao-tool-chip { padding: 10px 8px; font-size: 12.5px; }

  .hao-main footer.main-footer { margin: 24px 0 0; padding: 16px 12px; font-size: 11px; }
  .hao-main footer.main-footer .go-up { display: none; }

  /* 抽屉：浅色化 */
  .hao-drawer-backdrop { position: fixed; inset: 0; z-index: 1000; display: block; background: rgba(43, 22, 8, .4); opacity: 0; visibility: hidden; transition: opacity .22s ease, visibility .22s ease; }
  .hao-mobile-drawer { position: fixed; inset: 0 0 0 auto; z-index: 1001; width: min(88vw, 360px); display: block; overflow-y: auto; color: var(--hao-text); background: #FFF9EF; transform: translateX(102%); transition: transform .22s ease; box-shadow: -14px 0 35px rgba(87, 39, 12, .18); }
  .hao-mobile-drawer header { position: sticky; top: 0; z-index: 2; height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 0; background: var(--hao-orange); }
  .hao-mobile-drawer header a { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
  .hao-mobile-drawer header a span { background: rgba(255, 255, 255, .22); color: #fff; }
  .hao-mobile-drawer header a strong { font-size: 19px; }
  #hao-menu-close { width: 42px; height: 42px; border: 0; background: transparent; color: #fff; font-size: 34px; line-height: 1; cursor: pointer; }
  .hao-mobile-drawer nav { padding: 13px 13px 30px; }
  .hao-mobile-drawer nav > ul > li { margin: 3px 0; }
  .hao-mobile-drawer a, .hao-mobile-drawer summary { display: flex; align-items: center; justify-content: flex-start; gap: 11px; min-height: 48px; padding: 10px 13px; border-radius: 12px; color: var(--hao-text-2) !important; text-align: left; text-decoration: none !important; list-style: none; font-weight: 600; cursor: pointer; }
  .hao-mobile-drawer a:active, .hao-mobile-drawer summary:active { background: var(--hao-orange-tint); }
  .hao-mobile-drawer nav > ul > li:first-child > a { background: var(--hao-orange-tint); border: 1px solid var(--hao-orange-line); color: var(--hao-orange-dark) !important; }
  .hao-mobile-drawer details ul { padding-left: 19px; }
  .hao-mobile-drawer details ul a { min-height: 38px; padding: 7px 12px; font-size: 13px; font-weight: 500; }
  .hao-mobile-drawer a > span:last-child:not(.hao-nav-dot) { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--hao-muted); }
  body.hao-menu-open .hao-mobile-drawer { transform: none; }
  body.hao-menu-open .hao-drawer-backdrop { opacity: 1; visibility: visible; }
  body.hao-menu-open { overflow: hidden; }

  /* 底部快捷栏 */
  .hao-bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 950; display: flex; padding: 5px 0 calc(5px + env(safe-area-inset-bottom)); border-top: 1px solid var(--hao-border); background: #FFFFFF; }
  .hao-bnav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; border: 0; background: transparent; color: var(--hao-muted); text-decoration: none !important; font-size: 11px; cursor: pointer; }
  .hao-bnav-item .fa { font-size: 18px; line-height: 1.2; }
  .hao-bnav-item.is-active { color: var(--hao-orange-dark); font-weight: 600; }
}

@media (max-width: 359px) {
  .hao-site-grid { gap: 7px; }
  .hao-mode-logo .hao-site-card, .hao-card-logo { min-height: 102px; }
  .hao-mode-logo .hao-site-media, .hao-card-logo .hao-site-media { width: 40px; height: 40px; flex-basis: 40px; }
  .hao-site-name { font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *:before, *:after { transition: none !important; animation: none !important; }
}
