/* global styles */

/* Silkscreen – WOFF only (EOT/SVG deprecated; TTF redundant for modern browsers) */
@font-face {
  font-family: "SilkscreenNormal";
  src: url("/fonts/silkscreen/slkscr-webfont.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "SilkscreenBold";
  src: url("/fonts/silkscreen/slkscrb-webfont.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}

:root {
  /* Chrome-only for now but this will allow smooth size transitions */
  interpolate-size: allow-keywords;

  /* light mode (default) */
  --bg-primary: #f5e6d3;
  --bg-secondary: #faf0e6;
  --text-primary: #3e0101;
  --accent-color: #c9a227;
  --accent-color-muted: #d4af37;
  --border-subtle: #8b1a1a;
  --backdrop-color: rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #3e0101;
    --bg-secondary: #5a0202;
    --text-primary: #f5e6d3;
    --accent-color: #c9a227;
    --accent-color-muted: #d4af37;
    --border-subtle: #8b1a1a;
    --backdrop-color: rgba(0, 0, 0, 0.7);
  }
}

html {
  box-sizing: border-box;
}

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

body {
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
  background-color: var(--bg-primary);
  color: var(--text-primary);

  font-family: Futura, "Trebuchet MS", Arial, sans-serif;
  font-style: normal;
  font-variant: normal;
}

footer,
header {
  flex: 0;
  min-height: 50px;
  height: 50px;
  display: flex;
  align-items: center;

  img {
    max-height: 40px;
    margin: 0 8px;
  }

  h1 {
    flex: 1;
    margin-right: 56px;
    text-align: center;
  }
}

header#main-head {
  justify-content: space-between;
  padding: 0 8px;
  background-color: var(--bg-primary);
  border-bottom: 2px groove var(--accent-color);
}

.header-identity {
  text-decoration: none;
  color: inherit;

  h1 {
    font-family: "SilkscreenNormal", Arial, Gadget, sans-serif;
    font-size: 24px;
  }
}

header h1 {
  font-family: "SilkscreenNormal", Arial, Gadget, sans-serif;
  margin-left: 0.5rem;
}

h1,
h2,
h3,
h4 {
  font-family: "SilkscreenNormal", Arial, Gadget, sans-serif;
  font-variant: common-ligatures small-caps;
  margin: 0;
}

#main-head > * {
  display: flex;
  flex-direction: row;
  align-items: center;
}

#logo {
  height: 40px;
  margin: 0 10px 0 5px;
}

#main-foot {
  background-color: var(--bg-primary);
  border-top: 1px solid var(--accent-color);
  justify-content: center;
}

main {
  display: flex;
  flex: 1 1 auto;
  min-height: 80vh;
  max-width: 100vw;
  overflow: hidden;

  padding: 8px;
  overflow-y: auto;
  background-color: var(--bg-secondary);
}

.btn,
button,
input[type="file"]::file-selector-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.25em 1em;
  cursor: pointer;
  font-variant: common-ligatures small-caps;
  text-decoration: none;
  background-color: #fff;
  border: 2px solid var(--accent-color);
  border-radius: 0;
  cursor: pointer;

  img {
    height: 2em;
    width: 2em;
    margin: 0 0.25rem;
  }

  &:disabled {
    cursor: not-allowed;

    img {
      opacity: 0.5;
    }
  }

  &:not(:disabled):hover,
  &:not(:disabled):focus-visible {
    outline: var(--accent-color) auto 1px;
    background-color: color-mix(in srgb, var(--accent-color) 25%, transparent);
  }
}

input[type="file"] {
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  cursor: pointer;

  &::file-selector-button {
    display: inline-flex;
  }

  &:not(:disabled):hover,
  &:not(:disabled):focus-visible {
    outline: var(--accent-color) auto 1px;

    &::file-selector-button {
      background-color: color-mix(
        in srgb,
        var(--accent-color) 25%,
        transparent
      );
    }
  }
}

a.btn {
  &:not(:disabled):hover,
  &:not(:disabled):focus-visible {
    text-decoration: underline;
  }
}

a:focus-visible {
  outline: var(--accent-color) auto 1px;
}

/* util classes */

.u-hidden {
  display: none !important;
}

.u-flex {
  display: flex;
}

.u-flex-column {
  flex-direction: column;
}

.u-flex-1 {
  flex: 1;
}

.u-left {
  text-align: left;
}

.u-center {
  text-align: center;
}

.u-fill-width {
  width: -webkit-fill-available;
  width: 100%;
}

.u-fill-height {
  height: -webkit-fill-available;
  height: 100vh;
}

.u-stretch-height {
  height: -webkit-fill-available;
  height: 100%;
  flex: 1;
}

/* background scroll fix for dialogs */
dialog {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: var(--backdrop-color);
}

/* responsive design tweaks (breakpoints adopted from Bootstrap) */

/* Small devices (e.g. phones, 575px and under) */
@media (max-width: 575px) {
  header > img {
    display: none;
  }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
  header > img {
    display: none;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  header > img {
    display: block;
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
  header > img {
    display: block;
  }
}

/* web component placeholders */
update-notification {
  display: none;
}

/* view transitions */

@view-transition {
  navigation: auto;
  types: slide, forwards;
}
