/*
Theme Name: Scrittore
Theme URI: https://example.com/
Author: 
Author URI: 
Description: Tema WordPress moderno e minimale pensato per il sito di uno scrittore o di una scrittrice: home page con foto e biografia, e una sezione dedicata ai libri con copertina, titolo, casa editrice, anno di uscita e descrizione.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: scrittore
*/

/* -------------------------------------------------- */
/* 1. Font e variabili                                 */
/* -------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --color-bg: #faf7f2;
  --color-surface: #ffffff;
  --color-text: #2a2521;
  --color-text-muted: #6f6a63;
  --color-accent: #8a5a3f;
  --color-accent-dark: #6e4630;
  --color-border: #e7ded2;
  --font-heading: 'Playfair Display', Georgia, 'Segoe UI', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 1120px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(42, 37, 33, 0.08);
  --shadow-hover: 0 16px 40px rgba(42, 37, 33, 0.14);
}

/* -------------------------------------------------- */
/* 2. Reset di base                                    */
/* -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-dark); }
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5em;
  color: var(--color-text);
}
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }

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

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.button--primary {
  background: var(--color-accent);
  color: #fff;
}
.button--primary:hover {
  background: var(--color-accent-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* -------------------------------------------------- */
/* 3. 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;
  padding-top: 18px;
  padding-bottom: 18px;
  gap: 24px;
}
.site-branding { display: flex; flex-direction: column; }
.site-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
}
.site-description {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--color-text-muted);
}
.custom-logo { max-height: 56px; width: auto; }

.site-nav { display: flex; align-items: center; }
#primary-menu {
  display: flex;
  gap: 28px;
}
#primary-menu a {
  color: var(--color-text);
  font-weight: 500;
  font-size: 15px;
}
#primary-menu a:hover { color: var(--color-accent); }

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.menu-toggle span {
  display: block;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}

/* -------------------------------------------------- */
/* 4. Hero (home page)                                 */
/* -------------------------------------------------- */
.hero {
  display: flex;
  align-items: center;
  gap: 64px;
  padding: 72px 24px;
}
.hero__photo {
  flex: 0 0 320px;
}
.hero__photo img {
  width: 320px;
  height: 320px;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero__content { flex: 1; min-width: 280px; }
.hero__name {
  font-size: clamp(32px, 4vw, 46px);
  margin-bottom: 6px;
}
.hero__tagline {
  font-size: 18px;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 18px;
}
.hero__bio {
  color: var(--color-text-muted);
  font-size: 17px;
  max-width: 60ch;
  margin-bottom: 26px;
}
.hero__bio p:last-child { margin-bottom: 0; }

/* -------------------------------------------------- */
/* 5. Sezione libri                                    */
/* -------------------------------------------------- */
.books-section, .archive-libri { padding: 40px 24px 88px; }
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 16px;
}
.section-header h2 { font-size: 30px; margin: 0; }
.section-header__link { font-weight: 600; font-size: 15px; white-space: nowrap; }

.archive-title {
  font-size: 36px;
  margin-bottom: 40px;
}

.libri-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 34px;
}

.libro-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
  display: flex;
  flex-direction: column;
}
.libro-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}
.libro-card__cover-link { display: block; }
.libro-card__cover {
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--color-border);
}
.libro-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.libro-card__cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 13px;
  aspect-ratio: 2 / 3;
  background: var(--color-border);
}
.libro-card__body {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.libro-card__title {
  font-size: 19px;
  margin-bottom: 4px;
}
.libro-card__title a { color: var(--color-text); }
.libro-card__title a:hover { color: var(--color-accent); }
.libro-card__meta {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 10px;
}
.libro-card__excerpt {
  font-size: 14.5px;
  color: var(--color-text-muted);
  margin-bottom: 14px;
  flex: 1;
}
.libro-card__link {
  font-size: 14px;
  font-weight: 600;
  align-self: flex-start;
}

.libro-card__cover--square {
  aspect-ratio: 1 / 1;
}
.libro-card__cover--placeholder.libro-card__cover--square {
  aspect-ratio: 1 / 1;
}

.lavori-gruppo {
  margin-bottom: 56px;
}
.lavori-gruppo:last-child {
  margin-bottom: 0;
}

.empty-state {
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
}

/* -------------------------------------------------- */
/* 6. Pagina singolo libro                             */
/* -------------------------------------------------- */
.single-libro { padding: 48px 24px 88px; }
.back-link {
  display: inline-block;
  margin-bottom: 32px;
  font-weight: 600;
  font-size: 14px;
}
.single-libro__grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 56px;
  align-items: start;
}
.single-libro__cover img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.single-libro__details h1 { font-size: 36px; }
.single-libro__meta {
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  color: var(--color-accent);
  font-size: 14px;
  margin-bottom: 22px;
}
.single-libro__description { font-size: 17px; color: var(--color-text); }
.single-libro__description p:first-child { margin-top: 0; }

/* -------------------------------------------------- */
/* 7. Pagine e articoli generici                       */
/* -------------------------------------------------- */
.page-content, .error-404 { padding: 56px 24px 88px; max-width: 780px; margin: 0 auto; }
.page-content h1 { font-size: 36px; }
.page-thumb { margin: 24px 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.entry-meta { color: var(--color-text-muted); font-size: 14px; margin-bottom: 24px; }
.entry-content { font-size: 17px; }
.error-404 { text-align: center; }

/* -------------------------------------------------- */
/* 8. Footer                                           */
/* -------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 28px 24px;
  background: var(--color-surface);
}
.site-footer__inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  color: var(--color-text-muted);
}

/* -------------------------------------------------- */
/* 9. Responsive                                       */
/* -------------------------------------------------- */
@media (max-width: 860px) {
  .hero { flex-direction: column; text-align: center; gap: 32px; padding: 48px 24px; }
  .hero__photo, .hero__photo img { width: 220px; height: 220px; }
  .hero__bio { margin-left: auto; margin-right: auto; }
  .single-libro__grid { grid-template-columns: 1fr; }
  .single-libro__cover { max-width: 280px; margin: 0 auto; }
}

@media (max-width: 700px) {
  .menu-toggle { display: flex; }
  .site-nav { position: relative; }
  #primary-menu {
    display: none;
    position: absolute;
    top: 46px;
    right: 0;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 14px 20px;
    min-width: 200px;
    gap: 14px;
  }
  #primary-menu.is-open { display: flex; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}
