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

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

#noscript-warning {
  position: absolute;
  inset: 0;
  bottom: unset;
  min-block-size: 100dvb;
  z-index: 9999;
}


body {
  max-inline-size: 100vi;
  min-block-size: 100svh;
  /*background-color: oklch(var(--color-dark)); set into the html, so the gradient stays put */
  color: oklch(var(--color-light));
  font-family: var(--main-font, system-ui);
  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-rendering: optimizeSpeed;
  text-wrap: 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, system-ui);
  text-rendering: optimizeLegibility;
  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 {
  font-size: var(--step-ultra) !important;
}

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

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

h4,
.h4 {
  font-size: var(--step-2) !important;
  font-weight: var(--fw-black) !important;
}

h5,
.h5 {
  font-size: var(--step-1) !important;
  font-weight: var(--fw-bold) !important;
}

h6,
.h6 {
  font-size: var(--step-0) !important;
  font-weight: var(--fw-medium) !important;
}

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

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

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

ul {
  list-style: none;
}

ol {
  padding-left: 2em !important;
  padding-inline-start: 2em !important;
}

dt {
  font-weight: var(--fw-bold);
  color: oklch(var(--color-primary));
}

dt::after {
  content: ": ";
}

details {
  cursor: pointer;
  
  & summary {
      font-weight: var(--fw-bold);
  }
  
  & summary + * {
    margin-block-start: 0.5em;
  }
}

details > summary {
  position: relative;
  display: block;
  width: 100%;
  padding-left: 1.25em;
  text-decoration: underline;
  list-style: none; /* remove the ::marker */
}

details > summary::after {
  content: "\f107";
  position: absolute;
  top: 50%;
  left: 0;
  translate: 0 -50%;
  font-family: FontAwesome;
  transition: rotate 0.3s;
}

details[open] > summary::after {
  rotate: 180deg;
}

/* Full width, with custom icon on the right */
details.styled > summary {
  position: relative;
  display: block;
  width: 100%;
  list-style: none; /* remove the ::marker */
}

details.styled > summary::after {
  content: "\f107";
  position: absolute;
  top: 50%;
  right: 1em;
  translate: 0 -50%;
  font-family: FontAwesome;
  transition: rotate 0.3s;
}

details.styled[open] > summary::after {
  rotate: 180deg;
}

/** Text importance */
strong,
b {
  font-weight: var(--fw-bold);
}

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

address {
  font-style: normal;
}

figure {
  overflow: hidden;
}

figcaption {
  font-style: italic;
}

:is(input, select, textarea):not([type="checkbox"]) {
  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));
  accent-color: oklch(var(--color-primary));
  caret-color: oklch(var(--color-primary));
  appearance: none;

  @supports (caret-shape: underscore) {
    caret-shape: underscore;
  }
}

option {
  background: oklch(var(--color-dark));
  color: oklch(var(--color-light));
}

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

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

::selection {
  background-color: oklch(var(--color-primary));
  color: oklch(var(--color-dark));
}

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

/* Only screen readers can read it */
.visually-hidden,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border-width: 0;
}

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

/* Detail animation - requires interpolate-size: allow-keywords in :root */
details {
  &::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;
    }
  }
}
