:root {
  --warning: #faf4d4;
  --orange-35: #f9e6d8;
  --blue: #00a7db;
}

@layer base {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  [hidden] {
    display: none !important;
  }

  body {
    margin: 0;
    margin-top: 47px;
    background-color: #d5cbbd;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    margin: 0;
  }
  p {
    padding: 0;
  }

  button,
  input,
  select {
    font-size: 1rem;
    line-height: 1.5rem;
    font-family: inherit;
  }
  select {
    padding: 0.3rem;
    min-height: 1.693rem;
  }
  input:not([type='checkbox']) {
    padding: 0.3rem 0.5rem;
    padding: calc(var(--spacing)) calc(var(--spacing) * 2);
  }
  select,
  input:not([type='checkbox']) {
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
    border: 1px solid #d3d6d9;
    border-radius: var(--spacing);
    background-color: #f1f2f3;
    width: 100%;
    &:focus {
      outline: 0;
      box-shadow: inset 1px 1px 2px #faccaa;
      border-color: #f9c6a0 #fad2b3 #fad2b3 #f9c6a0;
      background: #fce6d5;
      color: #434343;
      text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
    }
  }

  fieldset.with-errors input,
  input:invalid:required,
  select:invalid:required {
    background: var(--warning);
    &:focus {
      background: var(--orange-35);
    }
  }

  fieldset:has(input:required, select:required) label::after {
    content: ' *';
  }

  fieldset {
    margin: 0;
    border: none;
    padding: 0;
    label {
      display: flex;
      gap: calc(var(--spacing) / 2);
      margin-bottom: calc(var(--spacing) / 2);
      font-weight: bold;
      font-size: 0.8rem;
    }
  }

  button {
    transition: background-color 0.3s ease;
    border: 0;
    border-radius: 0.5rem;
    padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 4);
    &:not(:disabled):hover {
      cursor: pointer;
    }
  }
  button.button-primary {
    background-color: var(--blue);
    color: white;
    &:hover {
      cursor: pointer;
      background-color: #0096c4;
      background-color: hsl(from var(--blue) h s calc(l - 5));
    }
    &:active {
      background-color: #008bb3;
      background-color: hsl(from var(--blue) h s calc(l - 10));
    }
    &:disabled {
      background-color: #2f96b4;
    }
  }
  button.button-secondary {
    background-color: #e0e0e0;
    color: #333;
    &:hover {
      background-color: #d5d5d5;
    }
    &:active {
      background-color: #c8c8c8;
    }
    &:disabled {
      background-color: #f0f0f0;
      color: #999;
    }
  }
  @supports (corner-shape: squircle) {
    button,
    select,
    input:not([type='checkbox']) {
      corner-shape: squircle;
    }
  }
}

@layer components {
  #topnav {
    display: flex;
    position: fixed;
    top: 0;
    justify-content: space-between;
    box-shadow: 0 1px 1px rgba(17, 17, 17, 0.3);
    background: #33393e;
    width: 100%;
  }

  #main {
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
    margin-inline: auto;
    padding: 1rem;
  }

  #flash {
    display: flex;
    position: fixed;
    top: 50px;
    right: 0.5rem;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9999;
    min-width: 200px;
    max-width: 330px;
  }
  .flash-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 2px solid #212428;
    background-color: #fff;
    padding: 1em 2em 1em 1em;
    font-size: 1.2em;
  }
  .flash-message__close {
    opacity: 0.7;
    cursor: pointer;
    margin-left: auto;
    border: none;
    background: none;
    padding: 0;
    color: inherit;
    font-size: 1.25em;
    line-height: 1;
    &:hover {
      opacity: 1;
    }
  }
  .flash-message[data-type='success'] {
    background-color: #dff0d8;
    color: #3c763d;
  }
  .flash-message[data-type='error'],
  .flash-message[data-type='alert'] {
    background-color: #f2dede;
    color: #a94442;
  }
  .flash-message[data-type='notice'] {
    background-color: #fcf8e3;
    color: #8a6d3b;
  }
}

@layer utilities {
  .alert {
    border-radius: calc(var(--spacing) * 4);
    padding: calc(var(--spacing) * 4);
  }
  .alert-info {
    border-color: #bce8f1;
    background-color: #d9edf7;
    color: #3a87ad;
  }
  .alert-success {
    border-color: #d6e9c6;
    background-color: #dff0d8;
    color: #3c763d;
  }
  .alert-warning {
    border-color: #faebcc;
    background-color: #fcf8e3;
    color: #8a6d3b;
  }
  .alert-error {
    border-color: #ebccd1;
    background-color: #f2dede;
    color: #a94442;
  }

  .text-error {
    color: #a94442;
  }
  @supports (corner-shape: squircle) {
    .alert {
      corner-shape: squircle;
    }
  }
}
