/*
Theme Name: Roberta Rabellotti
Text Domain: roberta-rabellotti
Author: Roccella Studio
Author URI: www.roccella.studio
Version: 1.0
*/

/* =========================================================
   Roberta Rabellotti — Website
   Font: Montserrat (variable) · Palette: dal PDF · No JS
   Breakpoint: 1024 (intermedio) · 768 (mobile)

   INDICE
   0. Font
   1. Tokens (:root)
   2. Reset + base
   3. Tipografia (astratta)
   4. Componenti riusabili
      · header + menu (con sottolivelli)
      · tag / pill
      · card (+ variante row)
      · bio sidebar (+ variante about)
      · page-title
      · pagination
      · prev/next
      · footer
      · placeholder
   5. Layout
      · .layout  (sidebar + main: listing / detail / about)
      · .home    (griglia dedicata)
      · spotlight
      · post (detail)
   6. Responsive
   ========================================================= */

/* ---------- 0. Font ---------- */
@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/Montserrat-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/Montserrat-Italic-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900; font-style: italic; font-display: swap;
}

/* ---------- 1. Tokens ---------- */
:root {
  --cream:        #faf5f0;
  --white:        #ffffff;
  --mint:         #c3f0e8;
  --beige:        #f3e8da;
  --spotlight-tag:#ecc5c6;   /* fondo del tag IN THE SPOTLIGHT */
  --spotlight-bg: #efece9;   /* fondo del box Spotlight */
  --bordeaux:     #a83751;
  --blue:         #5580c2;

  --ink:          #1a1a1a;
  --body-text:    #3a3a3a;
  --muted:        #6f6f6f;
  --line:         #e7e0d8;
  --ph:           #d9d9d9;
  --cover-empty:  #f3f0ec;   /* --beige stemperato verso il grigio, poi schiarito di 1/3: il box delle card senza cover */
  --cover-line:   #f0ece8;   /* la sua trama diagonale, schiarita allo stesso modo */

  --maxw:   1200px;
  --gutter: 48px;
  --gap:    24px;
}

/* ---------- 2. Reset + base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
body {
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
  color: var(--body-text);
  background: var(--cream);
  line-height: 1.55;
}
a { color: inherit; font-weight: inherit; }
img { max-width: 100%; display: block; }
sup { font-size: 1em; vertical-align: baseline; }
.wp-block-heading { font-size: 0.9rem; font-weight: normal; line-height: 1.5; margin-bottom: 8px; }

/* larghezza-madre dei box top-level */
.site-header, .home, .layout, .site-footer {
  width: min(var(--maxw), 100% - var(--gutter));
  margin-left: auto; margin-right: auto;
}

/* ---------- 3. Tipografia (astratta) ---------- */
.logo {
  font-size: clamp(1.5rem, 4.5vw, 2.5rem);
  font-weight: 300; letter-spacing: 0.18em; line-height: 1.1;
  color: var(--ink); text-decoration: none;
}
.tagline { font-size: 1.05rem; font-weight: 600; letter-spacing: 0.02em; color: var(--ink); }

/* titolo di pagina con highlight (Publications, About, ...) */
.page-title {
  display: inline-block;
  background: var(--beige);
  color: var(--ink);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2rem);
  line-height: 1.1;
  padding: 6px 14px;
  margin-bottom: 26px;
}
.page-title--mint { background: var(--mint); }

/* titolo About: chip azzurro (come page-title, fondo mint) */
.post-about .post-title {
  display: inline-block;
  background: var(--mint);
  color: var(--ink);
  padding: 6px 14px;
}

/* ---------- 4. Componenti ---------- */

/* Header ---------------------------------------------------*/
.site-header { background: var(--white); margin-top: 24px; padding: 38px 46px 20px; }
.brand { text-align: center; display: flex; flex-direction: column; gap: 8px; }
.divider { border: none; border-top: 1px solid var(--line); margin: 22px 0; }

.main-nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; position: relative; }

.nav-links { display: flex; gap: 34px; list-style: none; }
.nav-links > li { position: relative; }
.nav-links a,
.nav-links .nav-label {
  text-decoration: none; color: var(--ink);
  font-weight: 500; letter-spacing: 0.06em; font-size: 0.92rem;
  display: inline-block;
}
.nav-links a:hover { text-decoration: underline; }
.nav-links a.active,
.nav-links .nav-label.active { font-weight: 700; text-decoration: underline; }
.nav-label { cursor: default; }   /* voce morta (Publications): non è un link, ma si raggiunge da tastiera */

/* sottomenu (desktop: dropdown su hover/focus) */
.submenu {
  list-style: none;
  position: absolute; left: 0; top: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  padding: 8px 0; min-width: 210px;
  display: none; z-index: 20;
}
.submenu li { display: block; }
.submenu a { display: block; padding: 8px 18px; font-size: 0.85rem; letter-spacing: 0.04em; }
.has-sub:hover > .submenu,
.has-sub:focus-within > .submenu { display: block; }
.has-sub > a,
.has-sub > .nav-label { display: inline-flex; align-items: center; gap: 0.3em; }
.has-sub > a::after,
.has-sub > .nav-label::after { content: "▾"; font-size: 0.9em; line-height: 1; color: var(--muted); }

/* Search */
.search { display: inline-flex; align-items: center; gap: 8px; background: var(--white); border: 1px solid var(--line); padding: 8px 14px; margin-left: auto; width: 90%; max-width: 175px; }
.search-icon { color: var(--muted); }
.search input { border: none; background: transparent; outline: none; font: inherit; font-size: 0.9rem; letter-spacing: 0.08em; color: var(--ink); max-width: 90%; }

/* Hamburger (checkbox hack) */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle-label { display: none; }

/* Tag / pill ----------------------------------------------*/
.tag {
  display: inline-block;
  background: var(--beige);
  color: var(--ink);
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 5px 12px;
}
.tag--spotlight { background: var(--spotlight-tag); }

/* Card ----------------------------------------------------*/
.card { margin-bottom: 38px; }
.card-img { margin-bottom: 14px; }
.card-title {
  font-size: 1.4rem; font-weight: 500; line-height: 1.3;
  color: var(--blue); margin-bottom: 8px;
}
.card-title a { text-decoration: none; color: inherit; }
.card-title a:hover { text-decoration: underline; }
.date { font-size: 0.82rem; font-weight: 700; letter-spacing: 0.03em; color: var(--ink); margin-bottom: 10px; }
.card p { font-size: 0.9rem; line-height: 1.5; margin-bottom: 8px; }
.more { font-weight: 525; text-decoration: underline; }
.struck { text-decoration: line-through; }

/* variante listing: thumbnail a sinistra, testo a destra */
.card--row { display: grid; grid-template-columns: 1fr 2fr; gap: 22px; align-items: start; }
.card--row .card-img { margin: 0; }
.card--row .card-title { font-size: 1.4rem; line-height: 1.3; }

/* Bio sidebar ---------------------------------------------*/
.bio-body { background: var(--mint); padding: 16px 18px; }
.bio-body p { font-size: 0.88rem; line-height: 1.5; margin-bottom: 10px; }
.bio-links { list-style: none; margin-top: 12px; }
.bio-links li { margin-bottom: 4px; }
.bio-links a { text-decoration: none; }
.bio-links a:hover { text-decoration: underline; }

/* variante About: box bianco, solo link, senza foto */
.bio--about .bio-body { background: var(--white); border: 1px solid var(--line); padding: 20px 22px; }
.bio--about .bio-links { margin-top: 0; }
.bio--about .bio-links li { margin-bottom: 12px; }
.bio--about .bio-links a { font-weight: 600; line-height: 1.7; }

/* Pagination ----------------------------------------------*/
.pagination { text-align: right; margin-top: 24px; font-size: 0.95rem; letter-spacing: 0.05em; color: var(--ink); font-weight: 525; }
.pagination .current {
  display: inline-flex; width: 1.7em; height: 1.7em;
  align-items: center; justify-content: center;
  background: var(--beige); border-radius: 50%;
}
.pagination .divider { border: none; margin: 0 6px; display: inline; }
.pagination .prev { margin-right: 10px; text-decoration: none; }
.pagination .next { margin-left: 10px; text-decoration: none; }

/* Prev / next ---------------------------------------------*/
.prevnext { display: flex; justify-content: space-between; gap: 20px; margin-top: 52px; align-items: center; }
.prevnext a { text-decoration: none; font-weight: 525; display: inline-flex; align-items: center; gap: 8px; }
.prevnext a:hover { text-decoration: underline; }
.nav-circle {
  display: inline-flex; width: 2em; height: 2em; flex: none;
  align-items: center; justify-content: center;
  background: var(--beige); border-radius: 50%;
}

/* Footer --------------------------------------------------*/
.site-footer { background: var(--white); margin: 24px auto 40px; padding: 34px 46px; }
.footer-inner { display: flex; flex-direction: column; gap: 20px; }
.footer-row { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.logo-sm { font-size: 1.3rem; font-weight: 300; letter-spacing: 0.12em; color: var(--ink); }
.footer-nav { display: flex; gap: 50px; }
.footer-nav ul { list-style: none; }
.footer-nav li { margin-bottom: 6px; }
.footer-nav a { text-decoration: none; font-size: 0.88rem; text-transform: uppercase; }
.footer-nav a:hover { text-decoration: underline; }
.footer-legal { text-align: right; font-size: 0.85rem; }
.footer-legal p { margin-bottom: 6px; }
.footer-legal a { color: inherit; text-decoration: underline; }

/* Placeholder immagini ------------------------------------*/
.placeholder {
  background-color: var(--ph);
  background-image: repeating-linear-gradient(45deg, #d2d2d2 0 12px, #dcdcdc 12px 24px);
  width: 100%;
}
/* card senza cover: un box al posto dell'immagine, solo nelle liste */
.card-img--empty {
  display: block; width: 100%; aspect-ratio: 3 / 2;
  background: repeating-linear-gradient(45deg, var(--cover-empty) 0 14.5px, var(--cover-line) 14.5px 16px);
}
img.card-img, img.bio-img, img.spotlight-img, img.post-media { width: 100%; height: auto; }
.home img.card-img { max-height: 350px; width: auto; max-width: 100%; }
.card-img-link { display: block; }
.tag { text-decoration: none; }

/* ---------- 5. Layout ---------- */

/* Layout generico: sidebar (bio) + main — listing / detail / about */
.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-areas: "bio main";
  gap: var(--gap);
  align-items: start;
  margin: 24px auto;
}
.layout .bio  { grid-area: bio; }
.layout .main { grid-area: main; background: var(--white); padding: 30px; }

/* Home: griglia dedicata */
.home {
  display: grid;
  grid-template-columns: 300px 1fr;
  align-items: start; gap: var(--gap); margin: 24px auto;
}
.home-side { display: flex; flex-direction: column; gap: 32px; }

.articles {
  background: var(--white); padding: 30px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 34px;
}
.articles .talks        { grid-column: 1; }
.articles .publications { grid-column: 2; }
.articles .media        { grid-column: 1 / -1; margin-top: 6px; }
.articles .tag { margin-bottom: 18px; }
.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }

/* Spotlight box (home) */
.spotlight { background: var(--spotlight-bg); padding: 24px; }
.spotlight .tag { margin-bottom: 16px; }
.spotlight-title {
  font-size: clamp(1.5rem, 3vw, 1.95rem); line-height: 1.12; font-weight: 400;
  letter-spacing: 0.01em; color: var(--bordeaux); margin: 14px 0 18px;
}
.spotlight-title a { color: inherit; text-decoration: none; }
.spotlight-title a:hover { text-decoration: underline; }
.spotlight-img { margin-bottom: 16px; }
.spotlight p { font-size: 0.9rem; line-height: 1.5; margin-bottom: 10px; }
.spotlight-title-link { text-decoration: none; }

/* Post (detail) */
.post-title { color: var(--blue); font-weight: 400; font-size: clamp(1.6rem, 3.2vw, 2.1rem); line-height: 1.2; margin-bottom: 14px; }
.post-meta { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.post-meta .date { margin-bottom: 0; }
.post-media { margin-bottom: 22px; }
.post-single .post-media { max-width: 75%; }
.post-body p,
.post-body h1,
.post-body h2 {
  margin-bottom: 14px;
  line-height: 1.6;
  font-weight: normal;
  font-size: 1em;
}
.post-download { font-weight: 700; margin-top: 6px; }

/* listing: distanza fra card-row */
.card-list .card { margin-bottom: 51px; }

/* ---------- 6. Responsive ---------- */

/* Layout largo (≥ 1025, 2 colonne): tipografia calibrata */
@media (min-width: 64rem) {
  .page-title             { font-size: 2.16rem; }   /* Category — 80% */
  .post-title             { font-size: 1.84rem; }   /* Post — 65% */
  .post-about .post-title { font-size: 2.27rem; }   /* About — 80% */
  .post-body p,
  .post-body h1,
  .post-body h2 { font-size: 1.08rem; }   /* corpo About + Post — 80% */
  .bio-body p             { font-size: 1rem; }       /* sidebar = dimensione link */
  .spotlight p            { font-size: 1rem; }       /* Spotlight = sidebar About */
  .card p:not(.date),
  .wp-block-heading       { font-size: 1.08rem; }    /* corpo Article Home = corpo Post */
}

/* Intermedio — ≤ 1024: macro-griglia a colonna singola */
@media (max-width: 63.99rem) {
  .home {
    grid-template-columns: 1fr;
  }
  .home-side { flex-direction: row; gap: var(--gap); align-items: start; }
  .home-side > * { flex: 1; min-width: 0; }
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas: "main" "bio";
  }
  .post-single .post-media { max-width: 100%; }
}

/* Mobile — ≤ 768 */
@media (max-width: 48rem) {
  :root { --gutter: 28px; }
  .site-header { padding: 30px 24px 16px; }

  /* hamburger */
  .nav-toggle-label {
    display: inline-flex; flex-direction: column; justify-content: space-between;
    width: 30px; height: 22px; cursor: pointer;
  }
  .nav-toggle-label span { display: block; height: 3px; width: 100%; background: var(--ink); }

  .nav-links {
    flex-basis: 100%; display: none; flex-direction: column; gap: 0;
    border-top: 1px solid var(--line); margin-top: 12px;
  }
  .nav-links > li { border-bottom: 1px solid var(--line); }
  .nav-links a,
  .nav-links .nav-label { display: block; padding: 12px 2px; }
  .nav-toggle:checked ~ .nav-links { display: flex; }

  /* search: nascosta; a tutta larghezza solo a menu aperto */
  .search { display: none; }
  .nav-toggle:checked ~ .search {
    display: flex; flex-basis: 100%; margin: 12px 0 0;
  }
  .nav-toggle:checked ~ .search input { flex: 1; min-width: 0; }

  /* sottomenu: statico e indentato dentro l'hamburger */
  .submenu {
    position: static; display: block; border: none; padding: 0 0 8px 18px; min-width: 0;
  }
  .submenu a { padding: 8px 2px; }
  .has-sub > a::after,
  .has-sub > .nav-label::after { content: ""; }

  /* home: colonna unica; sidebar (bio + spotlight) prima degli articoli */
  .home { grid-template-columns: 1fr; }
  .home-side { flex-direction: column; }

  /* liste Category: sidebar prima del contenuto (About e Post esclusi) */
  .layout--aside-first { grid-template-areas: "bio" "main"; }

  /* articoli impilati */
  .articles { grid-template-columns: 1fr; gap: 0; padding: 24px; }
  .articles .talks, .articles .publications { grid-column: 1; }
  .media-grid { grid-template-columns: 1fr; gap: 0; }

  /* card row → impilata */
  .card--row { grid-template-columns: 1fr; gap: 12px; }

  /* footer impilato */
  .site-footer { padding: 28px 24px; }
  .footer-row { flex-direction: column; gap: 26px; }
  .footer-legal { text-align: left; }
  .footer-nav { gap: 40px; }
}
