/* ==========================================
   HypeHere - Base Styles
   Global Styles, Reset, Typography
   ========================================== */

/* ===== CSS Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Global horizontal scroll prevention */
*:not(svg):not(path):not(circle):not(line):not(polyline):not(rect):not(ellipse):not(polygon) {
  max-width: 100%;
}

html {
  font-size: 14px; /* Mobile-first: smaller base for better content density */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden; /* Prevent horizontal scroll */
  max-width: 100%;
  -webkit-text-size-adjust: 100%; /* Prevent iOS auto-zoom */
  -ms-text-size-adjust: 100%; /* Prevent IE auto-zoom */
  scroll-behavior: smooth; /* Smooth scrolling */
  -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
}

/* ===== Hide scrollbars for native app feel ===== */
/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 0px;
  height: 0px;
  background: transparent;
}

/* Firefox */
* {
  scrollbar-width: none;
}

/* IE, Edge (Legacy) */
body {
  -ms-overflow-style: none;
  overscroll-behavior-y: contain; /* Prevent overscroll bounce */
}

/* Touch optimization */
* {
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
  touch-action: manipulation; /* Prevent double-tap zoom */
}

/* Responsive font scaling - Mobile to Desktop */
@media (min-width: 480px) {
  html {
    font-size: 14.5px; /* Large mobile */
  }
}

@media (min-width: 640px) {
  html {
    font-size: 15px; /* Small tablet */
  }
}

@media (min-width: 768px) {
  html {
    font-size: 16px; /* Tablet */
  }
}

@media (min-width: 1024px) {
  html {
    font-size: 17px; /* Desktop */
  }
}

@media (min-width: 1440px) {
  html {
    font-size: 18px; /* Large desktop */
  }
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  overflow-x: hidden; /* Prevent horizontal scroll */
  max-width: 100%;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
}

h1 {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-md);
}

h3 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-md);
}

h4 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-sm);
}

h5 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-sm);
}

h6 {
  font-size: var(--font-size-base);
  margin-bottom: var(--space-sm);
}

p {
  margin: 0 0 var(--space-md) 0;
}

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

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ===== Lists ===== */
ul, ol {
  list-style: none;
}

/* ===== Images & SVG ===== */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

svg {
  flex-shrink: 0;
  display: inline-block;
}

/* Button SVG explicit sizing */
button svg, .btn svg, a svg {
  width: 20px;
  height: 20px;
}

/* ===== Code ===== */
code, pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
}

code {
  padding: 2px 6px;
  background-color: var(--color-bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--color-primary-dark);
}

pre {
  padding: var(--space-md);
  background-color: var(--color-bg-tertiary);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

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

/* ===== Forms ===== */
input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* ===== iOS Safari 자동 확대 방지 ===== */
/* iOS는 input font-size < 16px일 때 자동 확대 → 16px 최소값 강제 */
@supports (-webkit-touch-callout: none) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  input[type="search"],
  textarea,
  select {
    font-size: max(16px, 1rem) !important;
  }
}

/* ===== Utility Classes ===== */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

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

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

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

/* ===== Text Utilities ===== */
.text-primary {
  color: var(--color-primary);
}

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

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

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

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

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

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

.font-medium {
  font-weight: var(--font-weight-medium);
}

.font-semibold {
  font-weight: var(--font-weight-semibold);
}

.font-bold {
  font-weight: var(--font-weight-bold);
}

/* ===== Spacing Utilities ===== */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.ml-sm { margin-left: var(--space-sm); }
.ml-md { margin-left: var(--space-md); }
.ml-lg { margin-left: var(--space-lg); }

.mr-sm { margin-right: var(--space-sm); }
.mr-md { margin-right: var(--space-md); }
.mr-lg { margin-right: var(--space-lg); }

.pt-sm { padding-top: var(--space-sm); }
.pt-md { padding-top: var(--space-md); }
.pt-lg { padding-top: var(--space-lg); }

.pb-sm { padding-bottom: var(--space-sm); }
.pb-md { padding-bottom: var(--space-md); }
.pb-lg { padding-bottom: var(--space-lg); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

/* ===== Flex Utilities ===== */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-1 {
  flex: 1;
  min-width: 0;  /* Prevent flex item overflow */
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

/* ===== Display Utilities ===== */
.hidden {
  display: none !important;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

/* ===== Responsive Utilities ===== */
@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
}
