/**
 * @file
 * Base element styling for NBVT Base theme
 * Provides consistent styling for HTML elements
 */

/* Reset and base styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font-family-sans-serif);
  font-size: var(--font-size-base);
  font-weight: 400;
  line-height: var(--line-height-base);
  color: var(--text-color);
  background-color: var(--background-color);
  text-align: left;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: var(--spacing-unit);
  font-family: var(--font-family-sans-serif);
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary-color);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

/* Paragraphs and text */
p {
  margin-top: 0;
  margin-bottom: var(--spacing-unit);
}

/* Links */
a {
  color: var(--link-color);
  text-decoration: none;
  background-color: transparent;
  transition: color 0.2s ease-in-out;
}

a:hover {
  color: var(--link-hover-color);
  text-decoration: underline;
}

a:not([href]):not([class]),
a:not([href]):not([class]):hover {
  color: inherit;
  text-decoration: none;
}

/* Lists */
ol,
ul {
  padding-left: 2rem;
  margin-top: 0;
  margin-bottom: var(--gin-spacing-m, 1rem);
}

ol ol,
ul ul,
ol ul,
ul ol {
  margin-bottom: 0;
}

dt {
  font-weight: var(--font-weight-semibold);
}

dd {
  margin-bottom: var(--gin-spacing-s, 0.5rem);
  margin-left: 0;
}

/* Blockquotes */
blockquote {
  margin: 0 0 var(--gin-spacing-m, 1rem);
  padding: var(--gin-spacing-m, 1rem) var(--gin-spacing-l, 1.5rem);
  border-left: 4px solid var(--color-primary);
  background-color: var(--color-bg-alt);
  font-style: italic;
}

blockquote footer {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  font-style: normal;
}

blockquote footer::before {
  content: "— ";
}

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

small {
  font-size: var(--font-size-sm);
}

mark {
  padding: 0.2em;
  background-color: #fcf8e3;
  color: #000;
}

/* Subscript and superscript */
sub,
sup {
  position: relative;
  font-size: var(--font-size-xs);
  line-height: 0;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

/* Code */
pre,
code,
kbd,
samp {
  font-family: var(--font-family-mono);
  font-size: 1em;
}

pre {
  display: block;
  margin-top: 0;
  margin-bottom: var(--gin-spacing-m, 1rem);
  overflow: auto;
  font-size: var(--font-size-sm);
  background-color: var(--color-bg-muted);
  padding: var(--gin-spacing-m, 1rem);
  border-radius: var(--gin-border-m, 6px);
}

pre code {
  font-size: inherit;
  color: inherit;
  word-break: normal;
}

code {
  font-size: var(--font-size-sm);
  color: var(--color-text);
  background-color: var(--color-bg-muted);
  padding: 0.125rem 0.25rem;
  border-radius: var(--gin-border-s, 3px);
  word-wrap: break-word;
}

a > code {
  color: inherit;
}

kbd {
  padding: 0.2rem 0.4rem;
  font-size: var(--font-size-sm);
  color: var(--color-white);
  background-color: var(--color-gray-900);
  border-radius: var(--gin-border-s, 3px);
}

kbd kbd {
  padding: 0;
  font-size: 1em;
  font-weight: var(--font-weight-bold);
}

/* Figures */
figure {
  margin: 0 0 var(--gin-spacing-m, 1rem);
}

/* Images */
img,
svg {
  vertical-align: middle;
  max-width: 100%;
  height: auto;
}

/* Tables */
table {
  caption-side: bottom;
  border-collapse: collapse;
  width: 100%;
  margin-bottom: var(--gin-spacing-m, 1rem);
}

caption {
  padding-top: var(--gin-spacing-s, 0.5rem);
  padding-bottom: var(--gin-spacing-s, 0.5rem);
  color: var(--color-text-light);
  text-align: left;
}

th {
  text-align: inherit;
  text-align: -webkit-match-parent;
}

thead,
tbody,
tfoot,
tr,
td,
th {
  border-color: inherit;
  border-style: solid;
  border-width: 0;
}

th,
td {
  padding: var(--gin-spacing-s, 0.5rem) var(--gin-spacing-m, 1rem);
  border-bottom: 1px solid var(--color-table-border);
}

th {
  background-color: var(--color-table-header-bg);
  color: var(--color-table-header-text);
  font-weight: var(--font-weight-semibold);
}

tbody tr:nth-child(odd) {
  background-color: var(--color-table-stripe);
}

tbody tr:hover {
  background-color: var(--color-table-hover);
}

/* Forms */
label {
  display: inline-block;
  margin-bottom: var(--gin-spacing-xs, 0.25rem);
  font-weight: var(--font-weight-medium);
}

button {
  border-radius: 0;
}

button:focus:not(:focus-visible) {
  outline: 0;
}

input,
button,
select,
optgroup,
textarea {
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button,
input {
  overflow: visible;
}

button,
select {
  text-transform: none;
}

[role="button"] {
  cursor: pointer;
}

select {
  word-wrap: normal;
}

select:disabled {
  opacity: 1;
}

[list]::-webkit-calendar-picker-indicator {
  display: none;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
}

button:not(:disabled),
[type="button"]:not(:disabled),
[type="reset"]:not(:disabled),
[type="submit"]:not(:disabled) {
  cursor: pointer;
}

::-moz-focus-inner {
  padding: 0;
  border-style: none;
}

textarea {
  resize: vertical;
}

fieldset {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: var(--gin-spacing-s, 0.5rem);
  font-size: calc(1.275rem + 0.3vw);
  font-weight: var(--font-weight-semibold);
  line-height: inherit;
}

@media (min-width: 1200px) {
  legend {
    font-size: 1.5rem;
  }
}

legend + * {
  clear: left;
}

::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
  padding: 0;
}

::-webkit-inner-spin-button {
  height: auto;
}

[type="search"] {
  outline-offset: -2px;
  -webkit-appearance: textfield;
}

::-webkit-search-decoration {
  -webkit-appearance: none;
}

::-webkit-color-swatch-wrapper {
  padding: 0;
}

::file-selector-button {
  font: inherit;
}

::-webkit-file-upload-button {
  font: inherit;
  -webkit-appearance: button;
}

/* Output */
output {
  display: inline-block;
}

/* Progress */
progress {
  vertical-align: baseline;
}

/* Hidden attribute */
[hidden] {
  display: none !important;
}

/* Horizontal rule */
hr {
  margin: var(--gin-spacing-m, 1rem) 0;
  color: inherit;
  background-color: currentColor;
  border: 0;
  opacity: 0.25;
}

hr:not([size]) {
  height: 1px;
}

/* Address */
address {
  margin-bottom: var(--gin-spacing-m, 1rem);
  font-style: normal;
  line-height: inherit;
}

/* Abbreviation */
abbr[title],
abbr[data-original-title] {
  text-decoration: underline;
  text-decoration: underline dotted;
  cursor: help;
  text-decoration-skip-ink: none;
}

/* Details */
details {
  margin-bottom: var(--gin-spacing-m, 1rem);
}

summary {
  display: list-item;
  cursor: pointer;
  font-weight: var(--font-weight-medium);
}

/* Focus styles */
:focus {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  *,
  *::before,
  *::after {
    text-shadow: none !important;
    box-shadow: none !important;
  }

  a:not(.btn) {
    text-decoration: underline;
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #adb5bd;
    page-break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}
