/*
Theme Name: Il Faro Economico
Theme URI: https://example.com/il-faro-economico
Author: Codex
Author URI: https://openai.com
Description: Tema editoriale per magazine economico con homepage configurabile, pubblicita, ricerca e infinite scroll.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: il-faro-economico
Tags: news, blog, custom-logo, featured-images, custom-menu, theme-options
*/

:root {
  --ife-paper: #faf9f6;
  --ife-ink: #171717;
  --ife-muted: #6f6f6f;
  --ife-line: #d8d5cf;
  --ife-gold: #b47a16;
  --ife-gold-soft: #d9a13d;
  --ife-white: #fff;
  --ife-serif: Georgia, "Times New Roman", serif;
  --ife-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--ife-paper);
  color: var(--ife-ink);
  font-family: var(--ife-sans);
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus {
  color: var(--ife-gold);
}

img {
  display: block;
  height: auto;
  max-width: 100%;
}

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.ife-container {
  margin-inline: auto;
  max-width: 1480px;
  padding-inline: 28px;
}

.ife-header {
  background: rgba(250, 249, 246, 0.96);
  border-bottom: 1px solid var(--ife-line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.ife-topbar {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: 64px 1fr auto;
  min-height: 88px;
}

.ife-menu-toggle,
.ife-search-toggle,
.ife-close-search {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ife-ink);
  cursor: pointer;
  display: inline-flex;
  height: 44px;
  justify-content: center;
  padding: 0;
  width: 44px;
}

.ife-menu-toggle span,
.ife-menu-toggle::before,
.ife-menu-toggle::after {
  background: currentColor;
  content: "";
  display: block;
  height: 2px;
  position: absolute;
  width: 23px;
}

.ife-menu-toggle {
  position: relative;
}

.ife-menu-toggle::before {
  transform: translateY(-8px);
}

.ife-menu-toggle::after {
  transform: translateY(8px);
}

.ife-brand {
  font-family: var(--ife-serif);
  font-size: clamp(2.1rem, 4vw, 4.4rem);
  font-weight: 500;
  letter-spacing: 0.18em;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.ife-brand a {
  color: var(--ife-ink);
}

.ife-brand img,
.ife-header-logo {
  display: inline-block;
  max-height: 72px;
  object-fit: contain;
  width: auto;
}

.ife-actions {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: flex-end;
}

.ife-social {
  align-items: center;
  display: flex;
  gap: 14px;
  font-size: 0.86rem;
  font-weight: 700;
}

.ife-action-divider {
  background: var(--ife-line);
  height: 42px;
  width: 1px;
}

.ife-search-toggle svg,
.ife-close-search svg {
  height: 24px;
  width: 24px;
}

.ife-nav-wrap {
  border-top: 1px solid var(--ife-line);
}

.ife-nav {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 52px;
}

.ife-nav ul {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(18px, 4vw, 66px);
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ife-nav a {
  color: var(--ife-ink);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ife-search-panel {
  background: var(--ife-paper);
  border-top: 1px solid var(--ife-line);
  display: none;
  padding-block: 18px;
}

.ife-search-panel.is-open {
  display: block;
}

.ife-search-form {
  align-items: center;
  display: flex;
  gap: 12px;
}

.ife-search-form input[type="search"] {
  background: var(--ife-white);
  border: 1px solid var(--ife-line);
  color: var(--ife-ink);
  flex: 1;
  font: 1.2rem var(--ife-serif);
  min-height: 50px;
  padding: 0 16px;
}

.ife-button,
.ife-search-form button[type="submit"],
.ife-load-more {
  background: var(--ife-ink);
  border: 1px solid var(--ife-ink);
  color: var(--ife-white);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  min-height: 46px;
  padding: 0 18px;
  text-transform: uppercase;
}

.ife-button:hover,
.ife-search-form button[type="submit"]:hover,
.ife-load-more:hover {
  background: var(--ife-gold);
  border-color: var(--ife-gold);
  color: var(--ife-white);
}

.ife-main {
  padding-block: 20px 54px;
}

.ife-section {
  border-top: 1px solid var(--ife-line);
  margin-top: 26px;
  padding-top: 14px;
}

.ife-section-title {
  align-items: center;
  display: flex;
  font-size: 0.92rem;
  font-weight: 900;
  gap: 16px;
  margin: 0 0 14px;
  text-transform: uppercase;
}

.ife-section-title::after {
  background: var(--ife-line);
  content: "";
  flex: 1;
  height: 1px;
}

.ife-ad {
  align-items: center;
  background: #efede8;
  border: 1px solid var(--ife-line);
  color: var(--ife-muted);
  display: flex;
  justify-content: center;
  margin-block: 22px;
  min-height: 90px;
  overflow: hidden;
  padding: 12px;
  text-align: center;
}

.ife-ad iframe,
.ife-ad img,
.ife-ad ins {
  max-width: 100%;
}

.ife-hero-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1.05fr);
}

.ife-hero-card {
  min-height: 420px;
  position: relative;
}

.ife-hero-card img {
  height: 100%;
  object-fit: cover;
  position: absolute;
  width: 100%;
}

.ife-hero-card::after {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.18));
  content: "";
  inset: 0;
  position: absolute;
}

.ife-hero-content {
  bottom: 0;
  color: var(--ife-white);
  max-width: 780px;
  padding: clamp(26px, 4vw, 44px);
  position: absolute;
  z-index: 2;
}

.ife-kicker {
  color: var(--ife-gold-soft);
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 900;
  gap: 10px;
  text-transform: uppercase;
}

.ife-kicker::after {
  background: currentColor;
  content: "";
  height: 1px;
  margin-top: 0.72em;
  width: 54px;
}

.ife-hero-title {
  font-family: var(--ife-serif);
  font-size: clamp(1.95rem, 3.8vw, 3.25rem);
  line-height: 1.08;
  margin: 18px 0;
}

.ife-hero-excerpt {
  font-size: 1.08rem;
  max-width: 620px;
}

.ife-meta {
  color: var(--ife-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.78rem;
  gap: 10px;
  margin-top: 16px;
}

.ife-hero-card .ife-meta {
  color: var(--ife-white);
}

.ife-side-list {
  display: grid;
  gap: 12px;
}

.ife-side-card {
  background: var(--ife-paper);
  border: 1px solid var(--ife-line);
  display: grid;
  grid-template-columns: 44% 1fr;
  min-height: 136px;
}

.ife-side-card img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.ife-side-card-content {
  padding: 18px 20px;
}

.ife-card-title {
  font-family: var(--ife-serif);
  font-size: 1.18rem;
  line-height: 1.15;
  margin: 8px 0 0;
}

.ife-feature-grid {
  display: grid;
  gap: 32px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ife-feature-card img {
  aspect-ratio: 16 / 7;
  object-fit: cover;
  width: 100%;
}

.ife-fallback-thumb {
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, rgba(180, 122, 22, 0.28), rgba(23, 23, 23, 0.08)),
    repeating-linear-gradient(90deg, #e7e3db 0, #e7e3db 1px, transparent 1px, transparent 18px);
  min-height: 120px;
  width: 100%;
}

.ife-feature-card .ife-card-title {
  font-size: 1.08rem;
}

.ife-lower-grid {
  display: grid;
  gap: 36px;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 0.36fr);
}

.ife-list-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ife-list-card {
  display: grid;
  gap: 18px;
  grid-template-columns: 34% 1fr;
}

.ife-list-card img {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  width: 100%;
}

.ife-video-list {
  display: grid;
  gap: 16px;
}

.ife-video-card {
  display: grid;
  gap: 16px;
  grid-template-columns: 45% 1fr;
}

.ife-play-thumb {
  position: relative;
}

.ife-play-thumb::after {
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid var(--ife-white);
  border-radius: 50%;
  color: var(--ife-white);
  content: "▶";
  display: flex;
  height: 46px;
  justify-content: center;
  left: 50%;
  padding-left: 3px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 46px;
}

.ife-opinion-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ife-opinion-card {
  border-left: 3px solid var(--ife-gold);
  padding-left: 18px;
}

.ife-opinion-card img,
.ife-opinion-card .ife-fallback-thumb {
  aspect-ratio: 16 / 9;
  margin-bottom: 12px;
  object-fit: cover;
  width: 100%;
}

.ife-page-title {
  border-bottom: 1px solid var(--ife-line);
  font-family: var(--ife-serif);
  font-size: clamp(2.1rem, 4vw, 3.8rem);
  line-height: 1.05;
  margin: 0 0 24px;
  padding-bottom: 18px;
}

.ife-archive-grid {
  display: grid;
  gap: 30px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ife-article {
  margin-inline: auto;
  max-width: 860px;
}

#ife-next-article-stream .ife-article {
  border-top: 1px solid var(--ife-line);
  margin-top: 52px;
  padding-top: 36px;
}

.ife-article-header {
  border-bottom: 1px solid var(--ife-line);
  margin-bottom: 28px;
  padding-bottom: 24px;
}

.ife-article-title {
  font-family: var(--ife-serif);
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.04;
  margin: 14px 0;
}

.ife-article-excerpt {
  color: #3f3f3f;
  font-size: 1.25rem;
}

.ife-article-image {
  margin: 26px 0;
}

.ife-content {
  font-family: var(--ife-serif);
  font-size: 1.22rem;
  line-height: 1.78;
}

.ife-content a {
  border-bottom: 1px solid var(--ife-gold);
  color: var(--ife-gold);
}

.ife-content p,
.ife-content ul,
.ife-content ol,
.ife-content blockquote {
  margin-bottom: 1.25em;
}

.ife-author-box {
  align-items: center;
  border-top: 1px solid var(--ife-line);
  display: grid;
  gap: 18px;
  grid-template-columns: 88px 1fr;
  margin-top: 36px;
  padding-top: 24px;
}

.ife-author-box img {
  border-radius: 50%;
}

.ife-author-box h2 {
  font-family: var(--ife-serif);
  margin: 0 0 6px;
}

.ife-post-nav {
  border-top: 1px solid var(--ife-line);
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 34px;
  padding-top: 20px;
}

.ife-post-nav a {
  border: 1px solid var(--ife-line);
  display: block;
  padding: 16px;
}

.ife-infinite-status {
  color: var(--ife-muted);
  font-size: 0.82rem;
  padding: 24px;
  text-align: center;
}

.ife-footer {
  border-top: 1px solid var(--ife-line);
  color: var(--ife-muted);
  padding: 28px 0;
}

@media (max-width: 980px) {
  .ife-topbar {
    grid-template-columns: 48px 1fr 48px;
    min-height: 72px;
  }

  .ife-social,
  .ife-action-divider {
    display: none;
  }

  .ife-brand {
    font-size: clamp(1.5rem, 6vw, 2.4rem);
    letter-spacing: 0.12em;
  }

  .ife-nav {
    display: none;
    justify-content: flex-start;
    padding-block: 16px;
  }

  .ife-nav.is-open {
    display: block;
  }

  .ife-nav ul {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .ife-hero-grid,
  .ife-lower-grid,
  .ife-list-grid,
  .ife-opinion-grid {
    grid-template-columns: 1fr;
  }

  .ife-feature-grid,
  .ife-archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .ife-container {
    padding-inline: 16px;
  }

  .ife-feature-grid,
  .ife-archive-grid {
    grid-template-columns: 1fr;
  }

  .ife-side-card,
  .ife-list-card,
  .ife-video-card,
  .ife-author-box,
  .ife-post-nav {
    grid-template-columns: 1fr;
  }

  .ife-hero-card {
    min-height: 500px;
  }

  .ife-search-form {
    align-items: stretch;
    flex-direction: column;
  }
}
