@layer base, starlight, theme, components, utilities;
@import '@astrojs/starlight-tailwind';
@import "tailwindcss/theme.css" layer(theme);
@import "tailwindcss/utilities.css" layer(utilities);

@import "./lists.css" layer(components);

/* Starlight Fixes */
@import "./starlight-search.css" layer(components);
@import "./starlight-right-sidebar.css" layer(components);

@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-VariableFont_opsz,wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('/fonts/Inter-Italic-VariableFont_opsz,wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('/fonts/GeistMono-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@theme {
  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;

  /* Buttons */
  --color-button-bg: #EEECF7;
  --color-checkout-radio: #eeecf6;
  --color-checkout-radio-active: #4a31c8;

  /* Colors Nav */
  --color-nav-link: #A0A1AC;
  --color-nav-link-hover: #e8eefc;

  /* Colors Text */
  --color-primary: #0F0934;

  /* Colors Landing Page */
  --color-accent: #4F2FD0;
  --color-accent-1: #7d5DFF;
  --color-accent-2: #87E0E1;
  --color-accent-3: #BFA6F2;
  --color-bg-dark: #0F1731;
  --color-dark-blue-1: #0F0934;
  --color-gray-1: #A0A1AC;
  --color-gray-2: #6B6C7A;
  --color-gray-3: #DBDBDB;
  --color-gray-4: #6D6F86;
  --color-stroke-dark: #2E375A;
  --color-button-primary-border: hsla(0deg, 0%, 100%, 20%);

  /* Colors Contact Form */
  --color-contact-form-button-bg: rgba(255, 255, 255, 0.15);

  /* Component Colors */
  --color-opacity-5: rgba(255, 255, 255, 0.05);
  --color-opacity-10: rgba(255, 255, 255, 0.1);

  /* Dialog */
  --color-dialog-bg: oklch(0.92 0.004 286.32);

  /* Colors Terragrunt Page */
  --color-feature-container: #171e3c;
  --color-feature-container-stroke: #7b7f94;
  --color-card-border: #2F3547;
  --color-acc-text: #F48701;
  --color-gray-border: #E2E3E6;
  --color-primary-button-light: hsl(33, 99%, 47%);

  /* Starlight Customizations */
  --sl-color-hairline-shade: #2E375A;
  --sl-color-secondary: #EBEBEB;
  --sl-text-sm: 16px;
  --sl-color-stroke-dark: #2E375A;
  --sl-z-index-toc: 10;

  /* Strokes */
  --color-stroke-light: #282A46;

  /* Surfaces */
  --color-surface-1: #0F0726;
  --color-surface-3: #1C1833;

  /* Navigation */
  --sl-color-bg-nav: #0F1731;
  --sl-color-asides-border: hsl(41, 90%, 60%);
  --sl-nav-height: 90px;
}

/* Docs Dark mode colors. */
:root {
  --sl-color-bg: #0F1731;
  --sl-color-bg-sidebar: #0F1731;
  --sl-color-bg-inline-code: #2b2d4c;
  --color-code-border: #403f64;
  --color-code-text: #BFA6F2;
  --sl-color-accent-low: #1f1d47;
  --sl-color-accent: #5e46e6;
  --sl-color-accent-high: #c0c3fa;
  --sl-color-black: #131824;
  --sl-color-docs-stroke: #2E375A;
  --sl-color-gray-1: #e8eefc;
  --sl-color-gray-2: #bbc2d4;
  --sl-color-gray-3: #7e8bac;
  --sl-color-gray-4: #4c5776;
  --sl-color-gray-5: #2d3754;
  --sl-color-gray-6: #1c2541;
  --color-toc-accent: #BFA6F2;
  --color-toc-background: rgba(191, 166, 242, 0.15);
  --color-toc-text: #EBEBEB;
  --sl-color-white: #ffffff;
}

/* Docs Light mode colors. */
:root[data-theme='light'] {
  --sl-color-bg: #ffffff;
  --sl-color-bg-sidebar: #ffffff;
  --sl-color-bg-inline-code: #F3F2FF;
  --color-code-border: #BDADFF;
  --color-code-text: #7B5AFF;
  --sl-color-accent-low: #d0d3fc;
  --sl-color-accent: #6049e8;
  --sl-color-accent-high: #2c2669;
  --sl-color-black: #ffffff;
  --sl-color-docs-stroke: #DBDBDB;
  --sl-color-gray-1: #1c2541;
  --sl-color-gray-2: #2d3754;
  --sl-color-gray-3: #4c5776;
  --sl-color-gray-4: #7e8bac;
  --sl-color-gray-5: #bbc2d4;
  --sl-color-gray-6: #e8eefc;
  --color-toc-accent: #7B5AFF;
  --color-toc-background: #E4E9FC;
  --color-toc-text: #777888;
  --sl-color-white: #131824;
}

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

  body {
    margin: 0;
    padding: 0;
  }

  /* Hide scrollbar for Chrome, Safari and Opera */
  .no-scrollbar::-webkit-scrollbar {
    display: none;
  }

  /* Hide scrollbar for IE, Edge and Firefox */
  .no-scrollbar {
      -ms-overflow-style: none;  /* IE and Edge */
      scrollbar-width: none;  /* Firefox */
  }

  @media (width <= 375px) {
    .primary-button, .secondary-button {
        padding: 10px 10px;
    }
  }
}

/* Handle all CSS overrides in a single layer to make it easier to manage and update. */
@layer components {

  /* Baseline styles
  These should really be in the base layer, but for now we want them to apply at this layer.
  */
  h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
  }

  /* Header */
  header {
    background-color: transparent;
    border: none;
    height: var(--sl-nav-height);
  }

  .header {
    padding: 0 !important;
  }

  starlight-menu-button button {
    top: 92px;
    position: fixed;
  }

  @media (max-width: 767px) {
    starlight-menu-button button {
      top: 70px;
    }
  }

  .searchbar {
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 8px;
    width: 280px;
    height: 40px;
    padding: 6px 12px;
    background-color: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
  }

  .menu-icon {
      display: none;
  }

  @media (min-width: 768px) and (max-width: 1023px) {
      .menu-icon {
          display: inline-flex;
      }
  }

  /* Table of contents (right-hand side in-page guide) */

  mobile-starlight-toc {
    display: block;
  }

  mobile-starlight-toc nav {
    left: 0;
    position: relative;
    top: 0;
  }

  starlight-toc h2 {
    background-color: var(--color-toc-background);
    color: var(--color-code-text);
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    user-select: none;
    padding: 4px 2px;
  }

  starlight-toc li {
    font-family: var(--font-sans);
    margin: 0.2rem;
  }

  starlight-toc li a {
    color: var(--color-toc-text);
  }

  starlight-toc li a[aria-current="true"],
  starlight-toc li a:hover {
    color: var(--color-toc-accent);
    font-weight: 500;
  }

  .main-frame {
    margin-top: var(--sl-nav-height);
    padding-top: 0;
  }

  .social-icon {
    color: var(--color-nav-link) !important;
    cursor: pointer;
    text-decoration: none;
  }

  .social-icon:hover {
    color: var(--color-nav-link-hover) !important;
    cursor: pointer;
  }

  /* Main body */

  .sl-markdown-content h2:not(:first-child) {
    margin-top: 1.5em;
  }

  .sl-markdown-content .expressive-code {
    margin: 1.5em 0;
  }

  .sl-markdown-content aside {
    border-left: 5px solid var(--sl-color-asides-border);
    margin: 1.5em 0;
  }

  h1 code,
  h2 code,
  h3 code,
  h4 code,
  h5 code,
  h6 code {
    border: 1px solid var(--color-code-border);
    border-radius: 6px;
    color: var(--color-code-text);
    font-size: 0.75em;
  }

  p code,
  li code {
    border: 1px solid var(--color-code-border);
    border-radius: 6px;
    color: var(--color-code-text);
  }

  #starlight__sidebar ul li {
    margin: 0;
  }

  #starlight__sidebar ul li ul li {
    padding-left: 1em;
  }

  #starlight__sidebar details  {
    padding-left: 0;
    margin-bottom: 10px;
  }

  #starlight__sidebar summary {
    margin-top: 5px;
    padding-left: 0;
  }

  #starlight__sidebar details details details {
    margin-bottom: 0;
  }

  #starlight__sidebar details details details summary {
    margin-top: 0;
    padding: 0.3em var(--sl-sidebar-item-padding-inline);
  }

  /* Open Source Cards */
  .opensourcecard {
    border-left: 0;
  }

  .opensourcecard:last-child {
    border-right: 0;
  }

  /* Main pane */

  .main-pane .sl-container {
    margin-inline: 0;
  }

  .main-pane p {
    line-height: 1.6;
    margin-bottom: 1.5rem;
  }

  .main-pane starlight-file-tree {
    margin-bottom: 1.8rem;
  }

  .main-pane .code {
    font-size: calc(14 / 16 * 1rem);
  }

  /* Sidebar */

  .sidebar-pane {
    border-inline-end: 1px dashed var(--sl-color-docs-stroke);
  }

  .content-panel {
    border-top: 1px dashed var(--sl-color-docs-stroke);
  }

  .right-sidebar {
    border-inline-start: 1px dashed var(--sl-color-docs-stroke);
  }

  /* Cards */

  article.card {
    background-color: transparent;
    border: 1px solid var(--sl-color-gray-5);
    margin: 1.5em 0;
  }
}

@media (width < 768px) {
  :root {
    --sl-nav-height: 125px;
  }
}

@media (1280px > width >= 768px) {
  :root {
    --sl-nav-height: 148px;
  }
}

/* FAQ */

.accordion-item:last-of-type {
  border-bottom: dashed 1px var(--color-gray-3);
}
