/* ============================================================
   CORRIERE DIGITALE — Stili newspaper
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400;1,700&family=UnifrakturMaguntia&family=IM+Fell+English:ital@0;1&family=PT+Serif:ital,wght@0,400;0,700;1,400&display=swap');

/* ---- Reset & base ---- */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  background: #f5f0e8;
  color: #1a1a1a;
  font-family: 'PT Serif', Georgia, serif;
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
  padding: 0;
}

/* ---- Top bar (dark strip) ---- */
.top-bar {
  background: #1a1a1a;
  color: #ccc;
  font-family: 'PT Serif', Georgia, serif;
  font-size: 12px;
  padding: 4px 16px;
}

.top-bar-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.top-bar-left a {
  color: #aaa;
  text-decoration: none;
  font-size: 12px;
  transition: color 0.15s;
}

.top-bar-left a:hover { color: #fff; }

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- Selettore lingua ---- */
.lang-selector {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid #444;
  border-radius: 3px;
  color: #bbb;
  font-family: 'PT Serif', Georgia, serif;
  font-size: 11.5px;
  padding: 3px 7px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1;
}
.lang-btn img { display: block; }
.lang-btn:hover { border-color: #888; color: #fff; }
.lang-btn .lang-arrow { font-size: 9px; opacity: .6; margin-left: 1px; }

.lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 3px;
  min-width: 90px;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
}
.lang-selector.open .lang-menu { display: block; }

.lang-menu form { margin: 0; }

.lang-option {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  background: none;
  border: none;
  color: #ccc;
  font-family: 'PT Serif', Georgia, serif;
  font-size: 12px;
  padding: 7px 10px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.lang-option:hover { background: #2a2a2a; color: #fff; }
.lang-option img { display: block; }

.top-bar-login {
  color: #aaa;
  text-decoration: none;
  font-size: 12px;
  transition: color 0.15s;
}

.top-bar-login:hover { color: #fff; }

/* ---- Link aggiuntivi nella top bar (compat) ---- */
.top-bar-link {
  color: #aaa;
  text-decoration: none;
  font-size: 12px;
}

.top-bar-link:hover { color: #fff; }

/* ---- Top bar admin menu ---- */
.top-bar-admin {
  display: flex;
  align-items: center;
  gap: 4px;
}

.top-bar-admin a {
  color: #aaa;
  text-decoration: none;
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 3px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.top-bar-admin a:hover {
  background: #333;
  color: #fff;
}

.top-bar-admin-logout {
  border-left: 1px solid #444;
  margin-left: 4px;
  padding-left: 12px !important;
  color: #888 !important;
}

.top-bar-admin-logout:hover {
  color: #ffaaaa !important;
  background: transparent !important;
}

/* ---- Masthead ---- */
.masthead {
  text-align: center;
  padding: 12px 16px 6px;
  border-bottom: 3px solid #1a1a1a;
}

.masthead-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 900;
  font-size: clamp(22px, 3.8vw, 40px);
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: #1a1a1a;
  margin: 0;
  text-transform: uppercase;
  word-break: break-word;
}

.masthead-subtitle {
  font-family: 'PT Serif', Georgia, serif;
  font-style: italic;
  font-size: clamp(11px, 1.2vw, 14px);
  color: #444;
  margin: 4px 0 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* ---- Date / info bar ---- */
.date-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'PT Serif', Georgia, serif;
  font-size: 11.5px;
  padding: 4px 0;
  border-bottom: 1.5px solid #1a1a1a;
  border-top: 1.5px solid #1a1a1a;
  margin-top: 4px;
}

.date-bar .date-left {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.date-bar .date-center {
  text-align: center;
  font-style: italic;
}

.date-bar .date-right {
  text-align: right;
  text-transform: uppercase;
  font-size: 11px;
}

/* ---- Wrapper principale ---- */
.newspaper-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  background: #f5f0e8;
}

/* ---- Sezione articolo principale ---- */
.featured-label {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-top: 2px solid #1a1a1a;
  padding-top: 6px;
  margin-top: 10px;
  margin-bottom: 4px;
}

.featured-headline {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: clamp(22px, 3.5vw, 36px);
  line-height: 1.15;
  margin: 0 0 4px;
  color: #1a1a1a;
}

.featured-author {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  color: #444;
}

.featured-body {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 16px;
  line-height: 1.65;
  text-align: justify;
  column-count: 1;
  hyphens: auto;
  overflow: hidden;
}

.featured-body p {
  margin: 0 0 0.75em;
}

.featured-body p:last-child {
  margin-bottom: 0;
}

/* ---- Divisore orizzontale ---- */
.section-divider {
  border: none;
  border-top: 2px solid #1a1a1a;
  margin: 10px 0 8px;
}

.section-divider-thin {
  border: none;
  border-top: 1px solid #aaa;
  margin: 8px 0;
}

/* ---- Griglia 3 colonne ---- */
.columns-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border-top: 2px solid #1a1a1a;
}

.col-article {
  padding: 8px 14px;
  border-right: 1px solid #aaa;
}

.col-article:first-child {
  padding-left: 0;
}

.col-article:last-child {
  border-right: none;
  padding-right: 0;
}

/* ---- Stili articolo colonna ---- */
.col-category {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #1a1a1a;
  border-bottom: 1px solid #1a1a1a;
  padding-bottom: 3px;
  margin-bottom: 5px;
}

.col-headline {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: clamp(14px, 2vw, 17px);
  line-height: 1.2;
  margin: 0 0 3px;
  color: #1a1a1a;
}

.col-subhead {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 12.5px;
  font-style: italic;
  line-height: 1.35;
  margin-bottom: 4px;
  color: #222;
}

.col-author {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  margin-bottom: 5px;
}

.col-body {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 12.5px;
  line-height: 1.55;
  text-align: justify;
  hyphens: auto;
  color: #1a1a1a;
}

/* ---- Footer ---- */
.newspaper-footer {
  border-top: 3px double #1a1a1a;
  padding: 8px 0;
  font-size: 11px;
  text-align: center;
  color: #555;
  font-family: 'PT Serif', Georgia, serif;
  font-style: italic;
  margin-top: 16px;
}

/* ---- Gruppo leggi tutto + edita ---- */
.read-more-group {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.read-more-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.read-more-views {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 11.5px;
  color: #999;
  white-space: nowrap;
  flex-shrink: 0;
}

.read-more-edit {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 11px;
  font-style: italic;
  color: #888;
  text-decoration: none;
  border-bottom: 1px solid #ccc;
  transition: color 0.15s;
}

.read-more-edit:hover { color: #1a1a1a; border-color: #1a1a1a; }

/* ---- Link leggi tutto ---- */
.read-more {
  display: inline-block;
  font-family: 'PT Serif', Georgia, serif;
  font-size: 12px;
  font-style: italic;
  color: #1a1a1a;
  text-decoration: none;
  border-bottom: 1px solid #1a1a1a;
  margin-top: 6px;
  transition: opacity 0.15s;
}

.read-more:hover { opacity: 0.5; }

/* ---- Pagina articolo ---- */
.article-meta {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 11.5px;
  color: #888;
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  padding: 5px 0;
  margin: 8px 0 20px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.article-featured-img,
.featured-img {
  float: right;
  margin: 0 0 16px 24px;
  width: 275px;
  max-width: 42%;
  height: auto;
  border: 1px solid #e0dbd0;
  border-radius: 4px;
  display: block;
}

.article-body {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 15px;
  line-height: 1.75;
  color: #1a1a1a;
  max-width: 680px;
  overflow: hidden;
}

.article-body h1,
.article-body h2,
.article-body h3 {
  font-family: 'Playfair Display', Georgia, serif;
  margin: 1.4em 0 0.4em;
  line-height: 1.2;
}

.article-body h1 { font-size: 1.9em; }
.article-body h2 { font-size: 1.45em; }
.article-body h3 { font-size: 1.2em; }

.article-body p         { margin: 0 0 1em; }
.article-body blockquote {
  border-left: 3px solid #1a1a1a;
  margin: 1em 0;
  padding: 4px 0 4px 16px;
  font-style: italic;
  color: #444;
}

.article-body ul,
.article-body ol  { padding-left: 1.5em; margin-bottom: 1em; }
.article-body li  { margin-bottom: 0.3em; }
.article-body pre {
  background: #f0ece0;
  padding: 12px 16px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 13px;
  margin-bottom: 1em;
}

.article-body code {
  background: #f0ece0;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.9em;
}

.article-body pre code {
  background: none;
  padding: 0;
}

.article-back {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 13px;
  color: #555;
  text-decoration: none;
  border-bottom: 1px solid #ccc;
  display: inline-block;
  margin-bottom: 20px;
}

.article-back:hover { color: #1a1a1a; border-color: #1a1a1a; }

/* ---- Layout articolo (main + sidebar) ---- */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 32px;
  padding: 16px 0 0;
  align-items: start;
}

.article-main {
  min-width: 0; /* evita overflow in grid */
}

/* ---- Navigazione articolo (precedente / successivo) ---- */
.article-nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  margin-top: 40px;
  padding-top: 14px;
  border-top: 2px solid #1a1a1a;
}

.article-nav-prev,
.article-nav-next {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 14px;
  font-style: italic;
  color: #1a1a1a;
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 6px;
  max-width: 48%;
  line-height: 1.3;
}

.article-nav-next {
  margin-left: auto;
  text-align: right;
  flex-direction: row-reverse;
}

.article-nav-prev:hover,
.article-nav-next:hover { opacity: 0.55; }

.nav-arrow {
  font-style: normal;
  flex-shrink: 0;
}

/* ---- Sidebar ---- */
.article-sidebar {
  border-left: 1px solid #aaa;
  padding-left: 20px;
}

.sidebar-heading {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 14px;
  padding-bottom: 5px;
  border-bottom: 2px solid #1a1a1a;
}

.sidebar-box {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid #d0cdc4;
}

.sidebar-box:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.sidebar-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  color: #1a1a1a;
  text-decoration: none;
  display: block;
  margin-bottom: 3px;
}

.sidebar-title:hover { opacity: 0.6; }

.sidebar-date {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 11px;
  color: #999;
  margin: 0 0 5px;
}

.sidebar-excerpt {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 12.5px;
  line-height: 1.5;
  color: #444;
  margin: 0 0 6px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ---- Tablet landscape (< 900px) ---- */
@media (max-width: 900px) {
  .masthead-title {
    font-size: clamp(20px, 4vw, 32px);
  }

  .date-bar {
    font-size: 11px;
  }
}

/* ---- Tablet portrait (< 768px): articolo sidebar sotto ---- */
@media (max-width: 767px) {
  .article-featured-img,
  .featured-img {
    float: none;
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 0 18px 0;
  }

  .article-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .article-sidebar {
    border-left: none;
    border-top: 2px solid #1a1a1a;
    padding-left: 0;
    padding-top: 20px;
    margin-top: 24px;
  }
}

/* ---- Tablet portrait (< 768px): 2 colonne ---- */
@media (max-width: 767px) {
  .columns-row {
    grid-template-columns: 1fr 1fr;
  }

  /* Prima colonna: bordo solo a destra */
  .col-article:nth-child(2n) {
    border-right: none;
    padding-right: 0;
  }

  /* Riga inferiore: separa le coppie con bordo bottom */
  .col-article:nth-child(-n+2) {
    border-bottom: 1px solid #aaa;
    padding-bottom: 10px;
  }

  .col-article:nth-child(n+3) {
    padding-top: 10px;
  }

  /* Prima colonna prima fila: no padding left */
  .col-article:nth-child(2n+1) {
    padding-left: 0;
  }

  .date-bar {
    font-size: 10.5px;
    gap: 4px;
  }

  .featured-headline {
    font-size: clamp(20px, 4vw, 30px);
  }
}

/* ---- Mobile (< 480px): 1 colonna ---- */
@media (max-width: 479px) {
  .newspaper-wrapper {
    padding: 0 12px;
  }

  .masthead {
    padding: 10px 0 6px;
  }

  .masthead-title {
    font-size: clamp(20px, 7vw, 28px);
    letter-spacing: 0;
  }

  .masthead-subtitle {
    font-size: 13px;
  }

  .date-bar {
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-align: center;
  }

  .date-bar .date-left,
  .date-bar .date-right,
  .date-bar .date-center {
    text-align: center;
  }

  .columns-row {
    grid-template-columns: 1fr;
  }

  .col-article {
    border-right: none;
    border-bottom: 1px solid #aaa;
    padding: 10px 0;
  }

  .col-article:first-child {
    padding-left: 0;
  }

  .col-article:last-child {
    border-bottom: none;
    padding-right: 0;
  }

  /* Su mobile justify crea spaziatura irregolare */
  .featured-body,
  .col-body {
    text-align: left;
  }

  .featured-headline {
    font-size: clamp(20px, 6vw, 26px);
  }

  .col-headline {
    font-size: 15px;
  }
}
