/* Global variables. */
:root {
  --border-radius: 5px;

  /* OKLCH color components */
  --lch-bg: 100% 0 0;
  --lch-bg-secondary: 96.79% 0 0;
  --lch-bg-tertiary: 93% 0 0;
  --lch-text: 27.55% 0 0;
  --lch-text-light: 51.33% 0 0;
  --lch-text-lighter: 70.10% 0 0;
  --lch-border: 86.22% 0 282.863;
  --lch-border-hover: 90% 0 0;

  --lch-accent: 45.02% 0.18 264.06;
  --lch-accent-hover: 53% 0.15 264.06;
  --lch-code: 54.38% 0.23 0.45;
  --lch-preformatted: 41.86% 0 0;
  --lch-marked: 0.95 0.1 98.72;
  --lch-disabled: 94.93% 0 0;

  --lch-yellow: 89.12% 0.147 99.06;

  /* Theme application */
  --bg: oklch(var(--lch-bg));
  --bg-secondary: oklch(var(--lch-bg-secondary));
  --bg-tertiary: oklch(var(--lch-bg-tertiary));
  --text: oklch(var(--lch-text));
  --text-light: oklch(var(--lch-text-light));
  --border: oklch(var(--lch-border));
  --border-hover: oklch(var(--lch-border-hover));
  --accent: oklch(var(--lch-accent));
  --accent-hover: oklch(var(--lch-accent-hover));
  --accent-text: var(--bg);
  --code: oklch(var(--lch-code));
  --preformatted: oklch(var(--lch-preformatted));
  --marked: oklch(var(--lch-marked));
  --disabled: oklch(var(--lch-disabled));
  --shadow: 0px 0px 2.2px rgba(0, 0, 0, 0.02),
    0px 0px 5.3px rgba(0, 0, 0, 0.028),
    0px 0px 10px rgba(0, 0, 0, 0.035),
    0px 0px 17.9px rgba(0, 0, 0, 0.042),
    0px 0px 33.4px rgba(0, 0, 0, 0.05),
    0px 0px 80px rgba(0, 0, 0, 0.07);
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    /* Override OKLCH components for dark theme */
    --lch-bg: 25% 0 0;
    --lch-bg-secondary: 31% 0 0;
    --lch-bg-tertiary: 33% 0 0;
    --lch-text: 87.18% 0 0;
    --lch-text-light: 70.10% 0 0;
    --lch-border: 40% 0 0;
    --lch-border-hover: 40% 0 0;
    --lch-accent: 63.86% 0.22 264.06;
    --lch-accent-hover: 89.12% 0.147 99.06;
    --lch-code: 71.25% 0.20 0.45;
    --lch-preformatted: 82.86% 0 0;
    --lch-disabled: 12.32% 0 0;

    --lch-yellow: 70% 0.147 99.06;

    /* Adjust shadow for dark mode */
    --shadow: 0px 0px 2.2px rgba(0, 0, 0, 0.1),
      0px 0px 5.3px rgba(0, 0, 0, 0.13),
      0px 0px 10px rgba(0, 0, 0, 0.15),
      0px 0px 17.9px rgba(0, 0, 0, 0.17),
      0px 0px 33.4px rgba(0, 0, 0, 0.2),
      0px 0px 80px rgba(0, 0, 0, 0.3);
  }

  /* Add a bit of transparency so light media isn't so glaring in dark mode */
  img,
  video {
    opacity: 0.8;
  }
}

body {
  background: var(--bg);
  font-family: "Inter", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-size: 15px;
  margin: 0;
  padding: 0;
}

/* Grid layout with centered content */
body {
  display: grid;
  grid-template-columns: 1fr min(90ch, 90%) 1fr;
  grid-template-rows: [header-start] auto [header-end main-start] 1fr [main-end footer-start] auto [footer-end];
  min-height: 100vh;

  &>* {
    grid-column: 2;
  }
}

@media (max-width: 768px) {
  body {
    grid-template-columns: 10px 1fr 10px;
  }
}

/* Utilities */

.accent {
  color: var(--accent);
}

.hide-on-desktop {
  @media (min-width: 768px) {
    display: none !important;
  }
}

.hide-on-mobile {
  @media (max-width: 768px) {
    display: none !important;
  }
}

/* Typography */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
}

/* Styles */

body>header {
  grid-row: header-start / header-end;
  grid-column: 1 / -1;
  margin-top: 0px;
  padding: 15px 22px;

  display: flex;
  justify-content: space-between;
  align-items: center;


  a {
    text-decoration: none;
  }

  .logo {
    margin: 0;
    padding: 0;

    >a {
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--text);
      font-size: 24px;
      font-weight: 600;

      &:hover {
        opacity: 0.7;
        transition: opacity 0.2s ease-in-out;
      }
    }
  }

  nav {
    display: flex;
    align-items: center;
    gap: 15px;

    a {
      color: var(--text-light);
      font-weight: 400;
      text-decoration: none;

      &.button {
        padding: 5px 15px;
        border-radius: 20px;
        font-weight: 500;

        &.secondary {
          background: var(--bg-secondary);
          color: var(--text);
        }
      }

      &:hover {
        opacity: 0.8;
      }
    }
  }

  .menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
  }

  @media (max-width: 768px) {
    .menu-toggle {
      display: block;
    }

    nav {
      position: fixed;
      inset: 10px 10px auto 10px;
      height: auto;
      flex-direction: column;
      padding: 20px;
      padding-top: 40px;
      background: var(--bg);
      gap: 20px;
      box-shadow: var(--shadow);
      z-index: 100;
      align-items: center;
      justify-content: center;
      opacity: 0;
      visibility: hidden;
      border-radius: 10px;
      transition: opacity 0.15s ease-in-out, visibility 0s linear 0.15s;

      .button {
        width: 100%;
        text-align: center;
      }

      .close-menu {
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        color: var(--text);
        cursor: pointer;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }

    nav.open {
      opacity: 1;
      visibility: visible;
      transition-delay: 0s;
    }
  }
}

body>main {
  grid-row: main-start / main-end;
  padding: 0 25px;
  margin: 30px 0;

  h1 {
    margin-top: 0;
    font-size: 35px;
    font-weight: 600;
  }

  h2 {
    margin-top: 25px;
  }
}

body>footer {
  grid-row: footer-start / footer-end;
  grid-column: 1 / -1;
  padding: 0 20px;

  .content {
    color: var(--text-light);
    background: var(--bg-secondary);
    display: flex;
    justify-content: space-between;
    padding: 20px;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;

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

    .links {
      margin-top: 5px;
      display: flex;
      gap: 10px;

      a {
        color: var(--text-light);
      }
    }

    .contact {
      text-align: right;
    }

    @media (max-width: 768px) {
      flex-direction: column;
      text-align: center;

      a {
        margin: 20px 0;
      }

      .contact {
        text-align: center;
      }
    }
  }
}

/* Shared styles */

a.cta {
  padding: 5px 15px;
  border-radius: 20px;
  font-weight: 500;
  border: 2px solid var(--accent);
  color: var(--accent);
  box-shadow: 0px 7px 25px #d6d6d6;
  background: #c4cee0bf;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 30px;

  @media (prefers-color-scheme: dark) {
    box-shadow: 0px 7px 25px rgba(0, 0, 0, 0.2);
    background: oklch(0.3 0.05 264.06 / 0.75);
  }

  &:hover {
    opacity: 0.8;
  }
}

.cta-subtext {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 12px;
  opacity: 0.8;
}
