/* Theme Name: DURIX Theme
   Author: ZeroY Studio
   Description: Clean, precision B2B industrial theme for DURIX.
   Version: 1.0.0
*/

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--pw);
  color: var(--g);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.wrap {
  width: min(var(--max), calc(100% - var(--side) * 2));
  margin: 0 auto;
}

section {
  padding: var(--section) 0;
}

h1, h2, h3, h4, p {
  margin-top: 0;
}

h1 {
  font-size: clamp(40px, 5.5vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 700;
  color: var(--g);
  margin-bottom: 24px;
}

h2 {
  font-size: clamp(30px, 3.8vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 650;
  color: var(--g);
  margin-bottom: 20px;
}

h3 {
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 600;
  color: var(--g);
  margin-bottom: 12px;
}

p {
  font-size: 16px;
  line-height: 1.7;
  color: var(--body);
}

.label {
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  display: block;
  margin-bottom: 16px;
}

.mono {
  font-family: var(--font-mono);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 248, 247, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-in {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  /* Positioning context for the Books mega menu, so the panel hangs
     from the header's bottom edge instead of the nav item's box. */
  position: relative;
}

.brand-logo .logo-mark {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--g);
}

.brand-logo .logo-accent {
  color: var(--r);
}

.mobile-nav-toggle {
  display: none;
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--g);
  transition: all 0.2s ease;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 13px;
  font-weight: 500;
  color: var(--body);
}

.site-nav a {
  position: relative;
  padding: 8px 0;
  transition: color 0.2s ease;
}

/* 悬停统一为品牌红；当前所在页保持石墨色 + 红色下划线 */
.site-nav a:hover {
  color: var(--r);
}

.site-nav a.is-active {
  color: var(--g);
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 2px;
  background: var(--r);
  transition: right 0.22s ease;
}

.site-nav a:hover::after,
.site-nav a.is-active::after {
  right: 0;
}

/* Nav: Books entry with audience dropdown */
.site-nav .nav-item {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-caret {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 7px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  vertical-align: middle;
  transition: transform 0.22s ease;
}

.nav-item-dropdown:hover .nav-caret,
.nav-item-dropdown:focus-within .nav-caret {
  transform: rotate(180deg);
}

.nav-item-dropdown.is-active > a {
  color: var(--g);
}

.nav-item-dropdown.is-active > a::after {
  right: 0;
}

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 172px;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: var(--w);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: 0 16px 34px rgba(43, 48, 49, 0.1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 120;
}

.nav-item-dropdown:hover .nav-dropdown,
.nav-item-dropdown:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
}

.nav-dropdown li {
  margin: 0;
  list-style: none;
}

.site-nav .nav-dropdown a {
  display: block;
  width: 100%;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--body);
  white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.site-nav .nav-dropdown a::after {
  display: none;
}

.nav-dropdown a:hover,
.nav-dropdown a:focus {
  background-color: rgba(43, 48, 49, 0.05);
  color: var(--r);
}

/* Taxonomy group label inside a dropdown (e.g. 带锯条 / 圆锯片) */
.nav-dropdown .nav-dropdown-group {
  margin: 8px 0 2px;
  padding: 0 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: var(--muted);
}

.nav-dropdown .nav-dropdown-group:first-child {
  margin-top: 2px;
}

/* Nav: Mega Menu for Books */
/* `.site-nav .nav-item` sets position: relative, so this needs at least the
   same specificity to keep the item static — the panel must position against
   `.header-in` (80px), not against the nav item. */
.site-nav .nav-item-mega {
  position: static;
}

.nav-dropdown.nav-mega-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  left: auto;
  transform: none;
  min-width: 520px;
  max-width: 600px;
  padding: 0;
  background: var(--w);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: 0 18px 40px rgba(43, 48, 49, 0.12);
}

/* Invisible bridge: keeps the hover state while the pointer travels from the
   "Books" link down to the panel below the header. */
.nav-mega-dropdown::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -24px;
  height: 24px;
}

.nav-mega-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0;
  padding: 16px 8px;
}

/* Products mega：分类名较长，面板更宽、固定三列 */
.nav-dropdown.nav-mega-dropdown.is-products-mega {
  min-width: 660px;
  max-width: 780px;
}

.nav-dropdown.nav-mega-dropdown.is-products-mega .nav-mega-grid {
  grid-template-columns: repeat(3, minmax(190px, 1fr));
}

/* Resources mega：单列四个入口，面板收窄 */
.nav-dropdown.nav-mega-dropdown.is-resources-mega {
  min-width: 300px;
  max-width: 360px;
}

.nav-dropdown.nav-mega-dropdown.is-resources-mega .nav-mega-grid {
  grid-template-columns: 1fr;
}

/* 列标题本身可点击（没有下级分类时，它是该列唯一入口）：去掉下拉条目的内边距与底边线 */
.site-nav .nav-mega-dropdown .nav-mega-heading a {
  padding: 0;
  border: 0;
  color: var(--g);
}

.site-nav .nav-mega-dropdown .nav-mega-heading a:hover,
.site-nav .nav-mega-dropdown .nav-mega-heading a:focus {
  color: var(--r);
}

.nav-mega-col {
  padding: 4px 12px;
  border-right: 1px solid rgba(0, 0, 0, 0.06);
}

.nav-mega-col:last-child {
  border-right: none;
}

.nav-mega-heading {
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.nav-mega-title {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--g);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-mega-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-nav .nav-mega-list a {
  display: block;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--body);
  border-radius: 2px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.site-nav .nav-mega-list a:hover,
.site-nav .nav-mega-list a:focus {
  background-color: rgba(43, 48, 49, 0.05);
  color: var(--r);
  padding-left: 14px;
}

.nav-mega-empty {
  font-size: 12px;
  color: var(--steel);
  font-style: italic;
  margin: 8px 10px;
}

.nav-mega-footer {
  background-color: var(--pw);
  border-top: 1px solid var(--line);
  padding: 10px 20px;
  border-radius: 0 0 2px 2px;
}

.site-nav .nav-mega-footer .nav-mega-all-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--g);
  letter-spacing: 0.04em;
  padding: 0;
  transition: color 0.2s ease, gap 0.2s ease;
}

.site-nav .nav-mega-footer .nav-mega-all-link:hover {
  color: var(--r);
  gap: 10px;
  background: transparent;
}

.nav-mega-arrow {
  transition: transform 0.2s ease;
}

.nav-mega-all-link:hover .nav-mega-arrow {
  transform: translateX(2px);
}

/* Buttons */
.btn {
  height: 48px;
  padding: 0 24px;
  border: 1px solid var(--g);
  border-radius: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.22s ease;
  cursor: pointer;
}

/* Home Page Styles */
.home-hero {
  background-color: var(--w);
  border-bottom: 1px solid var(--line);
  padding: clamp(64px, 8vw, 110px) 0;
}

.home-hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(40px, 6vw, 96px);
  align-items: center;
}

.home-hero-copy p {
  font-size: 18px;
  line-height: 1.68;
  max-width: 600px;
  margin-bottom: 32px;
}

.home-hero-copy .slogan {
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 500;
  color: var(--g);
  margin-bottom: 16px;
}

.home-hero-copy .actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.home-hero-art .home-hero-block {
  min-height: 460px;
  height: 100%;
  border-radius: 2px;
  border: 1px solid var(--steel);
}

.home-intro-section {
  background-color: var(--pw);
  border-bottom: 1px solid var(--line);
}

.home-pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 48px;
}

.pillar-card {
  background: var(--w);
  border: 1px solid var(--line);
  padding: 40px 32px;
}

.pillar-num {
  font-size: 18px;
  font-weight: 600;
  color: var(--r);
  margin-bottom: 20px;
}

.pillar-card h3 {
  margin-bottom: 14px;
}

.pillar-card p {
  font-size: 15px;
  line-height: 1.68;
  margin: 0;
}

.home-cta-section {
  background-color: var(--w);
  padding: clamp(60px, 6vw, 90px) 0;
}

.cta-banner {
  border: 1px solid var(--line);
  background-color: var(--pw);
  padding: clamp(40px, 5vw, 60px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.cta-content {
  max-width: 700px;
}

.cta-content h2 {
  margin-bottom: 12px;
}

.cta-content p {
  margin: 0;
  font-size: 16px;
}

@media (max-width: 1024px) {
  .home-hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .home-hero-art .home-hero-block {
    min-height: 360px;
  }
  .home-pillars-grid {
    grid-template-columns: 1fr;
  }
  .cta-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

.btn-dark {
  background: var(--g);
  color: var(--w);
}

.btn-dark:hover {
  background: var(--r);
  border-color: var(--r);
}

.btn-light {
  background: transparent;
  color: var(--g);
}

.btn-light:hover {
  background: var(--w);
}

/* Cut Line Signatures */
.slogan-cut {
  width: 110px;
  height: 1px;
  background: var(--g);
  position: relative;
  margin-bottom: 28px;
}

.slogan-cut::after {
  content: "";
  position: absolute;
  right: 0;
  top: -2px;
  width: 32px;
  height: 5px;
  background: var(--r);
  transform: skewX(-38deg);
}

/* Gray Block Placeholders */
.gray-block {
  background-color: var(--gray-block);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gray-block-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  background: linear-gradient(180deg, transparent 40%, rgba(15, 18, 19, 0.4) 100%);
  color: #fff;
}

.gray-block-inner .tag {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.gray-block-inner .title {
  font-size: 16px;
  font-weight: 600;
  margin-top: 4px;
}

/* Footer */
.site-footer {
  background: var(--g);
  color: var(--w);
  padding: 96px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 48px;
  align-items: start;
  padding-bottom: 64px;
}

.footer-wordmark {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  margin-bottom: 12px;
}

.footer-wordmark .wordmark-x {
  color: var(--r);
}

.footer-slogan {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 16px;
  color: var(--steel);
}

.footer-cut {
  width: 88px;
  height: 1px;
  background: rgba(255, 255, 255, 0.4);
  position: relative;
  margin-bottom: 24px;
}

.footer-cut::after {
  content: "";
  position: absolute;
  right: 0;
  top: -2px;
  width: 26px;
  height: 5px;
  background: var(--r);
  transform: skewX(-38deg);
}

.footer-summary {
  color: var(--steel);
  font-size: 14px;
  max-width: 480px;
  line-height: 1.7;
}

.footer-heading {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

.footer-nav-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
  color: var(--steel);
}

.footer-nav-links a:hover {
  color: var(--w);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 900px) {
  .mobile-nav-toggle {
    display: flex;
  }
  .site-nav {
    display: none;
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    /* The Books mega menu makes the mobile menu taller than the viewport,
       so let it scroll instead of pushing the last links out of reach. */
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    background: var(--w);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    padding: 24px;
    gap: 16px;
    align-items: flex-start;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  }
  .site-nav.is-open {
    display: flex;
  }
  .site-nav a {
    width: 100%;
    padding: 10px 0;
    font-size: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 8px;
  }
}

/* Nav: Books dropdown and mega menu on small screens (tap-friendly, always expanded) */
@media (max-width: 900px) {
  .site-nav .nav-item {
    display: block;
    width: 100%;
  }
  .nav-caret {
    display: none;
  }
  .site-nav .nav-dropdown {
    position: static;
    transform: none;
    min-width: 0;
    max-width: none;
    margin: 2px 0 0;
    padding: 2px 0 2px 14px;
    border: 0;
    border-left: 2px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
  }
  .site-nav .nav-item-dropdown:hover .nav-dropdown,
  .site-nav .nav-item-dropdown:focus-within .nav-dropdown {
    transform: none;
  }
  .site-nav .nav-dropdown a {
    padding: 9px 0;
    font-size: 14px;
    color: var(--steel);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  }
  .site-nav .nav-dropdown .nav-dropdown-group {
    margin: 10px 0 2px;
    padding: 0;
  }
  /* Mega menu mobile adjustments */
  /* Explicit reset (higher specificity than the desktop rule above), so the
     panel becomes an in-flow, full-width block instead of an oversized
     absolutely positioned box that overflows the viewport. */
  .site-nav .nav-item-mega .nav-mega-dropdown {
    position: static;
    top: auto;
    right: auto;
    left: auto;
    min-width: 0;
    max-width: none;
    margin: 2px 0 0;
    padding: 2px 0 2px 14px;
    border: 0;
    border-left: 2px solid var(--line);
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
  }
  .site-nav .nav-item-mega .nav-mega-dropdown::before {
    display: none;
  }
  .nav-mega-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 8px 0;
  }
  .nav-dropdown.nav-mega-dropdown.is-products-mega .nav-mega-grid {
    grid-template-columns: 1fr;
  }
  .nav-mega-col {
    padding: 0;
    border-right: none;
  }
  .nav-mega-heading {
    margin-bottom: 6px;
    padding-bottom: 4px;
  }
  .site-nav .nav-mega-list a {
    padding: 6px 0;
    font-size: 14px;
  }
  .site-nav .nav-mega-list a:hover,
  .site-nav .nav-mega-list a:focus {
    padding-left: 0;
    background: transparent;
  }
  .nav-mega-footer {
    background: transparent;
    border-top: 1px dashed var(--line);
    padding: 12px 0 4px;
    margin-top: 8px;
  }
}
