/* =========================================================
   FUNTOMY — Legal / Privacy / Security shared styles
   ========================================================= */

:root {
  --phantom: #141f18;
  --forest: #2d4f38;
  --forest-mid: #3d6147;
  --gold: #b89a50;
  --gold-light: #d4b878;
  --gold-pale: #ede0b8;
  --cream: #f5f0e6;
  --cream-light: #faf8f3;
  --white: #ffffff;
  --text-dark: #1a2820;
  --text-mid: #3a4e42;
  --text-light: #6a7e72;
  --ff-en: 'Cormorant Garamond', Georgia, serif;
  --ff-jp: 'Noto Serif JP', 'Yu Mincho', serif;
  --ff-sans: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
  --ff-label: 'Jost', 'Futura', 'Century Gothic', sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: var(--ff-sans);
  color: var(--text-dark);
  background:
    radial-gradient(ellipse 70% 50% at 15% 0%, rgba(184,154,80,0.06), transparent 60%),
    radial-gradient(ellipse 60% 60% at 90% 100%, rgba(45,79,56,0.05), transparent 60%),
    linear-gradient(180deg, var(--cream-light) 0%, var(--cream) 100%);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: strict;
  overflow-x: hidden;
  max-width: 100vw;
}

a { color: inherit; }

/* ---- NAVIGATION ---- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  height: 68px;
  background: rgba(20, 31, 24, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.nav-logo { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.nav-mark { width: 30px; height: auto; border-radius: 3px; }
.nav-name {
  font-family: var(--ff-label);
  font-size: 15px;
  letter-spacing: 0.2em;
  color: var(--gold);
}
.nav-links { display: flex; gap: 36px; list-style: none; }
.nav-links a {
  font-family: var(--ff-sans);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  transition: color 0.3s;
}
.nav-links a:hover { color: var(--gold-light); }
.nav-cta {
  font-family: var(--ff-label);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--gold);
  text-decoration: none;
  border: 1px solid rgba(184,154,80,0.5);
  padding: 8px 20px;
  border-radius: 2px;
  transition: all 0.3s;
}
.nav-cta:hover { background: rgba(184,154,80,0.12); border-color: var(--gold); }
.nav-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-burger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--gold);
}
.mobile-menu {
  display: none;
  position: fixed;
  top: 68px; left: 0; right: 0;
  background: var(--phantom);
  z-index: 999;
  padding: 28px 48px 40px;
  flex-direction: column;
  gap: 0;
  transform: translateY(-100%);
  transition: transform 0.4s var(--ease);
  border-top: 1px solid rgba(184,154,80,0.15);
}
.mobile-menu.open { transform: translateY(0); }
.mobile-menu a {
  font-size: 15px;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mobile-menu a:hover { color: var(--gold); }

/* ---- PAGE HERO ---- */
.page-hero {
  position: relative;
  height: 44vh;
  min-height: 300px;
  overflow: hidden;
  background: var(--phantom);
  display: flex;
  align-items: flex-end;
  padding: 0 80px 60px;
}
.page-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 80% 40%, rgba(45,79,56,0.28) 0%, transparent 70%),
    linear-gradient(to bottom, transparent 40%, rgba(14,26,18,0.7) 100%);
}
.page-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 65% 55% at 50% 50%, rgba(45,79,56,0.5) 0%, transparent 70%),
    var(--phantom);
  opacity: 1;
}
.page-hero-content { position: relative; z-index: 2; }
.page-eyebrow {
  font-family: var(--ff-label);
  font-size: 10px;
  letter-spacing: 0.35em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 16px;
  opacity: 0.85;
}
.page-title {
  font-family: var(--ff-jp);
  font-size: clamp(26px, 4vw, 48px);
  font-weight: 200;
  letter-spacing: 0.1em;
  color: var(--white);
  line-height: 1.3;
}
.page-title-en {
  font-family: var(--ff-en);
  font-style: italic;
  font-size: clamp(14px, 1.8vw, 18px);
  letter-spacing: 0.08em;
  color: rgba(184,154,80,0.55);
  margin-top: 10px;
  display: block;
}

/* ---- LEGAL BODY ---- */
.legal-main {
  padding: 88px 48px 96px;
}
.legal-inner {
  max-width: 860px;
  margin: 0 auto;
}
.legal-intro {
  font-family: var(--ff-jp);
  font-size: 15px;
  font-weight: 300;
  color: var(--text-mid);
  line-height: 2.2;
  letter-spacing: 0.04em;
  padding: 32px 0 44px;
  margin-bottom: 40px;
  border-bottom: 1px solid rgba(45,79,56,0.15);
}

.legal-section { margin-bottom: 48px; }
.legal-section h2 {
  font-family: var(--ff-jp);
  font-size: clamp(17px, 1.8vw, 20px);
  font-weight: 400;
  color: var(--forest);
  letter-spacing: 0.08em;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(184,154,80,0.25);
  position: relative;
}
.legal-section h2::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 0.3em;
  width: 3px;
  height: 1em;
  background: var(--gold);
  border-radius: 2px;
}
.legal-section p {
  font-family: var(--ff-jp);
  font-size: 14px;
  font-weight: 300;
  color: var(--text-mid);
  line-height: 2;
  letter-spacing: 0.03em;
}
.legal-section p + p { margin-top: 14px; }

.legal-list {
  list-style: none;
  counter-reset: legal-counter;
  margin-top: 18px;
}
.legal-list li {
  counter-increment: legal-counter;
  font-family: var(--ff-jp);
  font-size: 14px;
  font-weight: 300;
  color: var(--text-mid);
  line-height: 2;
  letter-spacing: 0.03em;
  padding-left: 2.2em;
  position: relative;
  margin-bottom: 8px;
}
.legal-list li::before {
  content: '(' counter(legal-counter) ')';
  position: absolute;
  left: 0;
  font-family: var(--ff-label);
  color: var(--gold);
  font-size: 12px;
}

.legal-contact {
  margin-top: 18px;
  padding: 22px 28px;
  background: rgba(45,79,56,0.04);
  border-left: 2px solid var(--gold);
  border-radius: 2px;
}
.legal-contact p {
  font-size: 14px;
  margin: 0;
  line-height: 1.9;
}
.legal-contact a {
  color: var(--forest);
  text-decoration: none;
  border-bottom: 1px solid rgba(45,79,56,0.25);
  padding-bottom: 1px;
}
.legal-contact a:hover { border-color: var(--forest); }

.legal-update {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid rgba(45,79,56,0.15);
  font-family: var(--ff-label);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--text-light);
  text-align: right;
  line-height: 2;
}

/* ---- FOOTER ---- */
.site-footer {
  background:
    radial-gradient(ellipse 60% 50% at 20% 0%, rgba(45,79,56,0.35), transparent 60%),
    radial-gradient(ellipse 50% 45% at 90% 100%, rgba(184,154,80,0.05), transparent 60%),
    linear-gradient(180deg, var(--phantom) 0%, #0e1a12 100%);
  padding: 72px 80px 36px;
  border-top: 1px solid rgba(184,154,80,0.1);
}
.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 56px;
  max-width: 1200px;
  margin: 0 auto;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.footer-brand {}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  margin-bottom: 20px;
}
.footer-logo img { border-radius: 3px; }
.footer-name {
  font-family: var(--ff-label);
  font-size: 16px;
  letter-spacing: 0.24em;
  color: var(--gold);
}
.footer-tagline {
  font-family: var(--ff-jp);
  font-size: 13px;
  font-weight: 300;
  color: rgba(255,255,255,0.65);
  line-height: 2.1;
  letter-spacing: 0.06em;
  margin-bottom: 24px;
}
.footer-company-block {
  font-family: var(--ff-sans);
  font-size: 12px;
  font-weight: 300;
  color: rgba(255,255,255,0.4);
  line-height: 2;
  letter-spacing: 0.04em;
}
.footer-company-block a {
  color: rgba(184,154,80,0.75);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-company-block a:hover { color: var(--gold-light); }

.footer-col h4 {
  font-family: var(--ff-label);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--gold);
  text-transform: uppercase;
  font-weight: 400;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(184,154,80,0.15);
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-col a {
  font-family: var(--ff-sans);
  font-size: 12px;
  font-weight: 300;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--gold-light); }

.footer-copy {
  max-width: 1200px;
  margin: 28px auto 0;
  text-align: center;
  font-family: var(--ff-label);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,0.25);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .nav-links, .nav-cta { display: none; }
  .nav-burger { display: flex; }
  .mobile-menu { display: flex; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 40px; }
  .footer-brand { grid-column: 1 / -1; }
  .page-hero { padding: 0 32px 48px; }
}
@media (max-width: 640px) {
  .nav { padding: 0 24px; }
  .legal-main { padding: 64px 24px 80px; }
  .site-footer { padding: 56px 24px 32px; }
  .footer-inner { grid-template-columns: 1fr; gap: 36px; padding-bottom: 36px; }
  .page-hero { padding: 0 24px 40px; height: 38vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- Back-to-Top FAB (transparent F.mark) ---- */
.back-to-top {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 9999;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 80% at 50% 30%, rgba(61,97,71,0.95), rgba(20,31,24,0.95) 80%);
  border: 1px solid rgba(184,154,80,0.45);
  border-radius: 50%;
  box-shadow:
    0 6px 22px rgba(0,0,0,0.4),
    inset 0 0 12px rgba(184,154,80,0.08);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(0.9);
  transition: opacity 0.45s ease, transform 0.45s ease, background 0.3s ease, border-color 0.3s ease, visibility 0.45s;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.back-to-top img {
  width: 34px;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 6px rgba(184,154,80,0.45));
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  animation: fabFloat 3.2s ease-in-out infinite;
}
.back-to-top:hover {
  background:
    radial-gradient(ellipse 80% 80% at 50% 30%, rgba(77,117,96,1), rgba(45,79,56,1) 80%);
  border-color: rgba(184,154,80,0.85);
  box-shadow:
    0 10px 30px rgba(0,0,0,0.5),
    inset 0 0 16px rgba(184,154,80,0.15);
}
.back-to-top:hover img {
  transform: translateY(-3px) scale(1.05);
  animation-play-state: paused;
  filter: drop-shadow(0 0 10px rgba(184,154,80,0.7));
}
.back-to-top:active {
  transform: translateY(0) scale(0.94);
}
@keyframes fabFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-3px); }
}
@media (max-width: 640px) {
  .back-to-top {
    right: 20px;
    bottom: 20px;
    width: 50px;
    height: 50px;
  }
  .back-to-top img { width: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .back-to-top img { animation: none; }
  .back-to-top { transition: opacity 0.3s ease, visibility 0.3s; }
}

/* ---- CJK overflow guard: allow grid/flex items to shrink ---- */
img, video, iframe { max-width: 100%; height: auto; }
section, main, article, header, footer, nav, div {
  min-width: 0;
  max-width: 100%;
}
/* Grid/flex items default min-width: auto can force children to widest-content.
   Force them to 0 so they can shrink with the layout. */
.dual-grid > *, .philosophy-grid > *, .business-grid > *,
.affiliated-grid > *, .values-list > *, .footer-inner > *,
.greeting-inner > *, .access-inner > *,
.dual-col, .phi-card, .biz-card, .affil-card, .value-item, .footer-col {
  min-width: 0;
  max-width: 100%;
}
/* Break anywhere for CJK when overflow would occur (safety net) */
p, h1, h2, h3, h4, h5, h6, li, dd, dt, td, th,
.affil-desc, .eiji-eye-text, .dual-text, .story-body,
.contact-sub, .phi-desc, .biz-desc, .hero-copy, .dual-heading,
.greeting-text, .legal-section p, .legal-list li, .overview-table td {
  overflow-wrap: anywhere;
  word-break: normal;
}
