/* ==========================================================================
   CyoriaSMP — Shared Component Styles
   ใช้ร่วมกับ design-tokens.css ในทุกหน้า
   ========================================================================== */

/* ─── Component: Site Header ─────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.site-header .nav {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link[aria-current="page"],
.nav-link.active-page {
  color: var(--fg);
  background: var(--bg-surface);
  border-radius: var(--radius);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.status-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.header-cta {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.header-cta:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.menu-toggle {
  display: none;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  font-size: 18px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Mobile nav panel */
@media (max-width: 920px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 20px;
    right: 20px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    box-shadow: var(--shadow);
    flex-direction: column;
    z-index: 99;
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-link {
    padding: 0 14px;
    min-height: 48px;
    width: 100%;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .nav-actions .status-link {
    display: none;
  }
}

@media (max-width: 680px) {
  .nav-actions .header-cta.hide-mobile {
    display: none !important;
  }
}

/* ─── Component: Site Footer ─────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--muted);
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--fg);
}

@media (max-width: 680px) {
  .footer-row {
    flex-direction: column;
    text-align: center;
  }
}

/* ─── Component: Section ─────────────────────────────────────────────────── */

.section {
  padding: 88px 0;
  border-bottom: 1px solid var(--border);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.section-head h2 {
  max-width: 560px;
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.section-head p {
  max-width: 390px;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 15px;
}

@media (max-width: 680px) {
  .section {
    padding: 64px 0;
  }
  .section-head {
    display: block;
  }
  .section-head h2 {
    margin-bottom: 14px;
  }
}

/* ─── Component: Hero ────────────────────────────────────────────────────── */

.hero {
  padding: 112px 0 84px;
  border-bottom: 1px solid var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 72px;
  align-items: end;
}

.hero-copy {
  max-width: 590px;
  margin-bottom: 34px;
  color: var(--muted);
  font-size: 17px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

@media (max-width: 920px) {
  .hero {
    padding: 76px 0 60px;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 42px;
  }
}

/* ─── Component: Server Card ─────────────────────────────────────────────── */

.server-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
  box-shadow: var(--shadow);
}

.server-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(color-mix(in srgb, var(--fg) 10%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--fg) 10%, transparent) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(135deg, var(--fg), transparent 70%);
  pointer-events: none;
}

.server-card > * {
  position: relative;
}

.server-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 30px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.server-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.server-state .status-dot {
  background: var(--accent);
}

.server-ip {
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: clamp(20px, 3vw, 30px);
  letter-spacing: -0.04em;
  word-break: break-word;
}

.copy-ip {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 40%, transparent);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.copy-ip span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.copy-ip:hover {
  border-color: var(--accent);
}

.server-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 20px;
  border-top: 1px solid var(--border);
}

.meta-item {
  padding-top: 16px;
}

.meta-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 18px;
}

.meta-label {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

/* ─── Component: Features Grid ───────────────────────────────────────────── */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.feature {
  min-height: 220px;
  padding: 24px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
}

.feature:hover {
  background: var(--bg-surface);
}

.feature-index {
  display: block;
  margin-bottom: 48px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.feature h3 {
  margin-bottom: 8px;
  font-size: 18px;
  letter-spacing: -0.01em;
  font-weight: 600;
}

.feature p {
  max-width: 34ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 920px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .feature-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Component: Status Bar (loading state) ──────────────────────────────── */

.st {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.st-v {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
}

.st-l {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── Helpers ────────────────────────────────────────────────────────────── */

.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
