/* ==========================================================
   Peng Xiang 2026 UI / RWD enhancement layer
   Loaded after main.css and any page-level styles.
   Purpose: unify layout, readability and responsive behavior
   without changing existing business logic.
   ========================================================== */

:root {
  --px-primary: #0a1f3d;
  --px-primary-2: #132b4f;
  --px-accent: #d4af77;
  --px-accent-soft: #f3e5cf;
  --px-bg: #f6f8fb;
  --px-surface: #ffffff;
  --px-text: #142033;
  --px-muted: #667085;
  --px-border: #e7ebf0;
  --px-shadow-sm: 0 8px 24px rgba(10,31,61,.07);
  --px-shadow-md: 0 18px 44px rgba(10,31,61,.11);
  --px-radius: 22px;
  --px-header-h: 78px;
}

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

body {
  overflow-x: hidden;
  background: var(--px-surface);
  color: var(--px-text);
  font-family: "Inter", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  text-rendering: optimizeLegibility;
}

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

img {
  height: auto;
}

section {
  scroll-margin-top: calc(var(--px-header-h) + 16px);
}

.container,
.container-fluid {
  --bs-gutter-x: clamp(1.25rem, 3vw, 2.2rem);
}

/* Header */
.header {
  min-height: var(--px-header-h);
  padding: 12px 0 !important;
  background: rgba(255,255,255,.94) !important;
  border-bottom: 1px solid rgba(10,31,61,.08) !important;
  box-shadow: 0 8px 30px rgba(10,31,61,.06) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header .logo,
.header .logo:hover {
  text-decoration: none;
}

.header .logo h1 {
  margin: 0 !important;
  color: var(--px-primary) !important;
  font-size: clamp(1.05rem, 1.65vw, 1.55rem) !important;
  font-weight: 800 !important;
  line-height: 1.25;
  letter-spacing: -.02em;
}

.navbar {
  padding: 0;
}

.navbar > ul {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.navbar li {
  position: relative;
}

.navbar a,
.navbar a:focus {
  padding: 11px 14px !important;
  border-radius: 999px;
  color: #344054 !important;
  font-size: .96rem;
  font-weight: 650 !important;
  line-height: 1.2;
  text-decoration: none;
  transition: color .22s ease, background .22s ease, transform .22s ease;
}

.navbar a::after {
  display: none !important;
}

.navbar a:hover,
.navbar .active,
.navbar .active:focus {
  color: var(--px-primary) !important;
  background: rgba(212,175,119,.16);
}

.navbar a[href*="agent.peng-xiang.com"] {
  color: #fff !important;
  background: var(--px-primary);
  padding-inline: 18px !important;
}

.navbar a[href*="agent.peng-xiang.com"]:hover {
  color: var(--px-primary) !important;
  background: var(--px-accent);
  transform: translateY(-1px);
}

.mobile-nav-toggle {
  color: var(--px-primary) !important;
  font-size: 30px !important;
  cursor: pointer;
  line-height: 1;
}

/* Hero */
.hero {
  min-height: min(760px, 86vh) !important;
  padding: clamp(125px, 12vw, 170px) 0 clamp(72px, 8vw, 112px) !important;
  background:
    radial-gradient(circle at 80% 14%, rgba(212,175,119,.20), transparent 32%),
    linear-gradient(135deg, var(--px-primary) 0%, var(--px-primary-2) 100%) !important;
}

.hero h2 {
  max-width: 900px;
  margin-bottom: 1.25rem;
  font-size: clamp(2.2rem, 5vw, 4.35rem) !important;
  line-height: 1.1 !important;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.hero p,
.hero .lead {
  max-width: 760px;
  font-size: clamp(1.02rem, 1.8vw, 1.28rem) !important;
  line-height: 1.8;
}

.hero .btn {
  min-height: 50px;
  padding: 12px 28px !important;
  border-radius: 999px !important;
  font-weight: 750 !important;
}

/* Breadcrumb / inner-page hero */
.breadcrumbs {
  min-height: 290px;
  padding: calc(var(--px-header-h) + 52px) 0 54px !important;
  background-position: center !important;
  background-size: cover !important;
}

.breadcrumbs h2 {
  font-size: clamp(2rem, 4vw, 3.2rem) !important;
  font-weight: 800 !important;
  letter-spacing: -.025em;
}

.breadcrumbs ol {
  flex-wrap: wrap;
  justify-content: center;
  row-gap: 6px;
}

/* General content */
main section:not(.hero):not(.breadcrumbs) {
  padding-top: clamp(58px, 7vw, 88px);
  padding-bottom: clamp(58px, 7vw, 88px);
}

.section-header {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

.section-header h2 {
  margin-bottom: 1.15rem !important;
  color: var(--px-primary) !important;
  font-size: clamp(1.75rem, 3vw, 2.45rem) !important;
  font-weight: 800 !important;
  line-height: 1.25;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.section-header p {
  margin-bottom: 0;
  color: var(--px-muted) !important;
  font-size: clamp(1rem, 1.5vw, 1.12rem) !important;
  line-height: 1.8;
}

.content h3,
.content h4,
main h3,
main h4 {
  color: var(--px-primary);
  line-height: 1.35;
}

main p,
main li {
  overflow-wrap: anywhere;
}

/* Cards */
.card,
.card-hover,
.post-box,
.contact-info-card,
.team-member,
.portfolio-info {
  border-radius: var(--px-radius) !important;
}

.card,
.card-hover,
.post-box,
.contact-info-card {
  border: 1px solid var(--px-border) !important;
  background: var(--px-surface) !important;
  box-shadow: var(--px-shadow-sm) !important;
  transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}

.card:hover,
.card-hover:hover,
.post-box:hover,
.contact-info-card:hover {
  transform: translateY(-7px);
  border-color: rgba(212,175,119,.7) !important;
  box-shadow: var(--px-shadow-md) !important;
}

.card-body {
  padding: clamp(1.35rem, 3vw, 2rem) !important;
}

.card h3,
.card h4,
.post-box h3 {
  font-weight: 750;
}

.card i,
.contact-icon,
.contact-info-card i {
  color: var(--px-accent) !important;
}

/* Images */
.about img,
.post-img img,
.portfolio-item img,
.team-member img {
  width: 100%;
  object-fit: cover;
}

.about img {
  border-radius: var(--px-radius);
  box-shadow: var(--px-shadow-sm);
}

.post-box {
  height: 100%;
  overflow: hidden;
}

.post-img {
  overflow: hidden;
}

.post-img img {
  aspect-ratio: 16 / 10;
  transition: transform .35s ease;
}

.post-box:hover .post-img img {
  transform: scale(1.035);
}

/* Forms and touch targets */
.form-control,
.form-select,
.php-email-form input,
.php-email-form textarea {
  min-height: 48px;
  border-radius: 12px !important;
  border-color: #d7dde5 !important;
  padding: .75rem 1rem !important;
  font-size: 16px !important; /* Prevent iOS input zoom */
}

textarea.form-control,
.php-email-form textarea {
  min-height: 150px;
}

.form-control:focus,
.form-select:focus,
.php-email-form input:focus,
.php-email-form textarea:focus {
  border-color: var(--px-accent) !important;
  box-shadow: 0 0 0 .22rem rgba(212,175,119,.18) !important;
}

button,
.btn,
.php-email-form button[type="submit"] {
  min-height: 44px;
}

/* Tables */
.table-responsive {
  border: 1px solid var(--px-border);
  border-radius: 16px;
  box-shadow: var(--px-shadow-sm);
}

.table {
  margin-bottom: 0;
  vertical-align: middle;
}

/* Footer */
.footer,
.footer.bg-dark,
.footer-content,
.footer-legal {
  background: linear-gradient(180deg, var(--px-primary), #07182e) !important;
  color: #fff !important;
}

.footer {
  padding-top: clamp(48px, 6vw, 72px) !important;
}

.footer h4,
.footer h5,
.footer .fs-3,
.footer .footer-info span {
  color: #fff !important;
}

.footer p,
.footer address,
.footer li,
.footer .text-white-50 {
  color: rgba(255,255,255,.70) !important;
}

.footer a,
.footer a.text-white-50 {
  color: rgba(255,255,255,.76) !important;
  text-decoration: none;
}

.footer a:hover {
  color: var(--px-accent) !important;
}

.footer .copyright,
.footer-legal {
  border-color: rgba(255,255,255,.12) !important;
}

/* Floating controls */
.scroll-top {
  width: 46px !important;
  height: 46px !important;
  right: max(16px, env(safe-area-inset-right)) !important;
  bottom: max(16px, env(safe-area-inset-bottom)) !important;
  border-radius: 50% !important;
  background: var(--px-accent) !important;
  color: var(--px-primary) !important;
  box-shadow: 0 10px 24px rgba(10,31,61,.18);
}


@media (min-width: 1280px) {
  .mobile-nav-toggle {
    display: none !important;
  }
}

/* Large tablets / small desktop */
@media (max-width: 1199.98px) {
  :root { --px-header-h: 72px; }

  .header .container-xl {
    max-width: 100%;
  }

  .navbar a,
  .navbar a:focus {
    padding-inline: 10px !important;
    font-size: .92rem;
  }
}

/* Mobile navigation breakpoint follows template behavior */
@media (max-width: 1279px) {
  .mobile-nav-toggle {
    display: block !important;
    position: relative;
    z-index: 10000;
  }

  .mobile-nav-hide {
    display: none !important;
  }

  .mobile-nav-hide:not(.d-none) {
    display: block !important;
  }

  .navbar {
    position: fixed;
    inset: 0;
    z-index: 9997;
    display: none;
    background: rgba(7,24,46,.48);
    overflow: hidden;
  }

  .mobile-nav-active .navbar {
    display: block;
  }

  .navbar ul {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: block !important;
    max-height: min(86vh, 720px);
    overflow-y: auto;
    margin: 0 !important;
    padding: calc(var(--px-header-h) + 18px) 18px 22px !important;
    border-radius: 0 0 22px 22px;
    background: #fff !important;
    box-shadow: 0 20px 50px rgba(10,31,61,.18);
    list-style: none;
  }

  .navbar a,
  .navbar a:focus {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    margin: 3px 0;
    padding: 12px 16px !important;
    border-radius: 12px;
    color: #344054 !important;
    font-size: 1rem;
  }

  .navbar a[href*="agent.peng-xiang.com"] {
    justify-content: center;
    margin-top: 10px;
    color: #fff !important;
  }

  .mobile-nav-show,
  .mobile-nav-toggle.bi-list {
    display: block;
  }
}

/* Tablet */
@media (max-width: 991.98px) {
  .hero {
    min-height: auto !important;
    text-align: center;
  }

  .hero h2,
  .hero p,
  .hero .lead {
    margin-left: auto;
    margin-right: auto;
  }

  .hero .mt-4,
  .hero .d-flex {
    justify-content: center;
  }

  .hero-decoration {
    display: none !important;
  }

  .content.ps-lg-4,
  .content.ps-lg-5 {
    padding-left: calc(var(--bs-gutter-x) * .5) !important;
  }

  .footer [class*="col-lg-"] {
    text-align: left;
  }
}

/* Phones */
@media (max-width: 767.98px) {
  :root { --px-header-h: 66px; --px-radius: 18px; }

  body {
    font-size: 15.5px;
    line-height: 1.7;
  }

  .header {
    min-height: var(--px-header-h);
    padding: 9px 0 !important;
  }

  .header .logo {
    max-width: calc(100% - 56px);
  }

  .header .logo h1 {
    max-width: 100%;
    font-size: clamp(.98rem, 4.2vw, 1.15rem) !important;
    white-space: normal;
  }

  .hero {
    padding-top: 112px !important;
    padding-bottom: 68px !important;
  }

  .hero h2 {
    font-size: clamp(2rem, 9vw, 3rem) !important;
  }

  .hero .btn {
    width: 100%;
    max-width: 360px;
    margin: 6px auto !important;
  }

  .breadcrumbs {
    min-height: 235px;
    padding-top: 112px !important;
    padding-bottom: 38px !important;
  }

  main section:not(.hero):not(.breadcrumbs) {
    padding-top: 52px;
    padding-bottom: 52px;
  }

  .section-header {
    margin-bottom: 2rem !important;
  }

  .section-header h2 {
    font-size: clamp(1.65rem, 7vw, 2rem) !important;
  }

  .row.g-4,
  .row.gy-4 {
    --bs-gutter-y: 1.25rem;
  }

  .card-body {
    padding: 1.3rem !important;
  }

  .about .row.mt-4 .col-6 {
    width: 100%;
  }

  .contact-info-card {
    padding: 1.15rem !important;
  }

  .footer {
    text-align: center;
  }

  .footer [class*="col-"] {
    text-align: center !important;
  }

  .footer ul {
    padding-left: 0;
  }

  .footer address {
    margin-bottom: 0;
  }
}

/* Very small phones */
@media (max-width: 420px) {
  .container,
  .container-fluid {
    --bs-gutter-x: 1.1rem;
  }

  .header .logo h1 {
    font-size: .96rem !important;
  }

  .mobile-nav-toggle {
    font-size: 28px !important;
  }

  .hero h2 {
    font-size: 2rem !important;
  }

  .hero p,
  .hero .lead {
    font-size: 1rem !important;
  }
}

/* Accessibility / reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
