@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&family=Noto+Sans+JP:wght@400;500;700&display=swap');

:root {
  --font-en: 'Inter', sans-serif;
  --font-jp: 'Noto Sans JP', sans-serif;
  --bg-color: #ffffff;
  --bg-alt: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #475569;
  --accent-cyan: #0284c7;
  --accent-blue: #1e3a8a;
  --border-light: #e2e8f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-en), var(--font-jp);
  color: var(--text-main);
  background-color: var(--bg-alt);
  overflow: hidden;
  
  /* 日本語の文節をまたぐ変な改行を防ぐ自動認識設定 */
  word-break: auto-phrase;
  line-break: strict;
  overflow-wrap: break-word;
}

/* UI Controls (Hide in print) */
.controls {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  gap: 1rem;
  z-index: 100;
}
.lang-toggle {
  position: fixed;
  top: 2rem;
  right: 3rem;
  z-index: 100;
  display: flex;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 4px;
}
.btn {
  border: 1px solid var(--border-light);
  background: white;
  color: var(--text-main);
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  transition: all 0.2s;
}
.btn:hover {
  background: #f8fafc;
}
.lang-toggle .btn {
  box-shadow: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
}
.lang-toggle .btn.active {
  background: white;
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.05);
  color: var(--accent-cyan);
}

@media print {
  .controls, .lang-toggle { display: none !important; }
}

/* Slide Container */
.deck {
  width: 100vw;
  height: 100vh;
  position: relative;
  background: var(--bg-alt);
}

.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  padding: 4rem 6rem;
  background: var(--bg-color);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease-in-out;
}
.slide.active {
  opacity: 1;
  pointer-events: auto;
}

/* Print Styles (Strict 16:9 Vector PDF Output) */
@media print {
  @page {
    size: 16in 9in !important;
    margin: 0 !important;
  }
  body, html {
    width: 16in !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Hide interactive/UI elements to keep PDF clean */
  .controls, .lang-toggle, .info-toggle-btn, .modal-overlay, #download-slide { 
    display: none !important; 
  }
  
  .deck {
    height: auto !important;
    position: static !important;
    overflow: visible !important;
    display: block !important;
  }
  
  .slide {
    display: flex !important;
    position: relative !important;
    width: 16in !important;
    height: 9in !important;
    min-height: 9in !important;
    max-height: 9in !important;
    margin: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    page-break-after: always !important;
    page-break-inside: avoid !important;
    pointer-events: none !important;
    box-shadow: none !important;
    padding: 4.5rem 6.5rem !important; /* Proper internal spacing for 16x9 layout */
  }
  
  .slide:nth-child(even) {
    background-color: var(--bg-alt) !important;
  }
  .slide:nth-child(odd) {
    background-color: var(--bg-color) !important;
  }
  
  .slide:last-child {
    page-break-after: auto !important;
  }
}

/* Grid & Layout Utilities */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  flex: 1;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1.2fr 1.5fr 1.3fr; /* col1:size, col2:text, col3:diagram */
  gap: 2rem;
  align-items: center;
  flex: 1;
}
.flex-split {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}
.slide-header {
  margin-bottom: 2rem;
  text-align: center;
}

/* Typography styles */
.subtitle {
  color: var(--accent-cyan);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 1rem;
  margin-bottom: 1rem;
  text-wrap: balance;
}
.title {
  font-size: clamp(3rem, 4vw, 3.5rem);
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 1.5rem 0;
  color: var(--text-main);
  text-wrap: balance;
}
.title .highlight {
  color: var(--accent-cyan);
}
.slide h2 {
  font-size: clamp(2rem, 3vw, 2.25rem);
  font-weight: 800;
  margin: 0 0 2.5rem 0;
  color: var(--accent-blue);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.text {
  font-size: clamp(1.1rem, 1.5vw, 1.25rem);
  line-height: 1.8;
  color: var(--text-muted);
  text-wrap: pretty;
}
.text-lg {
  font-size: clamp(1.25rem, 1.8vw, 1.5rem);
  line-height: 1.7;
  text-wrap: pretty;
}

ul {
  padding-left: 1.5rem;
  margin: 0;
}
li {
  margin-bottom: 1.5rem;
  font-size: clamp(1.05rem, 1.4vw, 1.15rem);
  line-height: 1.7;
  color: var(--text-muted);
  text-wrap: pretty;
}
li strong {
  color: var(--text-main);
  font-weight: 700;
}

/* Graphic Blocks (Premium presentation aesthetic) */
.graphic-box {
  background: var(--bg-alt);
  border-radius: 20px;
  padding: 2.5rem;
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.graphic-box .stat {
  font-size: 4rem;
  font-weight: 800;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
  line-height: 1;
}

/* Mechanism Cards */
.mech-card {
  background: white;
  border: 1px solid rgba(0,0,0,0.06);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 10px -4px rgba(0,0,0,0.04);
}
.mech-card:last-child {
  margin-bottom: 0;
}
.mech-num {
  font-family: var(--font-en);
  font-weight: 800;
  color: var(--accent-cyan);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}
.mech-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
  text-wrap: balance;
}
.mech-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.4;
  text-wrap: pretty;
}

/* Hide inactive language */
body.lang-en [data-lang="ja"],
body.lang-ja [data-lang="en"] {
  display: none !important;
}

/* Slide Numbering */
.footer-line {
  position: absolute;
  bottom: 2.5rem;
  left: 4rem;
  right: 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-light);
  padding-top: 1rem;
}
.footer-line .brand {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}
@media print {
  .footer-line { bottom: 1.5rem; }
}

/* Title Slide Specifics */
.slide-center {
  text-align: center;
  align-items: center;
}

/* Custom CSS Charts & Diagrams */
.diagram-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
}

/* Bubble Size Comparison Diagram */
.bubble-compare {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: white;
  padding: 2rem;
  border-radius: 16px;
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
  margin-top: 2rem;
}
.bubble-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.circle-normal {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px dashed var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: 700;
}
.circle-nano {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-cyan);
  display: flex;
  position: relative;
}
.circle-nano::after {
  content: '< 200nm';
  position: absolute;
  top: 35px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--accent-cyan);
  font-weight: 800;
  white-space: nowrap;
}
.bubble-label {
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-main);
}

/* Bar Charts */
.chart-row {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
}
.chart-box {
  flex: 1;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}
.chart-title {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2rem;
  color: var(--text-main);
}
.bar-chart-container {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 150px;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
  position: relative;
}
.bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 60px;
  height: 100%;
}
.bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
  transition: height 1s ease-out;
  position: relative;
}
.bar-before {
  background: var(--border-light);
}
.bar-after {
  background: var(--accent-cyan);
}
.bar-value {
  position: absolute;
  top: -25px;
  width: 100%;
  text-align: center;
  font-weight: 800;
  font-size: 1.1rem;
}
.bar-label {
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}
.line-chart-container {
  position: relative;
  height: 120px;
  border-bottom: 1px solid var(--border-light);
  border-left: 1px solid var(--border-light);
  display: flex;
  align-items: flex-end;
  margin-top: 2rem;
}
.line-bar {
  flex: 1;
  background: rgba(2, 132, 199, 0.1);
  margin: 0 1rem;
  border-top: 3px solid var(--accent-cyan);
  position: relative;
  text-align: center;
}
.line-val {
  position: absolute;
  top: -30px;
  width: 100%;
  font-weight: 800;
  color: var(--accent-cyan);
  font-size: 1.5rem;
}
.line-label {
  position: absolute;
  bottom: -30px;
  width: 100%;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* SDG Cards */
.sdg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
  flex: 1; /* stretches grid to fill available space */
}
.sdg-card {
  background: white;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05);
  height: 100%;
}
.sdg-icon {
  margin-bottom: 1rem;
}
.sdg-icon svg {
  width: 2rem;
  height: 2rem;
  opacity: 0.9;
}
.sdg-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sdg-num {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  margin-bottom: 0.4rem;
}
.sdg-desc {
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  text-wrap: balance;
}

/* Compare Cards (Slide 7) */
.compare-card {
  background: white;
  border: 1px solid rgba(0,0,0,0.06);
  padding: 1.75rem 2rem;
  border-radius: 16px;
  box-shadow: 0 4px 10px -4px rgba(0,0,0,0.04);
}
.bar-compare {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.bar-label {
  width: 120px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
}
.bar-track {
  flex: 1;
  height: 24px;
  background: #f1f5f9;
  border-radius: 12px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 12px;
}
.bar-val {
  width: 80px;
  text-align: right;
  font-weight: 700;
  font-size: 1rem;
}

/* Modal UI for Info Sources */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-box {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 650px;
  padding: 2.5rem;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 85vh;
  overflow-y: auto;
}
.modal-overlay.active .modal-box {
  transform: translateY(0);
}
.modal-close-btn {
  position: absolute;
  top: 1rem; right: 1.25rem;
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: var(--text-muted);
  box-shadow: none;
  padding: 0;
  cursor: pointer;
}
.modal-close-btn:hover {
  color: var(--text-main);
}
.info-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 1rem;
  padding: 0;
}
.info-toggle-btn:hover {
  background: var(--bg-alt);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}
.modal-body p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}
.modal-body strong {
  color: var(--text-main);
}
