/* ============================================================
   Strength Research Institute (Genshin Impact SRI) — Global stylesheet
   Design style: dark background + liquid glass effect + responsive layout
   Reference: DeepSeek web typography style
   UI baseline scale: 150% (html font-size: 24px)
   ============================================================ */

/* ----------------------------------------------------------
   1. CSS custom properties (design tokens)
   ---------------------------------------------------------- */
:root {
  /* Background colors */
  --bg-primary: #0a0a10;
  --bg-secondary: #12121a;

  /* Text colors */
  --text-primary: #f0f0f5;
  --text-secondary: rgba(240, 240, 245, 0.55);
  /* Brighter description text, more clearly visible */
  --text-tertiary: rgba(240, 240, 245, 0.5);

  /* Accent colors */
  --accent: #6ea8fe;
  --accent-hover: #8db9ff;

  /* Liquid glass effect */
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-bg-hover: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.14);
  --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
  --glass-inner-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  /* Border radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Blur amount */
  --blur-amount: 14px;

  /* Spacing (uses rem, scales with the root font size) */
  --navbar-height: 3.5rem;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* ----------------------------------------------------------
   2. Global reset and base styles
   ---------------------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  /* 180% UI scaling baseline (default 16px → 28.8px, 150% × 1.20) */
  font-size: 28.8px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  /* Unified font stack: Latin-first stack for consistent rendering on every platform */
  font-family: "Noto Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
  /* Disable emoji font rendering */
  font-variant-emoji: text;
}

/* Link reset */
a {
  color: inherit;
  text-decoration: none;
}

/* Image reset */
img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Button reset */
button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  outline: none;
}

/* ----------------------------------------------------------
   3. Liquid glass utility classes
   ---------------------------------------------------------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow), var(--glass-inner-shadow);
  transition: background var(--transition-normal),
    border-color var(--transition-normal),
    box-shadow var(--transition-normal),
    transform var(--transition-normal);
}

/* Navbar-specific glass effect (more transparent) */
.glass-nav {
  background: rgba(10, 10, 18, 0.4);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border-bottom: 1px solid var(--glass-border);
}

/* ----------------------------------------------------------
   4. Background image layer
   ---------------------------------------------------------- */
.background-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

/* Desktop background */
.background-layer::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("png/index-background-7.1.1.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* Keep the background image fixed when the browser is zoomed */
  background-attachment: fixed;
  opacity: 0.4;
}

/* Semi-transparent overlay to improve text contrast */
.background-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 16, 0.35);
}

/* ----------------------------------------------------------
   5. Navbar (shown on desktop, hidden on mobile)
   ---------------------------------------------------------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--navbar-height);
  padding: 0 1.5rem;
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Shared navigation link styles */
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.44rem 0.88rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-fast),
    background var(--transition-fast);
  user-select: none;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.nav-link:active {
  background: rgba(255, 255, 255, 0.03);
}

/* Disabled state of the home link while on the home page */
.nav-link.disabled {
  color: var(--text-tertiary);
  pointer-events: none;
  cursor: default;
}

/* Highlight the navigation link of the current page */
.nav-link.active {
  color: var(--accent);
}

/* ----------------------------------------------------------
   6. Main content area (vertically centered, biased upward)
   ---------------------------------------------------------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: calc(var(--navbar-height) + 2.5rem) 1.5rem 2.5rem;
  /* Visually biased about 5% upward */
  padding-bottom: 10vh;
}

/* ----------------------------------------------------------
   7. Title area
   ---------------------------------------------------------- */
.title-area {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

/* Site icon */
.gensri-icon {
  width: 4rem;
  height: 4rem;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
}

/* Title text container */
.title-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Main title */
.title-main {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* Subtitle */
.title-sub {
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

/* ----------------------------------------------------------
   9. Version info area (laid out horizontally in one row, wrapped in a glass border)
   ---------------------------------------------------------- */
.version-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
  padding: 0.6rem 1.5rem;
  /* Unified font size and typography */
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Separator */
.version-separator {
  color: var(--glass-border);
  user-select: none;
}

/* Dynamic values inside the version info */
.version-info .version-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* ----------------------------------------------------------
   9. Action button area (3 columns × 2 rows on desktop, stacked vertically on mobile)
   ---------------------------------------------------------- */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
  max-width: 1600px;
}

/* Single action button card: 3-column layout on desktop */
.btn-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 0 0 calc((100% - 2rem) / 3);
  padding: 1.5rem 1.25rem;
  cursor: pointer;
}

.btn-card:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border-hover);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25),
    var(--glass-inner-shadow);
  transform: translateY(-3px);
}

.btn-card:active {
  transform: translateY(0);
  box-shadow: var(--glass-shadow), var(--glass-inner-shadow);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

/* Button icon (enlarged) */
.btn-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* Button text container */
.btn-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

/* Button title */
.btn-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

/* Button description (more visible color) */
.btn-desc {
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--text-tertiary);
  /* Prevent overly long text from overflowing */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----------------------------------------------------------
   10. Subpage placeholder styles
   ---------------------------------------------------------- */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: calc(var(--navbar-height) + 2.5rem) 1.5rem 2.5rem;
}

.glass-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 2.5rem;
  text-align: center;
}

/* Placeholder icon */
.glass-card .placeholder-icon {
  font-size: 2.5rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

/* Placeholder title */
.glass-card .placeholder-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Placeholder description */
.glass-card .placeholder-desc {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------
   11. Footer (bottom of subpages)
   ---------------------------------------------------------- */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* Separator dot between the two footer items (desktop single-line mode only) */
.site-footer span:first-child::after {
  content: "·";
  margin-left: 0.5rem;
  color: var(--text-tertiary);
  user-select: none;
}

/* ----------------------------------------------------------
   12. Responsive: tablet (768px - 1024px)
   ---------------------------------------------------------- */
@media (max-width: 1024px) {
  :root {
    --navbar-height: 3.25rem;
  }

  .title-main {
    font-size: 2.2rem;
  }

  .btn-group {
    max-width: 900px;
    gap: 0.75rem;
  }

  .btn-card {
    flex: 0 0 calc(50% - 0.375rem);
    padding: 1.25rem;
    gap: 0.75rem;
  }

  .btn-icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .btn-title {
    font-size: 0.95rem;
  }

  .btn-desc {
    font-size: 0.8rem;
  }
}

/* ----------------------------------------------------------
   13. Responsive: mobile (< 768px)
   ---------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --navbar-height: 3rem;
    --blur-amount: 10px;
  }

  /* Overall smaller font size on mobile (baseline 28.8px → 20px) */
  html {
    font-size: 20px;
  }

  /* Hide the top navbar on mobile */
  .navbar {
    display: none;
  }

  /* Use the portrait background image on mobile */
  .background-layer::before {
    background-image: url("png/index-background-7.1.1(phone).jpg");
    background-attachment: scroll;
  }

  /* Main content area has no navbar, so reduce the top spacing */
  .hero {
    padding: 2rem 1rem 2rem;
  }

  /* Same adjustment for the subpage placeholder area */
  .placeholder {
    padding: 2rem 1rem 2rem;
  }

  /* Smaller title icon */
  .gensri-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-md);
  }

  .title-area {
    gap: 0.875rem;
  }

  .title-main {
    font-size: 1.8rem;
  }

  .title-sub {
    font-size: 0.9rem;
  }

  /* Version info */
  .version-info {
    margin-bottom: 2.25rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }

  /* Button group: back to vertical stacking on mobile */
  .btn-group {
    flex-direction: column;
    max-width: 400px;
    gap: 0.75rem;
  }

  /* Buttons are full width again on mobile */
  .btn-card {
    flex: 1;
    padding: 1.25rem 1.25rem;
  }

  .btn-icon {
    width: 2.75rem;
    height: 2.75rem;
  }

  .btn-title {
    font-size: 0.95rem;
  }

  .btn-desc {
    font-size: 0.8rem;
  }

  /* Subpage placeholder card */
  .glass-card {
    padding: 2.25rem 1.75rem;
  }

  /* The footer returns to two lines on mobile */
  .site-footer {
    flex-direction: column;
    gap: 0.15rem;
  }

  .site-footer span:first-child::after {
    content: none;
  }
}

/* Small screen phone optimization (< 400px) */
@media (max-width: 400px) {
  .title-main {
    font-size: 1.5rem;
  }

  .title-sub {
    font-size: 0.8rem;
  }

  .gensri-icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .btn-card {
    padding: 1rem;
    gap: 0.75rem;
  }

  .btn-icon {
    width: 2.375rem;
    height: 2.375rem;
  }

  .btn-title {
    font-size: 0.9rem;
  }

  .version-info {
    font-size: 0.78rem;
    padding: 0.45rem 0.75rem;
  }
}

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

/* ----------------------------------------------------------
   16. Language switcher (navbar; hidden on mobile together with the navbar)
   Styled after the dark liquid-glass dropdown of the database
   character page's "version diff" picker.
   ---------------------------------------------------------- */
.lang-switch {
  position: relative;
  flex: 0 0 auto;
}

/* Trigger: a glass pill matching the navbar links */
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.72rem;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color var(--transition-normal), border-color var(--transition-normal),
    background var(--transition-normal);
}

.lang-btn:hover,
.lang-switch.open .lang-btn {
  color: var(--text-primary);
  border-color: var(--glass-border-hover);
  background: rgba(255, 255, 255, 0.07);
}

.lang-btn:focus-visible {
  outline: none;
  border-color: var(--accent);
}

/* Caret: rotates softly when the menu opens */
.lang-caret {
  font-size: 0.6rem;
  color: var(--text-tertiary);
  transition: transform var(--transition-normal), color var(--transition-normal);
}

.lang-switch.open .lang-caret {
  transform: rotate(180deg);
  color: var(--accent);
}

/* Flag icon (SVG file, no emoji) */
.lang-flag {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 0.8rem;
  border-radius: 2px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.lang-flag-cn { background-image: url("/png/flags/cn.svg"); }
.lang-flag-en { background-image: url("/png/flags/us.svg"); }

/* Dropdown panel: dark liquid glass with a soft open/close transition */
.lang-menu {
  position: absolute;
  z-index: 120;
  top: calc(100% + 0.4rem);
  left: 0;
  min-width: 8.5rem;
  padding: 0.3rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border-hover);
  background: rgba(18, 20, 28, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(-0.3rem) scale(0.98);
  pointer-events: none;
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.lang-switch.open .lang-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* One language entry */
.lang-opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.42rem 0.55rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-normal), color var(--transition-normal);
}

.lang-opt:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.lang-opt.active {
  color: #FFD780;
  background: rgba(255, 215, 128, 0.12);
}

.lang-opt-code {
  margin-left: auto;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.lang-opt.active .lang-opt-code {
  color: #FFD780;
}

/* ----------------------------------------------------------
   17. Home page button group — stacked layout
   The English home page has three section entries, so they are
   stacked vertically and widened; descriptions wrap instead of
   being truncated with an ellipsis.
   ---------------------------------------------------------- */
.btn-group-stack {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.9rem;
  max-width: 44rem;
}

.btn-group-stack .btn-card {
  flex: 0 0 auto;
  width: 100%;
  padding: 1rem 1.4rem;
}

.btn-group-stack .btn-desc {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

@media (max-width: 1024px) {
  .btn-group-stack {
    max-width: 36rem;
  }
}

@media (max-width: 768px) {
  .btn-group-stack {
    max-width: 100%;
    gap: 0.75rem;
  }
}