/* -------------------------------------------------------------
   Az Corporate Design System - index.css
   ------------------------------------------------------------- */
:root {
  --color-plum: #3A2033;       /* Primary / TextMain */
  --color-crimson: #C42E46;    /* Accent */
  --color-camel: #E6CFAB;      /* SubAccent (Geometric Pattern/Secondary) */
  --color-sage: #799E86;       /* System/Tag/Timeline */
  --color-gray: #524C49;       /* UI/Border/HelperText */
  --color-bg: #FAF9F6;         /* Base Background (Clean Namecard White) */
  --color-white: #FFFFFF;      /* Card/Header/Footer BG */
  --color-text-sub: #4A4542;   /* Body Text */
  
  --font-main: 'Inter', 'Noto Sans JP', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text-sub);
  font-family: var(--font-main);
  line-height: 1.7;
  padding-bottom: 80px;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s;
  font-feature-settings: "palt"; /* design.md: 100% font-feature-settings */
  letter-spacing: 0.03em;
}

/* Headings styling as per design.md */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-plum);
  font-feature-settings: "palt";
  letter-spacing: 0.05em;
  font-weight: 700;
  line-height: 1.3;
}

p, li, td, th {
  color: var(--color-text-sub);
  font-feature-settings: "palt";
  letter-spacing: 0.03em;
}

th {
  color: var(--color-white);
}

/* -------------------------------------------------------------
   Header & Brand Assets
   ------------------------------------------------------------- */
header {
  background-color: var(--color-white);
  border-bottom: 1px solid rgba(82, 76, 73, 0.1);
  padding: 20px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
}

/* Logo Clear Space (50% of height) as per design.md */
.header-logo {
  height: 32px;
  width: auto;
  margin: 16px 0; /* 50% clear space */
  display: block;
}

.header-title-container {
  flex-grow: 1;
}

.header-title-container h1 {
  font-size: 1.4rem;
  color: var(--color-plum);
}

/* -------------------------------------------------------------
   Sticky Toggle Tabs Container
   ------------------------------------------------------------- */
.toggle-bar {
  position: sticky;
  top: 0;
  background-color: rgba(250, 249, 246, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(82, 76, 73, 0.1);
  padding: 12px 40px;
  display: flex;
  justify-content: center;
  z-index: 99;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.toggle-logo {
  position: absolute;
  left: 40px;
  top: 50%;
  transform: translateY(-50%);
  height: 28px;
  opacity: 0.9;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toggle-logo:hover {
  opacity: 1;
}

.toggle-container {
  display: flex;
  background-color: rgba(82, 76, 73, 0.08);
  border-radius: 30px;
  padding: 4px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

.toggle-tab {
  flex: 1;
  text-align: center;
  padding: 10px 15px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-gray);
  cursor: pointer;
  border-radius: 25px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  border: none;
  background: none;
  outline: none;
  z-index: 2;
  position: relative;
}

.toggle-tab:hover {
  color: var(--color-plum);
}

/* Dynamic Switch background slider in pure CSS/JS */
.toggle-slider {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  width: calc(33.333% - 5.3px);
  background-color: var(--color-white);
  border-radius: 25px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  z-index: 1;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s;
  pointer-events: none;
}

body.mode-technical .toggle-tab[data-mode="technical"],
body.mode-practical .toggle-tab[data-mode="practical"],
body.mode-conceptual .toggle-tab[data-mode="conceptual"],
.toggle-tab.active { 
  color: var(--color-white) !important; 
  font-weight: 700; 
}

body.mode-technical .toggle-slider { transform: translateX(0); background-color: var(--color-plum); }
body.mode-practical .toggle-slider { transform: translateX(calc(100% + 4px)); background-color: var(--color-crimson); }
body.mode-conceptual .toggle-slider { transform: translateX(calc(200% + 8px)); background-color: var(--color-sage); }

/* -------------------------------------------------------------
   Content Layout (Flat Cards style as per design.md)
   ------------------------------------------------------------- */
.main-container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
}

.flat-card {
  background-color: var(--color-white);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(82, 76, 73, 0.04);
  border-radius: 12px;
  padding: 35px;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.flat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background-color: var(--color-plum);
}

body.mode-technical .flat-card::before { background-color: var(--color-plum); }
body.mode-practical .flat-card::before { background-color: var(--color-crimson); }
body.mode-conceptual .flat-card::before { background-color: var(--color-sage); }

.meta-box {
  background-color: rgba(230, 207, 171, 0.15);
  border-left: 4px solid var(--color-camel);
  padding: 20px;
  margin-bottom: 30px;
  border-radius: 0 8px 8px 0;
}

.section-title {
  font-size: 1.6rem;
  margin-bottom: 25px;
  border-bottom: 2px solid rgba(82, 76, 73, 0.08);
  padding-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title span.number {
  font-family: 'Inter', sans-serif;
  font-size: 2rem;
  color: var(--color-crimson);
  opacity: 0.8;
}

.heading-icon {
  width: 26px;
  height: 26px;
  stroke-width: 2px;
  display: inline-block;
  vertical-align: middle;
  transition: color 0.3s;
}

body.mode-technical .heading-icon { color: var(--color-plum); }
body.mode-practical .heading-icon { color: var(--color-crimson); }
body.mode-conceptual .heading-icon { color: var(--color-sage); }

/* -------------------------------------------------------------
   CSS Grid-Based Dynamic Switch System (Prevents layout shift)
   ------------------------------------------------------------- */
.int-block {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  width: 100%;
}



.mode-tech, .mode-bus, .mode-con {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  height: 0;
  overflow: hidden;
  transition: opacity 0.25s ease-in-out, visibility 0.25s ease-in-out;
}

body.mode-technical .mode-tech {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  height: auto;
  overflow: visible;
}

body.mode-practical .mode-bus {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  height: auto;
  overflow: visible;
}

body.mode-conceptual .mode-con {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  height: auto;
  overflow: visible;
}

/* -------------------------------------------------------------
   Namecard Geometry Decorator Style (Az LLC Identity)
   ------------------------------------------------------------- */
.bg-geometry {
  position: fixed;
  top: 0;
  right: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.bg-geometry div {
  position: absolute;
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.8s ease;
  opacity: 0.08; /* Subtly integrated backdrop */
}

/* Geometric polygon mapping derived from corporate identity card */
.bg-geometry .shape-plum {
  top: -15%;
  right: -10%;
  width: 50vw;
  height: 50vw;
  background-color: var(--color-plum);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  transform: rotate(20deg) scale(0.9);
}

.bg-geometry .shape-crimson {
  bottom: -10%;
  right: -5%;
  width: 40vw;
  height: 40vw;
  background-color: var(--color-crimson);
  clip-path: polygon(25% 0%, 100% 30%, 75% 100%, 0% 70%);
  transform: rotate(-15deg) scale(0.9);
}

.bg-geometry .shape-camel {
  top: 25%;
  right: -15%;
  width: 35vw;
  height: 35vw;
  background-color: var(--color-camel);
  clip-path: polygon(0% 15%, 100% 0%, 85% 100%, 15% 85%);
  transform: rotate(35deg) scale(0.8);
}

.bg-geometry .shape-sage {
  top: 55%;
  right: -8%;
  width: 30vw;
  height: 30vw;
  background-color: var(--color-sage);
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
  transform: rotate(-10deg) scale(0.85);
}

/* Active mode color highlighting & scaling interactions */
body.mode-technical .bg-geometry .shape-plum {
  opacity: 0.22;
  transform: rotate(20deg) scale(1.02);
}
body.mode-practical .bg-geometry .shape-crimson {
  opacity: 0.22;
  transform: rotate(-15deg) scale(1.02);
}
body.mode-conceptual .bg-geometry .shape-sage {
  opacity: 0.22;
  transform: rotate(-10deg) scale(1.02);
}
body.mode-technical .bg-geometry .shape-camel {
  opacity: 0.12;
}

/* Block spacing inside dynamic switch container */
p.int-block {
  margin-bottom: 1.25rem;
}

/* -------------------------------------------------------------
   List & Table Layout Design
   ------------------------------------------------------------- */
ul, ol {
  margin-left: 20px;
  margin-bottom: 1.25rem;
}

li {
  margin-bottom: 8px;
}

.highlight-tag {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  color: var(--color-white);
  margin-right: 8px;
  display: inline-block;
  vertical-align: middle;
}

.tag-recommend { background-color: var(--color-sage); }
.tag-caution { background-color: var(--color-camel); color: var(--color-plum); }
.tag-remove { background-color: var(--color-crimson); }

/* Tables Styles matching design.md colors */
.table-container {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: 8px;
  border: 1px solid rgba(82, 76, 73, 0.1);
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

th {
  background-color: var(--color-plum);
  color: var(--color-white);
  padding: 14px 16px;
  font-weight: 600;
  font-feature-settings: "palt";
}

body.mode-technical th { background-color: var(--color-plum); }
body.mode-practical th { background-color: var(--color-crimson); }
body.mode-conceptual th { background-color: var(--color-sage); }

td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(82, 76, 73, 0.1);
  background-color: var(--color-white);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

/* Scrollbar Style as per design.md */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(82, 76, 73, 0.05);
}
::-webkit-scrollbar-thumb {
  background: rgba(82, 76, 73, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(82, 76, 73, 0.4);
}

/* -------------------------------------------------------------
   Interactive Code Blocks
   ------------------------------------------------------------- */
pre {
  background-color: rgba(82, 76, 73, 0.05);
  border-radius: 6px;
  padding: 15px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  overflow-x: auto;
  border: 1px solid rgba(82, 76, 73, 0.1);
  margin: 15px 0;
}

code {
  font-family: 'Courier New', Courier, monospace;
  background-color: rgba(82, 76, 73, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* -------------------------------------------------------------
   Mermaid Diagrams
   ------------------------------------------------------------- */
.mermaid-wrapper {
  margin: 20px 0;
  width: 100%;
  display: flex;
  justify-content: center;
}

.mermaid {
  background: var(--color-white);
  border: 1px solid rgba(82, 76, 73, 0.1);
  border-radius: 8px;
  padding: 20px;
  width: 100%;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

/* -------------------------------------------------------------
   Footer
   ------------------------------------------------------------- */
footer {
  background-color: var(--color-white);
  border-top: 1px solid rgba(82, 76, 73, 0.1);
  padding: 40px 20px;
  text-align: center;
  margin-top: 60px;
  position: relative;
}

.footer-logo {
  height: 24px;
  width: auto;
  margin: 12px auto;
  display: block;
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--color-gray);
  margin-top: 15px;
}

/* -------------------------------------------------------------
   Built-in Auto Testing Console
   ------------------------------------------------------------- */
.test-trigger {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--color-plum);
  color: var(--color-white);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  z-index: 9999;
  transition: transform 0.3s;
}

.test-trigger:hover {
  transform: scale(1.08);
}

.test-panel {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 350px;
  max-height: 500px;
  background-color: var(--color-white);
  border: 1px solid rgba(82, 76, 73, 0.2);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  z-index: 9998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-size: 0.85rem;
}

.test-panel.open {
  display: flex;
}

.test-header {
  background-color: var(--color-plum);
  color: var(--color-white);
  padding: 10px 15px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.test-body {
  padding: 15px;
  overflow-y: auto;
  flex-grow: 1;
}

.test-row {
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(82, 76, 73, 0.05);
  padding-bottom: 4px;
}

.test-status {
  font-weight: 700;
}

.status-ok { color: var(--color-sage); }
.status-ng { color: var(--color-crimson); }
