/* ======================================================================= *
 * recohub theme — fast, framework-free, responsive 2-column CSS.
 * Mobile-first. Dark-on-light Japanese typography. Card grid.
 * ======================================================================= */

/* ----------------------------- Design tokens --------------------------- */
:root {
  --color-bg: #f6f7f9;
  --color-surface: #ffffff;
  --color-text: #1d2129;
  --color-muted: #687078;
  --color-border: #e3e6ea;
  --color-primary: #e6005c;        /* FANZA-ish magenta */
  --color-primary-dark: #b80049;
  --color-accent: #ff7a00;
  --color-link: #c4005a;
  --color-star: #ffb300;
  --color-star-empty: #d8dbe0;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .04);
  --shadow-hover: 0 4px 14px rgba(0, 0, 0, .12);

  --container: 1160px;
  --gap: 20px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
          "Hiragino Sans", Meiryo, "Noto Sans JP", sans-serif;
}

/* ------------------------------- Reset --------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--color-text);
  background: var(--color-bg);
  word-break: break-word;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.4; margin: 0 0 .5em; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: #fff; padding: 8px 16px;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ------------------------------- Buttons ------------------------------- */
.btn {
  display: inline-block; padding: 12px 22px; border-radius: var(--radius-sm);
  font-weight: 700; text-align: center; cursor: pointer; border: 0;
  font-size: 1rem; text-decoration: none;
}
.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: var(--color-primary-dark); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--color-muted); border: 1px solid var(--color-border); }

/* ------------------------------ Age gate ------------------------------- */
.age-gate {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 18, 22, .92);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
/* Respect the `hidden` attribute: the gate starts hidden so it never flashes
   for visitors who already confirmed (JS reveals it only when needed). The
   class+attribute selector outranks `.age-gate { display: flex }` above. */
.age-gate[hidden] { display: none; }
.age-gate__panel {
  background: var(--color-surface); border-radius: var(--radius);
  max-width: 440px; width: 100%; padding: 32px 24px; text-align: center;
  box-shadow: var(--shadow);
}
.age-gate__title { font-size: 1.4rem; }
.age-gate__text { color: var(--color-text); margin: 0 0 20px; }
.age-gate__actions { display: flex; flex-direction: column; gap: 10px; }
.age-gate__note { font-size: .8rem; color: var(--color-muted); margin: 18px 0 0; }

/* ------------------------------- Header -------------------------------- */
.site-header {
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 50;
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.site-logo { display: flex; flex-direction: column; gap: 4px; line-height: 1.2; }
.site-logo:hover { text-decoration: none; }
.site-logo__name { font-size: 1.15rem; font-weight: 800; color: var(--color-text); }
.site-logo__tagline { font-size: .72rem; color: var(--color-muted); }

.nav-toggle {
  display: inline-flex; flex-direction: column; gap: 4px; justify-content: center;
  width: 40px; height: 40px; background: none; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); cursor: pointer; padding: 0 9px;
}
.nav-toggle__bar { height: 2px; background: var(--color-text); border-radius: 2px; }

.floor-nav { display: none; }
.floor-nav.is-open { display: block; }
.floor-nav__list { display: flex; flex-direction: column; }
.floor-nav__link {
  display: block; padding: 12px 4px; color: var(--color-text); font-weight: 600;
  border-bottom: 1px solid var(--color-border);
}
.floor-nav__item--search .floor-nav__link { color: var(--color-primary); }

/* ------------------------------- Layout -------------------------------- */
.layout { display: block; padding-top: 22px; padding-bottom: 40px; }
.layout__main { min-width: 0; }
.layout__sidebar { margin-top: 36px; }

/* --------------------------- Breadcrumb -------------------------------- */
.breadcrumb { font-size: .82rem; color: var(--color-muted); margin-bottom: 14px; }
.breadcrumb__list { display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb__list li::after { content: "›"; margin-left: 6px; color: var(--color-border); }
.breadcrumb__list li:last-child::after { content: ""; }

/* ------------------------------- Hero ---------------------------------- */
.hero {
  background: linear-gradient(135deg, #fff 0%, #ffeef5 100%);
  border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 26px 22px; margin-bottom: 28px;
}
.hero__title { font-size: 1.5rem; margin-bottom: .3em; }
.hero__lead { color: var(--color-muted); margin: 0 0 14px; }
.hero__floors { display: flex; flex-wrap: wrap; gap: 8px; }
.hero__floors a {
  display: inline-block; padding: 6px 14px; background: #fff;
  border: 1px solid var(--color-border); border-radius: 999px; font-size: .85rem; font-weight: 600;
}

/* ----------------------------- Genre cloud ----------------------------- */
.genre-cloud { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.genre-cloud a {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: #fff; border: 1px solid var(--color-border); border-radius: 999px;
  font-size: .85rem; font-weight: 600;
}
.genre-cloud__count {
  font-size: .72rem; font-weight: 700; color: var(--color-primary);
  background: var(--color-bg); border-radius: 999px; padding: 1px 7px;
}

/* FANZA API attribution banner (right-aligned, end of detail article).
   The global `img { display: block }` reset ignores text-align, so the anchor
   is made inline-block to be positioned by the parent's text-align: right. */
.fanza-credit { text-align: right; margin-top: 24px; }
.fanza-credit a { display: inline-block; }

/* Listing intro lead (genre pages) */
.listing-head__lead { margin: 8px 0 0; color: var(--color-muted); font-size: .9rem; line-height: 1.7; }

/* 404 page */
.error404 { text-align: center; padding: 48px 0; }
.error404__title { font-size: 1.5rem; margin: 0 0 12px; }
.error404__lead { color: var(--color-muted); margin: 0 0 20px; }
.error404 .hero__floors { justify-content: center; }

/* Contact-page form button */
.contact-cta { margin: 20px 0; }
.contact-cta .btn-link {
  display: inline-block; padding: 12px 22px; border-radius: var(--radius);
  background: var(--color-primary); color: #fff; font-weight: 700;
}
.contact-cta .btn-link:hover { filter: brightness(1.08); text-decoration: none; }

/* Entity index (author / series / label list) */
.entity-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.entity-list a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: #fff; border: 1px solid var(--color-border); border-radius: 999px;
  font-size: .9rem; font-weight: 600;
}
.entity-list a:hover { border-color: var(--color-primary); text-decoration: none; }
.entity-list__count {
  font-size: .72rem; font-weight: 700; color: var(--color-primary);
  background: var(--color-bg); border-radius: 999px; padding: 1px 8px;
}

/* ----------------------------- Sections -------------------------------- */
.home-section { margin-bottom: 34px; }
.home-section__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-title { font-size: 1.2rem; border-left: 4px solid var(--color-primary); padding-left: 10px; }
.section-more { font-size: .82rem; font-weight: 600; }
.listing-head { margin-bottom: 20px; }
.listing-head__title { font-size: 1.4rem; }
.listing-head__desc { color: var(--color-muted); margin: 0; }
.empty { color: var(--color-muted); padding: 40px 0; text-align: center; }

/* ------------------------------ Card grid ------------------------------ */
.card-grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(2, 1fr);
}
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); overflow: hidden; position: relative;
  transition: box-shadow .15s ease, transform .15s ease;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card__link { display: block; color: inherit; }
.card__link:hover { text-decoration: none; }
.card__thumb { aspect-ratio: 7 / 10; background: #eef0f3; overflow: hidden; }
.card__img { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: 10px 12px 14px; }
.card__title {
  font-size: .9rem; font-weight: 600; margin: 0 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card__date { margin: 0; text-align: right; font-size: .72rem; color: var(--color-muted); }
.card__rating { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--color-muted); margin-bottom: 4px; }
.card__price { display: flex; align-items: baseline; gap: 8px; font-size: .9rem; }
.card__list-price { color: var(--color-muted); text-decoration: line-through; font-size: .78rem; }
.card__sale-price { color: var(--color-primary); font-weight: 700; }
.card__rank {
  position: absolute; top: 0; left: 0; z-index: 2;
  background: var(--color-primary); color: #fff; font-weight: 800;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-bottom-right-radius: var(--radius);
}

/* ------------------------------- Stars --------------------------------- */
/* Star rating driven by --rate (0..5): a gold fill clipped over grey stars. */
.stars {
  --rate: 0;
  position: relative; display: inline-block; width: 5em; height: 1em;
  font-size: 15px; line-height: 1; vertical-align: middle; white-space: nowrap;
}
.stars::before,
.stars::after {
  content: "★★★★★";
  position: absolute; top: 0; left: 0; width: 100%;
  letter-spacing: 0; font-family: sans-serif;
}
.stars::before { color: var(--color-star-empty); }            /* empty track */
.stars::after {                                                /* gold fill  */
  color: var(--color-star);
  width: calc(var(--rate) / 5 * 100%);
  overflow: hidden;
}

/* --------------------------- Detail page ------------------------------- */
.detail__head { display: grid; grid-template-columns: 1fr; gap: 18px; margin-bottom: 24px; }
/* Meta fills the head row height (= cover height) so the CTA can sit at the
   bottom, aligned with the bottom of the cover image. */
.detail__meta { display: flex; flex-direction: column; align-self: stretch; }
.detail__cta { margin-top: auto; }
.detail__cover { margin: 0; }
.detail__cover img { width: 100%; max-width: 320px; margin: 0 auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.detail__floor { display: inline-block; font-size: .8rem; font-weight: 700; color: var(--color-primary); margin-bottom: 6px; }
.detail__title { font-size: 1.35rem; }
.detail__rating { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--color-muted); font-size: .9rem; }
.detail__rating-num { font-weight: 700; color: var(--color-text); }
.detail__price { font-size: 1.1rem; margin: 8px 0 16px; }
.detail__list-price { color: var(--color-muted); text-decoration: line-through; font-size: .9rem; margin-right: 8px; }
.detail__sale-price { color: var(--color-primary); font-weight: 800; font-size: 1.35rem; }
.detail__spec {
  display: grid; grid-template-columns: auto 1fr; font-size: .9rem; margin: 0 0 18px;
  border: 1px solid var(--color-border); border-radius: var(--radius);
  overflow: hidden; background: var(--color-surface);
}
.detail__spec dt {
  background: var(--color-bg); color: var(--color-muted); font-weight: 700;
  padding: 10px 14px; border-bottom: 1px solid var(--color-border); white-space: nowrap;
}
.detail__spec dd {
  margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--color-border);
}
.detail__spec dt:last-of-type, .detail__spec dd:last-of-type { border-bottom: none; }
/* Soft fade on hover for the spec links (author / series / label). */
.detail__spec a { transition: opacity .2s ease; }
.detail__spec a:hover { opacity: .7; text-decoration: none; }

.cta-button {
  display: block; width: 100%; text-align: center; padding: 16px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff; font-weight: 800; font-size: 1.1rem; border-radius: var(--radius);
  box-shadow: var(--shadow); transition: transform .12s ease, box-shadow .12s ease;
}
.cta-button:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); text-decoration: none; }
.cta-note { font-size: .75rem; color: var(--color-muted); margin: 6px 0 0; text-align: center; }
.detail__cta-bottom { margin: 30px 0; }

.detail__genres, .detail__description, .detail__gallery, .detail__related { margin-bottom: 28px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-block; padding: 5px 12px; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: 999px; font-size: .82rem; font-weight: 600;
}
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gallery__item img { border-radius: var(--radius-sm); width: 100%; }

/* ------------------------------- Prose --------------------------------- */
.prose { font-size: 1rem; }
.prose p { margin: 0 0 1em; }
.prose h2 { font-size: 1.15rem; margin-top: 1.4em; }
.prose h3 { font-size: 1.05rem; margin-top: 1.2em; }
.prose ul, .prose ol { margin: 0 0 1em 1.4em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose a { font-weight: 600; }
.prose img { border-radius: var(--radius-sm); margin: 1em 0; }

/* ------------------------------ Curated -------------------------------- */
.curated__title { font-size: 1.5rem; }
.curated__date { color: var(--color-muted); font-size: .82rem; margin: 0 0 18px; }
.ranking { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.ranking__item { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; }
.ranking__rank {
  font-size: 1.5rem; font-weight: 900; color: var(--color-primary);
  text-align: center; line-height: 1;
}

/* ----------------------------- Pagination ------------------------------ */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 30px 0 6px; flex-wrap: wrap; }
.pagination__pages { display: flex; gap: 4px; }
.pagination__page, .pagination__link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 10px;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); font-weight: 600; color: var(--color-text);
}
.pagination__page.is-current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pagination__link.is-disabled { opacity: .4; pointer-events: none; }
.pagination__ellipsis { padding: 0 4px; color: var(--color-muted); }
.pagination a:hover { text-decoration: none; border-color: var(--color-primary); }

/* ------------------------------ Sidebar -------------------------------- */
.widget { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.widget__title { font-size: 1rem; border-left: 3px solid var(--color-primary); padding-left: 8px; margin-bottom: 12px; }
.widget__list li { border-bottom: 1px solid var(--color-border); }
.widget__list li:last-child { border-bottom: 0; }
.widget__list a { display: block; padding: 9px 2px; color: var(--color-text); font-weight: 600; font-size: .9rem; }
.widget__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.widget__tags a { display: inline-block; padding: 4px 10px; background: var(--color-bg); border-radius: 999px; font-size: .78rem; font-weight: 600; }

.search-box { display: flex; gap: 6px; }
.search-box__input { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: .9rem; }
.search-box__btn { padding: 0 14px; background: var(--color-primary); color: #fff; border: 0; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer; }

/* --------------------------- Search page ------------------------------- */
.search-page-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.search-page-form__input { padding: 14px 16px; font-size: 1.05rem; border: 2px solid var(--color-border); border-radius: var(--radius); }
.search-page-form__input:focus { outline: none; border-color: var(--color-primary); }
.search-filters { display: flex; align-items: center; gap: 8px; }
.search-filters__select { padding: 8px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.search-status { color: var(--color-muted); font-size: .9rem; min-height: 1.2em; }

/* ------------------------------- Footer -------------------------------- */
.site-footer { background: #1d2129; color: #c7ccd2; margin-top: 40px; padding: 30px 0; }
.site-footer__nav { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 14px; }
.site-footer__nav a { color: #c7ccd2; font-size: .85rem; }
.site-footer__legal { font-size: .78rem; color: #99a0a8; margin: 0 0 10px; }
.site-footer__copy { font-size: .8rem; color: #99a0a8; margin: 0; }

/* ============================ Breakpoints ============================== */

/* Tablet: 3-col grids */
@media (min-width: 600px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .age-gate__actions { flex-direction: row; justify-content: center; }
  .detail__head { grid-template-columns: 320px 1fr; align-items: start; }
  .detail__cover img { max-width: none; }
}

/* Desktop: two-column page layout + 4-col grids, sticky sidebar, full nav */
@media (min-width: 900px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 32px;
    align-items: start;
  }
  .layout__sidebar { margin-top: 0; position: sticky; top: 76px; }
  .card-grid { grid-template-columns: repeat(4, 1fr); }

  .nav-toggle { display: none; }
  .floor-nav { display: block; }
  .floor-nav__list { flex-direction: row; gap: 4px; }
  .floor-nav__link { padding: 8px 12px; border-bottom: 0; border-radius: var(--radius-sm); }
  .floor-nav__link:hover { background: var(--color-bg); text-decoration: none; }
}

/* Card grid is capped at 4 columns at the widest breakpoint (set above). */

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; transition: none !important; }
}
