/* Koshishirai Theme base layout, independent of a parent theme. */
:root {
  --ast-global-color-0: #4db6ac;
  --ast-global-color-1: #3a3a3a;
  --ast-global-color-2: #03fae3;
  --ast-global-color-3: #4b4f58;
  --ast-global-color-4: #f5f5f5;
  --ast-global-color-5: #ffffff;
  --ast-global-color-6: #f2f5f7;
  --ast-global-color-7: #2c2c2c;
  --ast-global-color-8: #000000;
  --ast-border-color: #eaeaea;
  --ks-content-reading: 60rem;
  --ks-tool-max-width: 1000px;
  /* Outer border-box width, including the existing responsive gutters. */
  --ks-container-max-width: 1200px;
  /* In-flow publisher-owned ad wrappers only; Auto ads own their geometry. */
  --ks-ad-max-width: 1200px;
  --ks-content-wide: var(--ks-container-max-width);
  --ks-gutter: clamp(1rem, 4vw, 3rem);
  --ks-radius: .5rem;
  --ks-border: 1px solid var(--ast-border-color);
}

html { box-sizing: border-box; font-size: 112.5%; min-height: 100%; }
*, *::before, *::after { box-sizing: inherit; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  margin: 0;
  color: #fff;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 1rem;
  line-height: 1.8571428571;
  -webkit-font-smoothing: antialiased;
}
body { line-height: 0; }
#page { line-height: 1.8571428571; }

body:not(.home),
body:not(.home) #page,
body:not(.home) #content,
body:not(.home) .site-content {
  background-color: #2c2c2c;
}
img { max-width: 100%; height: auto; vertical-align: middle; }
main, nav { display: block; }
button, input, select, textarea { font: inherit; }
button, input[type="button"], input[type="submit"] { cursor: pointer; }

.ast-container {
  width: 100%;
  max-width: var(--ks-container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-inline: var(--ks-gutter);
}

/* Normal-flow sticky footer: the content, not the footer, takes spare space.
 * WordPress reserves its toolbar above html; use Core's responsive height. */
html:has(> body.admin-bar) { min-height: 0; }
body.admin-bar {
  min-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
  min-height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
}
#page {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
}
#page > #masthead, #page > #colophon { flex: 0 0 auto; }
#page > #content { flex: 1 0 auto; min-width: 0; }
#primary, #secondary { width: 100%; }
#primary { margin: 1em 0; }
.entry-header { margin-bottom: 1.2em; word-wrap: break-word; }
.entry-title { margin: 0 0 .67em; color: #fff; font-size: 2em; font-weight: 700; line-height: 1.3; text-align: center; word-wrap: break-word; }
.entry-content { word-wrap: break-word; min-width: 0; }
.entry-content::after { display: table; clear: both; content: ""; }
.entry-content p { margin-bottom: 1.6em; }
.entry-content h1, h1 { color: #fff; font-size: 2em; line-height: 1.2; }
.entry-content h2, h2 { color: #fff; font-size: 1.7em; line-height: 1.3; }
.entry-content h3, h3 { color: #fff; font-size: 1.5em; line-height: 1.4; }
.entry-content h4, h4 { color: #fff; font-size: 1.3em; line-height: 1.5; }
.entry-content h5, h5 { color: #fff; font-size: 1.2em; line-height: 1.6; }
.entry-content h6, h6 { color: #fff; font-size: 1.1em; line-height: 1.7; }

@media (max-width: 921px) {
  .ast-container { padding-left: 10px; padding-right: 10px; }
}

.entry-content a,
.comments-area a { color: var(--ast-global-color-0); }

a { color: #4db6ac; }

.post-edit-link,
.edit-link a,
a[href*="/wp-admin/"] { color: inherit; }

button,
input[type="button"],
input[type="submit"],
.button,
.wp-block-button__link {
  padding: 10px 15px;
  color: #fff;
  background: var(--ast-global-color-0);
  border: 0;
  border-radius: 2px;
  line-height: 1.8571428571;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.7em;
  border: 1px solid var(--ast-border-color);
  background: #fff;
}

.comments-area {
  margin-top: 3em;
  padding: 2em 0;
}

.comments-title { margin-bottom: 1.5em; }
.comment-list { margin-left: 1.5em; }
.comment-list .comment { margin-bottom: 1.5em; }
.comment-content { margin-top: 0.75em; }
.comment-form-cookies-consent { display: flex; gap: 0.5em; align-items: flex-start; }
.comment-form-cookies-consent input { width: auto; margin-top: 0.45em; }

.navigation.pagination,
.comment-navigation { display: flex; justify-content: space-between; gap: 1em; margin: 2em 0; }
.nav-links { display: flex; gap: 1em; }

.wp-block-image img { height: auto; }
.aligncenter { margin-right: auto; margin-left: auto; }
.alignwide { max-width: 100%; }
.alignfull { width: 100%; max-width: none; }

.site-main { width: 100%; }
.archive article,
.blog article,
.search article { margin-bottom: 2.5em; }
.archive article:last-child,
.blog article:last-child,
.search article:last-child { margin-bottom: 0; }
.entry-footer { margin-top: 1.5em; }
.edit-link { margin-left: 1em; }
.post-thumb { margin-bottom: 1.5em; text-align: center; }
.post-thumb img { width: 792px; max-width: 100%; }
@media (max-width: 1247px) {
  .post-thumb img { width: calc(100vw - 408px); }
}
@media (max-width: 921px) {
  .post-thumb img { width: calc(100vw - 20px); }
}
.page-links { clear: both; margin: 1.5em 0; }

.works-page .entry-title { display: none; }
.works-page #primary { margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }

body.page:not(.home) .site-content > .ast-container {
  max-width: var(--ks-content-wide);
  padding-inline: var(--ks-gutter);
}
body.page.page-layout-reading .site-content > .ast-container {
  max-width: min(var(--ks-container-max-width), calc(var(--ks-content-reading) + 2 * var(--ks-gutter)));
}
@media (min-width: 922px) {
  body.single .site-content > .ast-container {
    max-width: var(--ks-container-max-width);
    padding-inline: var(--ks-gutter);
  }
}

@media (min-width: 922px) {
  .site-content > .ast-container { display: flex; gap: 2rem; }
  .site-content > .ast-container > .primary { flex: 1 1 auto; min-width: 0; }
  .site-content > .ast-container > #secondary { flex: 0 0 280px; }
}

/* Site-owned tool shells share one width. The class is an opt-in contract;
 * data-ks-web-tool covers tools created with the existing generator. Legacy
 * roots stay here so HTML IDs, editor adapters and feature assets need no edits.
 * Only outer shells are matched; internal previews, controls and text retain
 * their feature-specific dimensions. The content scope beats legacy fallbacks. */
.site-content :is(
  .ks-tool-shell, [data-ks-web-tool], .ks-web-tool, .ks-shortcode-shell,
  .ks-archive, .video-tool, .oped, .image-tool, .playlist-cover__app,
  .pg-tool, .sc-tool, .rg-tool, .blc-tool, .avb-tool, .vr-tool, .vas-tool, .mv-tool
) {
  width: 100%;
  max-width: var(--ks-tool-max-width);
  min-width: 0;
  margin-inline: auto;
  box-sizing: border-box;
}

/* Opt-in hook for publisher-owned, normal-flow ad wrappers. Never target
 * adsbygoogle, Google-created frames, anchors or side rails here. No new unit
 * is created and existing units are not moved into this wrapper. */
.ks-ad-container {
  width: 100%;
  max-width: var(--ks-ad-max-width);
  margin-inline: auto;
}
