/* ==========================================================================
   Responsive CSS
   Tablet and mobile layout refinements with extra attention to first view.
   ========================================================================== */

@media (max-width: 980px) {
  :root {
    --container: min(100% - 36px, 760px);
  }

  .nav-toggle {
    display: inline-grid;
    gap: 5px;
  }

  .nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(6px) rotate(42deg);
  }

  .nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-6px) rotate(-42deg);
  }

  .global-nav {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    z-index: 90;
    width: min(330px, 84vw);
    min-height: 100svh;
    display: grid;
    align-content: start;
    gap: 0;
    padding: calc(var(--header-height) + 22px) 24px 28px;
    border-left: 1px solid var(--color-line);
    background: #05070d;
    box-shadow: -24px 0 70px rgba(0, 0, 0, 0.42);
    opacity: 0;
    pointer-events: none;
    transform: translateX(18px);
    transform-origin: top right;
    transition: opacity 220ms ease, transform 220ms ease;
  }

  .global-nav.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
  }

  .global-nav a {
    padding: 17px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(247, 248, 251, 0.92);
    font-family: var(--font-serif);
    font-size: 1.12rem;
    text-transform: none;
  }

  .global-nav a:last-child {
    border-bottom: 0;
  }

  .hero {
    min-height: 92svh;
    padding-top: calc(var(--header-height) + 18px);
  }

  .hero__content {
    padding-top: 3vh;
  }

  .hero__title {
    font-size: clamp(2.7rem, 11vw, 4.9rem);
  }

  .feature-grid,
  .work-grid,
  .link-grid,
  .track-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .split-layout,
  .statement,
  .audio-player,
  .featured-story,
  .vtuber-panel,
  .friend-vtuber-panel,
  .tool-release,
  .community-banner,
  .character-callout,
  .site-footer {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .site-footer {
    text-align: left;
  }
}

@media (max-width: 640px) {
  :root {
    --container: min(100% - 28px, 100%);
    --header-height: 68px;
  }

  .site-header {
    padding: 14px 16px;
  }

  .brand__mark {
    width: 34px;
    height: 34px;
  }

  .brand__text {
    font-size: 0.96rem;
    letter-spacing: 0.08em;
  }

  .hero {
    min-height: 100svh;
    padding-bottom: 46px;
  }

  .hero__copy {
    line-height: 1.78;
  }

  .hero__actions {
    display: grid;
    grid-template-columns: 1fr;
    max-width: 280px;
  }

  .button {
    width: 100%;
  }

  .section {
    padding: 68px 0;
  }

  .statement__inner p:not(.eyebrow) {
    line-height: 2;
  }

  .author-note {
    margin-top: 0;
  }

  .section__heading h2,
  .page-hero h1 {
    font-size: clamp(2.2rem, 13vw, 3.7rem);
  }

  .statement__inner h2 {
    font-size: clamp(2rem, 10vw, 3.2rem);
  }

  .feature-grid,
  .work-grid,
  .link-grid,
  .novel-card-grid,
  .track-grid {
    grid-template-columns: 1fr;
  }

  .novel-hero {
    min-height: 68svh;
    padding: calc(var(--header-height) + 54px) 0 62px;
  }

  .novel-hero h1 {
    font-size: clamp(3rem, 16vw, 5rem);
  }

  .featured-story,
  .character-callout {
    padding: 22px;
  }

  .story-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .novel-card__visual {
    min-height: 260px;
  }

  .music-player-section {
    margin-top: -34px;
  }

  .audio-player {
    padding: 22px;
  }

  .seek-control {
    grid-template-columns: 40px 1fr 40px;
    gap: 8px;
  }

  .track-card {
    min-height: auto;
    padding: 22px;
  }

  .feature-card {
    min-height: auto;
    padding: 24px;
  }

  .feature-card h3,
  .feature-card h2 {
    margin-top: 30px;
  }

  .work-card__visual {
    min-height: 320px;
  }

  .sound-panel__line {
    display: grid;
  }

  .sound-panel strong {
    text-align: left;
  }

  .community-banner {
    padding: 26px;
  }

  .vtuber-panel {
    min-height: auto;
    padding: 22px;
  }

  .friend-vtuber-panel {
    min-height: auto;
    padding: 22px;
  }

  .tool-release {
    padding: 22px;
  }

  .vtuber-panel__body h3,
  .friend-vtuber-panel__body h3 {
    font-size: clamp(2.1rem, 12vw, 3.7rem);
  }

  .friend-vtuber-panel__office {
    font-size: clamp(1.7rem, 10vw, 3.1rem);
  }

  .community-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .tool-release__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .tool-release__status {
    min-height: auto;
    padding: 20px;
  }

  .link-grid a {
    min-height: 112px;
  }

  .page-hero {
    min-height: 52svh;
    padding-bottom: 54px;
  }
}
