/*
Theme Name: Ahiru Block
Theme URI: https://example.com/
Author: Tatsuyoshi Ishikawa
Description: Local + AI運用向けのシンプルな block theme
Version: 0.1.0
Requires at least: 6.6
Tested up to: 6.8
Requires PHP: 8.0
Text Domain: ahiru-block
*/

/* --- Layout helpers --- */
.ahiru-header-inner,
.ahiru-footer-inner {
  width: min(1100px, calc(100% - 48px));
  margin-inline: auto;
}

/* --- Navigation link underline reset --- */
.wp-block-navigation a {
  text-decoration: none;
}

/* --- Buttons outline style --- */
.wp-block-button.is-style-outline .wp-block-button__link:hover {
  background-color: var(--wp--preset--color--accent) !important;
  color: var(--wp--preset--color--base) !important;
}

/* --- Image-to-CSS button replacements --- */

/* Main navigation buttons (blue gradient with diagonal stripes) */
.ahiru-btn-nav {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 104px;
  height: 80px;
  background: linear-gradient(135deg, #5a8ec0 0%, #4a7db5 40%, #3a6da0 100%);
  background-size: 100% 100%;
  color: #fff;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.ahiru-btn-nav::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.07) 3px,
    rgba(255, 255, 255, 0.07) 6px
  );
}

.ahiru-btn-nav__ja {
  position: relative;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.3;
}

.ahiru-btn-nav__en {
  position: relative;
  font-size: 0.6rem;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 2px;
}

a:hover .ahiru-btn-nav {
  background: linear-gradient(135deg, #6a9ed0 0%, #5a8dc5 40%, #4a7db0 100%);
}

a .ahiru-btn-nav {
  color: #fff;
}

/* Legacy table layout — fluid + responsive */
.entry-content table,
.wp-block-post-content table {
  max-width: 100%;
  width: auto !important;
  border-collapse: collapse;
}

.entry-content td,
.wp-block-post-content td {
  width: auto !important;
  height: auto !important;
}

.entry-content img,
.wp-block-post-content img {
  max-width: 100%;
  height: auto;
}

/* Sidebar banner images */
.entry-content img[src*="ban0"],
.wp-block-post-content img[src*="ban0"] {
  width: 100%;
  max-width: 230px;
  height: auto;
  border: 1px solid #e2e5ea;
  border-radius: 4px;
  transition: opacity 0.2s;
}

.entry-content a:hover img[src*="ban0"],
.wp-block-post-content a:hover img[src*="ban0"] {
  opacity: 0.8;
}

/* Back to top button */
.ahiru-btn-up {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  color: #555;
  font-size: 0.7rem;
  white-space: nowrap;
}

a:hover .ahiru-btn-up {
  background: #f0f0f0;
  border-color: #999;
}

a .ahiru-btn-up {
  color: #555;
  text-decoration: none;
}

/* Map button (blue rounded pill) */
.ahiru-btn-map {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 14px;
  background: linear-gradient(180deg, #5a9ed0 0%, #3a7eb0 100%);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 12px;
  white-space: nowrap;
}

a:hover .ahiru-btn-map {
  background: linear-gradient(180deg, #6aaee0 0%, #4a8ec0 100%);
}

a .ahiru-btn-map {
  color: #fff;
  text-decoration: none;
}

/* --- Sidebar layout --- */
.ahiru-layout-with-sidebar {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  width: min(1100px, calc(100% - 48px));
  margin-inline: auto;
}

.ahiru-sidebar {
  position: sticky;
  top: 32px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 48px;
}

.ahiru-side-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ahiru-side-link img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  transition: opacity 0.2s;
}

.ahiru-side-link:hover img {
  opacity: 0.8;
}

.ahiru-side-banners {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ahiru-side-banners a img {
  width: 100%;
  height: auto;
  border: 1px solid #e2e5ea;
  border-radius: 4px;
  transition: opacity 0.2s;
}

.ahiru-side-banners a:hover img {
  opacity: 0.8;
}

/* --- Responsive --- */
@media (max-width: 781px) {
  .ahiru-layout-with-sidebar {
    grid-template-columns: 1fr;
    width: calc(100% - 32px);
    gap: 0;
  }

  .ahiru-sidebar {
    position: static;
    padding: 32px 0;
    flex-direction: column;
    align-items: center;
  }

  .ahiru-side-links {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .ahiru-side-link {
    width: calc(50% - 4px);
    max-width: 200px;
  }

  .ahiru-side-banners {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .ahiru-side-banners a {
    width: calc(50% - 4px);
    max-width: 160px;
  }

  .ahiru-header-inner,
  .ahiru-footer-inner {
    width: calc(100% - 32px);
  }

  .ahiru-footer-inner {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  /* Legacy tables: stack vertically on mobile */
  .entry-content table,
  .entry-content tbody,
  .entry-content tr,
  .entry-content td,
  .wp-block-post-content table,
  .wp-block-post-content tbody,
  .wp-block-post-content tr,
  .wp-block-post-content td {
    display: block;
    width: 100% !important;
  }

  /* Hide spacer/decorative images on mobile */
  .entry-content img[src*="spacer"],
  .wp-block-post-content img[src*="spacer"] {
    display: none;
  }

  /* Main nav buttons: horizontal scroll row */
  .ahiru-btn-nav {
    width: 80px;
    height: 64px;
  }

  .ahiru-btn-nav__ja {
    font-size: 0.7rem;
  }

  .ahiru-btn-nav__en {
    font-size: 0.55rem;
  }

  /* Sidebar banners: horizontal row on mobile */
  .entry-content img[src*="ban0"],
  .wp-block-post-content img[src*="ban0"] {
    max-width: 160px;
    display: inline-block;
    margin: 4px;
  }
}
