/* =========================================================
   STUDY KIT COMPONENT (3D ROTATING CYLINDER)
   - 4 Categories: Worksheets, Books, Notes, Sample Papers
   - All 4 category pills strictly on ONE single horizontal line
   - Natural content height
   - Completely unclipped active card
   - 3D perspective rotation on scroll
   - Proper spacing between tabs, card and indicators
   ========================================================= */


/* =========================================================
   MAIN STUDY KIT SECTION
   ========================================================= */

.study-kit-section {
  position: relative;
  height: auto;
  min-height: 980px;
  padding: 0;
  margin-top: 56px;
  scroll-margin-top: var(--nav-height, 80px);

  background:
    linear-gradient(
      180deg,
      var(--bg-primary) 0%,
      #FFFDF5 35%,
      #FFF7D6 80%,
      var(--bg-primary) 100%
    );

  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);

  overflow: visible;
}


/* =========================================================
   STICKY / PIN STAGE
   ========================================================= */

.study-kit-pin-stage {
  position: -webkit-sticky;
  position: sticky;

  top: 72px;

  width: 100%;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;

  padding: 40px 0 32px;

  box-sizing: border-box;

  overflow: visible;

  z-index: 5;
}


/* =========================================================
   CONTAINER
   ========================================================= */

.study-kit-container {
  width: 100%;
  max-width: 1200px;

  margin: 0 auto;

  display: flex;
  flex-direction: column;
  align-items: center;

  gap: 0;

  box-sizing: border-box;
}


/* =========================================================
   CATEGORY PILLS BAR
   ========================================================= */

.study-kit-tabs {
  display: flex;
  flex-wrap: nowrap;

  justify-content: center;
  align-items: center;

  gap: 8px;

  /*
   * IMPORTANT:
   * Keep a clear separation between the category buttons
   * and the 3D carousel.
   */
  margin: 5px auto 18px;

  width: 100%;
  max-width: 100%;

  /*
   * Keep tabs visually above the rotating cards.
   */
  position: relative;
  z-index: 30;

  overflow-x: auto;

  -webkit-overflow-scrolling: touch;

  scrollbar-width: none;
}

.study-kit-tabs::-webkit-scrollbar {
  display: none;
}


/* =========================================================
   CATEGORY TAB
   ========================================================= */

.study-kit-tab {
  height: 48px;

  padding: 0 22px;

  border-radius: var(--radius-full);

  font-size: 17px;
  font-weight: 800;

  background: var(--bg-surface);

  border: 1.5px solid var(--border-light);

  color: var(--navy-deep);

  cursor: pointer;

  display: inline-flex;

  align-items: center;
  justify-content: center;

  gap: 8px;

  white-space: nowrap;

  flex: 0 0 auto;

  transition: all 0.2s ease;

  box-shadow: var(--shadow-sm);

  user-select: none;

  box-sizing: border-box;
}


/* =========================================================
   TAB HOVER
   ========================================================= */

.study-kit-tab:hover {
  border-color: var(--gold-sun);
  color: var(--navy-deep);
}


/* =========================================================
   ACTIVE TAB
   ========================================================= */

.study-kit-tab.active {
  background: var(--navy-deep);

  color: #FFFFFF;

  border-color: var(--navy-deep);

  box-shadow:
    0 6px 18px rgba(23, 37, 84, 0.28);
}


/* =========================================================
   3D CYLINDER VIEWPORT
   ========================================================= */

.study-cylinder-viewport {
  perspective: 1050px;
  perspective-origin: 50% 50%;

  width: 100%;
  max-width: 860px;

  /*
   * Extra vertical space gives the card enough breathing room
   * so it doesn't visually collide with the tabs or indicators.
   */
  height: 440px;

  position: relative;

  display: flex;

  justify-content: center;
  align-items: center;

  margin: 0 auto;

  touch-action: pan-y;

  overflow: visible;

  /*
   * Keep the complete carousel layer below the tabs.
   */
  z-index: 1;

  isolation: isolate;
}


/* =========================================================
   3D CAROUSEL
   ========================================================= */

.study-cylinder-carousel {
  position: relative;

  width: 300px;
  height: 380px;

  transform-style: preserve-3d;

  transition:
    transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);

  overflow: visible;

  /*
   * Keep carousel behind the navigation pills.
   */
  z-index: 1;
}


/* =========================================================
   INDIVIDUAL 3D CATEGORY CARD
   ========================================================= */

.cylinder-card {
  position: absolute;

  inset: 0;

  width: 300px;
  height: 380px;

  border-radius: 26px;

  background: #FFFFFF;

  border: 2px solid var(--border-light);

  padding: 26px 22px 22px;

  display: flex;

  flex-direction: column;

  justify-content: space-between;

  align-items: center;

  text-align: center;

  box-shadow:
    0 12px 36px rgba(23, 37, 84, 0.08);

  transform-style: preserve-3d;

  backface-visibility: hidden;

  cursor: pointer;

  transition:
    box-shadow 0.3s ease,
    border-color 0.3s ease,
    background 0.3s ease;

  user-select: none;

  box-sizing: border-box;
}


/* =========================================================
   ACTIVE FRONT CARD
   ========================================================= */

.cylinder-card.is-active-front {
  border-color: var(--gold-sun);

  box-shadow:
    0 20px 52px rgba(245, 183, 0, 0.3),
    0 0 0 3px rgba(255, 217, 61, 0.4);

  background: #FFFDF8;

  cursor: pointer;
}


/* =========================================================
   SIDE CARD
   ========================================================= */

.cylinder-card.is-side {
  opacity: 0.62;

  filter: saturate(0.85);
}

.cylinder-card.is-side:hover {
  opacity: 0.92;

  border-color: var(--gold-sun);
}


/* =========================================================
   BACK CARD
   ========================================================= */

.cylinder-card.is-back {
  opacity: 0.12;

  pointer-events: none;
}


/* =========================================================
   CARD CONTENTS
   ========================================================= */

.card-icon-halo {
  width: 72px;
  height: 72px;

  border-radius: 20px;

  display: grid;

  place-items: center;

  margin: 0 auto 12px;

  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.06);

  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}


.card-icon-halo svg {
  width: 34px;
  height: 34px;

  stroke-width: 2.2;
}


.is-active-front .card-icon-halo {
  transform:
    scale(1.08)
    translateY(-2px);
}


/* =========================================================
   CATEGORY BADGE
   ========================================================= */

.card-cat-badge {
  font-size: 15px;

  font-weight: 800;

  text-transform: uppercase;

  letter-spacing: 0.08em;

  padding: 4px 14px;

  border-radius: var(--radius-full);

  margin-bottom: 6px;

  display: inline-block;
}


/* =========================================================
   CARD TITLE
   ========================================================= */

.card-title {
  font-size: 26px;

  font-weight: 900;

  color: var(--navy-deep);

  letter-spacing: -0.02em;

  margin-bottom: 6px;
}


/* =========================================================
   CARD DESCRIPTION
   ========================================================= */

.card-desc {
  font-size: 16.5px;

  color: var(--navy-muted);

  line-height: 1.45;

  max-width: 270px;

  margin: 0 auto;
}


/* =========================================================
   CATEGORY COLOR THEMING
   ========================================================= */

.cat-worksheets .card-icon-halo {
  background: var(--res-ws-bg);
  border: 2px solid var(--res-ws-border);
  color: var(--res-ws-text);
}

.cat-worksheets .card-cat-badge {
  background: var(--res-ws-bg);
  color: var(--res-ws-text);
}


.cat-books .card-icon-halo {
  background: var(--res-book-bg);
  border: 2px solid var(--res-book-border);
  color: var(--res-book-text);
}

.cat-books .card-cat-badge {
  background: var(--res-book-bg);
  color: var(--res-book-text);
}


.cat-notes .card-icon-halo {
  background: var(--res-notes-bg);
  border: 2px solid var(--res-notes-border);
  color: var(--res-notes-text);
}

.cat-notes .card-cat-badge {
  background: var(--res-notes-bg);
  color: var(--res-notes-text);
}


.cat-sample-papers .card-icon-halo {
  background: var(--res-paper-bg);
  border: 2px solid var(--res-paper-border);
  color: var(--res-paper-text);
}

.cat-sample-papers .card-cat-badge {
  background: var(--res-paper-bg);
  color: var(--res-paper-text);
}


/* =========================================================
   CARD EXPLORE BUTTON
   ========================================================= */

.btn-card-explore {
  width: 100%;

  padding: 13px 20px;

  border-radius: 14px;

  background: var(--yellow-brand);

  color: var(--navy-deep);

  font-size: 17px;

  font-weight: 800;

  display: inline-flex;

  align-items: center;
  justify-content: center;

  gap: 8px;

  text-decoration: none;

  box-shadow:
    0 4px 14px rgba(255, 217, 61, 0.4);

  transition: all 0.2s ease;

  margin-top: 14px;

  box-sizing: border-box;
}


.btn-card-explore:hover {
  background: var(--gold-sun);

  transform: translateY(-2px);
}


/* =========================================================
   INDICATORS / 4 DOTS
   ========================================================= */

.study-kit-indicators {
  display: flex;

  justify-content: center;
  align-items: center;

  gap: 9px;

  /*
   * Clear space between the bottom of the carousel
   * and the indicators.
   */
  margin-top: 20px;

  margin-bottom: 8px;

  position: relative;

  z-index: 30;

  /*
   * Prevent the indicators from becoming part of
   * the card's visual stacking layer.
   */
  isolation: isolate;
}


.study-kit-dot {
  width: 10px;
  height: 10px;

  border-radius: 50%;

  background: #CBD5E1;

  cursor: pointer;

  transition: all 0.25s ease;
}


.study-kit-dot.active {
  width: 28px;

  border-radius: 12px;

  background: var(--gold-sun);

  box-shadow:
    0 2px 10px var(--gold-glow);
}


/* =========================================================
   TABLET RESPONSIVE
   <= 900px
   ========================================================= */

@media (max-width: 900px) {

  .study-cylinder-viewport {
    height: 370px;

    perspective: 850px;
  }


  .study-cylinder-carousel {
    width: 260px;
    height: 335px;
  }


  .cylinder-card {
    width: 260px;
    height: 335px;

    padding: 22px 18px 18px;
  }


  .card-icon-halo {
    width: 60px;
    height: 60px;
  }


  .card-icon-halo svg {
    width: 28px;
    height: 28px;
  }


  .card-title {
    font-size: 23px;
  }


  .card-desc {
    font-size: 15px;

    max-width: 230px;
  }
}


/* =========================================================
   MOBILE STUDY KIT
   <= 600px
   ========================================================= */

@media (max-width: 600px) {

  .study-kit-section {
    padding: 0;

    margin-top: 36px;

    scroll-margin-top:
      var(--nav-height-mobile, 66px);

    height: auto;

    min-height: 880px;
  }


  .study-kit-pin-stage {
    top: 56px;

    padding: 26px 0 22px;
  }


  .study-kit-container {
    gap: 0;
  }


  /* =======================================================
     MOBILE CATEGORY PILLS
     ======================================================= */

  .study-kit-tabs {
    flex-wrap: nowrap;

    gap: 5px;

    /*
     * Extra separation between tabs and card.
     */
    margin: 2px auto 18px;

    width: 100%;

    justify-content: center;

    /*
     * Keep tabs above the card.
     */
    position: relative;

    z-index: 30;

    overflow-x: auto;

    padding: 0 4px;

    box-sizing: border-box;
  }


  .study-kit-tab {
    height: 38px;

    padding: 0 11px;

    font-size: 14px;

    font-weight: 800;

    gap: 5px;

    background: #FFFFFF;

    color: var(--navy-deep);

    border: 1.5px solid var(--border-subtle);

    box-shadow:
      0 2px 5px rgba(23, 37, 84, 0.06);

    flex: 0 0 auto;

    white-space: nowrap;

    box-sizing: border-box;
  }


  .study-kit-tab.active {
    background: var(--navy-deep);

    color: #FFFFFF;

    border-color: var(--navy-deep);

    box-shadow:
      0 4px 12px rgba(23, 37, 84, 0.25);
  }


  /* =======================================================
     MOBILE 3D VIEWPORT
     ======================================================= */

  .study-cylinder-viewport {
    perspective: 680px;

    width: 100%;

    /*
     * Enough room for the 275px card plus breathing space.
     */
    height: 330px;

    margin: 0 auto;

    overflow: visible;

    position: relative;

    z-index: 1;

    isolation: isolate;
  }


  .study-cylinder-carousel {
    width: 215px;

    height: 275px;

    overflow: visible;

    position: relative;

    z-index: 1;
  }


  /* =======================================================
     MOBILE CARD
     ======================================================= */

  .cylinder-card {
    width: 215px;

    height: 275px;

    padding: 16px 14px 14px;

    border-radius: 20px;

    box-shadow:
      0 8px 24px rgba(23, 37, 84, 0.1);
  }


  /* =======================================================
     MOBILE ICON
     ======================================================= */

  .card-icon-halo {
    width: 48px;

    height: 48px;

    border-radius: 14px;

    margin: 0 auto 6px;
  }


  .card-icon-halo svg {
    width: 24px;

    height: 24px;
  }


  /* =======================================================
     MOBILE BADGE
     ======================================================= */

  .card-cat-badge {
    font-size: 13px;

    padding: 3px 10px;

    margin-bottom: 4px;
  }


  /* =======================================================
     MOBILE TITLE
     ======================================================= */

  .card-title {
    font-size: 20px;

    margin-bottom: 4px;

    line-height: 1.2;
  }


  /* =======================================================
     MOBILE DESCRIPTION
     ======================================================= */

  .card-desc {
    font-size: 14px;

    line-height: 1.35;

    max-width: 195px;

    margin: 0 auto;

    display: -webkit-box;

    -webkit-line-clamp: 2;

    -webkit-box-orient: vertical;

    overflow: hidden;
  }


  /* =======================================================
     MOBILE EXPLORE BUTTON
     ======================================================= */

  .btn-card-explore {
    padding: 9px 14px;

    font-size: 15px;

    font-weight: 800;

    height: 38px;

    margin-top: 8px;

    border-radius: 10px;
  }


  /* =======================================================
     MOBILE INDICATORS
     ======================================================= */

  .study-kit-indicators {
    /*
     * Keep dots clearly BELOW the card.
     */
    margin-top: 28px;

    margin-bottom: 8px;

    position: relative;

    z-index: 30;

    isolation: isolate;
  }


  .study-kit-dot {
    width: 8px;

    height: 8px;
  }


  .study-kit-dot.active {
    width: 24px;
  }
}


/* =========================================================
   SMALL PHONES
   <= 420px
   Fixes 390px / 393px / iPhone-sized screens
   ========================================================= */

@media (max-width: 420px) {

  /* -------------------------------------------------------
     CATEGORY TABS
     ------------------------------------------------------- */

  .study-kit-tabs {
    width: 100%;

    /*
     * IMPORTANT:
     * Do NOT center an overflowing flex row.
     * Start from the left so the first tab is never clipped.
     */
    justify-content: flex-start;

    gap: 4px;

    padding-left: 6px;
    padding-right: 6px;

    margin: 2px auto 18px;

    overflow-x: auto;
    overflow-y: hidden;

    box-sizing: border-box;

    /*
     * Allow horizontal scrolling if a very narrow
     * device still cannot fit all four buttons.
     */
    -webkit-overflow-scrolling: touch;

    scrollbar-width: none;
  }


  .study-kit-tabs::-webkit-scrollbar {
    display: none;
  }


  /* -------------------------------------------------------
     SMALLER TAB SIZE
     ------------------------------------------------------- */

  .study-kit-tab {
    height: 36px;

    /*
     * Smaller horizontal padding so all 4 tabs
     * can fit on smaller phones.
     */
    padding-left: 8px;
    padding-right: 8px;

    font-size: 12px;

    gap: 4px;

    border-radius: 999px;

    flex: 0 0 auto;

    white-space: nowrap;

    box-sizing: border-box;
  }


  /* -------------------------------------------------------
     TAB ICONS
     ------------------------------------------------------- */

  .study-kit-tab svg {
    width: 12px;
    height: 12px;

    flex: 0 0 auto;
  }


  /* -------------------------------------------------------
     3D CARD
     ------------------------------------------------------- */

  .study-cylinder-viewport {
    width: 100%;

    /*
     * Keep the card comfortably below the tabs.
     */
    height: 320px;

    margin: 0 auto;

    overflow: visible;

    display: flex;

    justify-content: center;
    align-items: center;

    box-sizing: border-box;
  }


  .study-cylinder-carousel {
    width: 205px;
    height: 265px;
  }


  .cylinder-card {
    width: 205px;
    height: 265px;

    padding: 15px 12px 12px;

    border-radius: 19px;
  }


  /* -------------------------------------------------------
     CARD ICON
     ------------------------------------------------------- */

  .card-icon-halo {
    width: 46px;
    height: 46px;

    border-radius: 13px;

    margin: 0 auto 6px;
  }


  .card-icon-halo svg {
    width: 23px;
    height: 23px;
  }


  /* -------------------------------------------------------
     CARD BADGE
     ------------------------------------------------------- */

  .card-cat-badge {
    font-size: 12px;

    padding: 3px 9px;

    margin-bottom: 4px;
  }


  /* -------------------------------------------------------
     CARD TITLE
     ------------------------------------------------------- */

  .card-title {
    font-size: 19px;

    line-height: 1.2;

    margin-bottom: 4px;
  }


  /* -------------------------------------------------------
     CARD DESCRIPTION
     ------------------------------------------------------- */

  .card-desc {
    font-size: 13px;

    line-height: 1.3;

    max-width: 185px;
  }


  /* -------------------------------------------------------
     EXPLORE BUTTON
     ------------------------------------------------------- */

  .btn-card-explore {
    width: 100%;

    height: 36px;

    padding: 8px 10px;

    margin-top: 7px;

    border-radius: 10px;

    font-size: 14px;
  }


  /* -------------------------------------------------------
     INDICATORS
     ------------------------------------------------------- */

  .study-kit-indicators {
    margin-top: 26px;

    margin-bottom: 6px;

    gap: 7px;
  }


  .study-kit-dot {
    width: 7px;
    height: 7px;
  }


  .study-kit-dot.active {
    width: 22px;
  }
}
/* =========================================================
   ULTRA-COMPACT SCREENS
   <= 360px
   ========================================================= */

@media (max-width: 360px) {

  .study-kit-tabs {
    gap: 4px;

    padding-left: 3px;
    padding-right: 3px;
  }


  .study-kit-tab {
    padding: 0 7px;

    font-size: 12px;

    height: 34px;
  }


  .study-cylinder-viewport {
    height: 290px;
  }


  .study-cylinder-carousel {
    width: 185px;

    height: 255px;
  }


  .cylinder-card {
    width: 185px;

    height: 255px;

    padding: 12px 10px 10px;
  }


  .card-icon-halo {
    width: 40px;

    height: 40px;
  }


  .card-title {
    font-size: 18px;
  }


  .card-desc {
    font-size: 13px;
  }


  .btn-card-explore {
    font-size: 13.5px;

    height: 34px;
  }


  .study-kit-indicators {
    margin-top: 24px;

    margin-bottom: 6px;
  }
}