/*
Theme Name: 港湾 (Gangwan) Theme
Theme URI: https://www.gangwan123.com
Author: 林刚 (Lin Gang)
Author URI: https://www.gangwan123.com
Description: 港湾项目定制WordPress主题，提供专业的投标信息、行业新闻、指南、科技工具、团队介绍和联系方式。
Version: 2.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: gangwan
*/

/* ==========================================================================
   1. 基本全局样式 - Base & Global Styles
   ========================================================================== */

/* 确保所有元素使用 box-sizing */
html {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    /* 为整个页面设置默认字体，主要由 functions.php 中的 Google Fonts 加载 */
    font-family: 'Inter', sans-serif;
    margin: 0;
}

/* 固定 header 占位块：高度由 JS 动态设置，CSS 给一个初始回退值 */
.header-spacer {
    height: 72px; /* 回退值，JS 会用 header.offsetHeight 覆盖 */
    flex-shrink: 0;
}

/* 锚点跳转时让内容不被固定 header 遮挡 */
:target,
[id] {
    scroll-margin-top: 80px;
}

/* 页面内容区最小高度，避免内容过短时 footer 悬空 */
.site-content {
    min-height: calc(100vh - 72px);
}

/* ==========================================================================
   2. 辅助功能和可访问性样式 - Accessibility
   ========================================================================== */

/* 屏幕阅读器文字，用于隐藏视觉上的文本但对辅助设备可见 */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    word-wrap: normal !important;
    border: 0;
    -webkit-clip-path: inset(50%);
            clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    -webkit-clip-path: none;
            clip-path: none;
    color: #21759b;
    display: block;
    font-size: 14px;
    font-weight: 700;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000; /* Above all */
}

/* ==========================================================================
   3. 导航菜单样式 - Navigation
   ========================================================================== */

/* 桌面端导航菜单的子菜单（Sub-menus）样式 */
.main-navigation ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    min-width: 180px;
    z-index: 9999;
    list-style: none;
    margin: 0;
    padding: 0;
    border-radius: 4px;
}

/* 鼠标悬停时显示子菜单 */
.main-navigation ul.primary-menu li:hover > ul {
    display: block;
}

.main-navigation ul ul li {
    position: relative;
    border-bottom: 1px solid #eee;
}

.main-navigation ul ul li:last-child {
    border-bottom: none;
}

.main-navigation ul ul ul {
    top: 0;
    left: 100%;
}

.main-navigation ul ul a {
    padding: 10px 15px;
    display: block;
    white-space: nowrap;
    color: #333;
    text-decoration: none;
}

.main-navigation ul ul a:hover {
    background-color: #f0f0f0;
    color: #0073aa;
}


/* ==========================================================================
   4. 图片和Logo样式 - Images & Logos
   ========================================================================== */

.site-branding img {
    /* 强制 logo 图片高度，确保一致性 */
    height: 50px !important;
    width: auto !important;
    object-fit: contain;
}


/* ==========================================================================
   5. 响应式调整 - Responsive Adjustments
   ========================================================================== */

/* 适配中等屏幕及更小设备（md:max-width-767px） */
@media (max-width: 767px) {
    /* 占位块高度由 JS 动态同步，无需在此硬编码 padding-top */
}

/* ==========================================================================
   6. 主导航菜单链接样式
   ========================================================================== */

/* 桌面端主菜单每一项 */
#primary-menu > li {
    position: relative;
    list-style: none;
}

#primary-menu > li > a {
    display: inline-block;
    padding: 0.25rem 0;
    color: #374151;
    font-weight: 500;
    text-decoration: none;
    font-size: 0.9375rem;
    transition: color 0.2s ease;
    position: relative;
}

#primary-menu > li > a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #1a56db;
    transition: width 0.25s ease;
    border-radius: 2px;
}

#primary-menu > li > a:hover,
#primary-menu > li.current-menu-item > a,
#primary-menu > li.current-page-ancestor > a {
    color: #1a56db;
}

#primary-menu > li > a:hover::after,
#primary-menu > li.current-menu-item > a::after,
#primary-menu > li.current-page-ancestor > a::after {
    width: 100%;
}

/* ==========================================================================
   7. 手机端菜单链接样式
   ========================================================================== */

#mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#mobile-menu ul li {
    border-bottom: 1px solid #f3f4f6;
}

#mobile-menu ul li a {
    display: block;
    padding: 0.875rem 1rem;
    color: #374151;
    font-weight: 500;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.2s ease, background 0.2s ease;
    border-radius: 0.5rem;
}

#mobile-menu ul li a:hover,
#mobile-menu ul li.current-menu-item > a {
    color: #1a56db;
    background: #eff6ff;
}

/* ==========================================================================
   8. 页脚菜单链接样式
   ========================================================================== */

.footer-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-menu li {
    list-style: none;
}

.footer-menu li a {
    display: inline-block;
    color: #9ca3af;
    font-size: 0.875rem;
    text-decoration: none;
    padding: 0.25rem 0;
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.footer-menu li a:hover {
    color: #ffffff;
    padding-left: 4px;
}

/* 页脚菜单层级样式 */
.footer-menu .menu-item-has-children > a {
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 0.5rem;
}

.footer-menu .sub-menu {
    list-style: none;
    padding-left: 1rem;
    margin: 0.25rem 0 0.75rem 0;
    border-left: 2px solid #374151;
}

.footer-menu .sub-menu li a {
    font-size: 0.8125rem;
    padding: 0.125rem 0;
    color: #9ca3af;
}

.footer-menu .sub-menu li a:hover {
    color: #60a5fa;
    padding-left: 4px;
}
