/*  ==========================================================
    BASELINE STYLING
    ========================================================== */

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

html,
body {
  overflow-x: hidden; /* Fallback */
  overflow-x: clip;
}

#noscript-warning {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  background: #b00020;
  color: #ffffff;
  text-align: center;
  font-weight: 600;
  font-size: 2rem;
  z-index: 9999;
}

body {
  max-inline-size: 100dvi;
  min-block-size: 100dvb;
  text-rendering: optimizeSpeed;
  color: oklch(var(--color-dark));
  font-family: var(--main-font);
  font-optical-sizing: auto;
  font-size: var(--step-0);
  font-weight: var(--fw-regular);
  line-height: var(--base-line-height);
  letter-spacing: var(--tracking);
  text-wrap: pretty;
  word-break: auto-phrase;
}

h1,
.h1,
h2,
.h2,
h3,
.h3 {
  max-inline-size: var(--heading-length);
  line-height: var(--heading-line-height);
  letter-spacing: var(--tracking-s);
  font-family: var(--accent-font);
  text-wrap: balance;
}

h4,
.h4,
h5,
.h5,
h6,
.h6 {
  max-inline-size: var(--text-length);
  line-height: var(--base-line-height);
  letter-spacing: var(--tracking-s);
}

h1,
.h1 {
  max-inline-size: 24ch;
  font-size: var(--step-ultra);
}

h2,
.h2 {
  font-size: var(--step-4);
}

h3,
.h3 {
  font-size: var(--step-3);
}

h4,
.h4 {
  font-size: var(--step-2);
}

h5,
.h5 {
  font-size: var(--step-1);
}

h6,
.h6 {
  font-size: var(--step-0);
}

a {
  text-decoration: none;
  color: oklch(var(--color-dark));
}

a:not([class]) {
  text-decoration: underline;
}

p,
li,
a {
  max-inline-size: var(--text-length);
}

ul,
ol {
  list-style: none;
}

/** Text importance */
strong,
b {
  font-family: var(--accent-font);
}

mark {
  padding-inline: 0.25em;
  background-color: oklch(var(--color-primary));
  color: oklch(var(--color-light));
}

sup,
sub {
  font-size: var(--step--3) !important;
}

address {
  font-style: normal;
}

figure {
  overflow: hidden;
}

figcaption {
  font-style: italic;
}

/** Accessibility */
:focus-visible {
  outline: 2px solid oklch(var(--color-primary));
  outline-offset: 0.5ch;
  border-radius: var(--border-radius);
}

:target {
  margin-block-start: var(--space-xl, 5rem);
}

/* Screen readers can read it */
.visually-hidden,
.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;
}

input {
  accent-color: oklch(var(--color-primary));
}

input,
textarea {
  inline-size: 100%;
  padding: var(--space-s) var(--space-2xs);
  border: 1px solid oklch(var(--color-dark));
  border-radius: var(--border-radius);
  color: oklch(var(--color-dark));
  caret-color: oklch(var(--color-primary));
}

input[type="checkbox"] {
  margin-inline-end: var(--space-xs);
  inline-size: var(--space-s);
  block-size: var(--space-s);
  cursor: pointer;
}

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

/* Remove white padding under Google Maps */
iframe {
  display: block !important;
}

/* Detail animation - requires interpolate-size: allow-keywords in :root */
details {
  & summary {
    cursor: pointer;
  }

  &::details-content {
    height: 0;
    overflow: hidden;
    @supports (interpolate-size: allow-keywords) {
      transition: all var(--anim-fast) /* fallback */;
      transition-behavior: allow-discrete;
    }
  }

  &:open {
    &::details-content {
      height: auto;
    }
  }
}
