/*
Components for つむぎ舎
コンポーネント・レイアウト要素
*/

/* Buttons */
.btn,
.wp-block-button__link {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  border-radius: 4px;
  font-weight: bold;
  transition: all 0.3s ease;
  text-decoration: none;
  background-color: transparent;
}

.btn:hover,
.wp-block-button__link:hover {
  background-color: var(--color-accent);
  color: #fff;
}

.btn-primary {
  background-color: var(--color-accent);
  color: #fff;
}

.btn-primary:hover {
  background-color: #b19575;
  border-color: #b19575;
}

/* WordPressボタンブロックの中央寄せ */
.wp-block-buttons {
  justify-content: center;
}

/* Cards */
.card {
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  background-color: #fff;
  display: flex;
  flex-direction: column;
}

.card-image {
  display: block;
  width: 100%;
  height: 200px;
  margin: 0;
  overflow: hidden;
  background-color: var(--color-light-gray);
}

.card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

img.card-image {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: center;
}

.card-image-link {
  display: block;
  height: 200px;
  overflow: hidden;
  background-color: var(--color-light-gray);
}

.card-image-link .card-image {
  height: 100%;
}

.card-content {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  margin: 0 0 10px 0;
  font-size: 1.2rem;
}

.card-title a {
  text-decoration: none;
  color: var(--color-primary);
}

.card-title a:hover {
  color: var(--color-secondary);
}

/* Tiles (for illustrations/goods) */
.posts-grid.grid {
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* タブレット */
@media (max-width: 992px) {
  .posts-grid.grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
  }
}

/* スマホ */
@media (max-width: 576px) {
  .posts-grid.grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

/* Illustration & Goods Tiles */
.illustration-tile,
.goods-tile {
  position: relative;
  overflow: hidden;
  background: #f5f5f5;
  border-radius: 8px;
  aspect-ratio: 1 / 1;
}

.tile-link {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  text-decoration: none;
  color: inherit;
}

.tile-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.tile-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
}

.tile-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
  color: white;
  padding: 20px 15px 15px;
  transition: all 0.3s ease;
}

.tile-title {
  font-size: 14px;
  margin: 0 0 5px 0;
  font-weight: bold;
  line-height: 1.3;
}

.tile-date {
  font-size: 11px;
  opacity: 0.8;
}

.illustration-tile:hover .tile-overlay,
.goods-tile:hover .tile-overlay {
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3) 100%);
}

@media (max-width: 576px) {
  .tile-title {
    font-size: 12px;
  }
  .tile-date {
    font-size: 10px;
  }
  .tile-overlay {
    padding: 15px 10px 10px;
  }
}

/* Blog/News Lists */
.blog-latest {
  background-color: #fff;
}

.blog-latest .container {
  max-width: 800px;
}

.blog-post-excerpt {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 20px 0;
  border-bottom: 1px solid var(--color-border);
}

.blog-post-excerpt:last-child {
  border-bottom: none;
}

.post-meta {
  text-align: center;
  flex-shrink: 0;
}

.post-date-day {
  display: block;
  font-size: 32px;
  font-weight: bold;
  line-height: 1;
}

.post-date-month {
  display: block;
  font-size: 14px;
  color: var(--color-secondary);
}

.post-content {
  flex: 1;
}

.post-header {
  margin-bottom: 10px;
}

.post-title {
  margin: 0 0 5px 0;
  font-size: 1.1rem;
}

.post-title a {
  text-decoration: none;
  color: var(--color-primary);
}

.post-title a:hover {
  color: var(--color-secondary);
}

.post-meta-tags {
  font-size: 0.9rem;
  color: var(--color-secondary);
}

/* News Lists */
.news-list {
  max-width: 800px;
  margin: 0 auto;
}

.news-archive .container {
  max-width: 800px;
}

/* Forms */
.contact-form {
  text-align: center;
}

.contact-form .form-group {
  margin-bottom: 20px;
  text-align: left;
}

.contact-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
}

.contact-form button {
  width: 100%;
}

@media (min-width: 768px) {
  .contact-form button {
    width: auto;
  }
}

/* Contact Form 7 Styles */
.wpcf7 {
  max-width: 100%;
}

.wpcf7-form {
  text-align: center;
}

.wpcf7-form .form-group {
  margin-bottom: 20px;
  text-align: left;
}

.wpcf7-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: var(--color-primary);
}

.wpcf7-form .required {
  color: #e74c3c;
}

.wpcf7-form input[type="text"],
.wpcf7-form input[type="email"],
.wpcf7-form input[type="tel"],
.wpcf7-form input[type="url"],
.wpcf7-form textarea,
.wpcf7-form select {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.wpcf7-form input[type="text"]:focus,
.wpcf7-form input[type="email"]:focus,
.wpcf7-form input[type="tel"]:focus,
.wpcf7-form input[type="url"]:focus,
.wpcf7-form textarea:focus,
.wpcf7-form select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(197, 169, 139, 0.1);
}

.wpcf7-form textarea {
  resize: vertical;
  min-height: 120px;
}

.wpcf7-form input[type="submit"] {
  background-color: var(--color-accent);
  color: #fff;
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
}

.wpcf7-form input[type="submit"]:hover {
  background-color: #b19575;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Validation Messages */
.wpcf7-not-valid-tip {
  color: #e74c3c;
  font-size: 0.9rem;
  margin-top: 5px;
  display: block;
}

.wpcf7-validation-errors,
.wpcf7-mail-sent-ng {
  border: 2px solid #e74c3c;
  background-color: #fdf2f2;
  color: #e74c3c;
  padding: 15px;
  margin: 20px 0;
  border-radius: 4px;
  font-weight: bold;
}

.wpcf7-mail-sent-ok {
  border: 2px solid #27ae60;
  background-color: #f0f9f4;
  color: #27ae60;
  padding: 15px;
  margin: 20px 0;
  border-radius: 4px;
  font-weight: bold;
}

.wpcf7-spinner {
  visibility: hidden;
}

.wpcf7-form.submitting .wpcf7-spinner {
  visibility: visible;
}

/* Form field focus states */
.wpcf7-form input.wpcf7-not-valid,
.wpcf7-form textarea.wpcf7-not-valid {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

@media (min-width: 768px) {
  .wpcf7-form input[type="submit"] {
    width: auto;
    min-width: 200px;
  }
}

/* Contact Form 7 fieldset and hidden fields fix */
.wpcf7-form fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

.wpcf7-form legend {
  display: none;
}

.hidden-fields-container {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
}

.wpcf7-form .wpcf7-hidden {
  display: none !important;
}

/* Contact Form 7 additional fixes */
.wpcf7-form .wpcf7-response-output {
  margin: 20px 0;
}

.wpcf7-form .wpcf7-mail-sent-ok {
  border: 2px solid #27ae60;
  background-color: #f0f9f4;
  color: #27ae60;
}

.wpcf7-form .wpcf7-validation-errors {
  border: 2px solid #e74c3c;
  background-color: #fdf2f2;
  color: #e74c3c;
}

/* Page Headers */
.page-header {
  text-align: center;
  margin-bottom: 40px;
}

.page-title {
  margin: 0 0 10px 0;
  font-size: 1.65rem;
}

.archive-description {
  margin: 0;
  color: var(--color-secondary);
  font-size: 1.1rem;
}

/* Section Titles */
.section-title {
  text-align: center;
  margin: 0 0 40px 0;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
}

/* Post Navigation */
.post-navigation .container {
  max-width: 800px;
}

.back-to-archive {
  text-align: center;
}

.nav-links {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.nav-previous,
.nav-next {
  flex: 1;
}

.nav-previous a,
.nav-next a {
  display: block;
  padding: 20px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-primary);
  border-radius: 4px;
}

.nav-previous a:hover,
.nav-next a:hover {
  background-color: var(--color-light-gray);
}

.nav-subtitle {
  display: block;
  font-size: 0.9rem;
  color: var(--color-secondary);
  margin-bottom: 5px;
}

.nav-title {
  display: block;
  font-weight: bold;
}

/* Animations */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in.stagger-1 { transition-delay: 0.1s; }
.fade-in.stagger-2 { transition-delay: 0.2s; }
.fade-in.stagger-3 { transition-delay: 0.3s; }
.fade-in.stagger-4 { transition-delay: 0.4s; }

/* Definition Lists */
.definition-list {
  margin-bottom: 2em;
}

.definition-list dt {
  font-weight: bold;
  margin-bottom: 0.5em;
  color: var(--color-primary);
}

.definition-list dd {
  margin-left: 0;
  margin-bottom: 1em;
}

/* Gallery */
.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gallery-item {
  flex: 1;
  min-width: 150px;
}

/* Text Utilities */
.text-center {
  text-align: center;
}

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

.text-right {
  text-align: right;
}
