/* ================================================================
   renxk.com — Mobile Design System
   Design Concept: "Refined Layers" — Premium Editorial for Mobile
   Loaded via <link media="screen and (max-width: 767px)">
   ================================================================ */

/* === Variable Overrides — Slightly Deeper for Mobile Intimacy === */
:root {
  --surface: #f7f5f1;
  --card: rgba(255,255,255,.72);
  --card-solid: #ffffff;
  --border: #e6e2d9;
  --border-soft: rgba(230,226,217,.5);

  /* Deeper, richer shadows for small-screen depth */
  --shadow-1: 0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.04);
  --shadow-2: 0 4px 12px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --shadow-3: 0 12px 40px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
  --shadow-card: 0 2px 8px rgba(0,0,0,.05), 0 8px 32px rgba(0,0,0,.05), 0 0 0 1px rgba(0,0,0,.03);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,.07), 0 16px 48px rgba(0,0,0,.08), 0 0 0 1px rgba(91,76,235,.1);

  /* Mobile spacing */
  --space-section: 56px;
  --space-card-pad: 20px;
  --touch-target: 44px;
}

/* === Base === */
html {
  font-size: 16px;
  scroll-padding-top: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: calc(var(--touch-target) + 28px + env(safe-area-inset-bottom, 0px));
  /* room for bottom nav */
}

/* === Background Mesh — Mobile Optimized === */
.bg-mesh { opacity: .45; }
.bg-mesh .orb:nth-child(1) {
  width: 280px; height: 280px;
  top: -5%; left: -15%;
}
.bg-mesh .orb:nth-child(2) {
  width: 240px; height: 240px;
  top: 45%; right: -20%;
}
.bg-mesh .orb:nth-child(3) {
  width: 200px; height: 200px;
  bottom: -5%; left: 20%;
}

/* ================================================================
   PROFILE CARD OVERLAY — React component handles all card CSS.
   Only mobile-specific overrides below.
   ================================================================ */

/* Show the React overlay on mobile (desktop hidden by global.css !important) */
.pc-overlay {
  display: flex !important;
}

/* ================================================================
   PAGE BODY REVEAL — after card is dismissed
   ================================================================ */

#page-body {
  opacity: 0;
  transition: opacity .45s ease;
}

#page-body.revealed {
  opacity: 1;
}

/* Mobile: hide the desktop hero card (overlay card is used instead) */
.hero-card { display: none; }

/* Mobile: hero single column */
.hero-layout {
  flex-direction: column;
  gap: 0;
}

.hero-info {
  text-align: center;
}

.hero-info .name,
.hero-info .pinyin-row,
.hero-info .tag-row,
.hero-info .links-row {
  text-align: center;
  justify-content: center;
}

.topnav {
  position: fixed;
  top: auto;
  bottom: 0;
  left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(247,245,241,.82);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-top: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 -1px 8px rgba(0,0,0,.04);
  gap: 0;
  transition: none;
  will-change: auto;
}

/* Hide the scrolled state on mobile — bottom nav is always solid */
.topnav.scrolled {
  background: rgba(247,245,241,.82);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  box-shadow: 0 -1px 8px rgba(0,0,0,.04);
}

.topnav .logo {
  display: none; /* hidden on mobile, nav items centered */
}

.topnav nav {
  display: flex;
  gap: 0;
  width: 100%;
  max-width: 400px;
  justify-content: space-around;
  align-items: center;
}

.topnav nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: .68rem;
  font-weight: 600;
  color: var(--ink-muted);
  padding: 6px 10px;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  justify-content: center;
  border-radius: var(--radius-sm);
  position: relative;
  transition: color .2s;
  letter-spacing: .02em;
  cursor: pointer;
}

/* Show icon + label on mobile */
.topnav nav a .nav-ico {
  display: block;
  font-size: 1.15rem;
  line-height: 1;
  transition: color .2s;
}

.topnav nav a .nav-lbl {
  display: block;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .04em;
}

.topnav nav a::after { display: none; }

.topnav nav a::before { display: none; }

.topnav nav a.active,
.topnav nav a:hover {
  color: var(--accent);
}

.topnav nav a.active .nav-ico,
.topnav nav a:hover .nav-ico {
  color: var(--accent);
}

/* Bottom nav CTA button */
.topnav nav a.cta-nav {
  background: var(--accent);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: .72rem;
  font-weight: 650;
  min-width: auto;
  min-height: 36px;
  flex-direction: row;
  gap: 4px;
  box-shadow: 0 4px 16px rgba(91,76,235,.3);
  transition: background .2s, transform .2s;
}
.topnav nav a.cta-nav .nav-ico { display: inline; font-size: .85rem; }
.topnav nav a.cta-nav .nav-lbl { display: inline; font-size: .72rem; }
.topnav nav a.cta-nav::before { display: none; }
.topnav nav a.cta-nav:hover {
  background: var(--accent-glow);
  transform: translateY(-1px);
  color: #fff;
}

/* ================================================================
   HERO — Home Page
   ================================================================ */

.home-hero {
  min-height: 85vh;
  min-height: 85dvh;
  padding: 48px 24px 64px;
  justify-content: center;
}

.home-hero .domain-display {
  margin-bottom: 20px;
}

.home-hero .domain-name {
  font-size: clamp(2.6rem, 12vw, 4rem);
  letter-spacing: -.04em;
  filter: drop-shadow(0 3px 6px rgba(91,76,235,.25));
}

.home-hero .tagline {
  font-size: .95rem;
  color: var(--ink-soft);
  margin-top: 10px;
  letter-spacing: .03em;
  padding: 0 16px;
  line-height: 1.6;
}

.home-hero .stat-row {
  flex-direction: column;
  gap: 6px;
  margin-top: 32px;
  align-items: center;
}

.stat-item {
  display: flex !important;
  align-items: baseline !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
  justify-content: center;
}

.stat-item .stat-num {
  font-size: 1.6rem;
  display: inline !important;
}

.stat-item .stat-label {
  font-size: .9rem;
  display: inline !important;
}

.stat-item span[style*="color:var(--ink-muted)"] {
  margin: 0 6px !important;
  font-size: 1rem !important;
}

/* Force stats to stack as two groups on smallest screens */
@media (max-width: 374px) {
  .stat-item span[style*="color:var(--ink-muted)"] {
    display: none; /* hide the dot separator */
  }
}

.home-hero .links-row {
  flex-direction: column;
  align-items: stretch;
  margin-top: 36px;
  width: 100%;
  max-width: 300px;
  gap: 10px;
}

.home-hero .links-row .link-pill {
  justify-content: center;
  padding: 14px 24px;
  font-size: .95rem;
  font-weight: 600;
}

.home-scroll-hint {
  bottom: 100px; /* above bottom nav */
}
.home-scroll-hint span {
  width: 20px; height: 20px;
}

/* ================================================================
   HERO — Name Pages
   ================================================================ */

.hero {
  padding: 48px 24px 40px;
  text-align: center;
}

.hero .avatar-wrapper {
  margin-bottom: 20px;
}

.hero .avatar {
  width: 88px;
  height: 88px;
  font-size: 1.8rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.12), 0 0 0 5px rgba(255,255,255,.6);
}

.hero .avatar-ring {
  inset: -8px;
}

.hero .name {
  font-size: 2rem;
  letter-spacing: .03em;
}

.hero .pinyin-row {
  font-size: .88rem;
  gap: 8px;
  margin-bottom: 12px;
}

.hero .tag-row {
  gap: 8px;
  margin-bottom: 14px;
}

.hero .badge {
  font-size: .78rem;
  padding: 5px 14px;
}

.hero .location {
  font-size: .82rem;
}

.hero .intro {
  font-size: .93rem;
  max-width: 100%;
  padding: 0 8px;
  margin: 18px auto 0;
  line-height: 1.7;
}

/* Name page hero links — stacked pills */
.hero .links-row {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 24px;
  padding: 0 16px;
}

.hero .links-row .link-pill {
  justify-content: center;
  padding: 12px 20px;
  font-size: .9rem;
}

/* ================================================================
   LINK PILLS — Enhanced for Touch
   ================================================================ */

.link-pill {
  padding: 12px 20px;
  font-size: .9rem;
  min-height: var(--touch-target);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(230,226,217,.6);
  transition: all .25s var(--ease-out), transform .15s var(--ease-out);
}

.link-pill:active {
  transform: scale(.97);
  background: rgba(91,76,235,.06);
  border-color: rgba(91,76,235,.2);
}

.link-pill:hover {
  transform: none;
  box-shadow: var(--shadow-1);
  border-color: rgba(230,226,217,.6);
}

/* ================================================================
   SECTIONS — Shared
   ================================================================ */

.page-section {
  padding: var(--space-section) 20px;
}

.page-section.alt {
  background: rgba(255,255,255,.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.section-inner {
  max-width: 100%;
}

.section-label {
  font-size: .7rem;
  letter-spacing: .14em;
  text-align: center;
  margin-bottom: 8px;
}

.section-header {
  text-align: center !important;
  margin-bottom: 36px;
}

.section-header h2 {
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: -.02em;
}

.section-header .section-line {
  width: 40px;
  height: 3px;
  margin: 14px auto 0 !important;
  border-radius: 2px;
}

/* ================================================================
   VALUE GRID — Glass Cards
   ================================================================ */

.value-grid {
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0 4px;
}

.value-card {
  padding: 24px 20px;
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(230,226,217,.5);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  cursor: default;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}

.value-card:active {
  transform: scale(.98);
  box-shadow: var(--shadow-2);
}

.value-card:hover {
  transform: none;
  box-shadow: var(--shadow-card);
}

.value-card::after { display: none; }

.value-card .vc-icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.value-card h3 {
  font-size: .98rem;
  margin-bottom: 4px;
}

.value-card p {
  font-size: .85rem;
  line-height: 1.6;
}

/* ================================================================
   NAME DIRECTORY — 2-Column Grid
   ================================================================ */

.name-directory {
  padding: 0 20px var(--space-section);
  max-width: 100%;
}

.name-directory .dir-desc {
  font-size: .85rem;
  padding: 0 8px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.name-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.name-grid a {
  padding: 14px 12px;
  font-size: .88rem;
  font-weight: 550;
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: var(--radius-sm);
  background: var(--card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(230,226,217,.5);
  transition: all .2s var(--ease-out);
}

.name-grid a:active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(91,76,235,.06);
  transform: scale(.97);
}

.name-grid a:hover {
  transform: none;
  border-color: rgba(230,226,217,.5);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* ================================================================
   ABOUT
   ================================================================ */

.about-grid {
  grid-template-columns: 1fr;
  gap: 18px;
}

.about-grid p {
  font-size: .9rem;
  line-height: 1.75;
}

.about-grid p:first-child {
  font-size: .98rem;
}

/* ================================================================
   TIMELINE
   ================================================================ */

.timeline {
  padding-left: 28px;
}

.timeline::before {
  left: 8px;
}

.timeline-item {
  padding: 18px 16px;
  margin-bottom: 20px;
  background: var(--card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(230,226,217,.5);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1);
  transition: box-shadow .2s var(--ease-out);
}

.timeline-item:hover {
  transform: none;
  box-shadow: var(--shadow-1);
}

.timeline-item:active {
  box-shadow: var(--shadow-2);
}

.timeline-item::before {
  left: -22px;
  top: 24px;
  width: 9px;
  height: 9px;
  box-shadow: 0 0 0 4px rgba(91,76,235,.1);
}

.ti-header {
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.ti-role { font-size: .93rem; }
.ti-period {
  font-size: .78rem;
  white-space: normal;
}

.ti-desc { font-size: .82rem; line-height: 1.6; }

/* ================================================================
   SKILLS
   ================================================================ */

.skills-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}

.skill-card {
  padding: 16px 18px;
  background: var(--card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(230,226,217,.4);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1);
  transition: box-shadow .2s;
}

.skill-card:hover { box-shadow: var(--shadow-1); }
.skill-card:active { box-shadow: var(--shadow-2); }

.skill-card .skill-name {
  font-size: .85rem;
  margin-bottom: 8px;
}

.skill-card .track {
  height: 4px;
}

/* ================================================================
   PROJECTS
   ================================================================ */

.project-grid {
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0 4px;
}

.project-card {
  padding: 24px 20px;
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(230,226,217,.5);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  cursor: default;
  transition: transform .2s, box-shadow .2s;
}

.project-card::after { display: none; }

.project-card:hover {
  transform: none;
  box-shadow: var(--shadow-card);
}

.project-card:active {
  transform: scale(.98);
  box-shadow: var(--shadow-2);
}

.project-card .pc-no {
  font-size: 2.4rem;
  margin-bottom: -4px;
}

.project-card h3 {
  font-size: .98rem;
  margin: 10px 0 6px;
}

.project-card p {
  font-size: .84rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.project-card .tag {
  font-size: .7rem;
  padding: 3px 10px;
}

/* ================================================================
   BLOG
   ================================================================ */

.blog-list {
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  background: var(--card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(230,226,217,.4);
}

.blog-item {
  padding: 16px 18px;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  cursor: default;
}

.blog-item::before { display: none; }

.blog-item:active {
  background: rgba(91,76,235,.04);
}

.blog-item:hover { background: transparent; }
.blog-item:hover .blog-title { color: inherit; }

.blog-item .blog-title {
  font-size: .9rem;
}

.blog-item .blog-rhs {
  gap: 8px;
}

.blog-cat { font-size: .7rem; }
.blog-date { font-size: .75rem; }

/* ================================================================
   CONTACT / CTA SECTION
   ================================================================ */

.contact-section {
  padding: var(--space-section) 20px 40px;
}

.contact-section .cta-text {
  font-size: .93rem;
  padding: 0 8px;
  margin-bottom: 24px;
  line-height: 1.65;
}

/* ================================================================
   FOOTER
   ================================================================ */

.contact-footer {
  padding: 40px 20px 48px;
  background: rgba(255,255,255,.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.contact-footer h3 {
  font-size: 1.05rem;
}

.contact-footer .cf-subtitle {
  font-size: .82rem;
  margin-bottom: 24px;
}

.qr-row {
  gap: 28px;
  margin-bottom: 24px;
}

.qr-item .qr-box {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
}

.qr-item .qr-label {
  font-size: .85rem;
}

.contact-footer .email-line {
  font-size: .82rem;
  margin-bottom: 20px;
}

.contact-footer .demo-footnote {
  font-size: .75rem;
  margin-top: 24px;
  padding-top: 16px;
}

.site-footer {
  padding: 36px 20px;
  font-size: .82rem;
}

.site-footer .powered {
  font-size: .78rem;
}

.site-footer .domain-sale {
  font-size: .72rem;
}

/* ================================================================
   DEMO BANNER
   ================================================================ */

.demo-banner {
  font-size: .8rem;
  padding: 10px 16px;
  line-height: 1.5;
}

/* ================================================================
   MODAL
   ================================================================ */

.modal-card {
  padding: 32px 24px 28px;
  width: calc(100% - 32px);
  border-radius: var(--radius);
}

.modal-card h3 {
  font-size: 1.1rem;
}

.modal-sub {
  font-size: .82rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
}

/* ================================================================
   SCROLL ANIMATIONS — Optimized for Mobile
   ================================================================ */

.reveal,
.reveal-left,
.reveal-right {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .55s var(--ease-smooth), transform .55s var(--ease-smooth);
}

.reveal-left,
.reveal-right {
  transform: translateX(0) translateY(24px);
  /* horizontal reveals degrade to vertical on mobile */
}

.reveal.visible,
.reveal-left.visible,
.reveal-right.visible {
  opacity: 1;
  transform: translateY(0) translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(.94);
  transition: opacity .45s var(--ease-smooth), transform .45s var(--ease-smooth);
}

.reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* Stagger delays — compressed for mobile */
.stagger > *:nth-child(1) { transition-delay: 0ms; }
.stagger > *:nth-child(2) { transition-delay: 50ms; }
.stagger > *:nth-child(3) { transition-delay: 100ms; }
.stagger > *:nth-child(4) { transition-delay: 150ms; }
.stagger > *:nth-child(5) { transition-delay: 200ms; }
.stagger > *:nth-child(6) { transition-delay: 250ms; }
.stagger > *:nth-child(7) { transition-delay: 300ms; }
.stagger > *:nth-child(8) { transition-delay: 350ms; }

/* ================================================================
   ACTIVE STATES — Replace hover with :active for touch
   ================================================================ */

/* Any remaining hover-only interactions get an active fallback */
a:active {
  opacity: .8;
}

/* Remove hover-based card tilt JS effects since they don't work on touch */
.project-card,
.value-card {
  transform: none !important;
}

/* ================================================================
   SAFE AREA / NOTCH SUPPORT
   ================================================================ */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .topnav {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  body {
    padding-bottom: calc(var(--touch-target) + 28px + env(safe-area-inset-bottom, 0px));
  }

  .contact-footer {
    padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
  }
}

/* ================================================================
   LARGE MOBILE / SMALL TABLET REFINEMENTS (480px - 767px)
   ================================================================ */

@media (min-width: 480px) {
  .value-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .value-card {
    padding: 28px 22px;
  }

  .name-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .project-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .skills-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .home-hero .links-row {
    flex-direction: row;
    max-width: 420px;
  }

  .hero .links-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero .links-row .link-pill {
    flex: 0 1 auto;
  }

  .home-hero .stat-row {
    flex-direction: row;
    gap: 32px;
  }
}