/*
Theme Name: Cafe Cafe
Theme URI: https://example.com/
Author: Your Name
Description: 参考サイトに限りなく近づけたモダン北欧カフェ風テーマ。動きも派手で高級感あり。
Version: 3.0
Text Domain: cafecafe
*/

/* -- カラー変数 -- */
:root {
  --color-primary: #1b3b2d; /* 深い緑 */
  --color-secondary: #7e503b; /* 茶色 */
  --color-bg: #f9f7f3; /* アイボリー */
  --color-text: #2f2f2f;
  --color-accent: #d9b382;
  --radius: 12px;
  --shadow-light: rgba(30, 50, 40, 0.15);
  --font-sans: "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Merriweather", serif;
  --transition-fast: 0.3s ease-in-out;
}

/* リセット */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  overflow-x: hidden;
  scroll-behavior: smooth;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ヘッダー */
.site-header {
  position: sticky;
  top: 0;
  background: var(--color-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.3rem 2rem;
  box-shadow: 0 3px 8px var(--shadow-light);
  z-index: 10000;
  transition: background-color 0.4s ease;
}

.site-header.scrolled {
  background-color: rgba(27, 59, 45, 0.9);
  box-shadow: 0 5px 20px rgba(27, 59, 45, 0.7);
}

.site-branding h1,
.site-branding img {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 2rem;
  color: var(--color-primary);
  cursor: default;
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.site-nav ul li a {
  font-weight: 600;
  color: var(--color-secondary);
  font-size: 1rem;
  padding: 0.4rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.25s ease;
  position: relative;
  cursor: pointer;
}

.site-nav ul li a:hover,
.site-nav ul li a:focus {
  border-color: var(--color-accent);
  color: var(--color-primary);
  outline: none;
}

/* コンテナ */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ヒーローセクション */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5rem 0 7rem 0;
  gap: 3rem;
  position: relative;
  overflow: visible;
}

.hero-inner {
  flex: 1 1 500px;
  max-width: 500px;
}

.hero-inner h2 {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 3.4rem;
  color: var(--color-primary);
  line-height: 1.1;
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.hero-inner p {
  font-size: 1.2rem;
  color: #444;
  margin-bottom: 1.6rem;
  font-weight: 500;
}

.hero .visual {
  flex: 1 1 500px;
  max-width: 500px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 25px 35px var(--shadow-light);
  cursor: pointer;
  transition: transform 0.6s ease;
}

.hero .visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s ease;
}

.hero .visual:hover img,
.hero .visual:focus img {
  transform: scale(1.15) rotate(2deg);
  outline: none;
}

/* メニューグリッド */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2.5rem;
  margin-top: 2rem;
}

/* メニューカード */
.menu-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 10px 20px var(--shadow-light);
  padding: 1.8rem 1.5rem;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  outline-offset: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.menu-card:hover,
.menu-card:focus {
  transform: translateY(-8px);
  box-shadow: 0 18px 40px rgba(126, 80, 59, 0.4);
  outline: none;
}

.menu-card img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  box-shadow: 0 5px 15px rgba(27, 59, 45, 0.15);
}

/* メニューカードテキスト */
.menu-card h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-primary);
  margin-bottom: 0.4rem;
  text-align: center;
}

.menu-card p {
  font-weight: 600;
  color: var(--color-secondary);
  font-size: 1rem;
}

/* こだわり商品 */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 1.8rem;
}

/* 店内ギャラリー */
.interior-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.8rem;
  margin-top: 2.2rem;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.interior-gallery img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: 0 8px 20px var(--shadow-light);
  cursor: pointer;
  transition: transform 0.35s ease;
}

.interior-gallery img:hover,
.interior-gallery img:focus {
  transform: scale(1.12) rotate(2deg);
  outline: none;
}

/* 下段2枚は中央寄せ */
.interior-gallery img:nth-child(n + 4) {
  justify-self: center;
  width: 85%;
}

/* 店舗情報・アクセス */
.access-info {
  display: flex;
  flex-wrap: wrap;
  gap: 3rem;
  align-items: flex-start;
  margin-top: 3rem;
}

.access-info dl {
  flex: 1 1 320px;
  font-size: 1.15rem;
  line-height: 1.6;
}

.access-info dt {
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 1.6rem;
}

.access-info dd {
  margin: 0.3rem 0 0 0;
  color: var(--color-secondary);
}

/* マップ */
.access-info .map {
  flex: 1 1 360px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 28px var(--shadow-light);
  min-height: 280px;
}

/* お問い合わせ固定リンク */
.contact-quicklink {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--color-secondary);
  padding: 1rem 1.5rem;
  border-radius: 30px 0 0 30px;
  box-shadow: 0 8px 25px var(--shadow-light);
  z-index: 15000;
  transition: background-color var(--transition-fast);
  font-weight: 700;
}

.contact-quicklink a {
  color: white;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
}

.contact-quicklink a:hover,
.contact-quicklink a:focus {
  background-color: var(--color-primary);
  outline: none;
  text-decoration: underline;
}

/* モーダル問い合わせフォーム */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 16000;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
  animation: fadeInModal 0.35s ease forwards;
}

@keyframes fadeInModal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-content {
  background: var(--color-bg);
  padding: 2rem 2.5rem;
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  box-shadow: 0 15px 40px var(--shadow-light);
  position: relative;
  font-family: var(--font-sans);
}

.modal-content h2 {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 2rem;
  color: var(--color-primary);
  margin-bottom: 1.5rem;
  text-align: center;
}

.modal-content label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--color-secondary);
  font-size: 1rem;
}

.modal-content input[type="text"],
.modal-content input[type="email"],
.modal-content textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  border: 1.7px solid var(--color-secondary);
  font-size: 1rem;
  margin-bottom: 1.4rem;
  font-family: var(--font-sans);
  transition: border-color 0.3s ease;
}

.modal-content input[type="text"]:focus,
.modal-content input[type="email"]:focus,
.modal-content textarea:focus {
  border-color: var(--color-primary);
  outline: none;
}

.modal-content textarea {
  resize: vertical;
  min-height: 120px;
}

.modal-content button.submit-btn {
  background-color: var(--color-secondary);
  border: none;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.9rem 1.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.3s ease;
  width: 100%;
}

.modal-content button.submit-btn:hover,
.modal-content button.submit-btn:focus {
  background-color: var(--color-primary);
  outline: none;
}

/* モーダルクローズボタン */
.modal-close {
  position: absolute;
  right: 1rem;
  top: 1rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--color-secondary);
  cursor: pointer;
  transition: color 0.25s ease;
}

.modal-close:hover,
.modal-close:focus {
  color: var(--color-primary);
  outline: none;
}

/* フェードイン用 */
.fade-in {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s ease, transform 0.8s ease;
  will-change: opacity, transform;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* オープニングアニメーション保持 */
#opening-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 99999;
  user-select: none;
}

#opening-overlay h1 {
  font-family: var(--font-serif);
  font-size: 6rem;
  color: #fff;
  letter-spacing: 0.16em;
  display: flex;
  gap: 0.2em;
  perspective: 1200px;
  user-select: none;
}

#opening-overlay h1 span {
  display: inline-block;
  transform-origin: bottom center;
  animation: swingIn 1.3s ease forwards;
  opacity: 0;
}

#opening-overlay h1 span:nth-child(1) {
  animation-delay: 0s;
}
#opening-overlay h1 span:nth-child(2) {
  animation-delay: 0.1s;
}
#opening-overlay h1 span:nth-child(3) {
  animation-delay: 0.2s;
}
#opening-overlay h1 span:nth-child(4) {
  animation-delay: 0.3s;
}
#opening-overlay h1 span:nth-child(5) {
  animation-delay: 0.4s;
}
#opening-overlay h1 span:nth-child(6) {
  animation-delay: 0.5s;
}
#opening-overlay h1 span:nth-child(7) {
  animation-delay: 0.6s;
}
#opening-overlay h1 span:nth-child(8) {
  animation-delay: 0.7s;
}
#opening-overlay h1 span:nth-child(9) {
  animation-delay: 0.8s;
}

@keyframes swingIn {
  0% {
    transform: rotateX(90deg);
    opacity: 0;
  }
  70% {
    transform: rotateX(-15deg);
    opacity: 1;
  }
  100% {
    transform: rotateX(0deg);
  }
}

#opening-overlay.fade-out {
  animation: fadeOut 1s ease forwards;
  animation-delay: 2.8s;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

/* レスポンシブ */

@media (max-width: 1024px) {
  .hero {
    flex-direction: column;
    padding: 3rem 0 4rem 0;
  }
  .hero-inner,
  .hero .visual {
    max-width: 100%;
  }
  .menu-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
  .interior-gallery {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

@media (max-width: 768px) {
  .site-nav ul {
    gap: 1.1rem;
  }
  .contact-quicklink {
    right: auto;
    left: 50%;
    bottom: 0;
    top: auto;
    transform: translateX(-50%);
    border-radius: 30px 30px 0 0;
    padding: 1.1rem 2rem;
  }
  .contact-quicklink a {
    font-size: 1.2rem;
  }
}
