/* FONTS */
@import url('https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,100..900;1,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400..700&family=Doto:wght,ROND@764,64&family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&family=Orbitron:wght@400..900&family=Pacifico&family=Pinyon+Script&display=swap');

:root {
  /* Core Colors */
  --primary-color: #993333;
  --secondary-color: #e07b53;

  /* Neutral Colors */
  --white: #ffffff;
  --black: #000000;
  --gray-light: #f5f5f5;
  --gray-medium: #aaa;
  --gray-dark: #333333;

  /* Interactive Elements */
  --cta-color: #007bff;
  --cta-hover: #0056b3;
  --success-color: #28a745;
  --error-color: #dc3545;
  --warning-color: #ffc107;
  --correct: #99ff99;
  --incorrect: #ffcccc;

  /* Backgrounds */
  --bg-light: #fcfcfc;
  --bg-dark: #222;
  --bg-blue: #002147;
  --bg-red: #BB133E;
  --card-background: #f8f9fa;

  /* Typography */
  --text-primary: #333;
  --text-secondary: #002147;
  --text-tertiary: #BB133E;
  --text-muted: #adb5bd;
  --link-color: #007bff; /* Same as --cta-color */
  --link-hover: #0056b3; /* Same as --cta-hover */

  /* Gradients */
  --gradient-primary: linear-gradient(90deg, #993333, #e07b53);

  /* Shadows and Borders */
  --border-color: #cccccc; /* Same as --gray-medium */
  --box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.25);

  /* Font Families */
  --font-primary: "Public Sans", 'Arial', sans-serif; /* Default font */
  --font-secondary: 'Georgia', serif; /* For emphasis or headings */
  --font-monospace: 'Courier New', monospace; /* For code or technical text */

  /* Font Sizes */
  --font-size-xxs: 0.75rem;  /* Extra extra small (e.g., captions) */
  --font-size-xs: 0.875rem;  /* Extra small */
  --font-size-sm: 1rem;      /* Small (default body size) */
  --font-size-md: 1.125rem;  /* Medium */
  --font-size-lg: 1.5rem;    /* Large (e.g., headings) */
  --font-size-xl: 2rem;      /* Extra large */
  --font-size-xxl: 3rem;     /* Hero headings */

  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-black: 900;

  /* Line Heights */
  --line-height-tight: 1.2;   /* For headings */
  --line-height-normal: 1.5;  /* Default for body text */
  --line-height-loose: 1.8;   /* For longer paragraphs */

  /* Letter Spacing */
  --letter-spacing-tight: -0.02em; /* For bold, uppercase text */
  --letter-spacing-normal: 0;     /* Default */
  --letter-spacing-wide: 0.05em;  /* For headings or emphasis */

  /* Text Decorations */
  --text-decoration-none: none;
  --text-decoration-underline: underline var(--primary-color) 2px;
  --text-decoration-line-through: line-through;

  /* Margins and Padding for Text */
  --text-margin-bottom: 1rem; /* Default space after paragraphs */
  --text-padding-inline: 0.5rem; /* Inline padding for special text (e.g., buttons) */
}

/**
  GENERAL CSS
  ======================================================================================================================
*/
body {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 0px;
  grid-template-areas:
    "header"
    "main"
    "footer";
  background-color: var(--white);
  min-height: 100dvh; /* Ensure the layout fills the viewport */
  height: auto;
  margin: 0;
  padding:0;
  font-family: var(--font-primary);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-normal);
  color: var(--text-primary, #333);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  z-index: 0;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--text-margin-bottom);
}
button {
  font-family: var(--font-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-wide);
}
a {
  color: var(--bg-blue);
  &:hover {
    text-decoration: none;
  }
}


/**
  MOBILE (DEFAULT STYLES)
  ======================================================================================================================
*/
body {
  header {
    background: var(--bg-blue);
    color: var(--white);
    text-align: center;
    padding-top: 20px;
    position: sticky;
    top: 0;
    z-index: 10;
    align-self: start;

    #top-link {
      background-color: var(--white);
      display: block;
      padding-block: 24px;
      text-align: center;

      a {
        text-align: center;
        background-color: var(--bg-red);
        border-radius: 12px;
        color: var(--white);
        font-size: var(--font-size-lg);
        font-weight: var(--font-weight-bold);
        padding: 12px;
        text-decoration: none;
        text-transform: uppercase;

        &:hover {
          background: var(--primary-color)
        }
      }
    }
  }

  main {

    section {
      &#qa {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;

        nav {
          background: var(--gray-light);
          padding: 12px;

          h2 {
            margin: 0 0 6px;
          }

          #qa-categories-list {
            padding-left: 24px;

            li {
              padding: 6px 0 0 0;

              ul {
                padding-left: 18px;
              }

              &::marker {
                color: var(--bg-blue);
              }
            }
          }
        }

        #qa-content {
          scroll-behavior: smooth;
          padding: 12px;

          h2 {
            color: var(--text-secondary);

            .subtitle {
              color: var(--gray-dark);
              font-size: var(--font-size-sm);
              font-weight: normal;
            }
          }

          h3 {
            background-color: var(--bg-red);
            color: var(--white);
            padding: 6px;
            margin:24px 0 -6px;
            scroll-margin-top: 162px;
          }

          h4 {
            padding: 12px 0 0 6px;
            margin:0;
            scroll-margin-top: 153px;
          }

          details {
            border: solid 1px var(--border-color);
            border-radius: 12px;
            padding: 6px;
            margin: 6px 0;

            summary {
              cursor: pointer;
              display: flex;
              align-items: flex-start;
              list-style: none;
              padding-block: 4px;

              span {
                display: inline-flex;
                align-items: center;
                flex-shrink: 0;
                min-height: 1lh;
                width: 40px;
              }
            }

            &[open] {
              summary {
                border-bottom: dotted 1px var(--border-color);
                font-weight: bold;
                padding-bottom: 4px;
                margin-bottom: 4px;
              }

              ul {
                padding-left: 58px;

                li {
                  padding-block: 3px;
                }
              }
            }
          }
        }
      }

      &#quiz {
        padding: 12px;

        h2 {
          color: var(--text-secondary);

          .subtitle {
            color: var(--gray-dark);
            font-size: var(--font-size-sm);
            font-weight: normal;
          }
        }

        #questions {
          margin-top: 12px;
          details {
            border: solid 1px var(--border-color);
            border-radius: 12px;
            padding: 12px 12px 3px;
            margin: 6px 0;

            &.correct {
              background-color: var(--correct);
              opacity: 0.64;
            }
            &.incorrect {
              background-color: var(--incorrect);
              opacity: 0.64;
            }

            summary {
              cursor: pointer;
              list-style: none;
              padding-block: 4px;

              span {
                font-weight: var(--font-weight-bold);
                font-size: var(--font-size-xxs);
                color: var(--gray-medium)
              }
            }

            .buttons {
              text-align: center;
              padding-block: 12px;

              button {
                padding: 6px 12px;
                margin-inline: 12px;
              }
            }

            &[open] {
              summary {
                border-bottom: dotted 1px var(--border-color);
                font-weight: bold;
                padding-bottom: 7px;
                margin-bottom: 4px;
              }

              ul {
                padding-left: 24px;

                li {
                  padding-block: 3px;
                }
              }
            }
          }
        }
      }      
    }
    #score {
      background: var(--bg-blue);
      color: var(--white);
      display: none;
      font-size: var(--font-size-lg);
      font-weight: var(--font-weight-bold);
      text-align: center;
      padding-block: 18px;
      bottom: 0;
      z-index: 10;
      transform: translateZ(0);

      #restart {
        text-align: center;
        background-color: var(--bg-red);
        border-radius: 12px;
        color: var(--white);
        font-size: var(--font-size-lg);
        font-weight: var(--font-weight-bold);
        padding: 12px;
        text-decoration: none;
        text-transform: uppercase;
        display: block;
        clear: both;
        margin: 12px auto;

        &:hover {
          background: var(--primary-color)
        }
      }
    }
  }

  footer {
    background-color: var(--gray-dark);
    color: var(--white);
    font-size: var(--font-size-xs);
    padding:12px;

    a {
      color: var(--white);
    }

    .copyright {
      padding-top: 20px;
      font-size: var(--font-size-xxs);
    }
  }
}

/**
  MOBILE (SPECIFIC)
  ======================================================================================================================
*/
@media (max-width: 739px) {
}

/**
  DESKTOP
  ======================================================================================================================
*/
/* @media (min-width: 1200px) { */
@media (min-width: 740px) {
  body {
    header {
      position: static;
      align-self: stretch;
    }
    main {
      section {
        &#qa {
          grid-template-columns: 25% 1fr;
          grid-template-rows: 1fr;
          height: calc(100dvh - 96px);

          nav {
            position: sticky;
            top: 0;
            height: 100%;
            overflow-y: auto;
          }

          #qa-content {
            min-height: 0;
            overflow-y: auto;

            h3, h4 {
              scroll-margin-top: 0px;
            }
          }
        }
      }
    }
  }
}


::selection, body *::-webkit-selection {
  /* background-color: var(--primary-color); */
  background-color: transparent;
  color: inherit;
  text-shadow: none;
}