/* Shared base styling */

/* Include padding and border in element width and height by default */

html
{
  box-sizing: border-box;
}
*, *::before, *::after
{
  box-sizing: inherit;
}

/* Set base colors */

body
{
  color: var(--text);
  background: var(--inverse);
}

/* Override and/or reset user agent styling */

body,
html,
header,
h1, h2, h3,
p,
ul,
ol,
li,
img,
form,
fieldset,
legend,
input,
textarea,
button,
turbo-frame
{
  margin: 0;
  padding: 0;
  font-size: 100%;
  font-weight: inherit;
  border: none;
}
h1
{
  font-size: 150%;
}
h2
{
  font-size: 125%;
}
li
{
  list-style-type: none;
}
button,
input[type=email],
input[type=search],
input[type=text],
input[type=url],
textarea,
turbo-frame,
img,
svg
{
  display: block;
}
button,
input[type=email],
input[type=search],
input[type=text],
input[type=url],
textarea
{
  color: inherit;
  background: none;
  -webkit-appearance: none;
}
button
{
  border: none;
  -webkit-tap-highlight-color: transparent;
}
button,
label
{
  cursor: pointer
}
a
{
  color: var(--control-primary);
}
a:active
{
  color: var(--control-primary-active);
}

/* Turbo progress bar */

.turbo-progress-bar
{
  height: 2px;
  background: var(--link);
}

/* Make the page body fill the viewport height and keep the footer at the bottom */

body
{
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body > header,
body > footer
{
  flex: 0 0 auto;
}
body > main
{
  flex: 1 0 auto;
}

/* Page header with primary navigation */

body > header
{
  padding: 0 max(env(safe-area-inset-right), 1rem) 0 max(env(safe-area-inset-left), 1rem);
  background: var(--accent);
}
body > header,
body > header a
{
  color: var(--inverse);
}
body > header nav
{
  display: flex;
}
body > header nav a
{
  display: block;
  padding: max(env(safe-area-inset-top), 0.25rem) 1rem 0.25rem 1rem;
  text-decoration: none;
}
body > header nav a.current
{
  background: var(--main);
  color: var(--accent);
}
body > header nav a[href]:hover
{
  background: var(--accent-hover);
  color: var(--inverse);
}
body > header nav a[href]:active
{
  background: var(--accent-active);
  color: var(--inverse);
}

/* Page footer */

body > footer
{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem
           max(env(safe-area-inset-right), 1rem)
           max(env(safe-area-inset-bottom), 0.5rem)
           max(env(safe-area-inset-left), 1rem);
           border-top: 1px solid var(--border);
}

/* Main wraps the main content on the page */

main
{
  padding: 1rem
           max(env(safe-area-inset-right), 1rem)
           1rem
           max(env(safe-area-inset-left), 1rem);
  background: var(--main);
}

/* Allow Stimulus controllers to show and hide elements using a classname */

.hidden
{
  display: none;
}
