/* ============================================
   hitokiwa Custom CSS - Mobile Optimization & Theme Fixes
   Version: 1.0 (2026-03-12)
   ============================================ */

/* ---- PC Header Nav Fix (crowding issue) ---- */
@media (min-width: 768px) {
  .c-header__nav-links {
    gap: 0;
    flex-wrap: nowrap;
  }
  .c-header__nav-link {
    padding: clamp(3px, 0.3vw, 6px);
    font-size: clamp(10px, 1.05vw, 13px);
    white-space: nowrap;
  }
  .c-header__main-buttons {
    gap: 4px;
    flex-shrink: 0;
  }
  .c-header__main-button {
    padding: 8px 14px;
    font-size: clamp(10px, 1vw, 13px);
    white-space: nowrap;
  }
}

@media (min-width: 768px) and (max-width: 1100px) {
  .c-header__nav-link {
    padding: 3px 2px;
    font-size: 10px;
  }
  .c-header__main-button {
    padding: 6px 10px;
    font-size: 10px;
  }
}

/* ---- Mobile Header Overlay ---- */
.c-header-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}
body.is-fixed .c-header-overlay {
  display: block;
  opacity: 1;
}

/* ---- Mobile Nav Menu - Modern Full Screen ---- */
@media (max-width: 767px) {

  /* Nav Panel */
  .c-header__nav {
    background: linear-gradient(160deg, #0a0a0a 0%, #1a1a1a 50%, #111 100%) !important;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease !important;
    padding: 80px 32px 120px !important;
    display: flex !important;
    flex-direction: column;
    justify-content: flex-start;
  }

  body.is-fixed .c-header__nav {
    right: 0 !important;
    opacity: 1 !important;
  }

  /* Nav Links Container */
  .c-header__nav-links {
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
  }

  /* Individual Link */
  .c-header__nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 17px !important;
    font-weight: 500;
    width: 100%;
    padding: 18px 0 !important;
    text-align: left;
    color: #fff !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    letter-spacing: 0.04em;
    transition: color 0.2s ease, padding-left 0.2s ease;
    position: relative;
  }

  .c-header__nav-link:visited {
    color: #fff !important;
  }

  .c-header__nav-link:active {
    color: #ccc !important;
    padding-left: 8px !important;
  }

  /* Color accent links */
  .c-header__nav-link--on-green {
    color: #8ed16e !important;
  }
  .c-header__nav-link--on-green::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6c8954;
    flex-shrink: 0;
  }

  .c-header__nav-link--on-blue {
    color: #7baaf7 !important;
  }
  .c-header__nav-link--on-blue::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3647a0;
    flex-shrink: 0;
  }

  /* Menu CTA Buttons (injected by JS) */
  .hitokiwa-menu-cta {
    margin-top: auto;
    padding-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .hitokiwa-menu-cta__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s, opacity 0.2s;
    font-family: "Zen Kaku Gothic New", sans-serif;
  }

  .hitokiwa-menu-cta__btn:active {
    transform: scale(0.97);
    opacity: 0.9;
  }

  .hitokiwa-menu-cta__btn--primary {
    background: #fff;
    color: #000;
  }
  .hitokiwa-menu-cta__btn--primary:visited {
    color: #000;
  }

  .hitokiwa-menu-cta__btn--outline {
    background: transparent;
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
  }
  .hitokiwa-menu-cta__btn--outline:visited {
    color: #fff;
  }

  .hitokiwa-menu-cta__btn--line {
    background: #06C755;
    color: #fff;
  }
  .hitokiwa-menu-cta__btn--line:visited {
    color: #fff;
  }

  /* Phone number in menu */
  .hitokiwa-menu-phone {
    text-align: center;
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    letter-spacing: 0.02em;
  }
  .hitokiwa-menu-phone a {
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.05em;
  }

  /* Body lock */
  body.is-fixed {
    overflow: hidden;
  }

  /* Hamburger Button Redesign */
  .c-header__navBtn {
    width: 44px;
    height: 44px;
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 1001;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0;
    background: transparent !important;
  }

  .c-header__navBtn span {
    display: block;
    height: 2px !important;
    width: 24px !important;
    border-radius: 2px;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transform-origin: center;
    /* Color inherits from theme - black on light, white on dark */
  }

  .c-header__navBtn span:nth-of-type(2),
  .c-header__navBtn span:nth-of-type(3) {
    margin-top: 7px !important;
  }

  /* X animation when open */
  body.is-fixed .c-header__navBtn span {
    background: #fff !important;
  }
  body.is-fixed .c-header__navBtn span:nth-of-type(1) {
    transform: translateY(9px) rotate(45deg) !important;
  }
  body.is-fixed .c-header__navBtn span:nth-of-type(2) {
    opacity: 0 !important;
    transform: scaleX(0) !important;
  }
  body.is-fixed .c-header__navBtn span:nth-of-type(3) {
    transform: translateY(-9px) rotate(-45deg) !important;
  }
}

/* ---- Mobile Bottom Fixed Bar ---- */
@media (max-width: 767px) {
  .hitokiwa-mobile-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #000;
    display: flex;
    border-top: 1px solid #333;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
  }
  .hitokiwa-mobile-bar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    color: #fff;
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    gap: 3px;
    transition: background 0.2s;
    font-family: "Zen Kaku Gothic New", sans-serif;
  }
  .hitokiwa-mobile-bar__item:visited {
    color: #fff;
  }
  .hitokiwa-mobile-bar__item:active {
    background: #333;
  }
  .hitokiwa-mobile-bar__icon {
    font-size: 18px;
    line-height: 1;
  }
  .hitokiwa-mobile-bar__item--line {
    background: #06C755;
  }
  .hitokiwa-mobile-bar__item--line:active {
    background: #05b34d;
  }
  /* Adjust footer and body bottom padding for fixed bar */
  .l-footer {
    margin-bottom: 60px !important;
  }
  .p-cta-banner {
    margin-bottom: 0;
  }
}

@media (min-width: 768px) {
  .hitokiwa-mobile-bar {
    display: none !important;
  }
  .hitokiwa-menu-cta {
    display: none !important;
  }
  .hitokiwa-menu-phone {
    display: none !important;
  }
}

/* ---- Mobile Hero/Top Section ---- */
@media (max-width: 767px) {
  .p-front-firstview {
    min-height: 70vh;
  }
  .p-front-firstview__catch {
    font-size: clamp(24px, 7vw, 36px);
    padding: 0 16px;
  }
  .p-front-firstview__sub {
    font-size: clamp(14px, 4vw, 18px);
  }
}

/* ---- Mobile Counter Section ---- */
@media (max-width: 767px) {
  .p-number-counter {
    padding: 48px 16px;
  }
  .p-number-counter__header {
    margin-bottom: 36px;
  }
  .p-number-counter__title {
    font-size: 22px;
  }
  .p-number-counter__items {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .p-number-counter__number {
    font-size: 40px;
  }
  .p-number-counter__label {
    font-size: 14px;
  }
}

/* ---- Mobile CTA Banner ---- */
@media (max-width: 767px) {
  .p-cta-banner {
    padding: 36px 16px;
  }
  .p-cta-banner__title {
    font-size: 20px;
    line-height: 1.5;
    margin-bottom: 10px;
  }
  .p-cta-banner__subtitle {
    font-size: 12px;
    margin-bottom: 28px;
  }
  .p-cta-banner__buttons {
    flex-direction: column;
    gap: 10px;
  }
  .p-cta-banner__btn {
    min-width: 100%;
    width: 100%;
    padding: 14px 20px;
    font-size: 14px;
    text-align: center;
  }
}

/* ---- Mobile Stats (Donut Charts) ---- */
@media (max-width: 767px) {
  .hitokiwa-stats {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 0 12px;
  }
  .hitokiwa-stats__chart {
    width: 160px;
    height: 160px;
  }
  .hitokiwa-stats__legend {
    gap: 4px 12px;
  }
  .hitokiwa-stats__legend-item {
    font-size: 11px;
  }
}

/* ---- Mobile Cases Page ---- */
@media (max-width: 767px) {
  .p-cases-section {
    padding: 32px 12px 48px;
  }
  .p-case-card {
    margin-bottom: 32px;
  }
  .p-case-card__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 16px;
  }
  .p-case-card__company {
    font-size: 16px;
  }
  .p-case-card__company-sub {
    font-size: 12px;
  }
  .p-case-card__body {
    padding: 20px 14px;
  }
  .p-case-card__flow {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
  }
  .p-case-card__step-content {
    font-size: 13px;
  }
  .p-case-card__voice {
    padding: 16px;
  }
  .p-case-card__voice-text {
    font-size: 13px;
    line-height: 1.8;
  }
  /* Note Banner */
  .p-cases-note {
    flex-direction: column;
    text-align: center;
    padding: 24px 16px;
    gap: 16px;
  }
  .p-cases-note__heading {
    font-size: 18px;
  }
  .p-cases-note__description {
    font-size: 13px;
  }
  .p-cases-note__link {
    width: 100%;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
  }
}

/* ---- Mobile Case Carousel (Top Page) ---- */
@media (max-width: 767px) {
  .hitokiwa-case-track {
    gap: 16px;
    padding: 12px 4px 20px;
  }
  .hitokiwa-case-card {
    flex: 0 0 260px;
  }
  .hitokiwa-case-card__img {
    height: 140px;
  }
  .hitokiwa-case-card__body {
    padding: 14px;
  }
  .hitokiwa-case-card__title {
    font-size: 14px;
  }
  .hitokiwa-case-card__summary {
    font-size: 12px;
  }
}

/* ---- Mobile FAQ Section ---- */
@media (max-width: 767px) {
  .hitokiwa-faq-q {
    padding: 14px 8px;
    gap: 10px;
  }
  .hitokiwa-faq-q-text {
    font-size: 14px;
  }
  .hitokiwa-faq-q-icon,
  .hitokiwa-faq-a-icon {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
  .hitokiwa-faq-a {
    padding: 0 8px 14px 8px;
  }
  .hitokiwa-faq-a-text {
    font-size: 13px;
  }
}

/* ---- Mobile News/Column List ---- */
@media (max-width: 767px) {
  .p-news-item {
    padding: 14px 12px;
  }
  .p-news-item__info {
    font-size: 14px;
    line-height: 1.6;
  }
  .p-news-item__date {
    font-size: 12px;
  }
  .p-news-tabs {
    flex-wrap: wrap;
    gap: 6px;
  }
  .p-news-tab {
    padding: 6px 14px;
    font-size: 12px;
  }
}

/* ---- Mobile Column Article ---- */
@media (max-width: 767px) {
  .p-column-content {
    padding: 0 12px;
  }
  .p-column-content h2 {
    font-size: 18px;
    line-height: 1.5;
    margin: 32px 0 16px;
  }
  .p-column-content h3 {
    font-size: 16px;
    margin: 24px 0 12px;
  }
  .p-column-content p {
    font-size: 14px;
    line-height: 1.8;
  }
  .p-column-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 12px;
  }
  .p-column-content table th,
  .p-column-content table td {
    padding: 8px 10px;
    min-width: 100px;
  }
}

/* ---- Mobile Footer ---- */
@media (max-width: 767px) {
  .l-footer {
    padding: 40px 16px 24px;
  }
  .l-footer__nav-links {
    flex-wrap: wrap;
    gap: 0;
    justify-content: center;
  }
  .l-footer__nav-link {
    font-size: 13px;
    padding: 10px 8px;
  }
  .l-footer__nav-links-title {
    display: none;
  }
  .l-footer__bottom {
    font-size: 12px;
    padding: 16px 0;
  }
}

/* ---- Mobile Contact CTA (Cases page) ---- */
@media (max-width: 767px) {
  .p-contact-cta {
    padding: 36px 16px;
  }
  .p-contact-cta__ja {
    font-size: 20px;
  }
  .p-contact-cta__description {
    font-size: 13px;
  }
  .p-contact-cta__buttons {
    flex-direction: column;
    gap: 10px;
  }
  .p-contact-cta__button {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: 14px;
  }
}

/* ---- Mobile Service Pages ---- */
@media (max-width: 767px) {
  .p-service__content {
    padding: 0 12px;
  }
  .p-service__item {
    flex-direction: column;
  }
}

/* ---- Mobile About Page ---- */
@media (max-width: 767px) {
  .p-about__content {
    padding: 0 12px;
  }
}

/* ---- Mobile Download/Privacy Pages ---- */
@media (max-width: 767px) {
  .p-download__content,
  .p-privacy__content {
    padding: 0 12px;
  }
}

/* ---- General Mobile Typography ---- */
@media (max-width: 767px) {
  .container {
    padding: 0 16px;
  }
  .l-header {
    min-height: 140px;
  }
  .l-header__ja {
    font-size: clamp(24px, 6vw, 36px);
  }
  .l-section-header__ja {
    font-size: clamp(20px, 5vw, 28px);
  }
}

/* ---- Google Translate Widget Mobile ---- */
@media (max-width: 767px) {
  .google-translate-custom {
    bottom: 68px !important;
  }
}

/* ---- Sidebar fixed buttons mobile adjustment ---- */
@media (max-width: 767px) {
  .c-header__bottom-banner {
    display: none !important;
  }
}

/* ---- Smooth scroll behavior ---- */
html {
  scroll-behavior: smooth;
}

/* ---- Touch-friendly tap targets ---- */
@media (max-width: 767px) {
  a, button {
    min-height: 44px;
    min-width: 44px;
  }
  .c-header__navBtn {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ---- PC Side CTA Banner Overlap Fix ---- */
@media (min-width: 768px) {
  .c-header__bottom-banners {
    transform: none !important;
    opacity: 0.85 !important;
    flex-direction: column;
    bottom: 40px;
    right: 0;
    gap: 0;
    transition: opacity 0.3s ease !important;
  }
  .c-header__bottom-banners:hover {
    opacity: 1 !important;
  }
  .c-header__bottom-banner {
    padding: 8px 12px;
    font-size: 12px;
    max-width: 160px;
    border-radius: 8px 0 0 8px;
    border-right: none !important;
  }
  .c-header__bottom-banner-heading {
    font-size: 13px;
  }
  .c-header__bottom-banner-text {
    font-size: 10px;
  }
  .c-header__bottom-banner-icon {
    width: 24px;
    height: auto;
  }
}
