@import 'code-examples.css';
@import 'code-highlighter.css';
@import 'copy-code.css';
@import 'outline.css';
@import 'search.css';
@import 'cera_typeface.css';

:root {
  --wa-brand-orange: #f36944;
  --wa-brand-grey: #30323b;
}

html.wa-theme-default-dark .only-light,
html:not(.wa-theme-default-dark) .only-dark {
  display: none;
}

wa-page {
  --wa-flow-spacing: var(--wa-space-xl);
}

/* Header */
wa-page::part(header) {
  background-color: var(--wa-color-surface-default);
  border-bottom: var(--wa-border-style) var(--wa-panel-border-width) var(--wa-color-neutral-border-quiet);
}

wa-page::part(drawer__body) {
  padding-top: 0px;
}

wa-page::part(drawer__header-actions) {
  align-self: center;
}

wa-page > header {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--wa-space-xl);

  a[href='/'] {
    color: var(--wa-color-text-normal);
    line-height: 1;
  }

  wa-button[data-toggle-nav] {
    --label-color: currentColor;
    font-size: 1rem;
    margin-inline-start: -0.875rem;
    margin-inline-end: 0;

    &::part(base) {
      padding: 0;
      padding-inline: 0.875rem;
    }
  }

  svg {
    width: auto;
    height: 1.75rem;
  }

  #docs-branding,
  #docs-toolbar {
    display: flex;
    align-items: center;
    gap: var(--wa-space-xs);
  }

  #version-number {
    color: var(--wa-color-text-quiet);
    font-size: var(--wa-font-size-xs);
    line-height: 1;
    margin-block-start: var(--wa-space-2xs);
  }
  #version-number + wa-badge {
    --background-color: var(--wa-color-warning-fill-quiet);
    --content-color: var(--wa-color-warning-on-quiet);
    font-size: var(--wa-font-size-2xs);
    text-transform: uppercase;
  }
  wa-button#search-trigger {
    --background-color: var(--wa-form-control-background-color);
    --border-color: var(--wa-form-control-resting-color);
  }
  #search-trigger kbd {
    font-size: var(--wa-font-size-2xs);
    line-height: var(--wa-form-control-value-line-height);
  }
}

#sidebar,
#outline {
  h2 {
    font-size: var(--wa-font-size-m);
    margin: 0;
  }
  h2:not(:first-child) {
    margin-block-start: var(--wa-space-xs);
  }
  ul {
    border-inline-start: var(--wa-border-width-s) solid var(--wa-color-surface-border);
    font-size: var(--wa-font-size-s);
    line-height: var(--wa-line-height-condensed);
    margin: 0;
    padding-inline-start: var(--wa-space-m);
  }
  ul ul {
    margin-block-start: var(--wa-space-m);
  }
  li {
    list-style: none;
  }
  li + li {
    margin-block-start: var(--wa-space-m);
  }
  li a {
    color: var(--wa-color-text-normal);
    text-decoration: none;
  }
  li a:hover {
    text-decoration: underline;
  }

  li wa-badge::part(base) {
    font-size: var(--wa-font-size-2xs);
    font-weight: var(--wa-font-weight-bold);
  }

  li wa-icon {
    color: var(--wa-color-text-quiet);
    vertical-align: middle;

    &[name='flask'] {
      margin-inline: 0.125em;
    }
  }
}

#outline-standard h2 {
  margin-block-end: var(--wa-space-m);
}

/* Pro badges */
wa-badge.pro::part(base) {
  background-color: var(--wa-brand-orange);
  border-color: var(--wa-brand-orange);
}

#sidebar {
  h2 {
    color: var(--wa-color-text-quiet);

    a {
      display: flex;
      align-items: center;
      gap: 0.4em;
      color: var(--wa-color-text-normal);
      text-decoration: none;

      wa-icon {
        margin-block-end: -0.15em;
        font-size: var(--wa-font-size-s);
        font-weight: var(--wa-font-weight-action);
        color: var(--wa-color-gray-70);
      }

      &:hover {
        color: var(--wa-color-brand-on-normal);

        wa-icon {
          color: var(--wa-color-brand-on-quiet);
        }
      }
    }
  }
}

#sidebar-close-button {
  display: none;
}

@media screen and (max-width: 768px) {
  #sidebar-close-button {
    display: inline-block;
    position: absolute;
    top: 1rem;
    right: 1rem;
  }
}

#sidebar nav {
  padding-bottom: 1rem;
}

wa-page::part(menu) {
  scrollbar-width: thin;
}

/* Main content */
wa-page > main {
  max-width: 80ch;
  padding: var(--wa-space-xl);
  margin-inline: auto;
}

h1.title wa-badge {
  vertical-align: middle;

  &::part(base) {
    font-size: 1.5rem;
  }
}

.component-info {
  margin-block-end: var(--wa-flow-spacing);
}

/* Current link */
#sidebar,
#outline {
  .current {
    font-weight: var(--wa-font-weight-bold);
    text-decoration-style: solid;
  }
}

/* Anchor headings */
.anchor-heading a {
  visibility: hidden;
  text-decoration: none;
}

@media (hover: hover) {
  .anchor-heading:hover a {
    visibility: visible;
    padding: 0 0.125em;
  }
}

/* Callouts */
.callout {
  display: flex;
  gap: 1rem;
  border: var(--wa-border-style) var(--wa-border-width-s);
  border-radius: var(--wa-border-radius-m);
  padding: 1rem;
  margin-block-end: var(--wa-flow-spacing);

  :first-child {
    margin-block-start: 0;
  }

  :last-child {
    margin-block-end: 0;
  }
}

.callout-icon {
  flex: 0 0 auto;
  font-size: 1.5rem;
}

.callout-content {
  flex: 1 1 auto;
}

.callout-info {
  background-color: var(--wa-color-brand-fill-quiet);
  border-color: var(--wa-color-brand-border-quiet);

  .callout-icon {
    color: var(--wa-color-brand-on-normal);
  }

  code {
    background-color: var(--wa-color-brand-fill-normal);
  }
}

.callout-warning {
  background-color: var(--wa-color-warning-fill-quiet);
  border-color: var(--wa-color-warning-border-quiet);

  .callout-icon {
    color: var(--wa-color-warning-on-normal);
  }

  code {
    background-color: var(--wa-color-warning-fill-normal);
  }
}

/* Index Pages */
wa-page > main:has(> .index-grid) {
  max-width: 120ch;
  margin-inline: auto;
}

.index-summary {
  max-inline-size: 80ch;
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(20ch, 100%), 1fr));
  gap: var(--wa-space-2xl);
}

.index-category {
  grid-column: 1 / -1;
  margin-block-end: 0;
  margin-block-start: var(--wa-space-2xl);
}

.index-grid a {
  border-radius: var(--wa-border-radius-m);
}

.index-grid wa-card {
  --box-shadow: none;
  --spacing: var(--wa-space-m);
  inline-size: 100%;
}

.index-grid wa-card:hover {
  --border-color: var(--wa-color-brand-border-loud);
  --box-shadow: 0 0 0 var(--wa-border-width-s) var(--border-color);
  & .page-name {
    color: var(--wa-color-brand-on-quiet);
  }
}

.index-grid wa-card [slot='header'] {
  display: flex;
}

.index-grid wa-card::part(header) {
  background-color: var(--wa-color-neutral-fill-quiet);
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-block-size: calc(6rem + var(--spacing));
}

.index-grid .page-name {
  font-size: var(--wa-font-size-s);
  font-weight: var(--wa-font-weight-action);
}

/* Index Pages */
wa-page > main:has(> .index-grid) {
  max-width: 120ch;
  margin-inline: auto;
}

.index-summary {
  max-inline-size: 80ch;
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(20ch, 100%), 1fr));
  gap: var(--wa-space-2xl);
}

.index-category {
  grid-column: 1 / -1;
  margin-block-end: 0;
  margin-block-start: var(--wa-space-2xl);
}

.index-grid a {
  border-radius: var(--wa-border-radius-m);
}

.index-grid wa-card {
  --box-shadow: none;
  --spacing: var(--wa-space-m);
  inline-size: 100%;
}

.index-grid wa-card:hover {
  --border-color: var(--wa-color-brand-border-loud);
  --box-shadow: 0 0 0 var(--wa-border-width-s) var(--border-color);
  & .page-name {
    color: var(--wa-color-brand-on-quiet);
  }
}

.index-grid wa-card [slot='header'] {
  display: flex;
}

.index-grid wa-card::part(header) {
  background-color: var(--wa-color-neutral-fill-quiet);
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-block-size: calc(6rem + var(--spacing));
}

.index-grid .page-name {
  font-size: var(--wa-font-size-s);
  font-weight: var(--wa-font-weight-action);
}

/* Swatches */
.swatch {
  background-color: transparent;
  border-color: var(--wa-color-neutral-border-normal);
  border-style: var(--wa-border-style);
  border-width: var(--wa-border-width-s);
  border-radius: var(--wa-border-radius-s);
  box-sizing: border-box;
  line-height: 2.5;
  height: 2.5em;
  padding-inline: var(--wa-space-xs);
}

/* Layout Examples */
.layout-example-boundary {
  border: var(--wa-border-width-s) dashed var(--wa-color-neutral-border-normal);
  border-radius: var(--wa-border-radius-m);
  padding: var(--wa-space-s);
}

.layout-example-block {
  background-color: var(--wa-color-indigo-60);
  border-radius: var(--wa-border-radius-s);
  min-block-size: 4rem;
  min-inline-size: 4rem;
}

.layout-example-mixed-sizing .layout-example-block:nth-child(3n) {
  min-inline-size: 6rem;
}
.layout-example-mixed-sizing .layout-example-block:nth-child(3n + 2) {
  min-inline-size: 8rem;
}

/* Utilities */
.two-columns {
  columns: 2;
  gap: 1rem;
}

.component-table td > * + * {
  margin-block-start: var(--wa-space-s);
}

.table-scroll {
  overflow-x: auto;
  margin-block-end: var(--wa-flow-spacing);
}

/** mobile */
@media screen and (max-width: 768px) {
  wa-page .only-desktop {
    display: none;
  }
}

/** desktop */
@media screen and not (max-width: 768px) {
  wa-page [data-toggle-nav],
  wa-page .only-mobile {
    display: none;
  }

  /* Navigation sidebar */
  wa-page::part(navigation) {
    border-right: var(--wa-border-style) var(--wa-panel-border-width) var(--wa-color-neutral-border-quiet);
  }

  wa-page > #sidebar {
    overflow: auto;
    max-height: 100%;
    min-width: 300px;
    padding: var(--wa-space-xl);
    max-width: 300px;
  }

  wa-page > main {
    padding: var(--wa-space-3xl);
  }
}
