/* ============================================================
   Shinji Murakami - Shared Styles
   All pages load this file for common layout and components
   ============================================================ */

/* --- Base --- */
body {
  font-family: monospace;
}

/* --- Header & Menu --- */
#menu { line-height: 1.4; }
.menu-desktop { display: none; }
.menu-mobile { display: inline; }
@media (min-width: 768px) {
  .menu-desktop { display: inline; }
  .menu-mobile { display: none; }
}
@media (min-width: 768px) {
  #header { display: flex; align-items: flex-start; gap: 2em; }
}

/* --- Works Grid (used on most pages) --- */
#allworks-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-top: 2em;
}
#allworks-grid figure {
  margin: 0;
  padding: 0;
}
#allworks-grid figure > div {
  width: 100%;
}
#allworks-grid img {
  width: 100%;
  height: auto;
  display: block;
}
#allworks-grid figure > a {
  pointer-events: none;
}
@media (min-width: 768px) {
  #allworks-grid figure > a {
    pointer-events: auto;
  }
}
#allworks-grid figcaption {
  text-align: left;
  padding: 4px 0 24px;
}
@media (min-width: 768px) {
  #allworks-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  #allworks-grid figure {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  #allworks-grid figure > div {
    width: 100%;
    align-self: stretch;
  }
  #allworks-grid figcaption {
    align-self: flex-start;
  }
}

/* --- Works Exhibited Grid (exhibition detail pages) --- */
#works-exhibited hr {
  border: none;
  border-top: 1px solid #ccc;
  margin: 2em 0;
}
#works-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}
#works-grid figure {
  margin: 0;
  padding: 0;
}
#works-grid img {
  width: 100%;
  height: auto;
  display: block;
}
#works-grid figcaption {
  text-align: left;
  padding: 4px 0 24px;
}
@media (min-width: 768px) {
  #works-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  #works-grid figure {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  #works-grid figcaption {
    align-self: flex-start;
  }
}

/* --- iframe --- */
iframe { border: 0; }
.javatari-iframe {
  width: 100%;
  overflow: hidden;
}
@media (max-width: 767px) {
  .javatari-iframe { height: 350px; }
}

/* --- Exhibition Description --- */
#description {
  margin: 2em 0;
}
#description h2 {
  font-family: monospace;
  font-size: 1.2em;
  margin: 0 0 0.5em;
}
#description .exhibition-info {
  line-height: 1.6;
  margin-bottom: 1em;
}
#description details {
  margin-bottom: 1em;
}
#description details p {
  max-width: 100%;
}
#description hr {
  border: none;
  border-top: 1px solid #ccc;
  margin: 2em 0;
}
summary { color: blue; cursor: pointer; text-decoration: underline; }

/* --- Description Split (project/exhibition detail pages) --- */
#description-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2em;
  margin: 0 0 2em;
}
@media (min-width: 768px) {
  #description-split {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}
#description-split .desc-text {
  line-height: 1.6;
}
#description-split .desc-text p { margin: 0 0 1em; }
#description-split .desc-image > img {
  width: 100%;
  height: auto;
  display: block;
}

/* --- Dark Theme --- */
.dark {
  background: #0d1117;
  color: #c9d1d9;
}
.dark a { color: #5991f1; }
.dark #description hr,
.dark .year-header hr { border-top-color: #30363d; }
.dark summary { color: #5991f1; }
body {
  transition: background 0.3s, color 0.3s;
}

/* --- Theme Toggle --- */
#theme-toggle {
  position: fixed;
  top: 1em;
  right: 1em;
  background: none;
  border: none;
  font-family: monospace;
  font-size: 1em;
  color: inherit;
  cursor: pointer;
  z-index: 1001;
}

/* --- Back to Top --- */
#back-to-top {
  position: fixed;
  bottom: 2em;
  right: 2em;
  background: #333;
  color: #fff;
  border: 1px solid #666;
  font-family: monospace;
  font-size: 1em;
  padding: 0.5em 0.8em;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 1000;
}
#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}
.dark #back-to-top {
  background: #c9d1d9;
  color: #0d1117;
  border-color: #c9d1d9;
}
