/*
Theme Name: Libri (Storefront child)
Template: storefront
Description: Дочерняя тема магазина ebook libri-it: светлый "книжный" стиль, крупные обложки.
Version: 1.2.0
Text Domain: libri
*/
:root {
  --ink: #1f2430;
  --muted: #5d6475;
  --paper: #fbf8f3;
  --card: #ffffff;
  --line: #e7e1d6;
  --accent: #9c3d2e;      /* rosso mattone */
  --accent-dark: #7d2f23;
  --gold: #c8a24a;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body { background: var(--paper); color: var(--ink); font-family: var(--sans); }
h1, h2, h3, .site-title, .product_title, .woocommerce-loop-product__title { font-family: var(--serif); color: var(--ink); letter-spacing: 0; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

/* Header */
.site-header { background: #fff; border-bottom: 1px solid var(--line); padding-top: 1.2em; }
.site-branding .site-title a { color: var(--ink); font-size: 1.6rem; font-weight: 700; }
.site-branding .site-description { color: var(--muted); font-size: .85rem; }
.main-navigation ul.menu > li > a, .main-navigation ul.nav-menu > li > a { color: var(--ink); font-weight: 600; }
.site-header-cart .cart-contents { color: var(--ink); }
.storefront-primary-navigation { background: #fff; }
.site-search .widget_product_search input[type=search] { border-radius: 6px; background: var(--paper); }

/* Buttons */
button, input[type=button], input[type=submit], .button, .added_to_cart, .wc-block-components-button {
  background: var(--accent); border-color: var(--accent); color: #fff; border-radius: 6px; font-weight: 600;
}
button:hover, .button:hover, input[type=submit]:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
button.alt, .button.alt { background: var(--ink); border-color: var(--ink); }
button[disabled], .button[disabled] { background: #b9b4ab !important; border-color: #b9b4ab !important; cursor: not-allowed; }

/* Сетка книг: CSS grid вместо float-колонок Storefront, обложка целиком (contain) */
.col-full { max-width: 1240px; }
ul.products, .site-main ul.products { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px 18px; margin: 0 0 1.5em; padding: 0; }
ul.products::before, ul.products::after { display: none !important; }
ul.products li.product, .site-main ul.products li.product { width: auto !important; margin: 0 !important; float: none !important; clear: none !important;
  display: flex; flex-direction: column; background: transparent; border: 0; padding: 0; text-align: left; }
ul.products li.product a.woocommerce-LoopProduct-link { display: flex; flex-direction: column; flex: 1; color: var(--ink); }
ul.products li.product img { aspect-ratio: 2 / 3; width: 100%; height: auto; object-fit: cover;
  background: #efe9de; border-radius: 4px; box-shadow: 0 2px 10px rgba(0,0,0,.12); margin: 0 0 10px; padding: 0; transition: transform .15s ease; }
ul.products li.product:hover img { transform: translateY(-3px); }
ul.products li.product .woocommerce-loop-product__title { font-size: .92rem; line-height: 1.3; font-weight: 600; padding: 0; margin: 0 0 3px;
  min-height: 2.6em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.libri-loop-author { display: block; color: var(--muted); font-size: .8rem; margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
ul.products li.product .price { color: var(--ink); font-weight: 700; font-size: .95rem; margin: auto 0 8px; display: block; }
ul.products li.product .button { width: 100%; text-align: center; margin: 0; padding: .45em .6em; font-size: .82rem; font-weight: 600;
  background: transparent; color: var(--accent); border: 1px solid var(--accent); border-radius: 6px; }
ul.products li.product .button:hover, ul.products li.product .button.added { background: var(--accent); color: #fff; }
ul.products li.product .added_to_cart { display: block; text-align: center; font-size: .8rem; background: none; color: var(--accent); padding: 4px 0 0; }

/* Меню шапки */
.main-navigation ul.menu > li > a { padding: .9em .75em; font-size: .95rem; }
.main-navigation ul.menu > li:first-child > a { padding-left: 0; }
@media (min-width: 768px) { .storefront-primary-navigation .main-navigation { width: 78%; } .storefront-primary-navigation .site-header-cart { width: 20%; } }
.storefront-primary-navigation { border-top: 1px solid var(--line); }

/* Single product */
.single-product div.product .woocommerce-product-gallery img { border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.16); }
.single-product div.product .product_title { font-size: 1.9rem; line-height: 1.2; margin-bottom: .2em; }
.libri-author { font-size: 1.05rem; color: var(--muted); margin-bottom: .8em; }
.single-product div.product p.price { color: var(--ink); font-size: 1.6rem; font-weight: 700; }
.libri-fmt-badges { margin: .6em 0 1.2em; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.libri-fmt-badges span { border: 1px solid var(--line); background: #fff; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.libri-fmt-badges em { color: var(--muted); font-size: .85rem; font-style: normal; margin-left: 4px; }
.libri-details th { width: 38%; color: var(--muted); font-weight: 500; }
.libri-fmt-list { margin-left: 1.2em; }
.libri-faq details { border-bottom: 1px solid var(--line); padding: .6em 0; }
.libri-faq summary { cursor: pointer; font-weight: 600; }
.libri-faq p { margin: .5em 0 0; color: var(--muted); }

/* Checkout: оплата недоступна */
.libri-pay-off { background: #fff6e6; border: 1px solid #f0d9a8; border-left: 4px solid var(--gold); padding: 14px 16px; border-radius: 6px; margin-bottom: 12px; line-height: 1.5; }
.libri-cart-note { color: var(--muted); font-size: .9rem; }

/* Homepage */
.libri-hero { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 32px 28px; margin: 0 0 2em; }
.libri-hero h1 { font-size: 2.1rem; margin: 0 0 .3em; }
.libri-hero p { color: var(--muted); max-width: 760px; margin: 0; }
.libri-hero .libri-fmt-badges { margin-top: 1em; }
.libri-section { margin: 2.2em 0; }
.libri-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; border-bottom: 2px solid var(--ink); margin-bottom: 1em; }
.libri-section-head h2 { font-size: 1.5rem; margin: 0 0 .3em; }
.libri-section-head a { font-weight: 600; white-space: nowrap; }
.libri-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; padding: 0; list-style: none; margin: 0 0 2em; }
.libri-cats a { display: block; padding: 6px 0; color: var(--ink); font-size: .92rem; border-bottom: 1px dotted var(--line); }
.libri-cats a:hover { border-color: var(--accent); color: var(--accent); }
.libri-how { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.libri-how > div { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.libri-how h3 { font-size: 1.1rem; margin: 0 0 .4em; }
.libri-how p { margin: 0; color: var(--muted); font-size: .95rem; }

/* Footer */
.site-footer { background: var(--ink); color: #c9cdd6; }
.site-footer a { color: #fff; }
.site-footer h2, .site-footer .widget-title { color: #fff; }
.libri-footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 0 0 1em; padding: 0; }

@media (max-width: 767px) {
  .libri-hero { padding: 20px 16px; }
  .libri-hero h1 { font-size: 1.6rem; }
  ul.products, .site-main ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .single-product div.product .product_title { font-size: 1.5rem; }
}
