/* ============================================================
   EhiQlock — Manuale Utente
   Foglio di stile allineato alla Brand Identity EhiPi (2025)
   Type: Space Grotesk · Space Mono · Fraunces (corsivi)
   ============================================================ */

:root {
  --container-max: 880px;

  /* ── Teal (colore proprietario) ── */
  --teal-deeper: #093a3f;
  --teal-dark:   #0f4f55;
  --teal:        #1a7a82;
  --teal-light:  #2a9aa4;
  --teal-pale:   #e8f5f6;
  --teal-border-soft: rgba(26,122,130,0.22);

  /* ── Carta & inchiostro ── */
  --paper:   #f3efe7;
  --paper-2: #ece7dc;
  --white:   #ffffff;
  --surface: #fbf9f4;
  --surface-muted: #f5f1e8;
  --text:      #16201f;
  --text-soft: #3a4544;
  --text-muted:#6c7674;
  --border:    #d9d2c4;
  --bg: var(--paper);

  /* ── I quattro pulsanti (palette secondaria) ── */
  --btn-blue: #3b7dd8;   --btn-blue-bg: #eef3fc;
  --btn-yellow:#d4a017;  --btn-yellow-bg:#fdf7e8;
  --btn-white:#9a958c;   --btn-white-bg:#f4f1ea;
  --btn-green:#2d7a4f;   --btn-green-bg:#eef7f1;

  --press-short-bg:#eef3fc; --press-short-text:#2c5fae;
  --press-long-bg:#fdf3da;  --press-long-text:#8a6a12;
  --press-hold-bg:#fbeeec;

  --warn:#b04a3d; --warn-text:#7a2b22; --warn-bg:#fbeeec;
  --note-bg:#eef7f8;

  --overlay-line: rgba(255,255,255,0.035);
  --text-inverse-soft: rgba(255,255,255,0.66);
  --text-inverse-mid:  rgba(255,255,255,0.82);
  --text-inverse-dim:  rgba(255,255,255,0.18);
  --dot-shadow: rgba(0,0,0,0.06);
  --shadow-sm: 0 1px 3px rgba(20,40,38,0.06);
  --shadow-lg: 0 8px 24px rgba(20,40,38,0.10);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-pill: 100px;

  --fs-sm: 0.72rem;
  --fs-ui: 0.82rem;
  --fs-body: 0.88rem;
  --fs-base: 0.92rem;
  --fs-md: 0.96rem;
  --fs-lg: 1.08rem;
  --fs-xl: 1.15rem;
  --fs-2xl: 1.7rem;

  --mono:  'Space Mono', monospace;
  --sans:  'Space Grotesk', sans-serif;
  --serif: 'Fraunces', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* grana tattile (firma di marca) */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── HEADER (coerente con la cover del brand book) ── */
header {
  background: var(--teal-deeper);
  color: var(--white);
  padding: 3.5rem 0 3rem;
  position: relative;
  overflow: hidden;
}
header::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    45deg, transparent, transparent 40px,
    var(--overlay-line) 40px, var(--overlay-line) 41px);
}
header::after {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 82% 0%, rgba(42,154,164,.32), transparent 55%);
}
.header-inner { position: relative; z-index: 2; }
.brand {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--teal-light);
  margin-bottom: 0.6rem;
}
header h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin-bottom: 0.5rem;
}
header h1 span { color: var(--teal-light); }
.header-payoff {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.15rem, 2.6vw, 1.6rem);
  color: var(--white);
  margin-bottom: 0.8rem;
}
header p {
  color: var(--text-inverse-soft);
  font-size: var(--fs-base);
  max-width: 520px;
}

/* ── WORD CLOCK DISPLAY ── */
.clock-display { background: var(--teal); padding: 2.8rem 0; }
.clock-display-inner {
  display: flex; gap: 2.5rem;
  align-items: center; justify-content: center; flex-wrap: wrap;
}
.word-grid {
  font-family: var(--mono);
  font-weight: 400;
  font-size: clamp(0.6rem, 1.7vw, 0.85rem);
  color: var(--text-inverse-dim);
  -webkit-user-select: none; user-select: none;
  flex-shrink: 0;
}
.word-grid .row { display: grid; grid-template-columns: repeat(11, 1.9em); }
.word-grid .row span {
  display: flex; align-items: center; justify-content: center;
  width: 1.9em; height: 1.9em;
  transition: color .4s, text-shadow .4s;
}
.word-grid .row-dots {
  display: flex; justify-content: center; gap: 1.5em;
  height: 1.9em; align-items: center; margin-top: 0.3em;
}
.word-grid .lit {
  color: var(--white);
  text-shadow: 0 0 12px rgba(255,255,255,.5);
}
.clock-caption {
  color: var(--text-inverse-mid);
  font-size: var(--fs-base);
  max-width: 300px;
}
.clock-caption strong {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  color: var(--white);
  font-size: var(--fs-xl);
  margin-bottom: 0.35rem;
}

/* ── NAV ── */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
nav ul {
  max-width: var(--container-max);
  margin: 0 auto; display: flex; list-style: none;
  overflow-x: auto; padding: 0 2rem;
  -ms-overflow-style: none; scrollbar-width: none;
}
nav ul::-webkit-scrollbar { display: none; }
nav a {
  display: block; padding: 0.85rem 1rem;
  text-decoration: none; color: var(--text-muted);
  font-size: var(--fs-ui); font-weight: 500; letter-spacing: 0.02em;
  white-space: nowrap; border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
nav a:hover { color: var(--teal); border-bottom-color: var(--teal); }

/* ── LAYOUT ── */
main { padding-top: 3.5rem; padding-bottom: 6rem; }
section { margin-bottom: 4.5rem; scroll-margin-top: 52px; }

/* ── SECTION HEADERS ── */
.section-label {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--teal); margin-bottom: 0.45rem;
}
h2 {
  font-size: var(--fs-2xl);
  font-weight: 600; letter-spacing: -0.025em;
  margin-bottom: 1.2rem; color: var(--text);
  border-bottom: 2px solid var(--teal-pale); padding-bottom: 0.6rem;
}
h3 {
  font-size: var(--fs-lg);
  font-weight: 600; margin: 1.6rem 0 0.6rem; color: var(--teal-dark);
}
p { margin-bottom: 0.85rem; color: var(--text-soft); }

/* ── INTRO CHIPS ── */
.feature-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 1.5rem; }
.chip {
  background: var(--teal-pale);
  border: 1px solid var(--teal-border-soft);
  color: var(--teal-dark);
  padding: 0.32rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: var(--fs-ui); font-weight: 500;
}

/* ── STEPS ── */
.steps { margin: 1.2rem 0; }
.steps--mt { margin-top: 1rem; }
.step { display: flex; gap: 1rem; margin-bottom: 1.2rem; align-items: flex-start; }
.step-num {
  flex-shrink: 0; width: 28px; height: 28px;
  background: var(--teal); color: var(--white);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: var(--fs-ui); font-weight: 400; margin-top: 2px;
}
.step-body { flex: 1; }
.step-body > strong { display: block; margin-bottom: 0.2rem; color: var(--text); }
.step-body p { margin: 0; font-size: var(--fs-base); }

code {
  font-family: var(--mono);
  background: var(--teal-pale); color: var(--teal-dark);
  padding: 0.1em 0.45em; border-radius: var(--radius-sm); font-size: var(--fs-body);
}

/* ── BUTTONS SECTION ── */
.buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.2rem; margin: 1.5rem 0;
}
.btn-card, .webui-block, .settings-table, .spec-item, .trouble-item {
  background: var(--surface);
  border: 1px solid var(--border);
}
.btn-card { border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-sm); }
.btn-card-header { padding: 0.9rem 1.2rem; display: flex; align-items: center; gap: 0.8rem; }
.btn-card-header--blue   { background: var(--btn-blue-bg); }
.btn-card-header--yellow { background: var(--btn-yellow-bg); }
.btn-card-header--white  { background: var(--btn-white-bg); }
.btn-card-header--green  { background: var(--btn-green-bg); }
.btn-dot {
  width: 18px; height: 18px; border-radius: 50%;
  flex-shrink: 0; box-shadow: 0 0 0 3px var(--dot-shadow);
}
.btn-dot--blue   { background: var(--btn-blue); }
.btn-dot--yellow { background: var(--btn-yellow); }
.btn-dot--white  { background: var(--white); border: 1px solid var(--border); }
.btn-dot--green  { background: var(--btn-green); }
.btn-card-header h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.btn-card table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.btn-card td { padding: 0.55rem 1.2rem; border-top: 1px solid var(--border); vertical-align: top; }
.btn-card td:first-child {
  width: 110px; font-weight: 500; color: var(--text-muted); white-space: nowrap;
}
.press-type {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-family: var(--mono); font-size: var(--fs-sm);
  padding: 0.15rem 0.5rem; border-radius: var(--radius-sm); margin-bottom: 0.2rem;
}
.press-short { background: var(--press-short-bg); color: var(--press-short-text); }
.press-long  { background: var(--press-long-bg);  color: var(--press-long-text); }
.press-hold  { background: var(--press-hold-bg);  color: var(--warn); }

/* ── NOTE / WARNING ── */
.note, .warning {
  padding: 0.85rem 1.1rem;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  margin: 1rem 0; font-size: var(--fs-body);
}
.note { background: var(--note-bg); border-left: 3px solid var(--teal); color: var(--text-soft); }
.warning { background: var(--warn-bg); border-left: 3px solid var(--warn); color: var(--warn-text); }
.warning strong { color: var(--warn); }

/* ── WEB INTERFACE ── */
.webui-block {
  border-radius: var(--radius-xl); padding: 1.6rem;
  display: flex; gap: 2rem; align-items: flex-start; flex-wrap: wrap; margin: 1.2rem 0;
}
.webui-content { flex: 1; min-width: 200px; }
.webui-content h3 { margin-top: 0; }
.webui-url {
  font-family: var(--mono);
  background: var(--teal-pale); color: var(--teal-dark);
  padding: 0.5rem 0.8rem; border-radius: var(--radius-md);
  font-size: var(--fs-base); margin: 0.5rem 0 0.8rem; display: inline-block;
}
.webui-note { font-size: var(--fs-body); color: var(--text-muted); }
.webui-features {
  font-size: var(--fs-body); color: var(--text-soft);
  padding-left: 1.2rem; margin-top: 0.4rem;
}

/* ── SETTINGS TABLE ── */
.settings-table {
  width: 100%; border-collapse: collapse; margin: 1rem 0;
  font-size: var(--fs-body); border-radius: var(--radius-xl);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.settings-table--mb { margin-bottom: 1.5rem; }
.settings-table th {
  background: var(--teal-dark); color: var(--white);
  padding: 0.75rem 1rem; text-align: left;
  font-size: var(--fs-ui); font-weight: 500; letter-spacing: 0.04em;
}
.settings-table td { padding: 0.65rem 1rem; border-top: 1px solid var(--border); vertical-align: top; }
.settings-table tr:nth-child(even) td { background: var(--surface-muted); }

/* ── SPECS ── */
.specs-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem; margin: 1rem 0;
}
.spec-item { border-radius: var(--radius-lg); padding: 0.85rem 1rem; }
.spec-item .spec-label {
  font-size: var(--fs-sm); font-family: var(--mono);
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.1em; margin-bottom: 0.25rem;
}
.spec-item .spec-val { font-size: var(--fs-base); font-weight: 500; color: var(--teal-dark); }

/* ── TROUBLESHOOTING ── */
.trouble-item { border-radius: var(--radius-xl); margin-bottom: 1rem; overflow: hidden; }
.trouble-header { padding: 1rem 1.2rem; display: flex; gap: 0.8rem; align-items: flex-start; }
.trouble-icon { font-size: var(--fs-xl); flex-shrink: 0; margin-top: 2px; }
.trouble-header strong { font-size: var(--fs-md); display: block; }
.trouble-header span { font-size: var(--fs-ui); color: var(--text-muted); }
.trouble-body { padding: 0 1.2rem 1rem 3rem; }
.trouble-body ol { margin: 0; padding-left: 1.2rem; font-size: var(--fs-body); color: var(--text-soft); }
.trouble-body li { margin-bottom: 0.3rem; }

/* ── UTILITY ── */
.list-spaced { padding-left: 1.5rem; margin: 0.5rem 0 1rem; line-height: 2; }

/* ── SUPPORT ── */
.h3--mt-lg { margin-top: 2rem; }
.support-link { color: var(--teal); }

/* ── FOOTER ── */
footer {
  background: var(--teal-deeper);
  color: var(--text-inverse-soft);
  text-align: center; padding: 2.2rem;
  font-family: var(--mono); font-size: var(--fs-ui); letter-spacing: 0.08em;
}
footer p { color: var(--text-inverse-soft); margin: 0; }

@media (max-width: 600px) {
  .clock-display-inner { flex-direction: column; }
  .webui-block { flex-direction: column; }
  .buttons-grid { grid-template-columns: 1fr; }
  main { padding: 2rem 1rem 4rem; }
}
