/*
 * -----------------------------------------------------------------------------
 * Icy Math Official Website
 * File: responsive.css
 * Description: Responsive layout rules for phones, tablets and laptops.
 * -----------------------------------------------------------------------------
 */

@media (max-width: 1100px) {
  .cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stores-grid,
  .links-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 860px) {
  .site-header {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .cards-grid,
  .screenshots-grid {
    grid-template-columns: 1fr;
  }

  .stores-grid,
  .links-grid {
    grid-template-columns: 1fr;
  }

  .hero__title {
    max-width: 100%;
  }

}

@media (max-width: 620px) {
  .container {
    width: min(calc(100% - 1.2rem), var(--container-width));
  }

  .site-header {
    width: calc(100% - 1.2rem);
    min-height: 4.65rem;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.45rem;
    top: 0.6rem;
    margin-top: 0.6rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(139, 92, 246, 0.28);
    border-radius: 1.65rem;
    background: linear-gradient(135deg, rgba(76, 29, 149, 0.94), rgba(35, 25, 66, 0.94));
    box-shadow: 0 14px 34px rgba(30, 16, 58, 0.24);
    transition: border-radius var(--transition-medium), box-shadow var(--transition-medium);
  }

  body.drawer-open .site-header {
    border-bottom-right-radius: 0;
    box-shadow: 0 18px 42px rgba(30, 16, 58, 0.32);
  }

  .site-header .brand {
    min-width: 0;
    gap: 0.55rem;
    color: #fff;
    position: relative;
    z-index: 2;
  }

  .site-header .brand__icon {
    width: 2.55rem;
    height: 2.55rem;
    flex: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
  }

  .site-header .brand__name {
    overflow: hidden;
    font-size: 1rem;
    color: #fff;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .site-header .toolbar {
    width: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 0.35rem;
    position: relative;
    z-index: 2;
  }

  .site-header .segmented {
    width: auto;
    padding: 0.12rem;
    justify-content: initial;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.16);
  }

  .site-header .segmented__btn {
    min-width: 1.65rem;
    padding: 0.48rem 0.3rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.68rem;
  }

  .site-header .segmented__btn.is-active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
  }

  .menu-toggle {
    display: block;
    color: #fff;
    position: relative;
    z-index: 2;
  }

  .site-header .site-nav {
    position: absolute;
    top: calc(100% - 0.8rem);
    right: -1px;
    z-index: 1;
    display: flex;
    width: min(78vw, 21rem);
    max-height: calc(100dvh - 6rem);
    padding: 1.6rem 1rem max(1.15rem, env(safe-area-inset-bottom));
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.45rem;
    overflow-y: auto;
    border: 1px solid rgba(139, 92, 246, 0.28);
    border-top: 0;
    border-radius: 0 0 1.65rem 1.65rem;
    background: linear-gradient(155deg, rgba(67, 30, 130, 0.99), rgba(24, 19, 43, 0.99));
    box-shadow: -12px 22px 40px rgba(15, 8, 28, 0.3);
    transform: translateY(-0.75rem) scaleY(0.96);
    transform-origin: top;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform var(--transition-medium), opacity var(--transition-medium), visibility var(--transition-medium);
  }

  .site-header .site-nav.is-open {
    transform: translateY(0) scaleY(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .site-header .site-nav a {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 0.9rem;
    color: rgba(255, 255, 255, 0.82);
    font-size: 1rem;
    font-weight: 700;
  }

  .site-header .site-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
  }

  .drawer-scrim {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(8, 6, 15, 0.54);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-medium), visibility var(--transition-medium);
  }

  .drawer-scrim.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  body.drawer-open {
    overflow: hidden;
  }

  .section {
    padding-block: var(--space-12);
  }

  .hero {
    padding-top: var(--space-8);
    padding-bottom: var(--space-12);
  }

  .hero__content {
    gap: clamp(1.25rem, 5vw, 1.75rem);
  }

  .hero__title {
    font-size: clamp(3.1rem, 17vw, 4.8rem);
  }

  .hero__subtitle {
    font-size: clamp(1.15rem, 5vw, 1.4rem);
  }

  .hero__description {
    font-size: clamp(1rem, 4vw, 1.12rem);
    line-height: 1.65;
  }

  .hero__actions {
    flex-direction: column;
  }

  .hero__actions .button {
    width: 100%;
    min-height: 3.65rem;
    font-size: 1.05rem;
  }

  .site-nav {
    gap: var(--space-2);
  }

  .site-nav a {
    padding-inline: 0.65rem;
  }

}

@media (max-width: 520px) {
  .site-header {
    padding-inline: 0.55rem;
    gap: 0.3rem;
  }

  .site-header .brand {
    gap: 0.35rem;
  }

  .site-header .brand__icon {
    width: 2rem;
    height: 2rem;
  }

  .site-header .brand__name {
    font-size: 0.82rem;
  }

  .site-header .toolbar {
    gap: 0.2rem;
  }

  .site-header .segmented__btn {
    min-width: 1.3rem;
    padding: 0.4rem 0.18rem;
    font-size: 0.6rem;
  }

  .menu-toggle {
    width: 2.2rem;
    height: 2.2rem;
    padding: 0.5rem;
  }

}
