/* ============================================================
   iSticker — Base Styles
   Resets, typography, scrollbar, selection, utilities.
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  tab-size: 4;
}

body {
  font-family: var(--is-font-sans);
  font-size: var(--is-fs-base);
  font-weight: var(--is-fw-normal);
  line-height: var(--is-lh-normal);
  color: var(--is-fg-primary);
  background: var(--is-bg-app);
  overflow: hidden;
  height: 100dvh;
  width: 100dvw;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--is-scrollbar-thumb);
  border-radius: var(--is-r-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--is-scrollbar-thumb);
  opacity: 0.8;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--is-scrollbar-thumb) var(--is-scrollbar-track);
}

/* ---- Selection ---- */
::selection {
  background: var(--is-accent);
  color: var(--is-accent-fg);
}

/* ---- Focus ---- */
:focus-visible {
  outline: 2px solid var(--is-border-focus);
  outline-offset: 2px;
  border-radius: var(--is-r-sm);
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--is-fw-semibold);
  line-height: var(--is-lh-tight);
}

h1 { font-size: var(--is-fs-2xl); }
h2 { font-size: var(--is-fs-lg); }
h3 { font-size: var(--is-fs-base); }

p {
  line-height: var(--is-lh-normal);
}

small {
  font-size: var(--is-fs-sm);
}

code, kbd, pre {
  font-family: var(--is-font-mono);
  font-size: var(--is-fs-sm);
}

/* ---- Links ---- */
a {
  color: var(--is-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---- Media ---- */
img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

img {
  -webkit-user-drag: none;
  user-select: none;
}

/* ---- Form Element Resets ---- */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  outline: none;
}

button {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: var(--is-r-sm);
}

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

/* ---- Tables ---- */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ---- Prevent text drag on UI elements ---- */
.no-select {
  user-select: none;
  -webkit-user-select: none;
}

/* ---- Utilities: Display ---- */
.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;
}

[hidden] {
  display: none !important;
}

/* ---- Utilities: Text ---- */
.text-xs      { font-size: var(--is-fs-xs); }
.text-sm      { font-size: var(--is-fs-sm); }
.text-md      { font-size: var(--is-fs-md); }
.text-base    { font-size: var(--is-fs-base); }
.text-lg      { font-size: var(--is-fs-lg); }

.text-primary   { color: var(--is-fg-primary); }
.text-secondary { color: var(--is-fg-secondary); }
.text-tertiary  { color: var(--is-fg-tertiary); }
.text-accent    { color: var(--is-accent); }
.text-danger    { color: var(--is-danger); }

.fw-normal    { font-weight: var(--is-fw-normal); }
.fw-medium    { font-weight: var(--is-fw-medium); }
.fw-semibold  { font-weight: var(--is-fw-semibold); }
.fw-bold      { font-weight: var(--is-fw-bold); }

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-mono    { font-family: var(--is-font-mono); }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Utilities: Flex ---- */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1        { gap: var(--is-sp-1); }
.gap-2        { gap: var(--is-sp-2); }
.gap-3        { gap: var(--is-sp-3); }
.gap-4        { gap: var(--is-sp-4); }

/* ---- Utilities: Spacing ---- */
.mt-1 { margin-top: var(--is-sp-1); }
.mt-2 { margin-top: var(--is-sp-2); }
.mt-3 { margin-top: var(--is-sp-3); }
.mt-4 { margin-top: var(--is-sp-4); }
.mb-2 { margin-bottom: var(--is-sp-2); }
.mb-4 { margin-bottom: var(--is-sp-4); }

/* ---- Utilities: Animations ---- */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-4px); }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

.animate-fade-in {
  animation: fade-in var(--is-dur-slow) var(--is-ease-out) both;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
