@charset "utf-8";
/* Enhanced Stylesheet for EPUB/Web Book */
/* Based on Tatujin-Publishing */

:root {
  --primary-color: #3a7561;
  --secondary-color: #1b4636;
  --accent-color: #e67e22;
  --text-color: #333;
  --light-text: #666;
  --lighter-text: #999;
  --background-color: #fff;
  --light-background: #f9f9f9;
  --border-color: #ddd;
  --code-background: #f8f8f8;
  --link-color: #2980b9;
  --link-hover: #1a5889;
  --sidebar-width: 280px;
  --font-main: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --font-text: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --font-code: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  --radius: 6px;
}

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

body {
  margin: 0;
  padding: 0;
  font-size: 16px;
  line-height: 1.7;
  font-family: var(--font-main);
  color: var(--text-color);
  background-color: var(--background-color);
}

/* Layout */
.book {
  display: flex;
  min-height: 100vh;
}

.side-content {
  width: var(--sidebar-width);
  background-color: var(--light-background);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.book-body {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  max-width: 900px;
}

/* Typography */
p, ul, ol, dl, pre, table {
  font-family: var(--font-text);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-main);
  font-weight: 700;
  line-height: 1.3;
  margin: 2rem 0 1rem;
  color: var(--secondary-color);
}

h1 {
  margin: 0 0 2rem;
  padding: 1rem 0;
  border-bottom: 4px solid var(--primary-color);
  font-size: 2.2rem;
  position: relative;
}

h1:after {
  content: "";
  display: block;
  width: 30%;
  height: 4px;
  background-color: var(--accent-color);
  position: absolute;
  bottom: -4px;
  left: 0;
}

h2 {
  margin: 3rem 0 1.5rem;
  padding: 0.5rem 0;
  border-bottom: 2px solid var(--primary-color);
  font-size: 1.8rem;
}

h3 {
  margin: 2.5rem 0 1rem;
  font-size: 1.4rem;
  color: var(--primary-color);
}

h4, h5, h6 {
  margin: 1.5rem 0 1rem;
  font-size: 1.2rem;
}

/* Paragraph */
p {
  margin: 0 0 1.5rem;
  text-align: justify;
  text-indent: 1em;
  line-height: 1.8;
}

div.lead p {
  color: var(--light-text);
  font-size: 1.1rem;
  font-style: italic;
  text-indent: 0;
  border-left: 3px solid var(--accent-color);
  padding-left: 1rem;
}

/* Links */
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover, a:focus {
  color: var(--link-hover);
  text-decoration: underline;
}

a[href],
a:link,
a:visited {
  border-bottom: 1px solid rgba(41, 128, 185, 0.3);
  text-decoration: none;
}

a[href]:hover,
a:link:hover,
a:visited:hover {
  border-bottom: 1px solid rgba(41, 128, 185, 0.8);
}

/* Lists */
ul, ol {
  margin: 1.5rem 0 1.5rem 2rem;
  padding: 0;
}

ul > li,
ol > li {
  margin: 0 0 0.7rem 0;
  padding: 0 0 0 0.3rem;
  line-height: 1.7;
}

dl {
  margin: 1.5rem 0;
  padding: 0;
}

dt {
  margin: 1rem 0 0.5rem;
  padding: 0;
  font-weight: bold;
  color: var(--primary-color);
}

dd {
  margin: 0 0 1rem 1.5rem;
  padding: 0;
  line-height: 1.7;
}

/* Sidebar */
.side-content h1 {
  font-size: 1.3rem;
  margin: 0 0 1.5rem;
  padding: 0 0 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--primary-color);
  text-align: center;
}

.side-content h1:after {
  display: none;
}

.book-toc {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
}

.book-toc li {
  margin: 0 0 0.7rem;
  padding: 0;
}

.book-toc a {
  display: block;
  padding: 0.5rem;
  color: var(--text-color);
  border-radius: var(--radius);
  border-bottom: none;
  transition: all 0.2s ease;
}

.book-toc a:hover {
  background-color: rgba(58, 117, 97, 0.1);
  color: var(--primary-color);
  text-decoration: none;
  transform: translateX(3px);
}

.review-signature {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--lighter-text);
  text-align: center;
}

/* Table */
table {
  margin: 2rem auto;
  border-collapse: collapse;
  width: 100%;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
}

table tr th {
  background-color: var(--primary-color);
  color: white;
  padding: 0.7rem;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 600;
}

table tr:nth-child(even) {
  background-color: var(--light-background);
}

table tr td {
  padding: 0.7rem;
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
}

p.tablecaption, table caption {
  margin: 0 0 0.5rem;
  color: var(--light-text);
  font-size: 0.9rem;
  font-weight: bold;
  text-align: left;
  text-indent: 0;
}

/* Quote */
blockquote {
  margin: 2rem 0;
  padding: 1rem 1.5rem;
  border-left: 5px solid var(--primary-color);
  background-color: var(--light-background);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}

blockquote p {
  text-indent: 0;
  margin-bottom: 0.5rem;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Column Block */
div.column {
  margin: 2rem 0;
  padding: 1.5rem;
  background-color: var(--light-background);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-left: 5px solid var(--accent-color);
}

div.column * {
  margin: 0.7rem 0;
}

div.column *:first-child {
  margin-top: 0;
}

div.column *:last-child {
  margin-bottom: 0;
}

/* Code Block */
div.code, div.caption-code, div.source-code, div.emlist-code, div.emlistnum-code {
  margin: 1.5rem 0;
}

pre.emlist, pre.source, pre.list, pre.cmd {
  margin: 0;
  padding: 1rem;
  border-radius: var(--radius);
  font-family: var(--font-code);
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-x: auto;
}

pre.emlist, pre.source, pre.list {
  background-color: var(--code-background);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

div p.caption {
  margin: 0 0 0.5rem;
  color: var(--light-text);
  font-size: 0.9rem;
  font-weight: bold;
}

div.cmd-code pre.cmd {
  background-color: #2c3e50;
  color: #ecf0f1;
  font-weight: 600;
  border-radius: var(--radius);
}

/* Navigation */
.book-navi {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  padding: 1rem 0.5rem;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.book-navi:hover {
  background-color: rgba(255, 255, 255, 0.9);
}

.book-prev {
  left: var(--sidebar-width);
}

.book-next {
  right: 0;
}

.book-cursor {
  padding: 0.5rem;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.book-navi:hover .book-cursor {
  background-color: var(--accent-color);
  transform: scale(1.1);
}

/* Image Block */

.cover-image img.max {
  max-width: 100%;
  height: auto;
}

div.image {
  margin: 2rem auto;
  text-align: center;
}

div.image img {
  max-width: 100%;
  height: auto;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

div.image p.caption {
  margin: 1rem auto 0;
  text-align: center;
  color: var(--light-text);
  font-size: 0.9rem;
  font-weight: bold;
  text-indent: 0;
}

/* Footnote Block */
div.footnote {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

div.footnote p.footnote {
  color: var(--light-text);
  font-size: 0.9rem;
  text-indent: 0;
  line-height: 1.6;
}

/* Colophon */
div.colophon {
  margin: 3rem auto;
  padding: 2rem;
  background-color: var(--light-background);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

div.colophon p {
  text-indent: 0;
}

div.colophon p.title {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
}

div.colophon table {
  margin: 1rem 0 2rem;
  border: none;
  box-shadow: none;
}

div.colophon table tr th {
  background-color: transparent;
  color: var(--text-color);
  font-size: 1rem;
  font-weight: bold;
  text-align: right;
  padding-right: 1.5rem;
  width: 30%;
  border: none;
}

div.colophon table tr td {
  font-size: 1rem;
  border: none;
}

/* Inline */
b {
  font-weight: 700;
}

strong {
  font-weight: 700;
  color: var(--primary-color);
}

em {
  font-style: italic;
}

span.balloon {
  font-size: 0.9rem;
  background-color: rgba(230, 126, 34, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  margin: 0 0.3rem;
  position: relative;
}

span.balloon:before {
  content: "←";
  margin-right: 0.3rem;
  color: var(--accent-color);
}

/* Code Highlighting from Rouge */
.highlight {
  background-color: var(--code-background);
  border-radius: var(--radius);
}

.highlight table {
  margin: 0;
  box-shadow: none;
}

.highlight table td {
  padding: 5px;
  border: none;
}

.highlight table pre {
  margin: 0;
}

.highlight .cm,
.highlight .c1,
.highlight .cs,
.highlight .c, 
.highlight .cd {
  color: #8c9b9d;
  font-style: italic;
}

.highlight .cp {
  color: #8c9b9d;
  font-weight: bold;
}

.highlight .err {
  color: #a61717;
  background-color: #e3d2d2;
}

.highlight .k, 
.highlight .kc, 
.highlight .kd, 
.highlight .kn, 
.highlight .kp, 
.highlight .kr, 
.highlight .kv {
  color: #6c71c4;
  font-weight: bold;
}

.highlight .kt {
  color: #458;
  font-weight: bold;
}

.highlight .s, 
.highlight .sb, 
.highlight .sc, 
.highlight .sd, 
.highlight .s2, 
.highlight .se, 
.highlight .sh, 
.highlight .si, 
.highlight .sx, 
.highlight .s1 {
  color: #d14;
}

.highlight .sr {
  color: #009926;
}

.highlight .ss {
  color: #990073;
}

.highlight .na {
  color: #008080;
}

.highlight .nb {
  color: #0086B3;
}

.highlight .nc {
  color: #458;
  font-weight: bold;
}

.highlight .no {
  color: #008080;
}

.highlight .nd {
  color: #3c5d5d;
  font-weight: bold;
}

.highlight .ni {
  color: #800080;
}

.highlight .ne,
.highlight .nf,
.highlight .nl {
  color: #900;
  font-weight: bold;
}

.highlight .nn {
  color: #555;
}

.highlight .nt {
  color: #000080;
}

.highlight .vc,
.highlight .vg,
.highlight .vi,
.highlight .nv {
  color: #008080;
}

.highlight .ow,
.highlight .o {
  color: #000;
  font-weight: bold;
}

.highlight .w {
  color: #bbb;
}

.highlight .m, 
.highlight .mb, 
.highlight .mx,
.highlight .mf,
.highlight .mh,
.highlight .mi,
.highlight .mo,
.highlight .il {
  color: #099;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }
  
  .book-body {
    padding: 1.5rem;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 220px;
  }
  
  .book-body {
    padding: 1rem;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  h3 {
    font-size: 1.2rem;
  }
}

/* Image width definitions (percentage) */
.width-010per { width: 10%; }
.width-020per { width: 20%; }
.width-025per { width: 25%; }
.width-030per { width: 30%; }
.width-033per { width: 33%; }
.width-040per { width: 40%; }
.width-050per { width: 50%; }
.width-060per { width: 60%; }
.width-067per { width: 67%; }
.width-070per { width: 70%; }
.width-075per { width: 75%; }
.width-080per { width: 80%; }
.width-090per { width: 90%; }
.width-100per { width: 100%; }

/* Print styles for PDF output */
@media print {
  .side-content,
  .book-navi {
    display: none;
  }
  
  .book-body {
    margin-left: 0;
    max-width: 100%;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
  
  img, table, pre {
    page-break-inside: avoid;
  }
}
