/**
 * KNOT STUDIO — Base Reset & Global Styles
 * ============================================================
 * Imports tokens.css. Apply after tokens.css.
 * ============================================================
 */

@import './tokens.css';

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-relaxed);
  color: var(--color-text-body);
  background-color: var(--color-bg-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

ul, ol {
  list-style: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}


/* ── TYPOGRAPHY ──────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-text-primary);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
}

h1 { font-size: var(--text-h1); letter-spacing: var(--ls-tight); }
h2 { font-size: var(--text-h2); letter-spacing: var(--ls-tight); }
h3 { font-size: var(--text-h3); font-weight: var(--fw-semibold); letter-spacing: var(--ls-snug); }
h4 { font-size: var(--text-h4); font-weight: var(--fw-semibold); letter-spacing: var(--ls-snug); }
h5 { font-size: var(--text-h5); font-weight: var(--fw-medium); letter-spacing: 0; }
h6 { font-size: var(--text-h6); font-weight: var(--fw-medium); letter-spacing: 0; }

p {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-relaxed);
  color: var(--color-text-body);
}

p + p { margin-top: var(--space-4); }

strong { font-weight: var(--fw-semibold); color: var(--color-text-primary); }
em     { font-style: italic; }


/* ── SELECTION ───────────────────────────────────────────── */
::selection {
  background: var(--color-sky);
  color: var(--color-night);
}


/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(162, 192, 221, 0.3);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover { background: var(--color-sky); }


/* ── FOCUS ───────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-sky);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}


/* ── LAYOUT CONTAINERS ───────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--page-padding-x);
}

.container--wide   { max-width: var(--container-wide); }
.container--narrow { max-width: var(--container-narrow); }

.section {
  padding-block: var(--section-gap);
}

/* Dark section variant */
.section--dark {
  background-color: var(--color-night);
  color: var(--color-beige);
}
.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4,
.section--dark h5,
.section--dark h6 { color: var(--color-beige); }
.section--dark p   { color: var(--color-text-muted-light); }

/* Sky section variant */
.section--sky {
  background-color: var(--color-sky);
  color: var(--color-night);
}

/* Beige section variant */
.section--beige {
  background-color: var(--color-beige);
  color: var(--color-night);
}


/* ── DIVIDERS ────────────────────────────────────────────── */
hr {
  border: none;
  border-top: var(--border-width) solid var(--color-border);
}

.divider--sky   { border-top-color: var(--color-sky); }
.divider--light { border-top-color: var(--color-border-light); }

/* Short accent rule */
.rule {
  display: block;
  width: 32px;
  height: 2px;
  background: var(--color-sky);
  border-radius: 2px;
}


/* ── GRID ────────────────────────────────────────────────── */
.grid {
  display: grid;
  gap: var(--space-8);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

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

@media (max-width: 640px) {
  .grid--2,
  .grid--3,
  .grid--4 { grid-template-columns: 1fr; }
}


/* ── FLEX UTILITIES ──────────────────────────────────────── */
.flex       { display: flex; }
.flex-col   { display: flex; flex-direction: column; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.items-end      { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.gap-2  { gap: var(--space-2); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }
.gap-12 { gap: var(--space-12); }
.gap-16 { gap: var(--space-16); }
