/* ==========================================================================
   CAIRUI CONSULT — common foundation
   ========================================================================== */

@font-face {
  font-family: "Montserrat";
  src: url("../assets/fonts/montserrat-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Oswald";
  src: url("../assets/fonts/oswald-latin.woff2") format("woff2");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --red: #b91e22;
  --red-deep: #8f1014;
  --red-bright: #d5262b;
  --red-soft: #e0474c;
  --ink: #232325;
  --ink-soft: #2b2b2e;
  --text: #1e1e21;
  --text-2: #5d5d63;
  --muted: #8b8b91;
  --line: #e3e4e7;
  --line-strong: #d6d7db;
  --bg: #ffffff;
  --soft: #f5f6f8;
  --soft-2: #eeeeef;
  --blue: #1d3f8f;
  --blue-light: #3159c4;
  --gold: #b18a4b;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-pill: 999px;

  --shadow-xs: 0 2px 8px rgba(20, 20, 24, 0.04);
  --shadow-sm: 0 8px 24px rgba(20, 20, 24, 0.06);
  --shadow-md: 0 18px 44px rgba(20, 20, 24, 0.10);
  --shadow-lg: 0 30px 80px rgba(20, 20, 24, 0.16);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-ui: cubic-bezier(0.25, 0.8, 0.25, 1);
  --dur-ui: 280ms;
  --dur-panel: 700ms;

  --shell: min(1600px, calc(100% - 160px));
  --shell-wide: min(1760px, calc(100% - 120px));
  --header-h: clamp(68px, 5.208vw, 100px);

  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", "Source Han Sans SC", sans-serif;
  --font-en: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --font-num: "Oswald", "DIN Condensed", "Arial Narrow", sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding-top: var(--header-h);
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

img,
video,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

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

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

input,
textarea,
select {
  font: inherit;
}

h1,
h2,
h3,
h4,
h5,
p,
figure,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--red);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 500;
  top: 12px;
  left: 12px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  color: #fff;
  background: var(--red);
  font-size: 13px;
  transform: translateY(-160%);
  transition: transform 240ms var(--ease-ui);
}

.skip-link:focus-visible {
  transform: none;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  width: var(--shell);
  margin-inline: auto;
}

.shell-wide {
  width: var(--shell-wide);
  margin-inline: auto;
}

.section {
  position: relative;
  padding-block: clamp(64px, 7vw, 132px);
}

[id] {
  scroll-margin-top: calc(var(--header-h) + 18px);
}

.section--tight {
  padding-block: clamp(48px, 5vw, 88px);
}

.section--soft {
  background: var(--soft);
}

.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.icon--fill {
  fill: currentColor;
  stroke: none;
}

/* --------------------------------------------------------------------------
   Type & section headings
   -------------------------------------------------------------------------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-en);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.28em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--red);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: clamp(32px, 4vw, 64px);
}

.section-head--center {
  display: block;
  text-align: center;
}

.section-title {
  margin-top: 14px;
  color: var(--ink);
  font-size: clamp(30px, 2.5vw, 48px);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.25;
}

.section-title em {
  color: var(--red);
  font-style: normal;
}

.section-title--light {
  color: #fff;
}

.section-sub {
  max-width: 760px;
  margin-top: 18px;
  color: var(--text-2);
  font-size: clamp(14px, 0.95vw, 17px);
  line-height: 2;
}

.section-head--center .section-sub {
  margin-inline: auto;
}

.lead {
  color: var(--text);
  font-size: clamp(15px, 1vw, 18px);
  line-height: 2.05;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: fixed;
  z-index: 100;
  inset: 0 0 auto;
  height: var(--header-h);
  background: var(--ink);
  transition: box-shadow 300ms var(--ease-ui), background-color 300ms var(--ease-ui);
}

.site-header.is-scrolled {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.header-inner {
  display: flex;
  width: 100%;
  max-width: 1920px;
  height: 100%;
  margin-inline: auto;
}

.brand {
  position: relative;
  display: flex;
  flex: 0 0 min(43%, 825px);
  align-items: center;
  padding-left: clamp(28px, 9.375vw, 180px);
  background: var(--ink);
}

.brand-logo {
  width: clamp(168px, 11.9vw, 228px);
  height: auto;
  filter: brightness(0) invert(1);
  transition: opacity var(--dur-ui) var(--ease-ui), transform var(--dur-ui) var(--ease-ui);
}

.brand:hover .brand-logo {
  opacity: 0.86;
  transform: translateY(-1px);
}

.header-body {
  display: flex;
  flex: 1;
  align-items: stretch;
  min-width: 0;
  background: #fff;
}

.header-enter {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-right: clamp(18px, 2.4vw, 44px);
  color: var(--ink);
  font-size: clamp(13px, 0.83vw, 16px);
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: color var(--dur-ui) var(--ease-ui);
}

.header-enter .icon {
  width: 22px;
  height: 22px;
  transition: transform 420ms var(--ease-out);
}

.header-enter:hover {
  color: var(--red);
}

.header-enter:hover .icon {
  transform: rotate(180deg);
}

.header-video {
  display: flex;
  flex: 0 0 clamp(112px, 7.97vw, 153px);
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  background: var(--red);
  font-size: clamp(12px, 0.78vw, 15px);
  letter-spacing: 0.06em;
  transition: background-color var(--dur-ui) var(--ease-ui);
}

.header-video:hover {
  background: var(--red-deep);
}

.header-video .play-mini {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
}

.header-video .play-mini .icon {
  width: 11px;
  height: 11px;
  margin-left: 2px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1;
  transition: transform var(--dur-ui) var(--ease-ui),
    background-color var(--dur-ui) var(--ease-ui),
    color var(--dur-ui) var(--ease-ui),
    border-color var(--dur-ui) var(--ease-ui),
    box-shadow var(--dur-ui) var(--ease-ui);
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn--red {
  color: #fff;
  background: var(--red);
  box-shadow: 0 8px 22px rgba(185, 30, 34, 0.26);
}

.btn--red:hover {
  background: var(--red-deep);
  box-shadow: 0 12px 28px rgba(185, 30, 34, 0.3);
}

.btn--outline {
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: #fff;
}

.btn--outline:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.btn--dark-outline {
  border: 1px solid var(--red);
  color: var(--red);
}

.btn--dark-outline:hover {
  color: #fff;
  background: var(--red);
}

.btn--light {
  color: var(--red);
  background: #fff;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
}

.btn--light:hover {
  background: #f7f7f7;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--red);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.text-link .icon {
  width: 18px;
  height: 18px;
  transition: transform 320ms var(--ease-out);
}

.text-link:hover .icon {
  transform: translateX(5px);
}

/* --------------------------------------------------------------------------
   Page banner (sub pages)
   -------------------------------------------------------------------------- */

.page-hero {
  position: relative;
  height: clamp(300px, 26.35vw, 506px);
  background: var(--ink);
  overflow: hidden;
}

.page-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transform: scale(1.01);
}

.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 16, 28, 0.04), rgba(10, 16, 28, 0.2));
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Tabs / pill filters
   -------------------------------------------------------------------------- */

.pill-tabs {
  display: inline-flex;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: #fff;
  gap: 4px;
}

.pill-tab {
  min-width: clamp(150px, 12vw, 210px);
  padding: 12px 30px;
  border-radius: var(--radius-pill);
  color: var(--text-2);
  font-size: clamp(14px, 0.94vw, 17px);
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.4;
  transition: color var(--dur-ui) var(--ease-ui),
    background-color var(--dur-ui) var(--ease-ui);
}

.pill-tab:hover {
  color: var(--red);
}

.pill-tab.is-active {
  color: #fff;
  background: var(--red);
  box-shadow: 0 6px 18px rgba(185, 30, 34, 0.22);
}

/* --------------------------------------------------------------------------
   Panels transition
   -------------------------------------------------------------------------- */

.swap-panel {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 320ms var(--ease-out), transform 320ms var(--ease-out);
}

.swap-panel.is-leaving {
  opacity: 0;
  transform: translateY(10px);
}

.swap-panel.is-hidden {
  display: none;
}

[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Media frame / hover
   -------------------------------------------------------------------------- */

.media {
  position: relative;
  overflow: hidden;
  background: #d9dde3;
}

.media > img,
.media > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 800ms var(--ease-out);
}

.media:hover > img {
  transform: scale(1.04);
}

/* --------------------------------------------------------------------------
   Reveal engine
   -------------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur-panel) var(--ease-out),
    transform var(--dur-panel) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: translateY(0);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   Video modal
   -------------------------------------------------------------------------- */

.video-modal {
  position: fixed;
  z-index: 300;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 56px);
}

.video-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 10, 0.82);
  backdrop-filter: blur(8px);
  animation: overlay-in 380ms var(--ease-out) both;
}

.video-modal__dialog {
  position: relative;
  width: min(1120px, 92vw);
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  opacity: 0;
  animation: dialog-in 480ms var(--ease-out) 80ms forwards;
}

.video-modal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  color: rgba(255, 255, 255, 0.8);
  background: #0c0c0e;
  font-family: var(--font-en);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.video-modal__close,
.lightbox__close {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  transition: background-color var(--dur-ui) var(--ease-ui), transform var(--dur-ui) var(--ease-ui);
}

.video-modal__close:hover,
.lightbox__close:hover {
  background: var(--red);
  transform: rotate(90deg);
}

.video-modal video {
  width: 100%;
  max-height: 70vh;
  background: #000;
  aspect-ratio: 16 / 9;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialog-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */

.lightbox {
  position: fixed;
  z-index: 320;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 54px);
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 10, 0.9);
  backdrop-filter: blur(10px);
  animation: overlay-in 360ms var(--ease-out) both;
}

.lightbox__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(1020px, 86vw);
  max-height: 88vh;
  animation: dialog-in 480ms var(--ease-out) 40ms both;
}

.lightbox__figure {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 78vh;
}

.lightbox__image {
  max-width: min(1020px, 86vw);
  max-height: 76vh;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
}

.lightbox__caption {
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 14px;
  letter-spacing: 0.05em;
  text-align: center;
}

.lightbox__close {
  position: fixed;
  top: clamp(18px, 3vw, 38px);
  right: clamp(18px, 3vw, 38px);
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.12);
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  display: grid;
  width: clamp(42px, 3.2vw, 56px);
  height: clamp(42px, 3.2vw, 56px);
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.24);
  transition: background-color var(--dur-ui) var(--ease-ui), border-color var(--dur-ui) var(--ease-ui);
  transform: translateY(-50%);
}

.lightbox__nav:hover {
  border-color: #fff;
  background: var(--red);
}

.lightbox__nav--prev {
  left: clamp(-88px, -5vw, -58px);
}

.lightbox__nav--next {
  right: clamp(-88px, -5vw, -58px);
}

.lightbox__nav .icon {
  width: 20px;
  height: 20px;
}

.lightbox__count {
  position: absolute;
  bottom: 0;
  right: 0;
  color: rgba(255, 255, 255, 0.42);
  font-family: var(--font-num);
  font-size: 13px;
  letter-spacing: 0.16em;
}

/* --------------------------------------------------------------------------
   Back to top / home
   -------------------------------------------------------------------------- */

.back-home {
  position: fixed;
  z-index: 90;
  left: clamp(14px, 2vw, 30px);
  bottom: clamp(16px, 2.4vw, 34px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  letter-spacing: 0.06em;
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out), color var(--dur-ui);
}

.back-home.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.back-home:hover {
  color: var(--red);
}

.back-home .icon {
  width: 16px;
  height: 16px;
}

/* --------------------------------------------------------------------------
   Footer (sub pages only, optional minimal)
   -------------------------------------------------------------------------- */

.site-foot {
  padding: 30px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.site-foot .shell {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1440px) {
  :root {
    --shell: min(1600px, calc(100% - 120px));
    --shell-wide: min(1760px, calc(100% - 140px));
  }
}

@media (max-width: 1100px) {
  :root {
    --shell: calc(100% - 64px);
    --shell-wide: calc(100% - 64px);
  }

  .brand {
    flex-basis: 46%;
  }

  .section-head {
    gap: 24px;
  }
}

@media (max-width: 760px) {
  :root {
    --shell: calc(100% - 40px);
    --shell-wide: calc(100% - 40px);
  }

  body {
    font-size: 15px;
  }

  .brand {
    padding-left: 20px;
  }

  .brand-logo {
    width: 150px;
  }

  .header-enter {
    display: none;
  }

  .header-video {
    flex: 1;
    justify-content: flex-end;
    padding-right: 20px;
  }

  .header-inner {
    background: #fff;
  }

  .lightbox__nav--prev {
    left: 6px;
  }

  .lightbox__nav--next {
    right: 6px;
  }

  .lightbox__dialog {
    max-width: 92vw;
  }

  .lightbox__image {
    max-width: 92vw;
  }

  .lightbox__count {
    right: 6px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
