/* ============================================================================
   VPSCloudHub - Base theme
   Global resets, typography, scrollbar, focus, links, scroll behavior.
   Imports design tokens from theme/tokens.css.
   ============================================================================ */

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

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

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1 0 auto;
}

#site-footer {
  margin-top: auto;
  flex-shrink: 0;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-4);
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

@media (min-width: 768px) {
  h1 { font-size: var(--font-size-5xl); }
  h2 { font-size: var(--font-size-4xl); }
}

p {
  margin: 0 0 var(--space-4);
  color: var(--color-text);
}

small,
.text-sm {
  font-size: var(--font-size-sm);
}

.text-xs { font-size: var(--font-size-xs); }
.text-lg { font-size: var(--font-size-lg); }

.text-muted {
  color: var(--color-text-muted) !important;
}

.text-subtle {
  color: var(--color-text-subtle);
}

.text-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

code,
kbd,
pre,
samp {
  font-family: var(--font-family-mono);
  font-size: 0.95em;
}

code {
  background: var(--color-bg-elevated-2);
  color: var(--color-secondary);
  padding: 0.125em 0.375em;
  border-radius: var(--radius-sm);
}

pre {
  background: var(--color-bg-elevated-2);
  color: var(--color-text);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
  border: 1px solid var(--color-border);
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover,
a:focus {
  color: var(--color-link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Focus ring (consistent across the site) ---------- */
:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
  box-shadow: none;
}

/* ---------- Scrollbar (webkit) ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary-200);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-300);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary-200) var(--color-bg);
}

/* ---------- Selection ---------- */
::selection {
  background: var(--color-secondary);
  color: var(--color-text-inverse);
}

::-moz-selection {
  background: var(--color-secondary);
  color: var(--color-text-inverse);
}

/* ---------- Horizontal rule ---------- */
hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0;
  opacity: 1;
}

/* ---------- Images ---------- */
img {
  max-width: 100%;
  height: auto;
}

/* ---------- Section spacing ---------- */
section {
  padding: var(--space-12) 0;
}

@media (min-width: 768px) {
  section {
    padding: var(--space-16) 0;
  }
}

.page-section > h1,
.page-section > h2,
.page-section > h3 {
  margin-top: var(--space-3);
}

.page-section .card + .card,
.page-section .card + .surface,
.page-section .row + .row {
  margin-top: var(--space-4);
}

/* ---------- Page layout helpers ---------- */
.page-narrow {
  max-width: var(--layout-narrow-width);
  margin: 0 auto;
  padding: 0 var(--layout-gutter);
}

.page-section {
  max-width: var(--layout-max-width);
  margin: 0 auto;
  padding: 0 var(--layout-gutter);
}

.surface {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.surface-elevated {
  background: var(--color-bg-elevated-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.gradient-bg {
  background: var(--gradient-brand);
}

.divider-gradient {
  height: 2px;
  background: var(--gradient-brand-edge);
  border: 0;
  border-radius: var(--radius-full);
  margin: var(--space-8) 0;
}

/* ---------- Bootstrap component color tweaks that don't follow variables ---------- */
.bg-body {
  background-color: var(--color-bg) !important;
}

.bg-surface {
  background-color: var(--color-bg-elevated) !important;
}

.text-primary {
  color: var(--color-secondary) !important;
}

.text-secondary {
  color: var(--color-tertiary) !important;
}

.text-body {
  color: var(--color-text) !important;
}

/* ---------- Display utilities (Bootstrap replacements) ---------- */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
