/* =========================================================
   Wooden Fish — Zen Minimalist Stylesheet (v2)
   ========================================================= */

:root {
  --bg: #F5F0E6;
  --bg-soft: #EDE5D4;
  --ink: #2A2520;
  --ink-soft: #6B5F52;
  --ink-faint: #B5A48F;
  --accent: #8B6F47;
  --gold: #B89B5E;
  --gold-deep: #8C6A31;
  --card: rgba(255, 252, 246, 0.88);
  --card-edge: rgba(92, 63, 33, 0.12);
  --paper-line: rgba(42, 37, 32, 0.10);

  --serif: "Cormorant Garamond", "Songti SC", "STSong", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans", "Segoe UI", system-ui, sans-serif;

  --max-w: 720px;

  /* Temporary wooden mallet cursor until a final asset replaces it */
  --mallet-cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='52' height='52' viewBox='0 0 52 52'><defs><linearGradient id='h' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='%23d4a46a'/><stop offset='1' stop-color='%23a46d38'/></linearGradient><linearGradient id='s' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='%23c79358'/><stop offset='1' stop-color='%238a562a'/></linearGradient></defs><path d='M37 7 L18 28' stroke='url(%23s)' stroke-width='6.5' stroke-linecap='round'/><path d='M39 8.5 L20 29.5' stroke='%23f6d4a7' stroke-width='1.6' stroke-linecap='round' opacity='0.65'/><g transform='rotate(-24 14 33)'><ellipse cx='14' cy='33' rx='10.5' ry='8.5' fill='url(%23h)' stroke='%23663f1d' stroke-width='1.8'/><ellipse cx='11.8' cy='30.5' rx='3.4' ry='2.2' fill='%23fff0ca' opacity='0.72'/><path d='M5.8 33 C8.5 29.5 19.5 28.8 23 33' fill='none' stroke='%2387562b' stroke-width='1.4' opacity='0.35'/></g></svg>") 14 33, pointer;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(184, 155, 94, 0.04) 0, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(139, 111, 71, 0.05) 0, transparent 50%);
  z-index: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- Top Bar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 28px;
  position: relative;
  z-index: 3;
  gap: 12px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-link {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-soft);
  border: none;
  letter-spacing: 0.3px;
  font-weight: 500;
}
.topbar-link:hover { color: var(--ink); border-bottom: 1px solid var(--ink); }

/* ---------- Brand Mark (top-left logo) ---------- */
.brand-mark {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  color: var(--ink);
  border: none;
  letter-spacing: 0.6px;
  line-height: 1;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.brand-mark:hover {
  color: var(--gold-deep);
  border-bottom: none;
}

/* ---------- Language Dropdown ---------- */
.lang-dropdown {
  position: relative;
}

.lang-current {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--paper-line);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 22px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  min-width: 110px;
}
.lang-current:hover {
  border-color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.85);
}
.lang-current .chevron {
  transition: transform 0.2s ease;
  opacity: 0.6;
}
.lang-current[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  margin: 0;
  padding: 6px 0;
  background: #FFFCF6;
  border: 1px solid var(--paper-line);
  border-radius: 14px;
  list-style: none;
  min-width: 150px;
  z-index: 20;
  box-shadow: 0 10px 28px rgba(60, 40, 20, 0.12);
  animation: dropIn 0.15s ease-out;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lang-menu[hidden] { display: none; }

.lang-menu li { margin: 0; padding: 0; }

.lang-menu a {
  display: block;
  padding: 10px 18px;
  border: none;
  color: var(--ink);
  font-size: 14px;
  font-family: var(--sans);
}
.lang-menu a:hover { background: var(--bg-soft); color: var(--ink); }
.lang-menu a.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--bg-soft);
}

/* ---------- Sound Toggle ---------- */
.sound-toggle {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--paper-line);
  color: var(--ink-soft);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.sound-toggle:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  flex: 1;
  width: 100%;
  padding: clamp(8px, 1.6vh, 16px) 24px clamp(10px, 2vh, 22px);
}

.hero-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(14px, 2vh, 20px);
  margin-bottom: clamp(8px, 1.5vh, 16px);
}

.date {
  font-family: var(--sans);
  font-size: 17px;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-align: center;
  color: var(--ink);
  margin: 0;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.date .cal-icon {
  flex-shrink: 0;
  color: var(--gold-deep);
  opacity: 0.85;
  position: relative;
  top: -1px;
}

.merit-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.merit-panel::after {
  content: "";
  width: 76px;
  height: 1px;
  margin-top: 8px;
  background: linear-gradient(90deg, transparent, rgba(140, 106, 49, 0.72), transparent);
}

.merit-label {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin: 0;
  font-weight: 700;
}

.merit-count {
  font-family: var(--serif);
  font-size: clamp(56px, 10vh, 78px);
  font-weight: 500;
  color: #2F2011;
  line-height: 1;
  margin: 0;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 14px rgba(184, 155, 94, 0.18);
  transition: transform 0.12s ease;
}
.merit-count.bump { transform: scale(1.06); }

/* ---------- Wooden Fish ---------- */
.fish-wrap {
  position: relative;
  overflow: visible;
  margin: clamp(56px, 8vh, 96px) 0 10px;
  cursor: var(--mallet-cursor);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  width: min(340px, 36vw, calc(100vw - 56px));
  max-width: 100%;
  aspect-ratio: 2146 / 1612;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fish-wrap:active .fish-svg {
  transform: scale(0.965) translateY(4px) rotate(-1deg);
}

.fish-svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.08s ease-out;
  filter: drop-shadow(0 14px 18px rgba(60, 40, 20, 0.16));
  pointer-events: none; /* let cursor + clicks fall through to wrap */
}

.tap-hint {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 16px;
  margin: 0;
  letter-spacing: 0.5px;
  transition: opacity 0.4s ease;
}
.tap-hint.faded { opacity: 0; }

/* "+1 Merit" — floats up beside the right edge of the fish (not over it) */
.merit-pop {
  position: absolute;
  top: 38%;
  left: 100%;
  margin-left: -4px;
  pointer-events: none;
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
  animation: floatUp 1.2s ease-out forwards;
  z-index: 5;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}

@keyframes floatUp {
  0%   { opacity: 0; transform: translate(-6px, 6px) scale(0.75); }
  20%  { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(22px, -50px) scale(1); }
}

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 10px;
  padding: 10px 16px 18px;
  font-size: 13px;
  color: var(--ink-faint);
  font-family: var(--serif);
  letter-spacing: 0.5px;
}
.footer a {
  color: var(--ink-soft);
  border: none;
  margin: 0;
}
.footer a:hover { color: var(--ink); }

/* ---------- Article (about page) ---------- */
.article {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 24px 80px;
}
.article h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 38px;
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 12px;
}
.article .lead {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  color: var(--ink-soft);
  margin: 0 0 32px;
}
.article h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  color: var(--ink);
  margin: 44px 0 12px;
  border-bottom: 1px solid var(--paper-line);
  padding-bottom: 8px;
}
.article p { margin: 0 0 16px; color: var(--ink); }
.article ul { padding-left: 22px; margin: 0 0 16px; }
.article li { margin-bottom: 6px; }
.article a { border-bottom: 1px solid var(--paper-line); }

.back-link {
  display: inline-block;
  margin-bottom: 32px;
  font-family: var(--serif);
  font-size: 15px;
  border: none;
  color: var(--ink-soft);
}
.back-link::before { content: "← "; }

/* ---------- Mobile ---------- */
@media (max-width: 540px) {
  .topbar { padding: 12px 16px; }
  .topbar-left, .topbar-right { gap: 10px; }
  .topbar-link { font-size: 13px; }
  .brand-mark { font-size: 22px; }
  .lang-current { padding: 7px 12px; font-size: 13px; min-width: auto; }

  .hero { padding: 10px 16px 20px; }
  .hero-meta { gap: 14px; width: 100%; margin-bottom: 8px; }
  .date { font-size: 15px; letter-spacing: 0.06em; gap: 7px; }
  .date .cal-icon { width: 14px; height: 14px; }
  .merit-label { font-size: 12px; letter-spacing: 0.22em; }
  .merit-count { font-size: 58px; }

  .fish-wrap { width: min(290px, calc(100vw - 40px)); margin: 36px 0 8px; }
  .merit-pop { font-size: 16px; }
  .footer { padding: 8px 16px 16px; font-size: 12px; gap: 3px 8px; }

  .article h1 { font-size: 30px; }
  .article h2 { font-size: 22px; }
}

@media (max-height: 860px) {
  .topbar { padding-top: 10px; padding-bottom: 10px; }
  .hero { padding-top: 8px; padding-bottom: 16px; }
  .date { font-size: 16px; }
  .merit-label { font-size: 13px; }
  .fish-wrap { width: min(300px, 34vw, calc(100vw - 56px)); }
  .tap-hint { font-size: 15px; }
  .footer { padding-top: 8px; padding-bottom: 14px; }
}

@media (max-height: 720px) {
  .hero-meta { gap: 10px; margin-bottom: 4px; }
  .merit-panel { gap: 6px; }
  .merit-panel::after { margin-top: 4px; }
  .merit-count { font-size: 50px; }
  .fish-wrap { width: min(250px, 30vw, calc(100vw - 56px)); margin-top: 32px; }
  .tap-hint { font-size: 14px; }
}
