/* merita.jp - style.css
 * Fluid single-column layout with readable max-width for prose
 * and full-bleed capability for media.
 */

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: #ffffff;
  color: #1a1a1a;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  font-size: clamp(0.9375rem, 0.85rem + 0.25vw, 1.0625rem);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: #1d4ed8;
  text-decoration: none;
  text-underline-offset: 0.15em;
}
a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

p {
  margin: 0.875em 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  line-height: 1.35;
}

h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  font-weight: 700;
  color: #111;
  border-left: 3px solid #cbd5e1;
  padding-left: 0.6em;
}

h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.0625rem;
  font-weight: 600;
  color: #1e293b;
}

h4 {
  margin: 1.5rem 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: #334155;
}

pre, code, kbd, samp,
.programlisting, .screen, .synopsis {
  font-family: Inconsolata, ui-monospace, SFMono-Regular, monospace;
}

/* === Layout === */
#site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

#site-header .header-inner {
  width: min(100%, 90rem);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem clamp(1rem, 3vw, 2rem);
}

#site-header .site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #111;
  text-decoration: none;
  letter-spacing: -0.01em;
}
#site-header .site-brand:hover {
  text-decoration: none;
}
#site-header .site-brand img {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  object-fit: cover;
}

#site-header nav {
  margin-left: auto;
}

#site-header nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 450;
}

#site-header nav a {
  display: block;
  padding: 0.35rem 0.625rem;
  border-radius: 0.25rem;
  color: #555;
  text-decoration: none;
  transition: background-color 0.12s, color 0.12s;
}
#site-header nav a:hover {
  background-color: #f4f4f5;
  color: #111;
  text-decoration: none;
}

/* ナビゲーション active */
body[class^="index"] #site-header .site-brand,
body[class^="nightwings"] #site-header li.nightwings a,
body[class^="cg"] #site-header li.cg a,
body[class^="web-design-tips"] #site-header li.web-design-tips a,
body[class^="yokohama-sketch"] #site-header li.yokohama-sketch a,
body[class^="about"] #site-header li.about a,
body[class^="link"] #site-header li.link a,
body[class^="keyword"] #site-header li.keyword a {
  background-color: #18181b;
  color: #fff;
}

/* Container: fluid with comfortable side padding */
#site-container {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 3rem) 4rem;
}

/* Grid: single column, prose max-width */
#site-grid {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

/* Main content: fluid width, constrained prose */
#site-main {
  width: 100%;
}

/* Prose paragraphs and text blocks: readable line length */
/* max-width は設定しない: コンテナ幅に任せる */

/* Allow figures/images to use full available width */
#site-main .informalfigure,
#site-main .figure,
#site-main .googlemap {
  max-width: 100%;
}

/* Sidebar: minimal, inline at bottom */
#site-sidebar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  padding-top: 2rem;
  border-top: 1px solid #e5e5e5;
  font-size: 0.8125rem;
  color: #666;
}

#site-sidebar .sidebar-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

#site-sidebar .sidebar-box img {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
}

#site-sidebar .sidebar-box .caption {
  font-size: 0.8125rem;
  text-align: left;
  margin: 0;
}

/* Footer */
#site-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e5e5;
  font-size: 0.75rem;
  color: #a1a1aa;
  letter-spacing: 0.01em;
}
#site-footer a {
  color: #a1a1aa;
}
#site-footer a:hover {
  color: #555;
}

/* === Pager === */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 2rem 0;
}
@media (max-width: 480px) {
  .pager {
    grid-template-columns: 1fr;
  }
}

.pager .pager-prev,
.pager .pager-next {
  padding: 0.875rem 1rem;
  border: 1px solid #e5e5e5;
  border-radius: 0.625rem;
  transition: border-color 0.15s, background-color 0.15s;
}
.pager .pager-prev:hover,
.pager .pager-next:hover {
  border-color: #d4d4d8;
  background-color: #fafafa;
}

.pager .pager-next {
  text-align: right;
  grid-column: -2 / -1;
}

.pager .mark {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a1a1aa;
  margin-bottom: 0.2rem;
}

.pager a {
  color: #18181b;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
}
.pager a:hover {
  color: #1d4ed8;
  text-decoration: none;
}

.pager .title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pager p {
  margin: 0;
}

/* === Breadcrumb === */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  font-size: 0.8125rem;
  color: #a1a1aa;
}
.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.breadcrumb a {
  color: #71717a;
}
.breadcrumb a:hover {
  color: #1d4ed8;
}
.breadcrumb .separator {
  color: #d4d4d8;
}

/* === Content === */
.titlepage h1 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: clamp(1.375rem, 1.1rem + 1vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #111;
}

.pubdate {
  font-size: 0.8125rem;
  color: #a1a1aa;
  margin-bottom: 1.5rem;
}

.informalfigure, .figure {
  margin: 1.5rem 0;
}
.informalfigure img, .figure img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  width: auto;
  height: auto;
  border-radius: 0.5rem;
}

.informalfigure-float {
  float: left;
  margin: 0.25rem 1.25rem 1rem 0;
  max-width: 45%;
}

.caption {
  text-align: center;
  font-size: 0.8125rem;
  color: #71717a;
  margin-top: 0.5rem;
}

.blockquote .blockquote-title,
.formalpara .formalpara-title,
.table-title,
.figure-title,
.example-title,
.equation-title,
.sidebar-title {
  font-weight: 600;
}

.blockquote .attribution {
  text-align: right;
  font-size: 0.875rem;
  color: #71717a;
}

.emphasis em {
  font-style: normal;
  font-weight: 600;
  background: linear-gradient(to top, #fef08a 40%, transparent 40%);
  padding: 0 0.1em;
}

/* === ThumbLink === */
.tip ul,
[id^="keyword."] ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tip ul li .ThumbLink,
[id^="keyword."] ul li .ThumbLink {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.75rem 0;
  padding: 1rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  transition: background-color 0.12s, border-color 0.12s;
}
/* Hide <br> inside ThumbLink so it doesn't break flex flow */
.tip ul li .ThumbLink br,
[id^="keyword."] ul li .ThumbLink br {
  display: none;
}
.tip ul li .ThumbLink:hover,
[id^="keyword."] ul li .ThumbLink:hover {
  background-color: #fafafa;
  border-color: #e5e5e5;
}

.tip ul li .ThumbLink .formalpara-title,
[id^="keyword."] ul li .ThumbLink .formalpara-title {
  width: 100%;
  margin-bottom: 0.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
}

.tip ul li .ThumbLink img,
[id^="keyword."] ul li .ThumbLink img {
  border-radius: 0.375rem;
}

.tip ul li .ThumbLink .inlinemediaobject,
[id^="keyword."] ul li .ThumbLink .inlinemediaobject {
  display: inline-block;
}

.tip ul li .ThumbLink a.link,
[id^="keyword."] ul li .ThumbLink a.link {
  display: inline-block;
}

.tip ul li .ThumbLink .phrase,
[id^="keyword."] ul li .ThumbLink .phrase {
  width: 100%;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.7;
  color: #52525b;
}

/* === Amazon === */
.amazon-images-MZZZZZZZ,
.amazonad_small {
  display: inline-block;
  vertical-align: top;
  width: 155px;
  margin: 0;
  padding: 0;
}
.amazon-images-MZZZZZZZ img {
  display: block;
  margin: 0 auto;
  border-radius: 0.375rem;
}

.dbhtml-include-amazon {
  margin: 2rem 0;
  padding: 0;
}

/* === Google Map === */
.googlemap {
  display: block;
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
}
.googlemap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  border: 0;
}

/* === Yokohama Sketch thumbnails === */
.yokohama-sketch\.03\.thumb {
  display: inline-block;
  vertical-align: top;
  padding: 3px;
}

/* === URI === */
a.uri {
  word-break: break-all;
  overflow-wrap: break-word;
}

/* === Scroll to Top === */
#internallink {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 30;
}
#internallink a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e5e5e5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  color: #555;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  font-size: 0;
}
#internallink a:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  text-decoration: none;
}
#internallink a::after {
  content: "↑";
  font-size: 1.125rem;
}

/* === Sidebar iframe === */
#site-sidebar iframe {
  display: block;
  margin: 0 auto;
  max-width: 100% !important;
}

/* === Code blocks === */
.programlisting, .screen {
  white-space: pre;
  overflow-x: auto;
  padding: 1.25rem 1.5rem;
  background: #f4f4f5;
  border-radius: 0.625rem;
  font-size: 0.8125rem;
  line-height: 1.6;
  margin: 1.25rem 0;
  border: 1px solid #e5e5e5;
}

/* === TOC === */
.toc ul {
  padding-left: 1.25rem;
}
.toc li {
  margin: 0.3rem 0;
}

/* === Responsive fine-tuning === */
@media (max-width: 640px) {
  #site-header .header-inner {
    gap: 0.5rem;
  }
  #site-header nav a {
    padding: 0.3rem 0.4rem;
    font-size: 0.75rem;
  }
  .informalfigure-float {
    float: none;
    max-width: 100%;
    margin: 1rem 0;
  }
}
