/*
Theme Name: Open Hardware Lab
Theme URI: https://openhardwarelab.org
Author: Open Hardware Lab
Description: Tema ufficiale del sito Open Hardware Lab. Design responsive mobile-first basato sul mockup approvato: header bianco con logo orizzontale, hero, sezione "Come funziona", griglia progetti, sezione libro e banner community. Richiede il plugin "OHL Core" per progetti, banner e iscrizione community.
Version: 1.3.1
Requires at least: 6.0
Tested up to: 6.7
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: openhardwarelab
*/

/* ============================================================
   INDICE
   1. Variabili e reset
   2. Tipografia e utilità
   3. Header e navigazione (mobile-first)
   4. Hero
   5. Sezioni home (come funziona, progetti, libro, about)
   6. Card progetto e archivio
   7. Pagina progetto singolo + sezione download
   8. Banner (Kickstarter, countdown, tienimi aggiornato)
   9. Form iscrizione community
   10. Footer
   11. Contenuti generici (pagine, articoli)
   12. Media query desktop
   ============================================================ */

/* ---------- 1. Variabili e reset ---------- */
:root {
  /* Palette ufficiale (file palette_colori.png):
     blu #0160A4 · verde lime #A5F373 · nero #000000 · bianco #FFFFFF.
     I grigi sono tinte di nero/bianco per bordi, fondi e testi secondari. */
  --ohl-blue: #0160a4;        /* blu primario: CTA, link, bottoni */
  --ohl-blue-dark: #01477a;   /* blu scuro per hover */
  --ohl-navy: #000000;        /* bande scure: hero, footer, banner countdown */
  --ohl-green: #a5f373;       /* verde lime: accenti, badge, bottone iscrizione */
  --ohl-orange: #a5f373;      /* alias storico: ora punta al verde lime della palette */
  --ohl-text: #000000;
  --ohl-text-light: #4d4d4d;
  --ohl-bg: #ffffff;
  --ohl-bg-alt: #f4f4f4;
  --ohl-border: #e0e0e0;
  --ohl-radius: 10px;
  --ohl-shadow: 0 2px 12px rgba(0, 0, 0, .10);
  --ohl-container: 1140px;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ohl-text);
  background: var(--ohl-bg);
  -webkit-text-size-adjust: 100%;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ohl-blue); }
a:hover { color: var(--ohl-blue-dark); }

/* ---------- 2. Tipografia e utilità ---------- */
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; font-weight: 800; }
h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
.ohl-container { max-width: var(--ohl-container); margin: 0 auto; padding: 0 20px; }
.ohl-section { padding: 48px 0; }
.ohl-section--alt { background: var(--ohl-bg-alt); }
.ohl-section__title { text-align: center; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 32px; }
.ohl-btn {
  display: inline-block; background: var(--ohl-blue); color: #fff !important;
  padding: 12px 26px; border-radius: 8px; border: 0; font-size: 1rem; font-weight: 600;
  text-decoration: none; cursor: pointer; box-shadow: var(--ohl-shadow);
  transition: background .15s ease;
}
.ohl-btn:hover { background: var(--ohl-blue-dark); }
.ohl-btn--ghost { background: transparent; color: var(--ohl-blue) !important; border: 2px solid var(--ohl-blue); box-shadow: none; }
.ohl-btn--ghost:hover { background: var(--ohl-blue); color: #fff !important; }
/* Bottone accento verde lime (palette #A5F373), es. "Join now" nel banner estrazione */
.ohl-btn--lime { display: inline-block; background: var(--ohl-green); color: #000 !important; font-weight: 700; padding: 8px 18px; border-radius: 8px; text-decoration: none; margin-left: 8px; }
.ohl-btn--lime:hover { filter: brightness(1.08); }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- 3. Header e navigazione ---------- */
.ohl-header { background: #fff; box-shadow: 0 1px 6px rgba(22,50,63,.08); position: sticky; top: 0; z-index: 100; }
.ohl-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 20px; max-width: var(--ohl-container); margin: 0 auto; }
.ohl-header__logo img { height: 54px; width: auto; }
.ohl-nav { display: none; }               /* mobile: nascosto, aperto dal toggle */
.ohl-nav.is-open { display: block; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-top: 1px solid var(--ohl-border); box-shadow: var(--ohl-shadow); }
.ohl-nav ul { list-style: none; margin: 0; padding: 8px 0; }
.ohl-nav li a { display: block; padding: 12px 24px; text-decoration: none; color: var(--ohl-text); font-weight: 600; border-radius: 8px; white-space: nowrap; transition: background .15s ease, color .15s ease; }
.ohl-nav li.current-menu-item > a { color: var(--ohl-blue); }
/* Evidenziazione al passaggio del mouse: sfondo #0160A4 (blu palette) */
.ohl-nav li a:hover { background: var(--ohl-blue); color: #fff; }
.ohl-header__cta { display: none; }
.ohl-nav-toggle {
  display: inline-flex; flex-direction: column; gap: 5px; background: none; border: 0; padding: 8px; cursor: pointer;
}
.ohl-nav-toggle span { width: 26px; height: 3px; background: var(--ohl-text); border-radius: 2px; transition: transform .2s; }
.ohl-nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.ohl-nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.ohl-nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---------- 4. Hero ---------- */
.ohl-hero { background: linear-gradient(135deg, #000000 0%, #013a68 55%, var(--ohl-blue) 100%); color: #fff; }
.ohl-hero__inner { display: flex; flex-direction: column; gap: 28px; padding: 56px 20px; max-width: var(--ohl-container); margin: 0 auto; align-items: center; }
.ohl-hero__text { max-width: 560px; text-align: center; }
.ohl-hero__text h1 { font-size: 2.1rem; text-transform: uppercase; }
.ohl-hero__text p { font-size: 1.1rem; color: #e6e6e6; }
.ohl-hero__img img { border-radius: var(--ohl-radius); box-shadow: 0 8px 30px rgba(0,0,0,.35); }

/* ---------- 5. Sezioni home ---------- */
.ohl-steps { display: grid; grid-template-columns: 1fr; gap: 28px; text-align: center; }
.ohl-step__icon { font-size: 2.2rem; line-height: 1; margin-bottom: 10px; }
.ohl-step h3 { color: var(--ohl-text); }
.ohl-step p { color: var(--ohl-text-light); margin: 0; }
.ohl-center { text-align: center; margin-top: 32px; }

.ohl-book { display: flex; flex-direction: column; gap: 28px; align-items: center; }
.ohl-book__cover img { max-width: 240px; border-radius: 6px; box-shadow: var(--ohl-shadow); }
.ohl-book__text h2 { margin-top: 0; }
.ohl-book__badge { display: inline-block; background: var(--ohl-green); color: #000; font-size: .8rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 12px; }

.ohl-about { display: flex; flex-direction: column; gap: 28px; }
.ohl-about img { border-radius: var(--ohl-radius); }

/* ---------- 6. Card progetto e archivio ---------- */
.ohl-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
.ohl-card { background: #fff; border: 1px solid var(--ohl-border); border-radius: var(--ohl-radius); overflow: hidden; box-shadow: var(--ohl-shadow); display: flex; flex-direction: column; }
.ohl-card__thumb img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.ohl-card__body { padding: 20px; }
.ohl-card__body h3 { margin: 0 0 10px; }
.ohl-card__body p { margin: 0 0 18px; color: var(--ohl-text-light); }
.ohl-card__body .ohl-btn { display: inline-block; }

/* ---------- 7. Pagina progetto singolo ---------- */
/* Stesso gradiente blu della hero in home ("Build technology from scratch") */
.ohl-project-header { background: linear-gradient(135deg, #000000 0%, #013a68 55%, var(--ohl-blue) 100%); color: #fff; padding: 40px 0; }
.ohl-project-header p { color: #e6e6e6; max-width: 720px; margin: 0; }
.ohl-project-content { display: grid; grid-template-columns: 1fr; gap: 36px; padding: 40px 0; }
.ohl-specs table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.ohl-specs th, .ohl-specs td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--ohl-border); vertical-align: top; }
.ohl-specs th { width: 40%; color: var(--ohl-text-light); font-weight: 600; }

/* Figure con didascalia (foto e schemi del progetto, dalla brochure) */
.ohl-fig { margin: 24px 0; }
.ohl-fig img { width: 100%; border-radius: var(--ohl-radius); box-shadow: var(--ohl-shadow); }
.ohl-fig figcaption { font-size: .85rem; color: var(--ohl-text-light); text-align: center; margin-top: 10px; }

/* Feature card del progetto (non invasivo, batteria, SD, Bluetooth) */
.ohl-feats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 24px 0; }
.ohl-feat { background: #fff; border: 1px solid var(--ohl-border); border-top: 4px solid var(--ohl-green); border-radius: var(--ohl-radius); padding: 16px; box-shadow: var(--ohl-shadow); }
.ohl-feat__icon { font-size: 1.6rem; line-height: 1; display: block; margin-bottom: 8px; }
.ohl-feat h3 { font-size: 1rem; margin: 0 0 6px; }
.ohl-feat p { margin: 0; font-size: .88rem; color: var(--ohl-text-light); }

/* Dati di autonomia (statistiche dalla brochure) */
.ohl-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 24px 0; }
.ohl-stat { background: var(--ohl-navy); color: #fff; border-radius: var(--ohl-radius); padding: 18px 16px; text-align: center; }
.ohl-stat strong { display: block; font-size: 1.5rem; font-weight: 800; color: var(--ohl-green); margin-bottom: 6px; }
.ohl-stat span { font-size: .85rem; color: #d9d9d9; line-height: 1.4; display: block; }

.ohl-downloads { background: var(--ohl-bg-alt); border-radius: var(--ohl-radius); padding: 28px; }
.ohl-downloads h2 { margin-top: 0; }
.ohl-downloads__group { margin-bottom: 22px; }
.ohl-downloads__group h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 1.05rem; }
.ohl-downloads__list { list-style: none; margin: 0; padding: 0; }
.ohl-downloads__list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px; background: #fff; border: 1px solid var(--ohl-border); border-radius: 8px; margin-bottom: 8px; }
.ohl-downloads__list a { font-weight: 600; text-decoration: none; }
.ohl-downloads__meta { color: var(--ohl-text-light); font-size: .85rem; }
.ohl-license { font-size: .9rem; color: var(--ohl-text-light); border-top: 1px solid var(--ohl-border); padding-top: 14px; margin-top: 8px; }

/* ---------- 8. Banner ---------- */
.ohl-topbanner { background: var(--ohl-green); color: #000; text-align: center; padding: 10px 16px; font-weight: 600; font-size: .95rem; }
.ohl-topbanner a { color: #000; text-decoration: underline; font-weight: 800; }
.ohl-countdown-banner { background: var(--ohl-navy); color: #fff; text-align: center; padding: 14px 16px; }
.ohl-countdown-banner strong { color: var(--ohl-green); }
.ohl-countdown { display: inline-flex; gap: 10px; margin-left: 10px; font-variant-numeric: tabular-nums; font-weight: 800; }
.ohl-countdown span em { font-style: normal; font-size: .7rem; display: block; font-weight: 400; color: #cccccc; }
.ohl-countdown-banner a { color: #fff; }

/* ---------- 9. Form iscrizione community ---------- */
.ohl-subscribe { background: linear-gradient(135deg, var(--ohl-blue) 0%, #000000 100%); color: #fff; border-radius: var(--ohl-radius); padding: 32px 24px; }
.ohl-subscribe h2, .ohl-subscribe h3 { color: #fff; margin-top: 0; }
.ohl-subscribe p { color: #e6e6e6; }
.ohl-subscribe__row { display: flex; flex-direction: column; gap: 12px; margin: 18px 0 10px; }
.ohl-subscribe input[type="email"] { padding: 12px 16px; border-radius: 8px; border: 0; font-size: 1rem; width: 100%; }
.ohl-subscribe .ohl-btn { background: var(--ohl-green); color: #000 !important; }
.ohl-subscribe .ohl-btn:hover { filter: brightness(1.08); }
.ohl-subscribe__gdpr { display: flex; gap: 10px; align-items: flex-start; font-size: .85rem; color: #e6e6e6; }
.ohl-subscribe__gdpr input { margin-top: 4px; flex: none; }
.ohl-subscribe__gdpr a { color: #fff; }
.ohl-subscribe__note { font-size: .85rem; color: #cccccc; margin-top: 10px; }
.ohl-notice { padding: 14px 18px; border-radius: 8px; margin: 16px 0; font-weight: 600; }
.ohl-notice--ok { background: #f2fce8; color: #000; border: 1px solid #a5f373; }
.ohl-notice--err { background: #fdeaea; color: #9d2020; border: 1px solid #e08787; }

/* ---------- 10. Footer ---------- */
.ohl-footer { background: var(--ohl-navy); color: #d9d9d9; padding: 44px 0 24px; margin-top: 56px; }
.ohl-footer a { color: #fff; text-decoration: none; }
.ohl-footer a:hover { text-decoration: underline; }
.ohl-footer__cols { display: grid; grid-template-columns: 1fr; gap: 28px; }
.ohl-footer__logo img { height: 84px; width: auto; background: #fff; border-radius: 10px; padding: 8px; }
.ohl-footer h4 { color: #fff; margin-bottom: 12px; }
.ohl-footer ul { list-style: none; margin: 0; padding: 0; }
.ohl-footer li { margin-bottom: 8px; }
.ohl-footer__bottom { border-top: 1px solid rgba(255,255,255,.15); margin-top: 32px; padding-top: 18px; font-size: .85rem; text-align: center; }

/* ---------- 11. Contenuti generici ---------- */
.ohl-page { padding: 40px 0; }
.ohl-page .ohl-container { max-width: 820px; }
.ohl-page h1 { margin-bottom: 24px; }
.ohl-page img { border-radius: var(--ohl-radius); }
.wp-block-button__link { background: var(--ohl-blue); border-radius: 8px; }

/* ---------- 12. Media query desktop ---------- */
@media (min-width: 782px) {
  h1 { font-size: 2.6rem; }
  .ohl-nav-toggle { display: none; }
  /* Menu centrato tra il logo e il pulsante CTA, voci centrate */
  .ohl-nav { display: block !important; position: static; box-shadow: none; border: 0; background: none; margin: 0 auto; }
  .ohl-nav ul { display: flex; gap: 6px; padding: 0; justify-content: center; }
  .ohl-nav li a { padding: 8px 14px; text-align: center; }
  .ohl-header__cta { display: inline-block; }
  .ohl-hero__inner { flex-direction: row; text-align: left; padding: 72px 20px; }
  .ohl-hero__text { text-align: left; flex: 1; }
  .ohl-hero__text h1 { font-size: 2.7rem; }
  .ohl-hero__img { flex: 1; }
  .ohl-steps { grid-template-columns: repeat(3, 1fr); }
  .ohl-grid { grid-template-columns: repeat(3, 1fr); }
  .ohl-grid--2 { grid-template-columns: repeat(2, 1fr); }
  .ohl-book { flex-direction: row; text-align: left; }
  .ohl-book__text { flex: 1; }
  .ohl-about { flex-direction: row; align-items: center; }
  .ohl-about > * { flex: 1; }
  .ohl-project-content { grid-template-columns: 3fr 2fr; }
  .ohl-subscribe { padding: 44px; }
  .ohl-subscribe__row { flex-direction: row; }
  .ohl-subscribe input[type="email"] { flex: 1; }
  .ohl-footer__cols { grid-template-columns: 2fr 1fr 1fr; }
}
