@import '../override-function';

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
html,
body {
  padding: 0;
  margin: 0;
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
html {
  font-size: $em-base; // ** TODO: update base font for USWDS v3
  font-weight: 500;
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
body {
  background: $color-white;
  color: $color-base;
  // font-family: $font-sans;
  // font-size: $base-font-size;
  font-size: 16px;
  font-family: inherit;

  &.modal-open {
    overflow: hidden;
  }
}

// Skip link
.show-on-focus {
  position: absolute;
  top: -10em;
  background: $color-white;
  padding: 1em;
  margin: 1em;
  color: $color-primary-darkest;
  display: block;
  font-weight: 600;
  font-size: 1.06rem;

  &:focus {
    position: inherit;
    top: auto;
    outline: 2px solid $color-gold;
  }
}

// row
body .row.full {
  width: 100%;
  max-width: 100%;
}

// Screen Readers
// updated to match definition in
// packages/formation/sass/utilities/_visibility.scss
.sr-only {
  border: 0;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  // Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1241631
  word-wrap: normal !important;
}

// Remove from print view, incidentally removes from screen readers as well
.no-print-no-sr {
  display: none !important;
}

// Abbr
/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
#content abbr {
  border-bottom: 0px;
  text-decoration: none;
  font-weight: inherit;
  font-style: inherit;
  color: inherit;
  cursor: pointer;
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
a {
  color: $color-link-default;
  text-decoration: underline;
  @include color-transition;

  &:hover {
    background-color: $color-link-default-hover;
    color: inherit;
    text-decoration: underline;
  }
  &:active {
    color: $color-link-active;
  }
  &:visited,
  &:visited abbr {
    color: $color-link-visited;
  }
}

// ====== Headings

// H1 should only be used once at the top-level, so we can safely remove the margin-top.
/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
h1 {
  margin-top: 0;
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
h6 {
  margin: 0.5em 0 0;
  text-transform: none;
  font-weight: 700;
}

//======= Lists
/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
ul {
  padding: 0 0 0 1.5em;
  list-style: square;
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
ol {
  margin: 0 0 0 1.25em;
  list-style-position: outside;
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
ul,
ol {
  > ul,
  ol {
    margin: 0.5em 0 0.5em 1.2em;
  }
}

// Definition lists
/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
dd {
  margin-left: 0;
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
dd + dt {
  margin-top: 1.5em;
}

// Figure / Caption
/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
figure {
  font-size: 0.85em;
  margin-left: -$column-gutter/2;
  margin-right: -$column-gutter/2;

  @include media($large-screen) {
    margin-left: -16.66667%;
    margin-right: -16.66667%;
  }
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
figcaption {
  color: $color-primary-darker;
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
input::-webkit-input-placeholder {
  color: $color-gray;
}
/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
input::-moz-placeholder {
  color: $color-gray;
}
/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
input:-ms-input-placeholder {
  color: $color-gray;
}

// Visually clear placeholder text on focus
/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
input:focus::-webkit-input-placeholder {
  color: transparent;
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
input:focus::-moz-placeholder {
  color: transparent;
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
input:focus:-ms-input-placeholder {
  color: transparent;
}

input.va-input-medium-large {
  max-width: scale-rem(18rem);
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
hr {
  margin: 2.5em 0;
  margin: scale-rule(3rem 0 2.5rem);
  border: 1px solid $color-gray-light;
}

// Default table width to being 100%
table {
  width: 100%;
}

.va-pos-fixed {
  position: fixed;
}

// Logo and Header
.header {
  background: $color-primary-darkest;
  clear: both;
  margin: 0;
  padding: 0;

  // Without this value the navbar will look the same in the end but this keeps the navbar's height from expanding/blinking
  // right as the navbar elements are rendered on screen during page load.
  // This is the height on mobile fyi.
  min-height: 189.19px;

  // This sets the height of the header on large mobile devices between 480 and 768.
  @include media($small-screen) {
    min-height: 167.19px;
  }

  @include media($medium-screen) {
    position: relative;
    // Same reason as the comment above, only the value has been adjusted to be the height of the navbar for tablet/desktop.
    min-height: 159px;
  }

  .login-container {
    background: $color-primary-darkest;
    flex-wrap: wrap;
    white-space: nowrap;

    .row {
      padding: 0;
    }

    @include media($medium-large-screen) {
      flex: 1 0 100%;
    }
  }
}

#va-header-logo-menu {
  flex-wrap: wrap;
  padding: 1em 0.75em 0;

  @include media($medium-large-screen) {
    padding-bottom: 0;
  }
}

.va-header-logo-wrapper {
  flex: 1 0 164px;

  @include media($medium-large-screen) {
    flex-basis: scale-rem(6rem);
  }
}

// Also see l-playbook for more styles
.va-header-logo {
  background-color: transparent;
  border-bottom: none;
  display: block;
  height: 40px;
  //padding-left: scale-rem(.5rem);
  margin: 0;
  width: 164px;

  &:hover {
    .vets-logo-va path {
      fill: $color-gold;
    }
  }
}

.vets-logo {
  display: block;
  height: inherit;
  width: inherit;

  &-vetsdotgov,
  &-va {
    path,
    rect {
      fill: $color-white;
    }
  }
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2042
*/
article > h1 {
  margin-top: 0;
}

// Banner
#content {
  margin: 0;
  padding: 0;
  color: $color-base;
  overflow: hidden;
}

// TODO: .usa-font-lead is now .usa-intro in USWDS v3.
// This is a copy of USWDS's .usa-font-lead style
// https://github.com/18F/web-design-standards/blob/develop/src/stylesheets/elements/_typography.scss#L164
.va-introtext {
  font-family: $font-serif;
  font-size: $lead-font-size;
  font-weight: $font-normal;
  line-height: $lead-line-height;
  max-width: $lead-max-width;

  p, a {
    font-family: $font-serif;
    font-size: $lead-font-size;
    font-weight: $font-weight-normal;
    line-height: $lead-line-height;
  }
}

// TODO: Integrate USWDS and elements/_typography.scss
// and eliminate this declaration
.usa-content {
  max-width: $text-max-width;
}

//====================
// Content callout boxes
// ===================

.feature {
  background: $color-primary-alt-lightest;
  padding: 1em;
  clear: both;
  margin: 1.5em 0 1.5em 0;

  h2 {
    margin-top: 0;
  }

  h3 {
    margin-top: 0;
  }
  h4 {
    margin-top: 0;
  }
  ul {
    margin: 0 0 0.5em 1.5em;
    padding: 0;
    li {
      list-style: square;
      margin: 0;
    }
  }
}

// Quick Links
.va-quicklinks {
  ul {
    margin-top: scale-rem(0.8rem);
  }
  li {
    padding: scale-rule(0.56rem 0);
  }
  h3 {
    line-height: 1.2em;
    // TODO: Drop the !important when .home #content h3 and
    // body.fourohfour #content h3 are straightened out.
    font-size: 1.65em;
    color: $color-primary-darkest;
    margin: scale-rem(0 0 1rem 0);
    padding: 0 0 0.2em 0;
  }
}

// Used in content-build: src/site/includes/breadcrumbs-playbook.html
//===== Playbook and Facility Locator
.va-nav-breadcrumbs--playbook {
  background: none;
  margin: 0 0 1em 0;
  padding: 0;

  h2 {
    font-size: 1em;
  }

  li {
    text-transform: none;
    margin: 0.25em 0;
    padding: 0.1em;
    display: inline-block;
    line-height: 1.15em;
    vertical-align: middle;
    font-size: 1.35em;

    &:hover {
      border-bottom: none;
      text-decoration: none;
    }
  }

  a {
    border-bottom: 3px solid $color-white;
    text-decoration: none !important;
    color: $color-white;
    &:hover {
      text-decoration: none;
      background: $color-link-default-hover;
      border-bottom: 3px solid $color-gold;
    }
  }
}

.va-nav-breadcrumbs--playbook {
  .parent {
    padding-top: 0.5em;
    margin: 0 0 0.75em 0;
  
    &:after {
      content: " › ";
      display: inline-block;
      color: $color-white;
      padding: 0 0.5em;
    }
  }
  
  .active {
    background: $color-gold;
    color: $color-black;
    font: 400 1.35em / 1.15em $font-serif;
    margin: 0.5em 0;
    padding: 0.2em;
  
    @include media($medium-large-screen) {
      font-size: 1.8em;
    }
  
    &:before {
      content: "";
      padding: 0;
      margin: 0;
    }
  }
}

//===== General List Styles

li {
  span.meta {
    display: inline-block;
    padding: 0.5em;
    color: $color-primary-darkest;
    background: $color-link-default-hover;
    font-weight: bold;
    float: right;
    margin: 0.5em 0 1em 1em;
  }
}

//===== Navigation
.navigation {
  padding: 1em 0 3em 0;
  background: $color-gray-lightest;
  color: $color-primary-darkest;
  border-bottom: 2px solid $color-white;
  margin: 0 auto;
}

// Cards
[class*="block-grid-"] > li {
  padding: scale-rule(0 0.625rem 1.25rem 0.625rem);
}

// Telephone numbers
.tel {
  background: $color-link-default-hover;
  padding: 0.2em;
  display: inline-block;
}

// Notice / feedback banners
.va-notice--banner {
  background: $color-white;
  margin: 0 0 0.75em 0;
  padding: 0;
  font-weight: 400;

  @include media($medium-large-screen) {
    background: $color-gray-lightest;
    .usa-banner-inner {
      font-size: 12px;
      padding-left: scale-rem(1.5rem);
      p {
        font-size: 12px;
      }
    }

    .usa-banner-content {
      padding-left: 0;
      padding-right: 0;
    }
  }

  @include media($small-desktop-screen) {
    .usa-banner-inner {
      padding-left: 0;
      p {
        font-size: 12px;
      }
    }
  }

  &-inner {
    margin: auto;
    max-width: 1000px;
    position: relative;
  }
}

/* 
ADDED TO CSS-LIBRARY
file: stylesheets/elements.scss
issue: vets-design-system-documentation#2043
*/
.va-notice--banner {
  p {
    margin: 0;
  }

  a {
    background-image: none;
    color: inherit;
    padding: 0;
  }
}

// Search

.search-button {
  margin: 1em 0.5em 0 0;
  padding: 0;

  @include media($xsmall-screen) {
    float: right;
    margin-top: 0.1em;
  }
}

//===================================
// Blog-related CSS
//===================================

// DEPRECATED: Replaced with va-card web component
.card {
  position: relative;
  margin: 0 0 1.5em 0;
  padding: 1em;
  border: 1px solid $color-gray-lightest;
  dt {
    font-weight: 700;
  }
  dd {
    padding: 0;
    margin: 0;
  }
  &.templates {
    height: 338px;
  }
  &:after {
    visibility: hidden;
    display: block;
    font-size: 0;
    content: " ";
    clear: both;
    height: 0;
  }

  h4,
  h5 {
    margin-top: 0;
  }

  span {
    display: block;
  }

  .number {
    font-family: $font-serif;
    font-size: 2em;
    font-weight: 700;
    float: left;
    margin: 0;
    color: color-primary-darker;
    line-height: 1em;
    padding: 0 0 0.5em;
    border-bottom: 1px solid $color-gray-light;
  }

  .heading,
  .description {
    display: block;
  }

  .heading {
    color: $color-primary-alt-darkest;
    font-size: 0.8em;
    padding: 0;
  }

  .description {
    font-size: 1em;
    font-weight: 400;
    padding: 0.3em 0 0;
    text-align: left;
    width: 100%;
    float: left;
  }

  &.information {
    background: $color-link-default-hover;
    padding: 1em;
  }

  &.info-graphic {
    border: 1px solid $color-white;
    background: none;
    padding: 1em 1em 0;
    line-height: 2.5;
    span.number {
      color: $color-white;
      display: inline-block;
    }
  }
}

// Actions

.actions {
  margin: 1em 0;
}

// Dividers

.divider {
  &.margin {
    padding-top: 1em;
    padding-bottom: 1em;
    margin-top: 1em;
    margin-bottom: 1em;
  }
  &.top {
    border-top: 1px solid $color-gray-lightest;
  }
  &.bottom {
    border-bottom: 1px solid $color-gray-lightest;
  }
}

// Highlight headings
// TODO(css): Consolidate these rules, possibly into a new class name
.highlight,
.va-h-ruled {
  border-bottom: 3px solid $color-primary;
  padding-bottom: 0.25em;
  font-weight: 700;
}

// Ruled headings with VA Accent color. (Currently gold metal)
.va-h-ruled--a {
  color: $color-primary-darker;
  padding-bottom: 0.5em;
  border-bottom: $color-va-accent solid 2px;
}

// If this divider gets reused and with text in the middle
// you should create a variation of this rule that accounts
// for the size of the text.
.va-h-ruled--stars {
  display: flex;
  justify-content: center;
  align-items: center;

  // Flexbox magic means that setting a margin on ::before
  // applies the same margin to ::after
  &::before {
    margin-right: scale-rem(12rem);
  }

  &::before,
  &::after {
    border-top: 1px solid $color-gray-light;
    content: " ";
    flex: 1 1 50%;
    padding: scale-rule(1rem 0);
  }

  background: url('#{$formation-image-path}/stars.png') no-repeat center;
  background-size: scale-rule(11rem auto);
  margin: scale-rule(1.6rem auto auto);
  padding: scale-rule(2rem 0 0);
  text-align: center;

  @include media($medium-screen) {
    padding-left: 0;
  }
}

// DEPRECATED: Replaced with va-button web component
.va-button-primary {
  background: $color-green !important;

  &:hover,
  &:focus {
    background-color: $color-green-darker !important;
    text-decoration: none !important;
  }

  svg {
    display: inline-block;
    height: scale-rem(1.2rem);
    margin-left: scale-rem(0.5rem);
    width: scale-rem(1.2rem);
    vertical-align: -1px;
  }
}

// USDS component styles
// Accordion
.usa-accordion-content[aria-hidden="true"] {
  display: none !important;
}

.va-address-block {
  margin-left: scale-rem(5rem);
  border-left: 3px solid $color-primary;
  padding-left: scale-rem(1rem);
}

//====== Flexbox related utility classes
.va-flex {
  display: -webkit-flex;
  display: flex;
}

.react-container {
  padding: 2em 0;
}

.react-container {
  padding: 2em 0;
}

//==================
// New .plain rewrite
//===================

.va-list--plain {
  list-style: none;
  padding-left: 0;
}

// Last updated

.last-updated {
  margin-top: 1.5em;
  border-top: 2px solid $color-gray-light;
  padding: 1em 0;
  p {
    color: $color-gray-dark !important;
  }
}

// ----------------------
// Fixes an overly-broad ul selector
// ----------------------

.usa-sidenav-sub_list {
  padding-left: 0;
  list-style: none;
}

.vertical-list-group {
  list-style-type: none;
}

.vertical-list-group.more-bottom-cushion {
  margin-bottom: 2.5em;
}

.vertical-list-group .list-group-item {
  border: none;
  border-left: 4px solid $color-gray-lighter;
  box-sizing: border-box;
  border-radius: 0;
  padding-left: 20px;
  padding-right: 0px;
  padding-bottom: 20px;
  padding-top: 0px;
  margin-bottom: -30px;

  &:last-child {
    border: none;
    margin-bottom: 24px;
  }
  h4 {
    clear: none;
  }
}

.vertical-list-group .list-group-item:last-child {
  border-left: 4px solid transparent;
  padding-bottom: 0;
}
.vertical-list-group .list-group-item::before {
  border-radius: 50%;
  border: 3px $color-white solid;
  background-color: $color-gray-medium;
  content: "";
  display: inline;
  float: left;
  height: 18px;
  line-height: 12px;
  margin-left: -31px;
  text-align: center;
  width: 18px;
  position: absolute;
}

.fieldset-input {
  margin-top: scale-rem(3rem);
}

.i18-select {
  font-size: 1.06rem;
  line-height: 1.5;
}