/*
Theme Name: OpenLX Research Institute GeneratePress
Theme URI: https://openlx.org.cn/
Description: OpenLX 中国文旅 AI 信源研究院的 GeneratePress 子主题。
Author: OpenLX
Version: 1.0.7
Template: generatepress
Text Domain: openlx-org-generatepress-production
*/

:root {
  --olxri-ink: #222a2e;
  --olxri-blue: #416a84;
  --olxri-silver: #a7b0b2;
  --olxri-paper: #f8f9f7;
  --olxri-white: #ffffff;
  --olxri-border: #dfe4e4;
  --olxri-muted: #5e6a70;
  --olxri-radius: 14px;
  --olxri-shadow: 0 14px 38px rgba(34, 42, 46, 0.08);
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--olxri-paper);
  color: var(--olxri-ink);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.78;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6,
.site-branding,
.main-title {
  color: var(--olxri-ink);
  font-family: "Source Han Serif SC", "Songti SC", "Noto Serif CJK SC", serif;
  font-weight: 650;
  letter-spacing: -0.015em;
}

a {
  color: var(--olxri-blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover,
a:focus-visible {
  color: var(--olxri-ink);
}

.site-header {
  background: rgba(248, 249, 247, 0.96);
  border-bottom: 1px solid var(--olxri-border);
}

.inside-header,
.inside-navigation,
.site-grid,
.site-info {
  box-sizing: border-box;
  margin-inline: auto;
  max-width: 1180px;
  width: min(100% - 40px, 1180px);
}

.inside-header {
  min-height: 82px;
  padding: 16px 0;
}

.main-title a,
.site-logo a {
  color: var(--olxri-ink);
  text-decoration: none;
}

/* The WordPress custom-logo upload is a wide brand lockup. Constrain it in
 * the header so its source dimensions can never enlarge the site chrome or
 * push the site title outside the viewport. */
.site-header .header-image,
.site-header .custom-logo {
  display: block;
  height: auto;
  max-height: 56px;
  max-width: 240px;
  width: auto;
}

.site-description {
  color: var(--olxri-muted);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
}

.main-navigation {
  background: var(--olxri-ink);
}

.main-navigation .main-nav ul li a,
.main-navigation .menu-toggle {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.93rem;
  letter-spacing: 0.025em;
  min-height: 50px;
}

.main-navigation .main-nav ul li[class*="current-menu-"] > a,
.main-navigation .main-nav ul li:hover > a,
.main-navigation .main-nav ul li:focus-within > a {
  background: var(--olxri-blue);
  color: var(--olxri-white);
}

/*
 * Desktop header system
 *
 * Keep the identity row and the six primary destinations on separate, aligned
 * rows.  The navigation can then use the full 1180px research grid rather
 * than wrapping inside the narrow space beside the logo and site title.
 */
@media (min-width: 769px) {
  .inside-header {
    align-items: center;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 0;
  }

  .site-branding-container {
    justify-self: start;
  }

  #mobile-menu-control-wrapper {
    display: none;
  }

  #site-navigation {
    grid-column: 1;
    grid-row: 2;
    margin-top: 16px;
    width: 100%;
  }

  #site-navigation .inside-navigation {
    box-sizing: border-box;
    max-width: none;
    padding: 0;
    width: 100%;
  }

  #site-navigation .main-nav > ul {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
  }

  #site-navigation .main-nav > ul > li {
    flex: 1 1 0;
    text-align: center;
  }

  #site-navigation .main-nav > ul > li > a {
    display: flex;
    justify-content: center;
    padding-inline: 10px;
    white-space: nowrap;
  }
}

.site-content {
  padding-block: clamp(40px, 6vw, 88px);
}

/*
 * Wide-screen page system
 *
 * Singular templates deliberately have no sidebar (see functions.php).  The
 * outer canvas can therefore use the research site's full desktop measure,
 * while the prose selector below retains a comfortable 780px reading line.
 */
.no-sidebar .site.grid-container {
  box-sizing: border-box;
  max-width: 1320px;
  width: min(100% - 40px, 1320px);
}

/* The homepage is a section-based landing page, so its bands reach the full
 * viewport; each .openlx-wrap still provides the deliberate inner measure. */
body.home .featured-image.page-header-image {
  display: none;
}

body.home .site.grid-container {
  max-width: none;
  padding-inline: 0;
  width: 100%;
}

body.home .site-content {
  padding-block: 0;
}

body.home .site-main > article {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

body.home .inside-article,
body.home .entry-content {
  padding: 0;
}

.site-main,
.content-area {
  min-width: 0;
}

.site-main > article {
  background: var(--olxri-white);
  border: 1px solid var(--olxri-border);
  border-radius: var(--olxri-radius);
  box-shadow: var(--olxri-shadow);
  overflow: hidden;
}

.entry-header,
.entry-content,
.entry-summary,
.entry-footer {
  padding-inline: clamp(24px, 5vw, 72px);
}

.entry-header {
  padding-top: clamp(34px, 5vw, 68px);
}

.entry-content {
  padding-bottom: clamp(42px, 6vw, 80px);
}

.entry-content > :where(p, ul, ol, blockquote) {
  max-width: 780px;
}

.entry-content h2 {
  border-top: 1px solid var(--olxri-border);
  margin-top: 2.4em;
  padding-top: 1.25em;
}

.entry-content :where(blockquote, .wp-block-quote) {
  background: #eef3f5;
  border-left: 4px solid var(--olxri-blue);
  margin-inline: 0;
  padding: 20px 24px;
}

.entry-content :where(table, .wp-block-table table) {
  border-collapse: collapse;
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.entry-content :where(th, td) {
  border: 1px solid var(--olxri-border);
  padding: 12px 14px;
  text-align: left;
}

.entry-content th {
  background: #eef3f5;
}

.wp-element-button,
.wp-block-button__link,
button,
input[type="submit"] {
  background: var(--olxri-blue);
  border-radius: 999px;
  color: var(--olxri-white);
  min-height: 44px;
  padding: 11px 22px;
}

.wp-element-button:hover,
.wp-block-button__link:hover,
button:hover,
input[type="submit"]:hover {
  background: var(--olxri-ink);
  color: var(--olxri-white);
}

.site-footer {
  background: var(--olxri-ink);
  color: rgba(255, 255, 255, 0.74);
}

.site-info {
  background: var(--olxri-ink);
  color: rgba(255, 255, 255, 0.88);
  padding: 28px 0;
}

.site-footer a {
  color: #ffffff;
  font-weight: 600;
}

/* The final conversion panel sits on a dark field.  GeneratePress' general
 * heading rule is more persistent than the shared UI default, so keep this
 * title explicitly high-contrast as well. */
.openlx-cta h2 {
  color: #ffffff !important;
}

:focus-visible {
  outline: 3px solid #d7b866;
  outline-offset: 3px;
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .inside-header,
  .inside-navigation,
  .site-grid,
  .site-info {
    width: min(100% - 28px, 1180px);
  }

  .inside-header {
    min-height: 70px;
  }

  /* Keep the identity row inside narrow viewports. The logo and site title
   * are a flex pair on mobile; without an explicit shrink boundary the
   * branding container preserves its desktop intrinsic width and creates a
   * horizontal scroll area before the menu is opened. */
  .site-branding-container {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 64px);
  }

  .site-logo {
    flex: 0 1 150px;
    min-width: 0;
    max-width: 150px;
  }

  .site-header .site-branding-container .site-logo .header-image,
  .site-header .site-branding-container .site-logo .custom-logo {
    height: auto;
    max-width: 150px !important;
    width: 100% !important;
  }

  .site-branding,
  .main-title {
    min-width: 0;
    max-width: 100%;
  }

  .main-title a {
    display: block;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .site-content {
    padding-block: 32px 48px;
  }

  .no-sidebar .site.grid-container {
    width: min(100% - 28px, 1320px);
  }

  body.home .site.grid-container {
    width: 100%;
  }

  body.home .site-content {
    padding-block: 0;
  }

  .site-main > article {
    border-radius: 10px;
  }

  /* Keep the expanded mobile menu readable on the paper surface. GeneratePress
   * supplies a light menu background here, so the desktop white text rule
   * must not leak into the mobile state. */
  .main-navigation.toggled .main-nav ul li > a,
  .main-navigation.toggled .main-nav ul li > a:hover,
  .main-navigation.toggled .main-nav ul li > a:focus-visible {
    background: var(--olxri-paper);
    color: var(--olxri-ink);
  }

  .main-navigation.toggled .main-nav ul li[class*="current-menu-"] > a,
  .main-navigation.toggled .main-nav ul li[class*="current-menu-"] > a:hover,
  .main-navigation.toggled .main-nav ul li[class*="current-menu-"] > a:focus-visible {
    background: var(--olxri-blue);
    color: var(--olxri-white);
  }

  .entry-header,
  .entry-content,
  .entry-summary,
  .entry-footer {
    padding-inline: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
