:root {
  color-scheme: light;

  --gold-100: #fff9e6;
  --gold-200: #ffedb3;
  --gold-300: #ffd970;
  --gold-400: #f5c842;
  --gold-500: #d4a017;
  --gold-600: #a67c00;
  --gold-700: #7a5c00;

  --white: #ffffff;
  --off-white: #fbfaf7;
  --paper: #ffffff;

  --ink-950: #11100c;
  --ink-900: #1a1811;
  --ink-800: #262318;
  --ink-700: #3b3522;
  --muted: #423d2f;

  --sidebar-w: 310px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --transition: 0.25s ease;
  --shadow-soft: 0 10px 28px rgba(17, 16, 12, 0.08);
  --shadow-gold: 0 0 30px rgba(212, 160, 23, 0.18);
}

/* ===========================
   RESET & BASE
=========================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--white);
  background:
    radial-gradient(900px 600px at 20% -10%, rgba(212, 160, 23, 0.16) 0%, rgba(212, 160, 23, 0) 62%),
    radial-gradient(700px 520px at 110% 0%, rgba(245, 200, 66, 0.12) 0%, rgba(245, 200, 66, 0) 60%),
    linear-gradient(180deg, var(--off-white) 0%, #ffffff 60%, #fffdfa 100%);
  color: var(--ink-900);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ===========================
   SIDEBAR
=========================== */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: linear-gradient(180deg, #ffffff 0%, #fbfaf6 100%);
  border-right: 1px solid rgba(212, 160, 23, 0.25);
  box-shadow: 6px 0 22px rgba(17, 16, 12, 0.06);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition);
}

#sidebar::-webkit-scrollbar {
  width: 6px;
}

#sidebar::-webkit-scrollbar-track {
  background: rgba(212, 160, 23, 0.06);
}

#sidebar::-webkit-scrollbar-thumb {
  background: rgba(212, 160, 23, 0.55);
  border-radius: 6px;
}

.sidebar-header {
  padding: 28px 24px 18px;
  border-bottom: 1px solid rgba(212, 160, 23, 0.18);
  text-align: center;
}

.sidebar-home-link {
  display: block;
  text-decoration: none;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}

.sidebar-home-link:hover {
  opacity: 0.95;
}

.kanji-header {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 3.0rem;
  line-height: 1;
  letter-spacing: 6px;
  color: var(--gold-700);
  background: linear-gradient(135deg, var(--gold-700) 0%, var(--gold-600) 45%, var(--gold-500) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 10px rgba(212, 160, 23, 0.35));
  display: block;
  margin-bottom: 8px;
}

.dojo-name {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--gold-700);
  text-transform: uppercase;
}

.dojo-logo-wrap {
  position: relative;
  width: clamp(140px, 62%, 210px);
  margin: 14px auto 0;
}

.dojo-logo {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 10px rgba(212, 160, 23, 0.28));
  opacity: 0.98;
}

.dojo-logo-fallback {
  display: none;
  width: 100%;
  border-radius: 14px;
  border: 1px dashed rgba(212, 160, 23, 0.45);
  background:
    radial-gradient(250px 120px at 40% 20%, rgba(212, 160, 23, 0.18) 0%, rgba(212, 160, 23, 0) 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(251, 250, 246, 0.92) 100%);
  padding: 14px 12px;
  box-shadow: var(--shadow-soft);
}

.dojo-logo-fallback .fallback-title {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--gold-700);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.dojo-logo-fallback .fallback-sub {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}

.nav-section {
  padding: 10px 0;
}

.nav-category {
  padding: 14px 18px 8px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--transition);
  border-radius: var(--radius-sm);
  margin: 0 10px;
}

.nav-category:hover {
  background: rgba(212, 160, 23, 0.08);
}

.nav-category.active {
  background: rgba(212, 160, 23, 0.12);
}

.category-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1rem;
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.20) 0%, rgba(212, 160, 23, 0.08) 100%);
  border: 1px solid rgba(212, 160, 23, 0.30);
  color: var(--gold-700);
  flex-shrink: 0;
}

.category-title {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--gold-700);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  flex: 1;
}

.category-chevron {
  color: var(--gold-700);
  font-size: 0.7rem;
  transition: transform var(--transition);
  opacity: 0.9;
}

.nav-category.expanded .category-chevron {
  transform: rotate(90deg);
}

.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.submenu.open {
  max-height: 680px;
}

.submenu-item {
  display: block;
  padding: 9px 20px 9px 62px;
  font-size: 0.84rem;
  font-weight: 500;
  color: rgba(26, 24, 17, 0.70);
  cursor: pointer;
  transition: color var(--transition), background var(--transition), padding-left var(--transition);
  border-left: 2px solid transparent;
  margin: 1px 0;
  text-decoration: none;
}

.submenu-item:hover {
  color: var(--ink-900);
  background: rgba(212, 160, 23, 0.08);
  padding-left: 66px;
  border-left-color: rgba(212, 160, 23, 0.45);
}

.submenu-item.active {
  color: var(--ink-900);
  background: rgba(212, 160, 23, 0.12);
  border-left-color: var(--gold-600);
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid rgba(212, 160, 23, 0.16);
  margin-top: auto;
  text-align: center;
}

.sidebar-footer p {
  font-size: 0.67rem;
  color: rgba(122, 92, 0, 0.78);
  letter-spacing: 1px;
  line-height: 1.6;
}

/* ===========================
   MAIN / TOPBAR
=========================== */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#topbar {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.88) 0%, rgba(251, 250, 246, 0.88) 100%);
  border-bottom: 1px solid rgba(212, 160, 23, 0.20);
  padding: 14px 40px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.breadcrumb {
  font-size: 0.86rem;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.breadcrumb .breadcrumb-item {
  color: var(--ink-800);
}

.breadcrumb .breadcrumb-item.current {
  color: var(--ink-900);
  font-weight: 700;
}

.breadcrumb .breadcrumb-sep {
  margin: 0 8px;
  opacity: 0.55;
}

.back-btn {
  border: 1px solid rgba(212, 160, 23, 0.32);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(251, 250, 246, 0.96) 100%);
  color: var(--ink-900);
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.3px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  box-shadow: 0 6px 18px rgba(17, 16, 12, 0.08);
}

.back-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(212, 160, 23, 0.55);
  box-shadow: 0 10px 24px rgba(17, 16, 12, 0.10), var(--shadow-gold);
}

#content {
  padding: 42px 40px 60px;
  flex: 1;
  font-size: 1.15rem;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
  box-sizing: border-box;
}

.text {
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--ink-900);
  margin: 16px 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ===========================
   SECTION HEADER / BLOCKS
=========================== */
.section-header {
  margin-bottom: 18px;
  max-width: 100%;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Noto Sans JP', sans-serif;
  letter-spacing: 2px;
  color: var(--gold-700);
  font-size: clamp(1.0rem, 3.2vw, 1.35rem) !important;
  font-weight: 700;
  line-height: 1.3 !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.section-title {
  margin-top: 10px;
  font-family: 'Cinzel', serif;
  font-size: clamp(1.8rem, 4.5vw, 2.5rem) !important;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--ink-900);
  line-height: 1.25 !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.section-rule {
  height: 2px;
  width: 110px;
  margin-top: 12px;
  background: linear-gradient(90deg, rgba(212, 160, 23, 0.65) 0%, rgba(212, 160, 23, 0.15) 100%);
  border-radius: 999px;
}

.section-subtitle {
  margin-top: 12px;
  color: var(--muted);
  max-width: 72ch;
  line-height: 1.7;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.subsection-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.2rem, 3vw, 1.5rem) !important;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--gold-700);
  margin-top: 36px;
  margin-bottom: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(212, 160, 23, 0.22);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.info-box {
  margin: 18px 0;
  padding: 14px 16px;
  background: #fffcf2;
  border: 1px solid rgba(212, 160, 23, 0.30);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 24px rgba(17, 16, 12, 0.05);
  line-height: 1.75;
  color: var(--ink-900);
}

.quote-block {
  margin: 18px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--gold-500);
  background: #ffffff;
  border-radius: var(--radius-md);
  color: var(--ink-900);
  line-height: 1.75;
  box-shadow: 0 10px 24px rgba(17, 16, 12, 0.05);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  margin-top: 14px;
}

.card {
  grid-column: span 6;
  background: #ffffff;
  border: 1px solid rgba(212, 160, 23, 0.25);
  border-radius: var(--radius-lg);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: -2px -2px auto -2px;
  height: 64px;
  background: radial-gradient(140px 60px at 20% 40%, rgba(212, 160, 23, 0.16) 0%, rgba(212, 160, 23, 0) 70%);
  pointer-events: none;
}

.card-kanji {
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--gold-700);
  font-weight: 700;
  letter-spacing: 3px;
  font-size: 0.95rem;
}

.card-title {
  margin-top: 10px;
  font-family: 'Cinzel', serif;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: var(--ink-900);
}

.card-body {
  margin-top: 10px;
  color: var(--ink-900);
  line-height: 1.7;
}

.media {
  margin: 20px auto;
  border-radius: 16px;
  border: 1px solid rgba(212, 160, 23, 0.22);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(251, 250, 246, 0.96) 100%);
  max-width: 460px;
  box-shadow: 0 4px 18px rgba(17, 16, 12, 0.08);
}

/* ===========================
   PADRONIZAÇÃO DE IMAGENS DAS TÉCNICAS
=========================== */
#content img:not(.dojo-logo) {
  max-width: 100% !important;
  height: auto !important;
  box-sizing: border-box !important;
  border-radius: var(--radius-md);
  border: 1px solid rgba(212, 160, 23, 0.25);
  box-shadow: 0 4px 18px rgba(17, 16, 12, 0.08);
  background: #ffffff;
  padding: 4px;
}

/* Containers com display:flex (técnicas com 1, 2 ou 3 imagens) */
#content div[style*="display:flex"] {
  display: flex !important;
  flex-direction: row;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 20px !important;
  margin: 28px auto !important;
  max-width: 860px !important;
  width: 100% !important;
}

#content div[style*="display:flex"] img {
  display: block !important;
  height: auto !important;
  object-fit: contain;
  flex: 1 1 240px !important;
  max-width: 360px !important;
  width: 100% !important;
  max-height: 420px !important;
  margin: 0 auto !important;
}

#content div[style*="display:flex"] img:only-child {
  max-width: 420px !important;
  flex: 0 1 420px !important;
}

/* Containers com text-align:center (imagens empilhadas / grandes) */
#content div[style*="text-align:center"] {
  margin: 28px auto !important;
  max-width: 860px !important;
  width: 100% !important;
  text-align: center !important;
}

#content div[style*="text-align:center"] img {
  display: block !important;
  max-width: 420px !important;
  width: 100% !important;
  height: auto !important;
  margin: 18px auto !important;
}

/* ===========================
   INFOGRÁFICO — KIME & SUN-DOME
=========================== */
.infographic-figure {
  margin: 28px auto 8px;
  max-width: 700px;
}

.infographic-wrap {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border: 1px solid rgba(212, 160, 23, 0.28);
  border-bottom: none;
  box-shadow:
    0 4px 16px rgba(17, 16, 12, 0.07),
    0 20px 48px rgba(212, 160, 23, 0.10);
  overflow: hidden;
  background: #fff;
  display: flex;
  justify-content: center;
  transition: box-shadow 0.3s ease;
}

.infographic-figure:hover .infographic-wrap {
  box-shadow:
    0 8px 28px rgba(17, 16, 12, 0.10),
    0 24px 56px rgba(212, 160, 23, 0.18);
}

.infographic-wrap img {
  max-width: 100%;
  height: auto;
  display: block;
  transition: transform 0.4s ease;
}

.infographic-figure:hover .infographic-wrap img {
  transform: scale(1.008);
}

/* Legenda estruturada */
.infographic-caption {
  background: linear-gradient(135deg, rgba(255, 253, 245, 0.98) 0%, rgba(255, 249, 230, 0.96) 100%);
  border: 1px solid rgba(212, 160, 23, 0.28);
  border-top: 2px solid rgba(212, 160, 23, 0.45);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 20px 24px 18px;
  box-shadow: 0 6px 20px rgba(17, 16, 12, 0.06);
}

.infographic-caption-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
}

.caption-concept {
  padding: 12px 20px;
  border-right: 1px solid rgba(212, 160, 23, 0.18);
}

.caption-concept:last-child {
  border-right: none;
}

.caption-concept--center {
  position: relative;
  background: rgba(212, 160, 23, 0.06);
  border-top: 2px solid rgba(212, 160, 23, 0.45);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.caption-kanji {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--gold-700);
  background: linear-gradient(135deg, var(--gold-700) 0%, var(--gold-500) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 6px rgba(212, 160, 23, 0.22));
}

.caption-term {
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--ink-900);
  display: block;
  margin-bottom: 5px;
}

.caption-concept p {
  font-size: 0.81rem;
  line-height: 1.65;
  color: var(--ink-900);
  margin: 0;
}

@media (max-width: 680px) {
  .infographic-caption-grid {
    grid-template-columns: 1fr;
  }

  .caption-concept {
    border-right: none;
    border-bottom: 1px solid rgba(212, 160, 23, 0.18);
    padding: 14px 16px;
  }

  .caption-concept:last-child {
    border-bottom: none;
  }

  .caption-concept--center {
    border-top: 2px solid rgba(212, 160, 23, 0.45);
    border-radius: 0;
  }
}

.media svg {
  display: block;
  width: 100%;
  height: auto;
}

.media img {
  display: block;
  width: 100%;
  height: auto;
}

.media-caption {
  padding: 10px 12px 12px;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.6;
}

.styled-list {
  margin-top: 14px;
  padding-left: 18px;
  line-height: 1.85;
  color: var(--ink-900);
  font-size: 1.15rem;
}

.styled-list li {
  margin: 8px 0;
}

/* ===========================
   HOME
=========================== */
.home-panel {
  max-width: 980px;
  margin: 0 auto;
  text-align: center;
  padding-top: 24px;
}

.home-kanji {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: clamp(5rem, 10vw, 7.2rem);
  letter-spacing: 10px;
  color: var(--gold-700);
  background: linear-gradient(135deg, var(--gold-700) 0%, var(--gold-600) 55%, var(--gold-500) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 14px rgba(212, 160, 23, 0.22));
}

.home-divider {
  width: 140px;
  height: 2px;
  background: linear-gradient(90deg, rgba(212, 160, 23, 0.55) 0%, rgba(212, 160, 23, 0.10) 100%);
  border-radius: 999px;
  margin: 14px auto;
}

.home-title {
  font-family: 'Cinzel', serif;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--ink-900);
}

.home-subtitle {
  margin-top: 8px;
  color: var(--ink-800);
  letter-spacing: 1px;
}

.home-desc {
  margin: 16px auto 0;
  max-width: 78ch;
  color: var(--ink-900);
  line-height: 1.85;
}

.home-badges {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.badge {
  border: 1px solid rgba(212, 160, 23, 0.35);
  background: #fffcf2;
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--ink-900);
}

/* ===========================
   MOBILE
=========================== */
#menu-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(212, 160, 23, 0.25);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 14px 30px rgba(17, 16, 12, 0.12);
  cursor: pointer;
  font-size: 1.2rem;
  display: none;
  transition: transform var(--transition);
}

#menu-toggle:hover {
  transform: scale(1.03);
}

@media (max-width: 900px) {
  :root {
    --sidebar-w: 280px;
  }

  body {
    background-color: #ffffff;
    background: #ffffff;
    overflow-x: hidden;
  }

  #sidebar {
    transform: translateX(-100%);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #main {
    margin-left: 0;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }

  #menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #content {
    padding: 24px 20px 56px;
    font-size: 1.05rem;
  }

  .text {
    font-size: 1.05rem;
    line-height: 1.75;
    text-align: left !important;
  }

  .styled-list {
    font-size: 1.05rem;
  }

  #topbar {
    padding: 12px 18px;
  }
}

@media (max-width: 680px) {
  .card {
    grid-column: span 12;
  }

  #content {
    padding: 20px 16px 48px;
  }

  #content div[style*="display:flex"] {
    flex-direction: column !important;
    gap: 16px !important;
    margin: 20px auto !important;
  }

  #content div[style*="display:flex"] img {
    flex: none !important;
    max-width: 320px !important;
    width: 100% !important;
    max-height: 380px !important;
    margin: 0 auto !important;
  }

  #content div[style*="text-align:center"] img {
    max-width: 320px !important;
    width: 100% !important;
    margin: 14px auto !important;
  }

  .media {
    max-width: 320px;
  }
}

/* ===========================
   NEW MENU STYLES
=========================== */

/* Categoria Principal */
.nav-category {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.nav-category:hover {
  background: #fff9e6;
  /* Gold 100 */
}

/* Submenu (nivel 1) */
.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.submenu.open {
  max-height: 2000px;
  /* Suficiente para mostrar todos os itens */
}

/* Itens do submenu */
.submenu-item {
  display: block;
  padding: 12px 18px 12px 50px;
  /* Recuo à direita */
  font-size: 0.95rem;
  color: var(--ink-900);
  text-decoration: none;
  transition: all 0.2s ease;
}

.submenu-item:hover {
  color: #d4a017;
  /* Gold 500 */
  background: #fff9e6;
}

/* Submenu dentro de submenu (nivel 2) */
.submenu-nested {
  padding-left: 10px;
  /* Recuo extra para itens internos */
  background: rgba(247, 247, 247, 0.5);
}

/* Itens dentro de submenu interno */
.nested-item {
  padding-left: 60px !important;
  /* Mais recuo ainda */
  font-size: 0.9rem;
  color: var(--ink-800);
}

.nested-item:hover {
  color: #c48e0f;
  background: rgba(255, 249, 230, 0.3);
}

.submenu {
  display: none;
}

.submenu.open {
  display: block;
}