/*
Theme Name: Transizione Energia
Theme URI: https://example.com/transizione-energia
Author: Codex
Author URI: https://openai.com
Description: Tema editoriale WordPress per magazine su energia, rinnovabili, mercati e sostenibilita.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: transizione-energia
Tags: blog, news, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

:root {
  --te-bg: #020608;
  --te-bg-soft: #071012;
  --te-panel: #0b1114;
  --te-panel-2: #10191d;
  --te-border: rgba(255, 255, 255, .15);
  --te-border-soft: rgba(255, 255, 255, .09);
  --te-text: #f6f7f5;
  --te-muted: #b9c0c0;
  --te-dim: #7f8a8b;
  --te-orange: #ff5a00;
  --te-orange-2: #ff7a1a;
  --te-max: 1180px;
  --te-radius: 8px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 90, 0, .08), transparent 28rem),
    linear-gradient(180deg, #010304 0%, var(--te-bg) 38%, #03090b 100%);
  color: var(--te-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

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

a:hover,
a:focus {
  color: var(--te-orange-2);
}

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

button,
input,
textarea,
select {
  font: inherit;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-shell {
  width: min(100% - 32px, var(--te-max));
  margin: 0 auto;
}

.topbar {
  border-bottom: 1px solid var(--te-border-soft);
  font-size: .82rem;
}

.topbar__inner,
.brandbar,
.navrow,
.footer__grid {
  width: min(100% - 32px, var(--te-max));
  margin: 0 auto;
}

.topbar__inner {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar__links,
.topbar__social,
.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.newsletter-button,
.button,
.wp-block-button__link,
input[type="submit"] {
  border: 0;
  border-radius: 4px;
  color: #fff;
  background: linear-gradient(180deg, var(--te-orange-2), var(--te-orange));
  padding: 11px 18px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
}

.newsletter-button {
  min-height: 34px;
  padding: 8px 14px;
  font-size: .78rem;
}

.brandbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.site-title {
  color: var(--te-orange);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  font-weight: 850;
  letter-spacing: 0;
}

.site-title a:hover { color: var(--te-orange); }

.custom-logo {
  max-height: 62px;
  width: auto;
}

.search-toggle,
.menu-toggle,
.load-more-button {
  appearance: none;
  background: transparent;
  border: 1px solid var(--te-border);
  color: #fff;
  border-radius: 4px;
  min-width: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-toggle:hover,
.menu-toggle:hover,
.load-more-button:hover {
  border-color: var(--te-orange);
  color: var(--te-orange-2);
}

.navrow {
  border-top: 1px solid var(--te-border-soft);
  border-bottom: 1px solid var(--te-border-soft);
}

.primary-menu {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .86rem;
  font-weight: 800;
  text-transform: uppercase;
}

.primary-menu li {
  position: relative;
}

.primary-menu .sub-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 220px;
  margin: 0;
  padding: 10px;
  list-style: none;
  background: #071012;
  border: 1px solid var(--te-border);
  border-radius: var(--te-radius);
  z-index: 20;
}

.primary-menu li:hover > .sub-menu,
.primary-menu li:focus-within > .sub-menu {
  display: grid;
  gap: 8px;
}

.search-panel {
  display: none;
  border-bottom: 1px solid var(--te-border-soft);
  background: rgba(2, 6, 8, .96);
}

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

.search-form {
  width: min(100% - 32px, var(--te-max));
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.search-field,
.newsletter-form input,
.comment-form input,
.comment-form textarea,
.wp-block-search__input {
  width: 100%;
  border: 1px solid var(--te-border);
  background: #070c0f;
  color: #fff;
  border-radius: 4px;
  padding: 13px 14px;
}

.main {
  padding: 22px 0 54px;
}

.section {
  margin-top: 26px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-title {
  margin: 0;
  font-size: clamp(1.35rem, 2.6vw, 1.7rem);
  line-height: 1.15;
  font-weight: 700;
}

.section-title::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 1.25em;
  margin-right: 14px;
  vertical-align: -.22em;
  background: var(--te-orange);
}

.section-link,
.read-more {
  color: #fff;
  font-weight: 700;
  font-size: .94rem;
}

.section-link::after,
.read-more::after,
.post-nav-link.next::after {
  content: " ->";
  color: var(--te-orange);
}

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

.hero-card,
.side-list,
.focus-main,
.ad-slot,
.article-card,
.author-box,
.comments-area,
.post-content {
  border: 1px solid var(--te-border);
  border-radius: var(--te-radius);
  background: rgba(9, 15, 18, .78);
}

.hero-card {
  min-height: 492px;
  display: flex;
  align-items: flex-end;
  padding: clamp(24px, 4vw, 40px);
  position: relative;
  overflow: hidden;
}

.hero-card::before,
.article-card--image::before,
.ranking-card__image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, .82), rgba(0, 0, 0, .23) 58%, rgba(0, 0, 0, .36));
  z-index: 1;
}

.hero-card > * {
  position: relative;
  z-index: 2;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .9;
}

.eyebrow,
.cat-pill {
  display: inline-flex;
  width: fit-content;
  background: var(--te-orange);
  color: #fff;
  border-radius: 3px;
  padding: 4px 8px;
  font-size: .75rem;
  line-height: 1;
  font-weight: 850;
  text-transform: uppercase;
}

.hero-card .eyebrow {
  background: transparent;
  color: var(--te-orange);
  padding: 0;
  margin-bottom: 14px;
}

.hero-title {
  max-width: 680px;
  margin: 0 0 16px;
  font-size: clamp(2rem, 4.4vw, 3rem);
  line-height: 1.04;
}

.hero-excerpt {
  max-width: 620px;
  margin: 0 0 26px;
  color: #f0f2f0;
  font-size: 1.1rem;
}

.side-list {
  display: grid;
  align-content: stretch;
  overflow: hidden;
}

.side-story {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--te-border-soft);
}

.side-story:last-child {
  border-bottom: 0;
}

.side-story img {
  width: 170px;
  aspect-ratio: 1.35;
  object-fit: cover;
  border-radius: 5px;
}

.side-story h3,
.article-card h3,
.ranking-card h3 {
  margin: 8px 0 6px;
  line-height: 1.18;
  font-size: 1.08rem;
}

.meta,
.post-meta,
.byline {
  color: var(--te-muted);
  font-size: .82rem;
}

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

.article-card {
  overflow: hidden;
  min-height: 100%;
}

.article-card--image {
  position: relative;
  min-height: 302px;
  display: flex;
  align-items: flex-end;
  padding: 15px;
}

.article-card--image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-card__body {
  position: relative;
  z-index: 2;
}

.focus-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .95fr);
  gap: 26px;
  align-items: center;
}

.focus-main {
  display: grid;
  grid-template-columns: minmax(260px, .95fr) 1fr;
  gap: 28px;
  padding: 14px;
}

.focus-main img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: 6px;
}

.focus-main h3 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.08;
  margin: 10px 0 14px;
}

.focus-side {
  display: grid;
  gap: 20px;
}

.mini-story {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 16px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--te-border-soft);
}

.mini-story img {
  width: 112px;
  aspect-ratio: 1.15;
  object-fit: cover;
  border-radius: 5px;
}

.mini-story h3 {
  margin: 6px 0 0;
  font-size: 1.05rem;
  line-height: 1.18;
}

.ranking-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 22px;
  counter-reset: popular;
}

.ranking-card {
  position: relative;
  counter-increment: popular;
}

.ranking-card__image {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--te-border);
  border-radius: 6px;
}

.ranking-card__image img {
  width: 100%;
  aspect-ratio: 1.95;
  object-fit: cover;
}

.ranking-card::before {
  content: counter(popular);
  position: absolute;
  left: 0;
  top: -18px;
  color: var(--te-orange);
  font-weight: 900;
  font-size: 4.3rem;
  line-height: 1;
  z-index: 3;
}

.ranking-card h3 {
  font-size: 1rem;
  margin-top: 10px;
}

.newsletter-band {
  margin-top: 34px;
  border: 1px solid rgba(255, 90, 0, .78);
  border-radius: 6px;
  padding: 24px 28px;
  display: grid;
  grid-template-columns: auto 1fr minmax(260px, .75fr) auto;
  gap: 20px;
  align-items: center;
  background:
    linear-gradient(120deg, rgba(255, 90, 0, .11), transparent 36%),
    var(--te-panel);
}

.newsletter-icon {
  color: var(--te-orange);
  font-size: 3rem;
  line-height: 1;
}

.newsletter-band h2 {
  margin: 0 0 4px;
  font-size: 1.45rem;
}

.newsletter-band p {
  margin: 0;
  color: var(--te-muted);
}

.newsletter-form {
  display: contents;
}

.ad-slot {
  margin: 28px 0;
  padding: 16px;
  text-align: center;
  color: var(--te-muted);
  background:
    linear-gradient(135deg, rgba(255, 90, 0, .08), transparent),
    repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 1px, transparent 1px 10px);
}

.ad-slot--leaderboard { min-height: 90px; }
.ad-slot--medium { min-height: 250px; }
.ad-slot--mobile { min-height: 100px; }

.site-footer {
  border-top: 1px solid var(--te-border-soft);
  padding: 32px 0 20px;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.7fr repeat(4, 1fr);
  gap: 34px;
}

.footer-brand {
  color: var(--te-orange);
  font-size: 1.65rem;
  line-height: 1;
  font-weight: 850;
}

.footer-title {
  margin: 0 0 12px;
  text-transform: uppercase;
  font-size: .82rem;
}

.footer-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 3px;
  color: var(--te-muted);
  font-size: .93rem;
}

.copyright {
  width: min(100% - 32px, var(--te-max));
  margin: 26px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--te-border-soft);
  color: var(--te-muted);
  font-size: .83rem;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.archive-header,
.single-header {
  margin: 28px 0 22px;
}

.archive-title,
.single-title {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3.45rem);
  line-height: 1.03;
}

.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(260px, 340px);
  gap: 34px;
  align-items: start;
}

.post-hero img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  border-radius: var(--te-radius);
  border: 1px solid var(--te-border);
}

.post-content {
  padding: clamp(22px, 4vw, 42px);
  margin-top: 22px;
  font-size: 1.08rem;
}

.post-content a,
.post-meta a {
  color: var(--te-orange-2);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.post-content p {
  margin: 0 0 1.35em;
}

.post-content h2,
.post-content h3 {
  line-height: 1.15;
  margin: 1.5em 0 .55em;
}

.author-box {
  margin-top: 24px;
  padding: 22px;
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 18px;
}

.author-box img {
  width: 86px;
  height: 86px;
  border-radius: 50%;
}

.author-box h2 {
  margin: 0 0 6px;
}

.post-navigation {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.post-nav-link {
  border: 1px solid var(--te-border);
  border-radius: var(--te-radius);
  padding: 16px;
  background: var(--te-panel);
}

.post-nav-link.prev::before {
  content: "< ";
  color: var(--te-orange);
}

.sidebar {
  display: grid;
  gap: 18px;
}

.widget,
.comments-area {
  padding: 20px;
}

.widget {
  border: 1px solid var(--te-border);
  border-radius: var(--te-radius);
  background: var(--te-panel);
}

.widget-title {
  margin: 0 0 14px;
  font-size: 1rem;
  text-transform: uppercase;
}

.load-more-wrap {
  margin-top: 28px;
  display: flex;
  justify-content: center;
}

.load-more-button {
  width: auto;
  padding: 0 18px;
  font-weight: 800;
  text-transform: uppercase;
}

.load-more-button.is-loading {
  opacity: .7;
  pointer-events: none;
}

@media (max-width: 960px) {
  .hero-grid,
  .focus-grid,
  .post-layout,
  .footer__grid {
    grid-template-columns: 1fr;
  }

  .card-grid,
  .ranking-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .focus-main {
    grid-template-columns: 1fr;
  }

  .newsletter-band {
    grid-template-columns: 1fr;
  }

  .primary-menu {
    display: none;
    padding: 14px 0;
    align-items: stretch;
  }

  .primary-menu.is-open {
    display: grid;
  }

  .menu-toggle {
    display: inline-flex;
    margin: 10px 0;
  }
}

@media (min-width: 961px) {
  .menu-toggle {
    display: none;
  }
}

@media (max-width: 680px) {
  .topbar__inner,
  .brandbar,
  .copyright {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 0;
  }

  .topbar__links {
    flex-wrap: wrap;
    gap: 12px;
  }

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

  .side-story,
  .mini-story,
  .author-box,
  .post-navigation {
    grid-template-columns: 1fr;
  }

  .side-story img,
  .mini-story img {
    width: 100%;
  }

  .card-grid,
  .ranking-grid {
    grid-template-columns: 1fr;
  }

  .search-form {
    grid-template-columns: 1fr;
  }
}
