@use 'variables' as *;
@use 'mixins';
@use 'colors';
@use 'typography';
@use 'spacing';
@use 'animations';
@use 'comment';
@use 'search';
@use 'lightgallery';

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  min-width: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  hanging-punctuation: first last;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--ink);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow-x: hidden;
  tab-size: 4;
}

::selection {
  background-color: var(--accent);
  color: var(--bg);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--caramel);
  border-radius: $border-radius-full;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out-quart);

  &:hover {
    color: var(--accent-hover);
  }

  @include mixins.focus-visible;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}

.wi-main img,
.wi-main video {
  display: block;
}

img {
  border-radius: $border-radius-md;
}

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

blockquote {
  margin-block: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  border-left: 3px solid var(--accent);
  color: var(--ink-2);
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  background: var(--bg-raised);
  border-radius: 0 $border-radius-sm $border-radius-sm 0;
}

pre {
  padding: var(--space-lg);
  border-radius: $border-radius-md;
  overflow-x: auto;
  background: var(--ink);
  color: #f8f8f2;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  tab-size: 2;

  @include mixins.hide-scrollbar;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.15em 0.4em;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: $border-radius-sm;
}

pre > code {
  all: unset;
  font-size: 0.9em;
  color: inherit;
}

hr {
  margin-block: var(--space-2xl);
  border: none;
  border-top: 1px solid var(--rule);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  overflow-x: auto;
  display: block;

  th,
  td {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--rule);
    text-align: left;
  }

  th {
    background: var(--bg-raised);
    font-weight: 600;
    color: var(--ink);
  }

  td {
    color: var(--ink-2);
  }
}

.wi-container {
  @include mixins.responsive-container;
}

.wi-section {
  @include mixins.section-spacing;
}

.wi-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;
}

.wi-main {
  padding-top: 100px;
  padding-bottom: 0;
  position: relative;
  z-index: 1;
  background-color: var(--bg);
  width: 100%;
}

.wi-main--wide.wi-main--home {
  padding-top: 0;
  padding-bottom: 0;
  padding-inline: 0;
  background-color: transparent;
  max-width: 100%;
  margin: 0;
  overflow-x: hidden;
}

.wi-content-wrap {
  max-width: 800px;
  margin: 0 auto;
  padding-inline: clamp(1rem, 3vw, 2rem);
}

.wi-content-wrap--wide {
  max-width: 1200px;
}

.wi-main--wide {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}
