/*
Theme Name: tomatolabo.net
Author: tomatolabo.net
Description: tomatolabo.netの記事を、複数列のカードと静かな読みものとして見せるテーマです。
Version: 2.4.1
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: tomatolabo-net
*/

:root {
  --tomatolabo-bg: #fafafa;
  --tomatolabo-text: #242321;
  --tomatolabo-muted: #66635f;
  --tomatolabo-heading: #55524f;
  --tomatolabo-rule: #d8d5d0;
  --tomatolabo-outline: #aaa89f;
  --tomatolabo-radius: 18px;
  --tomatolabo-home-width: 680px;
  --tomatolabo-grid-width: 680px;
  --tomatolabo-desktop-columns: 2;
  --tomatolabo-card-gap: 22px;
  --tomatolabo-reading-width: 720px;
}

.tomatolabo-desktop-columns-3 { --tomatolabo-grid-width: 1031px; --tomatolabo-desktop-columns: 3; }
.tomatolabo-desktop-columns-4 { --tomatolabo-grid-width: 1382px; --tomatolabo-desktop-columns: 4; }
.tomatolabo-desktop-columns-5 { --tomatolabo-grid-width: 1733px; --tomatolabo-desktop-columns: 5; }

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--tomatolabo-bg);
  color: var(--tomatolabo-text);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.screen-reader-text:focus {
  z-index: 100000; top: 8px; left: 8px; width: auto; height: auto;
  padding: 10px 14px; clip: auto; background: #fff;
}

.site-header {
  width: min(calc(100% - 48px), var(--tomatolabo-home-width));
  margin: 0 auto;
  padding: 34px 0 24px;
  text-align: center;
}

.site-title {
  display: inline-block;
  color: var(--tomatolabo-heading);
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(27px, 2.45vw, 38px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.055em;
  text-decoration: none;
}

.site-logo {
  display: flex;
  justify-content: center;
}
.custom-logo-link { display: inline-block; line-height: 0; }
.custom-logo {
  display: block;
  width: var(--tomatolabo-logo-desktop-width, 280px);
  max-width: 100%;
  height: auto;
}

.site-tagline {
  margin: 0 0 9px;
  color: #77736e;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: .09em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 13px;
  margin-top: 16px;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .05em;
}

.site-nav a { text-decoration: none; }
.site-nav a:hover { opacity: .62; }
.site-nav a:focus-visible, .post-card:focus-visible {
  outline: 2px solid #57544f;
  outline-offset: 4px;
}
.nav-separator { color: #77736e; }
.social-links { display: inline-flex; align-items: center; gap: 10px; }
.social-link { display: inline-grid; width: 17px; height: 17px; place-items: center; }
.social-link img { width: 16px; height: 16px; }

.home-shell {
  width: min(calc(100% - 56px), var(--tomatolabo-grid-width));
  margin: 0 auto;
  padding-bottom: 64px;
}

.card-stack {
  display: grid;
  grid-template-columns: repeat(var(--tomatolabo-desktop-columns), minmax(0, 1fr));
  align-items: start;
  gap: var(--tomatolabo-card-gap);
}

.card-column { display: flex; flex-direction: column; gap: var(--tomatolabo-card-gap); }

.layout-controls {
  position: absolute;
  top: 22px;
  right: clamp(18px, 2.2vw, 36px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #77736e;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}
.layout-controls button {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease, opacity .2s ease;
}
.layout-controls__column { font-size: 18px; }
.layout-controls__column:hover,
.layout-controls__search-toggle:hover,
.layout-controls__gap-toggle:hover,
.layout-controls__radius-toggle:hover { opacity: .62; }
.layout-controls button:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 3px;
}
.layout-controls__column.is-active { color: #dc9699; }
.layout-controls__search-toggle {
  display: inline-grid;
  width: 17px;
  height: 17px;
  margin-right: 2px;
  place-items: center;
}
.layout-controls__search-toggle svg { width: 15px; height: 15px; fill: currentColor; }
.layout-controls__gap-toggle,
.layout-controls__radius-toggle { font-size: 12px; }
.layout-controls__gap-toggle { margin-left: 2px; }
.layout-controls__search-toggle.is-open,
.layout-controls__gap-toggle.is-open,
.layout-controls__radius-toggle.is-open { color: #dc9699; }
.layout-controls__search-panel,
.layout-controls__gap-panel,
.layout-controls__radius-panel {
  position: absolute;
  top: calc(100% + 11px);
  right: 0;
  width: 194px;
  padding: 13px 14px 12px;
  border: 1px solid #dedbd6;
  border-radius: 10px;
  background: rgba(250, 250, 250, .98);
  box-shadow: 0 10px 26px rgba(44, 40, 35, .1);
}
.layout-controls__search-panel { width: 238px; }
.layout-controls__search-form { display: flex; align-items: center; gap: 7px; }
.layout-controls__search-input {
  min-width: 0;
  width: 100%;
  height: 30px;
  padding: 5px 8px;
  border: 1px solid #d8d5d0;
  border-radius: 5px;
  background: #fff;
  color: #45423e;
  font: 12px/1.4 "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}
.layout-controls__search-submit {
  flex: 0 0 auto;
  padding: 7px 9px !important;
  border-radius: 5px !important;
  background: #66635f !important;
  color: #fff !important;
  font-size: 10px !important;
}
.layout-controls__gap-label,
.layout-controls__radius-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  color: #66635f;
  font-size: 10px;
  line-height: 1.4;
  white-space: nowrap;
}
.layout-controls__gap-range,
.layout-controls__radius-range {
  display: block;
  width: 100%;
  margin: 0;
  accent-color: #dc9699;
  cursor: pointer;
}
body.admin-bar .layout-controls { top: 54px; }

.taxonomy-heading {
  margin: 0 0 22px;
  color: var(--tomatolabo-heading);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}
.taxonomy-heading__type {
  margin: 0 0 4px;
  color: var(--tomatolabo-muted);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .12em;
}
.taxonomy-heading__title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.4; }

.post-card {
  position: relative;
  display: flex;
  min-width: 0;
  height: var(--card-height, 180px);
  overflow: hidden;
  align-items: flex-end;
  border: 1px solid transparent;
  border-radius: var(--tomatolabo-radius);
  background: #eceae6;
  color: #fff;
  text-decoration: none;
  isolation: isolate;
  transition: transform .25s ease, box-shadow .25s ease;
}

.post-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(40, 37, 32, .12); }
.post-card--short { --card-height: 130px; }
.post-card--medium { --card-height: 168px; }
.post-card--tall { --card-height: 218px; }
.post-card--extra { --card-height: 268px; }
.post-card--has-image {
  height: auto;
  aspect-ratio: var(--card-ratio, 1.4);
}

.post-card__image {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .55s ease;
}
.post-card:hover .post-card__image { transform: scale(1.025); }
.post-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, transparent 36%, rgba(8, 8, 7, var(--tomatolabo-card-overlay-opacity, .78)) 100%);
}

.post-card__copy { width: 100%; padding: 16px 17px 15px; }
.post-card:not(.post-card--empty) .post-card__copy {
  text-shadow: 0 1px var(--tomatolabo-card-text-shadow-core-blur, 3px) rgba(0, 0, 0, var(--tomatolabo-card-text-shadow-opacity, .72)), 0 0 var(--tomatolabo-card-text-shadow-blur, 10px) rgba(0, 0, 0, var(--tomatolabo-card-text-shadow-soft-opacity, .3));
}
.post-card__category {
  position: absolute;
  top: 13px;
  right: 13px;
  z-index: 2;
  display: block;
  max-width: calc(100% - 76px);
  margin: 0;
  padding: 3px 7px 2px;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 999px;
  background: rgba(20, 19, 17, .3);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: .06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px var(--tomatolabo-card-text-shadow-core-blur, 3px) rgba(0, 0, 0, var(--tomatolabo-card-text-shadow-opacity, .72));
}
.post-card__new-ribbon {
  position: absolute;
  top: 13px;
  left: 0;
  z-index: 2;
  padding: 5px 12px 4px 10px;
  border-radius: 0 999px 999px 0;
  background: #d6536d;
  color: #fff;
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: .1em;
  box-shadow: 0 3px 10px rgba(44, 26, 22, .2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .28);
}
.post-card__title {
  display: block;
  margin: 0;
  font-size: clamp(16px, 1.55vw, 21px);
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: .04em;
}
.post-card__subtitle {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  margin: 4px 0 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 10.5px;
  line-height: 1.55;
  letter-spacing: .04em;
}

.post-card--empty {
  height: auto;
  aspect-ratio: 4 / 3;
  border-color: var(--tomatolabo-outline);
  background: transparent;
  color: #62665a;
}
.post-card--empty::after { display: none; }
.post-card--minimal::after { display: none; }
.post-card--empty .post-card__copy { padding: 20px; }
.post-card--empty .post-card__category {
  border-color: currentColor;
  background: transparent;
  text-shadow: none;
}

.journal-shell {
  width: min(calc(100% - 64px), var(--tomatolabo-reading-width));
  margin: 0 auto;
  padding: 0 0 72px;
}

.journal-entry {
  display: flow-root;
  font-size: 15px;
  line-height: 1.9;
  letter-spacing: .025em;
}

.journal-entry + .journal-entry { margin-top: 20px; }
.journal-entry + .journal-entry::before {
  content: "";
  display: block;
  width: 95%;
  margin: 0 auto 20px;
  border-top: 1px solid var(--tomatolabo-rule);
}

.journal-entry__image,
.single-entry .wp-post-image,
.entry-content figure.wp-block-image.alignleft {
  float: left;
  width: 180px;
  height: 180px;
  margin: 0 24px 8px 0;
  overflow: hidden;
  border-radius: 10px;
  object-fit: cover;
}

.entry-content figure.wp-block-image.alignleft img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.journal-entry__placeholder {
  float: left;
  width: 180px;
  height: 180px;
  margin: 0 24px 8px 0;
  border: 1px solid var(--tomatolabo-outline);
  border-radius: 10px;
}

.journal-entry__title,
.single-entry__title,
.entry-content h2,
.entry-content h3 {
  margin: 0 0 10px;
  font-size: 25px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .035em;
}
.journal-entry__title a { text-decoration: none; }
.journal-entry__title a:hover { color: var(--tomatolabo-muted); }
.single-post.tomatolabo-single-title-center .single-entry__title { text-align: center; }
.single-post.tomatolabo-single-title-right .single-entry__title { text-align: right; }

.journal-entry p,
.entry-content p {
  margin: 0 0 .88em;
  font-size: 15px;
  line-height: 1.9;
}

.journal-entry__more {
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 12px;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.entry-content { display: flow-root; }
.entry-content > :first-child { margin-top: 0; }
.entry-content .wp-block-separator {
  clear: both;
  width: 95%;
  margin: 24px auto;
  border: 0;
  border-top: 1px solid var(--tomatolabo-rule);
}
.single-entry::after { content: ""; display: table; clear: both; }
.single-entry__meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 5px 0 18px;
  color: var(--tomatolabo-muted);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 11px;
}
.single-entry__edit {
  display: inline-flex;
  width: 13px;
  height: 13px;
  color: inherit;
  opacity: .72;
  transition: opacity .2s ease;
}
.single-entry__edit:hover,
.single-entry__edit:focus-visible { opacity: 1; }
.single-entry__edit svg { width: 100%; height: 100%; fill: currentColor; }

.pagination { clear: both; margin-top: 34px; text-align: center; }
.pagination .page-numbers { margin: 0 5px; }
.home-pagination {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 42px;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
}
.home-pagination__link {
  display: inline-flex;
  min-width: 92px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid #aaa69f;
  border-radius: 999px;
  text-decoration: none;
  transition: background-color .2s ease, color .2s ease;
}
.home-pagination__link:hover { background: #45423e; color: #fff; }

.related-posts { clear: both; margin-top: 48px; }
.related-posts__heading {
  margin: 0 0 17px;
  color: var(--tomatolabo-heading);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .06em;
}
.related-posts__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.related-card {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: min(var(--tomatolabo-radius), 14px);
  background: #eceae6;
  color: #fff;
  text-decoration: none;
}
.related-card--empty { border-color: var(--tomatolabo-outline); background: transparent; color: #56534f; }
.related-card__image { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.related-card:hover .related-card__image { transform: scale(1.03); }
.related-card__title {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 24px 10px 9px;
  background: linear-gradient(180deg, transparent, rgba(8, 8, 7, .78));
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .72);
}
.related-card--empty .related-card__title { background: none; text-shadow: none; }
.empty-state { padding: 40px 0; text-align: center; }

.site-footer {
  padding: 8px 24px 34px;
  color: #77736e;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 640px) {
  .layout-controls { display: none; }
  .taxonomy-heading { margin-bottom: 18px; }
  .site-header { width: min(calc(100% - 36px), 520px); padding: 42px 0 28px; }
  .site-title { font-size: clamp(27px, 8.6vw, 35px); }
  .custom-logo { width: var(--tomatolabo-logo-mobile-width, 250px); }
  .site-tagline { margin-bottom: 8px; font-size: 9.5px; }
  .site-nav { gap: 8px 9px; margin-top: 18px; font-size: 13px; letter-spacing: .01em; }
  .social-links { gap: 8px; }

  .home-shell { width: calc(100% - 52px); padding-bottom: 48px; }
  .card-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .card-column { gap: 22px; }
  .post-card { border-radius: var(--tomatolabo-mobile-card-radius, 15px); }
  .post-card--short { --card-height: 132px; }
  .post-card--medium { --card-height: 174px; }
  .post-card--tall { --card-height: 224px; }
  .post-card--extra { --card-height: 278px; }
  .post-card--has-image { height: auto; }
  .post-card__copy { padding: 13px 13px 12px; }
  .post-card__category { top: 11px; right: 11px; padding: 2px 6px; font-size: 8px; }
  .post-card__new-ribbon { top: 11px; padding: 4px 10px 3px 8px; font-size: 8px; }
  .post-card__title { font-size: clamp(14px, 4.25vw, 18px); line-height: 1.42; }
  .post-card__subtitle { font-size: clamp(9px, 2.55vw, 11px); }
  .post-card--empty .post-card__copy { padding: 14px; }

  .journal-shell { width: calc(100% - 56px); padding-bottom: 52px; }
  .journal-entry { font-size: 15px; line-height: 1.75; letter-spacing: .015em; }
  .journal-entry + .journal-entry { margin-top: 18px; }
  .journal-entry + .journal-entry::before { width: 100%; margin-bottom: 20px; }
  .journal-entry__image,
  .single-entry .wp-post-image,
  .entry-content figure.wp-block-image.alignleft,
  .journal-entry__placeholder {
    width: 92px;
    height: 92px;
    margin: 0 17px 3px 0;
    border-radius: 9px;
  }
  .journal-entry__title,
  .single-entry__title,
  .entry-content h2,
  .entry-content h3 {
    margin: 0 0 8px;
    font-size: 21px;
    line-height: 1.35;
    letter-spacing: .015em;
  }
  .journal-entry p,
  .entry-content p { margin: 0 0 .9em; font-size: 15px; line-height: 1.75; }
  .entry-content .wp-block-separator { width: 100%; margin: 21px auto; }
  .home-pagination { margin-top: 34px; }
  .related-posts { margin-top: 40px; }
  .related-posts__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .related-card__title { font-size: 12px; }

  .tomatolabo-mobile-columns-2 .home-shell { width: calc(100% - 40px); }
  .tomatolabo-mobile-columns-2 .card-stack { gap: 14px; }

  .tomatolabo-mobile-columns-1 .card-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 22px;
  }
  .tomatolabo-mobile-columns-1 .card-column { display: contents; }
  .tomatolabo-mobile-columns-1 .post-card {
    width: 100%;
    order: var(--card-order, 0);
  }
}

@media (max-width: 350px) {
  .site-nav { gap-inline: 6px; font-size: 12px; }
  .home-shell, .journal-shell { width: calc(100% - 40px); }
  .card-stack { gap: 14px; }
  .post-card__copy { padding-inline: 11px; }
}
