@layer base, layout, components;
@import url('https://fonts.googleapis.com/css2?family=Hubot+Sans:ital,wdth,wght@0,112.5,200..900;1,112.5,200..900&display=swap');


@layer base {
  :root {
    --bg: #f7fbfc;
    --panel: #ffffff;
    --accent: #e2d77e;
    --accent-hover: #b3a542;
    --muted: #30455c;
    --radius: 1rem;
    --shadow: 0 6px 18px rgba(16,24,40,0.08);
    --gap: 1rem;
  }

  body {
    font-family: "Hubot Sans", sans-serif;
    font-optical-sizing: auto;
    font-weight: 300;
    font-style: normal;
    margin: 0;
    background: #fafafa;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  a {
    color: var(--accent);
    text-decoration: none;
    color: inherit;
  }

  h1, h2, h3 {
    font-weight: 700;
    color: var(--accent);
  }

  li { list-style-type: disclosure-closed; &::marker {color: var(--accent);}}

  &::selection {
  color: rgb(145, 38, 38);
  background-color: var(--accent);
  }

  input[type=checkbox] { display:none; }
  input[type=checkbox] + label:before {
  display: inline-block;
}
  input[type=checkbox] + label:before { content: "🟥"; color: var(--accent); letter-spacing: 10px;}
  input[type=checkbox]:checked + label:before { content: "🟨"; color: var(--accent);}
}

@layer layout {
  header, footer {
    position: fixed;
    left: 0;
    width: 100%;
    z-index: 999;
     background: #282537;
 background-image: -webkit-radial-gradient(top, circle cover, #3c3b52 0%, #252233 80%);
 background-image: -moz-radial-gradient(top, circle cover, #3c3b52 0%, #252233 80%);
 background-image: -o-radial-gradient(top, circle cover, #3c3b52 0%, #252233 80%);
 background-image: radial-gradient(top, circle cover, #3c3b52 0%, #252233 80%);
    /* box-shadow: 0 2px 5px rgba(0,0,0,0.1); */
    /* padding: 1rem; */

    a, p {padding: 0.3rem 2rem; color: #fff; text-decoration: overline;}
  }
  header {
    top: 0;
    display: flex;
    align-items: center;
    h1 {width: 50%; margin: 0.5rem; text-align: center;}
    nav {text-align: center; width: 50%; a {margin: 0 1rem; color: #e2d77e;}}
  }

  footer {bottom: 0; p {position: absolute; bottom: -1rem; right: 0;}}

  .container {
    display: flex;
    height: 100vh;
    width: 100%;
    margin-top: 3rem;
    position: fixed;
  }

  #nervous-system {
    background-color: #050514;
    width: 50%;
    height: 94vh;
    overflow: hidden;

    canvas {
      position: absolute;
      top: 6rem;
      left: 0;
      width: 100% !important;
      height: 600px !important;
      display: block;
    }
  }

  main {
    direction: rtl;
    flex: 1;
    overflow: scroll;
    padding: 2rem;
    padding-bottom: 6rem;
    text-align: center;
    animation: fadeIn 0.3s ease;
    background: radial-gradient(1.5em 6.28571em at 1.95em, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.25) 55%, rgba(255, 255, 255, 0) 55%) 0 0, radial-gradient(1.5em 6.28571em at -0.45em, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.25) 55%, rgba(255, 255, 255, 0) 55%) 1.5em 5.5em, radial-gradient(2.3em 4.57143em at 2.99em, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.3) 55%, rgba(255, 255, 255, 0) 55%) 0 0, radial-gradient(2.3em 4.57143em at -0.69em, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.3) 55%, rgba(255, 255, 255, 0) 55%) 2.3em 4em, radial-gradient(3.5em 6.28571em at 4.55em, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.25) 55%, rgba(255, 255, 255, 0) 55%) 0 0, radial-gradient(3.5em 6.28571em at -1.05em, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.25) 55%, rgba(255, 255, 255, 0) 55%) 3.5em 5.5em, radial-gradient(#f1f1ef, #fffef3);
    background-color: #fff89d;
    background-size: 1.5em 11em, 1.5em 11em, 2.3em 8em, 2.3em 8em, 3.5em 11em, 3.5em 11em, 100% 100%;
    background-repeat: repeat;

    &::-webkit-scrollbar { width: 0.5rem; }
    &::-webkit-scrollbar-track { background: #040220; }
    &::-webkit-scrollbar-thumb { background-color: #e2d77e; }
  /* &::-webkit-scrollbar-thumb:hover { background-color: #222; } */

    section { direction: ltr;}
  }

  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @media (max-width: 900px) {
      .container {
        flex-direction: column;
        height: 50rem;

         #nervous-system {
            width: 100%; height: 30rem;

            canvas { height: 30rem !important;}
         }
      }
    }
}

@layer components {
  .btn {
    display: inline-block;
    background: var(--accent);
    color: rgb(31, 23, 23);
    padding: 0.7rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    margin-top: 2rem;
    transition: background 0.2s;
    &:hover {
      background: var(--accent-hover);
    }
  }

  .book {
    display: grid;
    place-items: center;
    gap: 2rem;
    img {
      border-radius: 6px;
      box-shadow: 0 4px 8px #0001;
      width: 300px;
      height: auto;
    }
  }

  .center {
    text-align: center;
    padding: 3rem;
  }

  .accordion {
    width: 100%;
    max-width: 40rem;
    border-radius: var(--radius);
    background: transparent;
    padding: 1rem;
    margin: auto;
    box-sizing: border-box;

    details {
      background: var(--panel);
      border-radius: 10px;
      box-shadow: var(--shadow);
      margin-bottom: var(--gap);
      overflow: hidden;
      border: 1px solid rgba(16,24,40,0.04);
    }

    /* remove native marker */
    summary::-webkit-details-marker { display: none; }

    summary {
      list-style: none;
      cursor: pointer;
      padding: 18px 20px;
      display: flex;
      align-items: center;
      gap: 12px;
      user-select: none;
      align-items: center;
    }

    /* title text */
    .title {
      font-weight: 600;
      font-size: 16px;
      letter-spacing: 0.1px;
      color: #132033;
      flex: 1;
    }

    .chev {
      width: 36px;
      height: 36px;
      border-radius: 8px;
      display: grid;
      place-items: center;
      transition: transform 0.28s cubic-bezier(.2,.9,.2,1), background 0.2s;
      background: linear-gradient(180deg, rgba(16,24,40,0.02), rgba(16,24,40,0.01));
      color: var(--accent);
      font-weight: 700;
      transform: rotate(0deg);
    }

    /* content wrapper for animated height */
    .content {
      padding: 0 20px 18px 20px;
      box-sizing: border-box;
      overflow: hidden;

      p {
        margin: 0 0 12px 0;
        line-height: 1.6;
        color: #22313f;
        font-size: 15px;
      }

      a {color: #580000;}
    }

    /* use inner to animate height smoothly */
    .content-inner {
      transform-origin: top left;
      transition: all 350ms cubic-bezier(.2,.9,.2,1);
      opacity: 0;
      transform: translateY(-6px);
      max-height: 0;
      padding-top: 0;
    }

    /* when open — reveal */
    details[open] .chev {
      transform: rotate(180deg);
      background: rgba(255,104,115,0.08);
    }

    details[open] .content-inner {
      opacity: 1;
      transform: translateY(0);
      max-height: 1000px; /* large enough for content */
      padding-top: 12px;
    }
  }

  #newsletter, #getGuidebook {
    position: relative;

    h1 {
      border-top: 3px solid var(--accent);
      margin: 3rem auto;
      width: fit-content;
    }

    form {

      .inputbox {
        position: relative;
        width: 20rem;
        height: 2rem;
        margin: 0 auto 3rem;

        input {
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          border: 1px solid var(--accent);
          outline: none;
          background: none;
          padding: 0.3rem 0.7rem;
          border-radius: 0.5rem;
          font-size: 1rem;
          font-family: inherit;

          &::last-child {
            margin-bottom: 0;
          }

          &:focus ~ span, &:valid ~ span {
            transform: translateX(-13px) translateY(-35px);
            font-size: 1em;
          }
        }

        span {
          position: absolute;
          top: 0.2rem;
          left: 0.8rem;
          font-size: 1em;
          transition: 0.6s;
        }
      }
      input[type='number'] {
        border: none;
        height: 2rem;
        width: 4rem;
        font-size: 1rem;
        padding: 0 1rem;
        margin-left: 0.5rem;
          }
      .numDisplay{
        display: flex;
        align-items: center;
        width: 100%;
        justify-content: center;
        font-size: 1.3rem;
      }
    }
  }

  .guidebook {
    img {height: 33rem;}
    
  }

  .loader {
    position: fixed;
    inset: 0;
    background: #ffffffcc;
    display: grid;
    place-items: center;
    backdrop-filter: blur(2px);
    z-index: 1000;
    transition: opacity 0.3s ease;
  }

  .loader.hidden {
    opacity: 0;
    pointer-events: none;
  }

  .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ccc;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
  }

  @keyframes spin {
    to { transform: rotate(360deg); }
  }

  @media (prefers-reduced-motion: reduce) {
    .chev, .content-inner { transition: none; }
  }

  @media (max-width:520px){
    .accordion { padding: 12px; }
    summary { padding: 14px; }
    .content { padding: 0 14px 12px 14px; }
  }
}
