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

body {
  font-family: var(--ff);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 17px;
  line-height: 1.6;
  transition:
    background 0.3s ease,
    color 0.3s ease;
}

/* ======== Typography ========= */
p {
  font-weight: 400;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

a {
  font-weight: 600;
  color: inherit;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h5 {
  font-family: var(--ff-mono);
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
}

h2.sub,
h2 span {
  font-weight: 500;
}

h1,
.h1 {
  font-size: 22px;
  letter-spacing: 0.5px;
}

h2,
.h2 {
  font-size: 19px;
  margin-top: 2.5rem;
}

h3,
.h3 {
  font-size: 17px;
  margin: 4px 0 6px;
}

h5,
.h5 {
  font-size: 14px;
}

ul {
  list-style: none;
}

h2 + p,
h2 + ul,
ul + p,
h2 + ol,
ol + p {
  margin-top: 12px;
  margin-bottom: 12px;
}

p + ul,
p + ol {
  margin-bottom: 1rem;
}

p + h3 {
  margin-top: 1.5rem;
}

ul,
ol {
  margin-left: 1rem;
}

ul > *,
ol > * {
  margin-left: 0.5rem;
  margin-bottom: 0.4rem;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

strong {
  font-weight: 700;
  color: inherit;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent-primary);
}

blockquote,
pre,
.blockquote,
.code {
  display: block;
  font-size: 1rem;
  font-family: var(--ff-mono);
  background: #f0f1f3;
  padding: 1rem;
  border-radius: 6px;
  margin: 1.5rem 0;
  color: #08003a;
}

pre {
  font-family: var(--ff);
  padding: 1.5rem 1rem 0;
}

button,
input,
select,
teaxtarea {
  width: 100%;
  padding: var(--spacing-xs) 10px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  outline: none;
  font-size: 1rem;
  transition: var(--transition);
  appearance: none;
  font-family: inherit;
}

button {
  width: unset;
}

select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  print-color-adjust: exact;
}

select * {
  font-family: inherit;
}

/* ======== Sliders ========== */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  padding: 2px 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  outline: none;
}

/* ===== Track ===== */
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: #e0e0e0;
  border-radius: 4px;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  background: #e0e0e0;
  border-radius: 4px;
}

/* Filled portion (Firefox only) */
input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 4px;
}

/* ===== Thumb ===== */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
}

input[type="range"]::-moz-range-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
}

/* ===== Hover / Focus ===== */
input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.15);
}
input[type="range"]:hover::-moz-range-thumb {
  transform: scale(1.15);
}

input[type="range"]:focus {
  outline: none;
}
input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.25);
}
input[type="range"]:focus::-moz-range-thumb {
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.25);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  font-family: inherit;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);

  caption {
    caption-side: top;
    text-align: left;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 6px;
    padding-left: 2px;
  }

  thead tr {
    text-align: left;
    font-weight: 600;
    cursor: pointer;
  }

  th {
    padding: 12px;
  }

  td {
    padding: 8px 12px;
  }

  a {
    font-weight: 600;
  }
}

/* ============= Utility primitives ============== */
.link-accent {
  color: var(--accent-link);
  font-weight: 600;
  text-decoration: none;
}

.link-accent:hover {
  text-decoration: underline;
}

.col-2,
.col-3 {
  display: grid;
  gap: var(--spacing-xs);
}

.col-2 {
  grid-template-columns: 1fr 1fr;
}
.col-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.anchor-target {
  scroll-margin-top: 1.5rem;
}

.border-left-thick {
  border-left: 4px solid currentColor;
  border-radius: 4px 0 0 4px;
}

.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  -webkit-overflow-scrolling: touch;

  /* Chrome, Safari, Opera, Edge (Chromium) */
  &::-webkit-scrollbar {
    display: none;
  }

  /* Firefox */
  scrollbar-width: none;

  /* IE, legacy Edge */
  -ms-overflow-style: none;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 480px) {
  p {
    font-size: 17px;
    line-height: 1.7;
  }

  .col-2 {
    grid-template-columns: 1fr;
  }
}
