/* ============================================================
   japnamegenerator.com — Main Stylesheet
   Design: Light, airy, Japan-inspired. Cherry blossom, paper, zen.
   ============================================================ */

/* --- Variables --- */
:root {
  --bg:               #FAF7F2;
  --bg-card:          #FFFFFF;
  --bg-section:       #F4EDE3;
  --primary:          #D97BA0;
  --primary-light:    #F2D0E0;
  --primary-dark:     #B85C81;
  --accent-red:       #C4473A;
  --accent-green:     #2F5D50;
  --accent-green-lt:  #4A8A72;
  --text:             #2B2B2B;
  --text-light:       #6B6260;
  --text-muted:       #9A8E85;
  --border:           #E6DAD0;
  --border-light:     #F0E8DE;
  --shadow-sm:        0 1px 4px rgba(43,27,18,.06);
  --shadow-md:        0 2px 14px rgba(43,27,18,.10);
  --shadow-lg:        0 6px 30px rgba(43,27,18,.13);
  --radius:           14px;
  --radius-sm:        8px;
  --radius-lg:        20px;
  --font-sans:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-ja:          'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo', sans-serif;
  --max-w:            1100px;
  --max-w-text:       720px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 3px; }
button { font-family: inherit; cursor: pointer; border: none; }
button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
select, input { font-family: inherit; }

/* --- SR-only utility --- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* --- Layout --- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}
.section { padding: 68px 0; }
.section-alt { background: var(--bg-section); }

/* ================================================================
   HEADER
   ================================================================ */
.site-header {
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.025em;
  flex-shrink: 0;
}
.logo-icon { color: var(--primary); flex-shrink: 0; }
.logo em { font-style: normal; color: var(--primary-dark); }
.site-nav { display: flex; gap: 2px; align-items: center; }
.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-light);
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  transition: color .14s, background .14s;
}
.site-nav a:hover {
  color: var(--primary-dark);
  background: var(--primary-light);
  text-decoration: none;
}

/* ================================================================
   HERO
   ================================================================ */
.hero {
  padding: 64px 0 52px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
/* Ambient glow blobs */
.hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -80px;
  width: 320px; height: 320px;
  background: radial-gradient(circle, #f2d0e0 0%, transparent 65%);
  opacity: .5;
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -30px; left: -50px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, #f5e6c8 0%, transparent 70%);
  opacity: .35;
  pointer-events: none;
}
/* Decorative sakura SVGs in hero corners */
.sakura-deco {
  position: absolute;
  pointer-events: none;
  opacity: .13;
}
.sakura-deco.top-left  { top: 20px;  left: 24px; }
.sakura-deco.top-right { top: 28px;  right: 28px; transform: rotate(25deg); }
.sakura-deco.bot-left  { bottom: 16px; left: 60px; transform: rotate(-15deg); }

.hero-h1 {
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.13;
  color: var(--text);
  margin-bottom: 18px;
  position: relative;
}
.hero-h1 em { font-style: normal; color: var(--primary-dark); }

.hero-sub {
  font-size: clamp(.97rem, 2.4vw, 1.18rem);
  color: var(--text-light);
  max-width: 560px;
  margin: 0 auto 40px;
  line-height: 1.7;
  position: relative;
}

/* ================================================================
   TOOL CARD
   ================================================================ */
.tool-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1.5px solid var(--border-light);
  padding: 32px 30px 28px;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

/* ---- Filters ---- */
.filters {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.filter-group label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}
.filter-group select {
  height: 44px;
  padding: 0 30px 0 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: .93rem;
  transition: border-color .14s, box-shadow .14s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239A8E85' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.filter-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(217,123,160,.2);
}

/* ---- Generate Button ---- */
.generate-btn {
  width: 100%;
  height: 52px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: background .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 3px 10px rgba(217,123,160,.38);
  margin-bottom: 10px;
}
.generate-btn:hover { background: var(--primary-dark); box-shadow: 0 5px 18px rgba(217,123,160,.48); }
.generate-btn:active { transform: translateY(1px); }

.micro-text {
  text-align: center;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ---- Results Area ---- */
#results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
  min-height: 0;
}
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 36px;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border);
}
.batch-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ================================================================
   NAME CARD
   ================================================================ */
.name-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px 18px 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s, border-color .2s;
  animation: cardEnter .38s cubic-bezier(.25,.46,.45,.94) both;
  position: relative;
  overflow: hidden;
}
.name-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  opacity: 0;
  transition: opacity .2s;
}
.name-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--primary-light); }
.name-card:hover::before { opacity: 1; }
.name-card.is-favorite {
  border-color: var(--primary-light);
  background: linear-gradient(145deg, #fff 80%, #fce9f1 100%);
}
.name-card.is-favorite::before { opacity: 1; }

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.name-romaji {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.25;
}
.card-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Icon buttons */
.btn-icon {
  width: 32px; height: 32px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all .14s;
  padding: 0;
  flex-shrink: 0;
}
.btn-icon:hover { border-color: var(--primary-light); color: var(--primary-dark); background: var(--primary-light); }
.btn-icon.copied { border-color: #86c59e; color: var(--accent-green); background: #e5f5ec; }
.btn-icon.is-fav { border-color: var(--primary-light); color: var(--primary); background: var(--primary-light); }

/* Kanji / hiragana / phonetic / meaning */
.name-kanji {
  font-family: var(--font-ja);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 4px;
  letter-spacing: .06em;
}
.name-hiragana {
  font-family: var(--font-ja);
  font-size: .92rem;
  color: var(--text-light);
  margin-bottom: 3px;
  letter-spacing: .05em;
}
.name-phonetic {
  font-size: .78rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 9px;
  letter-spacing: .04em;
}
.name-meaning {
  font-size: .88rem;
  color: var(--text-light);
  margin-bottom: 13px;
  line-height: 1.5;
}
.name-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
/* Gender pills */
.pill-female   { background: #fceaf3; color: #b55680; }
.pill-male     { background: #e6eefa; color: #3a6fa8; }
.pill-any,
.pill-unisex   { background: #eeeff6; color: #525878; }
.pill-surname  { background: #f5ede0; color: #8b5e3c; }
/* Style pills */
.pill-modern     { background: #e6f4ee; color: #2a5b44; }
.pill-traditional{ background: #fdf0e4; color: #9c5818; }
.pill-anime      { background: #efe8ff; color: #6b3fb0; }
.pill-historical { background: #f4ede1; color: #7a4f2e; }
.pill-nature     { background: #e8f4e5; color: #376529; }

/* ================================================================
   BATCH ACTIONS & SECONDARY BUTTONS
   ================================================================ */
.btn-secondary {
  height: 42px; padding: 0 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: .88rem; font-weight: 600;
  transition: all .14s;
}
.btn-secondary:hover { border-color: var(--primary-light); color: var(--primary-dark); background: var(--primary-light); }

.btn-primary-sm {
  height: 42px; padding: 0 20px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: .88rem; font-weight: 700;
  transition: all .14s;
  box-shadow: 0 2px 8px rgba(217,123,160,.3);
}
.btn-primary-sm:hover { background: var(--primary-dark); }

/* ================================================================
   SECTION HEADINGS
   ================================================================ */
.section-heading {
  font-size: clamp(1.45rem, 3.2vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-heading-icon { color: var(--primary); }
.section-sub {
  font-size: .97rem;
  color: var(--text-light);
  margin-bottom: 38px;
  max-width: var(--max-w-text);
  line-height: 1.7;
}

/* ================================================================
   CENTERED SECTIONS (How to Use, Why Authentic, FAQ)
   ================================================================ */
#how-heading,
#authentic-heading,
#faq-heading {
  justify-content: center;
  text-align: center;
}
#how-heading .section-heading-icon,
#authentic-heading .section-heading-icon,
#faq-heading .section-heading-icon {
  display: none;
}
section[aria-labelledby="how-heading"] .section-sub,
section[aria-labelledby="authentic-heading"] .section-sub,
section[aria-labelledby="faq-heading"] .section-sub {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
section[aria-labelledby="authentic-heading"] .authentic-box {
  margin-left: auto;
  margin-right: auto;
}
section[aria-labelledby="faq-heading"] .faq-list {
  margin-left: auto;
  margin-right: auto;
}

/* ================================================================
   HOW TO USE — STEPS
   ================================================================ */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.step-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  padding: 26px 22px;
  box-shadow: var(--shadow-sm);
}
.step-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 50%;
  font-weight: 900; font-size: 1rem;
  margin-bottom: 14px;
}
.step-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.step-card p  { font-size: .9rem; color: var(--text-light); line-height: 1.65; }

/* ================================================================
   AUTHENTICITY SECTION
   ================================================================ */
.authentic-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1.5px solid var(--border-light);
  padding: 32px 36px;
  box-shadow: var(--shadow-sm);
  max-width: var(--max-w-text);
}
.authentic-box p {
  font-size: .97rem;
  color: var(--text-light);
  line-height: 1.8;
}
.authentic-box p + p { margin-top: 14px; }
.authentic-box strong { color: var(--text); font-weight: 700; }

/* ================================================================
   NAME MEANINGS TABLE
   ================================================================ */
.meanings-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.meanings-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  font-size: .91rem;
}
.meanings-table th {
  background: var(--bg-section);
  padding: 11px 16px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
.meanings-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}
.meanings-table tr:last-child td { border-bottom: none; }
.meanings-table tr:hover td { background: #fdf7f2; }
.td-name  { font-weight: 700; }
.td-kanji { font-family: var(--font-ja); font-size: 1.1rem; font-weight: 700; letter-spacing: .05em; }
.td-meaning { color: var(--text-light); }

/* ================================================================
   VARIANT SECTIONS
   ================================================================ */
.variants-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.variant-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s;
  display: flex;
  flex-direction: column;
}
.variant-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.variant-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  font-size: 1.2rem;
}
.variant-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 10px; }
.variant-examples {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-bottom: 12px;
}
.example-tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .82rem;
  color: var(--text-light);
}
.variant-card p { font-size: .85rem; color: var(--text-muted); margin-bottom: 16px; line-height: 1.55; flex: 1; }
.btn-preset {
  width: 100%; height: 40px;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--primary-dark);
  font-size: .87rem; font-weight: 700;
  transition: all .14s;
  margin-top: auto;
}
.btn-preset:hover { background: var(--primary); color: #fff; }

/* ================================================================
   FAQ
   ================================================================ */
.faq-list { max-width: 780px; display: flex; flex-direction: column; gap: 10px; }
.faq-item {
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.faq-item summary {
  padding: 16px 20px;
  font-weight: 700;
  font-size: .96rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  user-select: none;
  color: var(--text);
  transition: background .13s;
}
.faq-item summary::after {
  content: '';
  width: 16px; height: 16px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23D97BA0' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform .2s;
}
.faq-item[open] summary::after { transform: rotate(180deg); }
.faq-item summary:hover { background: #fdf7f2; }
.faq-item[open] summary {
  color: var(--primary-dark);
  border-bottom: 1px solid var(--border-light);
}
.faq-body {
  padding: 16px 20px;
  font-size: .92rem;
  color: var(--text-light);
  line-height: 1.75;
}

/* ================================================================
   RELATED LINKS
   ================================================================ */
.related-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.related-link {
  display: inline-block;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  font-size: .86rem;
  color: var(--text-light);
  font-weight: 500;
  transition: all .14s;
}
.related-link:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-light);
  text-decoration: none;
}

/* ================================================================
   FOOTER
   ================================================================ */
.site-footer {
  background: #231B18;
  color: rgba(255,255,255,.65);
  padding: 44px 0 36px;
}
.footer-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.footer-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: .97rem; font-weight: 800; color: #fff;
  margin-bottom: 18px; letter-spacing: -0.02em;
}
.footer-logo .logo-icon { color: var(--primary-light); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 22px; }
.footer-nav a {
  color: rgba(255,255,255,.5);
  font-size: .85rem;
  text-decoration: none;
  transition: color .14s;
}
.footer-nav a:hover { color: var(--primary-light); }
.footer-micro { font-size: .78rem; color: rgba(255,255,255,.3); line-height: 1.6; }

/* ================================================================
   TOAST NOTIFICATION
   ================================================================ */
.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #231B18;
  color: #fff;
  padding: 10px 22px;
  border-radius: 22px;
  font-size: .88rem; font-weight: 500;
  box-shadow: 0 4px 18px rgba(0,0,0,.25);
  transition: transform .28s cubic-bezier(.25,.46,.45,.94);
  z-index: 9000;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 900px) {
  .variants-grid { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
  .header-inner { height: 54px; }
  .site-nav a { padding: 5px 9px; font-size: .82rem; }

  .hero { padding: 44px 0 36px; }
  .hero h1 { font-size: 1.85rem; }

  .tool-card { padding: 20px 16px 18px; border-radius: var(--radius); }
  .filters { grid-template-columns: repeat(2, 1fr); }

  #results-grid { grid-template-columns: 1fr; }

  .batch-actions { flex-direction: column; }
  .batch-actions button { width: 100%; }

  .section { padding: 52px 0; }
  .steps-grid { grid-template-columns: 1fr; gap: 14px; }
  .variants-grid { grid-template-columns: 1fr; }
  .authentic-box { padding: 22px 18px; }
}

@media (max-width: 480px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .site-nav { display: none; }
}
