/* 🌿 Haikuku Morning Calm Theme — cleaned, responsive, and improved dropdown animation */

:root {
  --bg-top: #f4f8f4;
  --bg-bottom: #e9f2e8;
  --text: #24352e;
  --primary: #2e6b4a;
  --primary-hover: #4d8b73;
  --card-bg: #ffffff;
  --card-border: #d8e4db;
  --shadow: rgba(0, 0, 0, 0.05);
}

/* Base */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", "Noto Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Meiryo", "Microsoft YaHei", "PingFang SC", "Malgun Gothic", sans-serif;
  color: var(--text);
  background: linear-gradient(to bottom, var(--bg-top), var(--bg-bottom));
  line-height: 1.6;
  overflow-x: hidden;
}

/* Hide initial content until i18n/dynamic data is ready (used on post.html) */
html.i18n-pending body { visibility: hidden; }

/* Layout helpers */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Navbar */
header.navbar {
  background: #ffffff;
  box-shadow: 0 2px 8px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

header.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}

header .brand img {
  height: 90px;
  width: auto;
  display: block;
}

/* Hamburger (right-aligned) */
.hamburger {
  display: none;
  flex-shrink: 0;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  background: none;
  border: 1px solid transparent;
  padding: 8px;
  border-radius: 8px;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 3px;
  background-color: var(--primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}
.hamburger.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Nav list */
nav ul {
  list-style: none;
  display: flex;
  gap: 18px;
  margin: 0;
  padding: 0;
}
nav a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}
nav a:hover { background: var(--primary-hover); color: #ffffff; }
nav a.active { background: var(--primary); color: #ffffff; }

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 2px 10px var(--shadow);
  margin: 1rem 0;
  padding: 1.5rem;
}

/* Hero */
.hero {
  text-align: center;
  background: #ffffffc0;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 2px 10px var(--shadow);
  padding: 2rem 1rem;
  margin: 1.5rem 0;
}
.hero h1 {
  font-family: "Merriweather", serif;
  color: var(--primary);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

/* Haiku block */
.haiku {
  font-family: "Merriweather", "Noto Serif", "Noto Serif CJK SC", "Noto Serif JP", "Noto Serif KR", serif;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  margin: 1.25rem 0;
  line-height: 1.8;
  letter-spacing: 0.4px;
}

/* RTL language font fallback */
html[dir="rtl"] {
  font-family: "Noto Naskh Arabic", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* Footer */
.footer {
  background: #ffffff;
  border-top: 1px solid var(--card-border);
  text-align: center;
  padding: 1rem;
  color: var(--text);
  opacity: 0.9;
  margin-top: 2rem;
}

/* Buttons */
.button, button, input[type="submit"] {
  display: inline-block;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}
.button:hover, button:hover, input[type="submit"]:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(46, 107, 74, 0.2);
}
.button:active, button:active, input[type="submit"]:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(46, 107, 74, 0.15);
}

/* Forms — unified */
form {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 2px 10px var(--shadow);
  max-width: 640px;
  margin: 1.5rem auto;
  padding: 1.5rem 2rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1rem;
}
.field label {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}
input, select, textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: #ffffff;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 5px rgba(46, 107, 74, 0.25);
  outline: none;
  background: #fefefe;
}
textarea { resize: vertical; min-height: 110px; }

/* Mobile Improvements */
@media (max-width: 900px) {
  header .brand img { height: 72px; }
}

@media (max-width: 700px) {
  .hamburger { display: flex; }

  nav ul {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    background: #ffffff;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    box-shadow: 0 4px 10px var(--shadow);
    border-top: 1px solid var(--card-border);
    padding: 10px 0;
    z-index: 200;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
  }

  nav ul.active {
    display: flex;
    opacity: 1;
    transform: translateY(0);
  }

  nav ul li { width: 100%; }

  nav ul li a {
    display: block;
    width: 100%;
    padding: 12px 20px;
    color: var(--primary);
  }

  nav ul li a:hover {
    background: var(--primary-hover);
    color: #fff;
  }
}

.post-card {
  text-align: center;
}
.post-card .haiku {
  margin-top: 0.5rem;
}



/* ===== Language Switcher (modern neutral) ===== */
.lang-switcher-anchor{ position:relative; margin:0 .5rem; display:flex; align-items:center; }
.lang-switcher-label,.lang-switcher-select{ display:none; }
.lang-switcher{ position:relative; }
.lang-switcher button{ background:transparent; border:none; padding:0; margin:0; display:flex; align-items:center; cursor:pointer; }
.lang-switcher button img{ width:28px; height:20px; border-radius:3px; object-fit:cover; box-shadow:0 2px 6px rgba(0,0,0,0.25); }
.lang-switcher button span{ display:none; }
.lang-switcher-list{ position:absolute; top:120%; right:0; background:#fff; border:1px solid rgba(0,0,0,0.15); border-radius:6px; box-shadow:0 10px 25px rgba(0,0,0,0.15); list-style:none; padding:.35rem; margin:0; display:none; z-index:999; width:150px; }
.lang-switcher.open .lang-switcher-list{ display:block; }
.lang-switcher-list button{ width:100%; background:none; border:none; padding:.2rem 0; text-align:left; display:flex; align-items:center; gap:.4rem; cursor:pointer; font-size:.85rem; color:#222; }
.lang-switcher-list button img{ width:22px; height:15px; border-radius:2px; object-fit:cover; box-shadow:none; }
.lang-switcher-list button.active span{ font-weight:700; }
.posts-feed{ position:relative; min-height:280px; }
.posts-feed .feed-inner{ display:grid; gap:1rem; transition:opacity .35s ease; opacity:1; }
.posts-feed[aria-busy="true"] .feed-inner{ opacity:.4; }
.placeholder-card{ border:none; background:rgba(0,0,0,0.04); padding:1.2rem 1rem; border-radius:12px; }
.placeholder-pill{ display:inline-block; width:42px; height:18px; border-radius:999px; background:rgba(0,0,0,0.12); margin-bottom:.5rem; animation:pulse 1.4s ease-in-out infinite; }
.placeholder-meta{ display:flex; gap:.5rem; margin-bottom:.6rem; }
.placeholder-line{ display:block; height:12px; border-radius:6px; background:rgba(0,0,0,0.09); margin:.3rem 0; animation:pulse 1.4s ease-in-out infinite; }
.placeholder-line.short{ width:65px; }
.placeholder-line.shorter{ width:45px; }
.placeholder-line.w-60{ width:60%; }
.placeholder-title .placeholder-line:first-child{ width:80%; }
.placeholder-button{ display:inline-block; width:120px; height:34px; border-radius:999px; background:rgba(0,0,0,0.09); animation:pulse 1.4s ease-in-out infinite; margin-top:1rem; }
@keyframes pulse{
  0%{ opacity:.45; }
  50%{ opacity:.85; }
  100%{ opacity:.45; }
}
.lang-trigger-wrap{ position:relative; }
.lang-trigger-btn{ display:flex; align-items:center; gap:.5rem; background:#fff; border:1px solid rgba(0,0,0,.15); border-radius:.5rem; padding:.35rem .5rem; line-height:1; cursor:pointer; box-shadow:0 1px 2px rgba(0,0,0,.06); transition: box-shadow .15s ease, transform .05s; color: var(--text); }
.lang-trigger-btn:hover{ box-shadow:0 2px 8px rgba(0,0,0,.08); }
.lang-trigger-btn:active{ transform: translateY(1px); }
.flag-img{ width:24px; height:16px; object-fit:cover; border-radius:2px; box-shadow:0 0 0 1px rgba(0,0,0,.15); }
.lang-menu{ position:absolute; right:0; top:110%; background:#fff; border:1px solid rgba(0,0,0,.1); border-radius:.5rem; width:max-content; min-width:auto; max-width:calc(100vw - 16px); white-space:nowrap; max-height:60vh; overflow:auto; padding:.25rem; box-shadow:0 8px 24px rgba(0,0,0,.12); z-index:10000; }
.lang-option{ display:flex; align-items:center; gap:.5rem; width:100%; background:transparent; border:0; text-align:left; padding:.5rem .65rem; font-size:.9rem; cursor:pointer; line-height:1.2; color: var(--text); }
.lang-option:hover{ background:rgba(0,0,0,.05); }

/* Language badge & fallback notice */
.lang-badge{ position:absolute; top:.75rem; right:.75rem; font-size:.75rem; line-height:1; padding:.3rem .5rem; border-radius:.5rem; background:rgba(0,0,0,.06); backdrop-filter:saturate(140%) blur(2px); }
.notice{ background:#fff3cd; border:1px solid #ffeeba; padding:.75rem 1rem; border-radius:.5rem; margin:.75rem 0; }

@media (max-width:768px){ .lang-trigger-btn{ padding:.4rem .5rem; } }
