/*
 * chrome.css — la "finestra" Windows XP (Luna) attorno all'enciclopedia:
 * cornice e barra del titolo col pulsante Proietta, pulsanti (.tbtn),
 * barra comandi (.toolbar), schede delle sezioni (.menubar), griglia
 * indice/contenuto, campo di ricerca e indice laterale come riquadro
 * attività di Esplora risorse, barra di stato, avviso "Link copiato" (.toast).
 * --side è la larghezza dell'indice: la usano la griglia, le schede e il campo
 * di ricerca, che sta sopra l'indice all'altezza delle schede.
 */

/* finestra: cornice blu di 4px, angoli superiori arrotondati */
.win {
  --side: 252px;
  --tabs-h: 42px;
  position: relative;
  max-width: 1200px;
  margin: 18px auto;
  display: flex;
  flex-direction: column;
  height: calc(100% - 36px);
  min-height: 520px;
  padding: 0 4px 4px;
  background: var(--frame);
  border: 1px solid var(--frame-lo);
  border-radius: 9px 9px 2px 2px;
  box-shadow:
    inset 1px 0 var(--frame-hi),
    inset -1px 0 var(--frame-lo),
    inset 0 -1px var(--frame-lo),
    0 14px 40px rgba(0,10,50,.38),
    0 2px 6px rgba(0,10,50,.25);
}

.title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  margin: 0 -4px;
  padding: 0 6px 0 8px;
  border-radius: 8px 8px 0 0;
  background: var(--title-bg);
  box-shadow: inset 0 1px rgba(255,255,255,.28),inset 1px 0 rgba(255,255,255,.12);
  color: #fff;
  font-family: var(--cap-font);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
  text-shadow: 1px 1px var(--title-sh);
}

/* icona: il globo di Encarta */
.title .glyph {
  flex: none;
  width: 18px;
  height: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cdefs%3E%3CradialGradient id='a' cx='.36' cy='.3' r='.8'%3E%3Cstop offset='0' stop-color='%23d4efff'/%3E%3Cstop offset='.5' stop-color='%232f8be8'/%3E%3Cstop offset='1' stop-color='%230a3d9c'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='9' cy='9' r='8.2' fill='url(%23a)' stroke='%2306256b' stroke-width='.9'/%3E%3Cpath d='M4.6 5c1.5-.5 2.7.3 2.9 1.5.2 1.1-1 1.6-.8 2.8.2 1.3 1.8 1.6 1.6 3.1-.1 1-1 1.9-1.9 2.4C4.1 13.9 2.6 11.6 2.6 9c0-1.6.7-3 2-4zM10.7 2.7c1.8.3 3.4 1.5 4.2 3-1 .5-2.1.1-2.8.9-.7.8.2 2-.7 2.6-.8.4-1.8-.4-2.1-1.3-.4-1.1.1-2.4 1-2.9.6-.4.4-1.5.4-2.3z' fill='%2357c447' stroke='%231f6e1a' stroke-width='.45'/%3E%3Cellipse cx='7' cy='4.8' rx='3.8' ry='2' fill='%23fff' opacity='.4'/%3E%3C/svg%3E") center/18px no-repeat;
  filter: drop-shadow(1px 1px 0 rgba(0,0,40,.35));
}

.title span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title small {
  font-size: 12.5px;
  font-weight: 400;
  opacity: .88;
}

/* pulsante XP standard */
.tbtn {
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  color: var(--btn-ink);
  min-height: 32px;
  padding: 4px 14px;
  cursor: pointer;
  border: 1px solid var(--btn-edge);
  border-radius: 3px;
  background: var(--btn);
  transition: box-shadow .12s,background-color .12s,border-color .12s;
}

.tbtn:hover {
  box-shadow: inset -1px 1px #fff0cf,inset 1px 2px #fdd889,inset -2px 2px #fbc761,inset 2px -2px #e5a01a;
}

.tbtn:active {
  background: var(--btn-down);
  box-shadow: inset 1px 1px 2px rgba(0,0,0,.18);
}

.tbtn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: inset -1px 1px #cee7ff,inset 1px 2px #98b8ea,inset -2px 2px #bcd4f6,inset 1px -1px #89ade4,inset 2px -2px #89ade4;
}

/* Proietta: pulsante della barra del titolo (blu, bordo bianco) */
.title .tbtn {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 0;
  height: 23px;
  padding: 0 10px 0 7px;
  border: 1px solid var(--cap-edge);
  border-radius: 3px;
  background: var(--cap);
  color: #fff;
  font-family: var(--cap-font);
  font-size: 12.5px;
  font-weight: 700;
  text-shadow: 0 1px 1px rgba(0,0,40,.55);
  box-shadow: inset 0 -1px 2px 1px rgba(40,60,200,.35);
}

.title .tbtn::before {
  content: "";
  width: 11px;
  height: 11px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 11'%3E%3Cpath d='M2 1.2v8.6l7.6-4.3z' fill='%23fff'/%3E%3C/svg%3E") center/contain no-repeat;
  filter: drop-shadow(0 1px 0 rgba(0,0,40,.5));
}

/* lingua: stesso pulsante, con un globo al posto del triangolo */
.title #langBtn { margin-right: 6px; }
.title #langBtn::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11 11' fill='none' stroke='%23fff' stroke-width='1.1'%3E%3Ccircle cx='5.5' cy='5.5' r='4.6'/%3E%3Cellipse cx='5.5' cy='5.5' rx='2' ry='4.6'/%3E%3Cpath d='M1 5.5h9'/%3E%3C/svg%3E");
}

/* area di clic di almeno 32px senza ingrossare il pulsante */
.title .tbtn::after {
  content: "";
  position: absolute;
  inset: -5px -3px;
}

.title .tbtn:hover {
  filter: brightness(1.18);
  box-shadow: inset 0 -1px 2px 1px rgba(40,60,200,.35);
}

.title .tbtn:active {
  filter: brightness(.82);
  background: var(--cap);
  box-shadow: inset 1px 1px 2px rgba(0,0,40,.5);
}

.title .tbtn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
  box-shadow: inset 0 -1px 2px 1px rgba(40,60,200,.35);
}

/* barra comandi (Esplora risorse): pulsanti piatti, evidenziati al passaggio */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  padding: 3px 6px;
  background: var(--face-bar);
  border-bottom: 1px solid var(--face-lo);
  box-shadow: inset 0 1px var(--face-hi);
}

.toolbar .sp {
  flex: 1;
}

.toolbar .tbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 3px 11px 3px 5px;
  color: var(--ink);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.toolbar .tbtn:hover {
  border-color: var(--hot-edge);
  background: var(--hot-bg);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.45);
}

.toolbar .tbtn:active {
  border-color: var(--push-edge);
  background: var(--push-bg);
  box-shadow: inset 1px 1px 3px rgba(110,55,0,.3);
}

.toolbar .tbtn:focus-visible {
  outline-offset: 0;
  box-shadow: none;
}

.toolbar .tbtn::before {
  content: "";
  flex: none;
  width: 24px;
  height: 24px;
  background: var(--ico) center/contain no-repeat;
}

.toolbar .tbtn:active::before {
  transform: translate(1px,1px);
}

#back {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cdefs%3E%3CradialGradient id='g' cx='.4' cy='.3' r='.78'%3E%3Cstop offset='0' stop-color='%23dcfbd2'/%3E%3Cstop offset='.45' stop-color='%235cc94a'/%3E%3Cstop offset='1' stop-color='%231d7a17'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='12' cy='12' r='10.8' fill='url(%23g)' stroke='%2317641a' stroke-width='1.2'/%3E%3Cpath d='M12.8 6.6 7.4 12l5.4 5.4M8 12h8.8' fill='none' stroke='%23fff' stroke-width='2.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cellipse cx='11' cy='6.6' rx='6.4' ry='3.4' fill='%23fff' opacity='.3'/%3E%3C/svg%3E");
}

#fwd {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cdefs%3E%3CradialGradient id='g' cx='.4' cy='.3' r='.78'%3E%3Cstop offset='0' stop-color='%23dcfbd2'/%3E%3Cstop offset='.45' stop-color='%235cc94a'/%3E%3Cstop offset='1' stop-color='%231d7a17'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='12' cy='12' r='10.8' fill='url(%23g)' stroke='%2317641a' stroke-width='1.2'/%3E%3Cpath d='M11.2 6.6 16.6 12l-5.4 5.4M16 12H7.2' fill='none' stroke='%23fff' stroke-width='2.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cellipse cx='11' cy='6.6' rx='6.4' ry='3.4' fill='%23fff' opacity='.3'/%3E%3C/svg%3E");
  position: relative;
  margin-right: 9px;
}

/* separatore verticale dopo Avanti */
#fwd::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--face-lo);
  box-shadow: 1px 0 var(--face-hi);
}

#idxBtn {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3.5' y='3.5' width='17' height='17' rx='2' fill='%23fff' stroke='%237f9db9'/%3E%3Cg fill='%23215dc6'%3E%3Crect x='6' y='7' width='2.5' height='2.5'/%3E%3Crect x='6' y='11' width='2.5' height='2.5'/%3E%3Crect x='6' y='15' width='2.5' height='2.5'/%3E%3C/g%3E%3Cg fill='%236d7684'%3E%3Crect x='10' y='7.5' width='8' height='1.5'/%3E%3Crect x='10' y='11.5' width='8' height='1.5'/%3E%3Crect x='10' y='15.5' width='6' height='1.5'/%3E%3C/g%3E%3C/svg%3E");
}

#copyBtn {
  --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke-linecap='round' stroke-width='2.6'%3E%3Cpath d='M10.3 13.7a3.6 3.6 0 0 0 5.1 0l3.4-3.4a3.6 3.6 0 0 0-5.1-5.1l-1.1 1.1' stroke='%23215dc6'/%3E%3Cpath d='M13.7 10.3a3.6 3.6 0 0 0-5.1 0l-3.4 3.4a3.6 3.6 0 0 0 5.1 5.1l1.1-1.1' stroke='%233a9a2e'/%3E%3C/g%3E%3C/svg%3E");
}

.idxbtn {
  display: none;
}

/* schede delle sezioni (controllo a schede di XP), allineate al contenuto */
.menubar {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: var(--tabs-h);
  margin-left: var(--side);
  padding: 0 10px 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  background: var(--face);
  box-shadow: inset 0 -1px var(--tab-edge);
}

.menubar::-webkit-scrollbar {
  display: none;
}

.menubar a {
  flex: none;
  display: flex;
  align-items: center;
  height: 32px;
  margin-bottom: 1px;
  padding: 0 14px;
  color: var(--tab-ink);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  border: 1px solid var(--tab-edge);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: var(--tab);
  transition: box-shadow .12s;
}

.menubar a:hover {
  border-top-color: var(--accent);
  box-shadow: inset 0 2px var(--accent-hi);
}

.menubar a[aria-current="page"] {
  height: 36px;
  margin-bottom: 0;
  padding-bottom: 3px;
  color: var(--head);
  background: var(--paper);
  border-top-color: var(--accent);
  box-shadow: inset 0 2px var(--accent-hi);
}

.menubar a:focus-visible {
  outline-offset: -5px;
}

.body {
  position: relative;
  display: grid;
  grid-template-columns: var(--side) minmax(0,1fr);
  grid-template-rows: minmax(0,1fr);
  flex: 1;
  min-height: 0;
  background: var(--paper);
}

/* il riquadro attività sale fino alla riga delle schede */
.body::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 100%;
  width: var(--side);
  height: var(--tabs-h);
  background: var(--pane-top);
  box-shadow: inset 0 1px rgba(255,255,255,.18);
}

.pane {
  background: var(--paper);
}

/* indice laterale: riquadro attività di Esplora risorse */
.index {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px 10px 14px;
  background: var(--pane);
}

/* campo di ricerca XP, nella riga delle schede sopra l'indice */
.index input {
  position: absolute;
  left: 10px;
  bottom: 100%;
  width: calc(var(--side) - 20px);
  height: 30px;
  margin: 0 0 6px;
  padding: 3px 30px 3px 8px;
  font: inherit;
  font-size: 13px;
  -webkit-appearance: none;
  appearance: none;
  color: var(--ink);
  background: var(--field) var(--mag) right 8px center/16px no-repeat;
  border: 1px solid var(--field-edge);
  border-radius: 2px;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,.08);
  transition: border-color .12s,box-shadow .12s;
}

.index input::-webkit-search-cancel-button {
  cursor: pointer;
}

.index input:not(:placeholder-shown) {
  background-image: none;
  padding-right: 8px;
}

.index input::placeholder {
  color: var(--ph);
  opacity: 1;
}

.index input:hover {
  border-color: var(--sel);
}

.index input:focus {
  outline: none;
  border-color: var(--sel);
  box-shadow: inset 1px 1px 2px rgba(0,0,0,.08),0 0 0 2px var(--accent-hi);
}

.index ul {
  flex: 1;
  min-height: 0;
  list-style: none;
  margin: 0;
  padding: 0 0 2px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.55) transparent;
}

/* gruppi: intestazione chiara con il pulsante tondo, corpo azzurro */
.index .grp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 26px;
  margin: 14px 0 0;
  padding: 3px 5px 3px 11px;
  border-radius: 4px 4px 0 0;
  background: var(--grp-head);
  color: var(--grp-ink);
  font-size: 12.5px;
  font-weight: 700;
}

.index .grp::after {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Ccircle cx='9' cy='9' r='8' fill='%23fff' stroke='%23b4c4ea'/%3E%3Cpath d='M5.8 8.2 9 5.4l3.2 2.8M5.8 12 9 9.2l3.2 2.8' fill='none' stroke='%23215dc6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: .9;
}

.index .grp:first-child {
  margin-top: 0;
  color: #fff;
  background: var(--grp1-head);
  text-shadow: 0 1px 0 rgba(0,0,60,.35);
}

.index li:not(.grp) {
  margin-bottom: -1px;
  padding: 0 6px 1px;
  background: var(--grp-body);
  border: 1px solid var(--grp-edge);
  border-top: 0;
  border-bottom: 0;
}

.index .grp:first-child ~ li:not(.grp):not(.grp:not(:first-child) ~ li) {
  background: var(--grp1-body);
}

.index li.grp + li,
.index ul > li:first-child:not(.grp) {
  padding-top: 6px;
}

.index ul > li:first-child:not(.grp) {
  border-top: 1px solid var(--grp-edge);
  border-radius: 4px 4px 0 0;
}

.index li:not(.grp):has(+ .grp),
.index li:not(.grp):last-child {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--grp-edge);
}

.index li a {
  display: block;
  padding: 8px;
  color: var(--grp-link);
  text-decoration: none;
  font-size: 13px;
  line-height: 16px;
  border-radius: 3px;
  transition: background-color .1s;
  scroll-margin: 40px 0 12px;
}

.index li a:hover {
  text-decoration: underline;
  background: rgba(255,255,255,.6);
}

.index li a.on {
  color: var(--sel-ink);
  background: var(--sel);
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
}

.index li a:focus-visible {
  outline-offset: -2px;
}

.index li a .kind {
  color: inherit;
  border-color: currentColor;
  opacity: .8;
}

.content {
  overflow: auto;
  padding: 26px 36px 48px;
  min-width: 0;
}

/* fumetto di notifica di XP */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(40px + env(safe-area-inset-bottom,0px));
  transform: translateX(-50%);
  background: var(--tip);
  color: var(--tip-ink);
  border: 1px solid var(--tip-edge);
  border-radius: 8px;
  box-shadow: 2px 3px 8px rgba(0,0,0,.3);
  padding: 8px 14px;
  font-size: 13px;
  max-width: calc(100vw - 32px);
  overflow-wrap: anywhere;
  display: none;
  z-index: 60;
}

/* barra di stato con pannelli e maniglia di ridimensionamento */
.status {
  position: relative;
  display: flex;
  padding-right: 18px;
  background: var(--status);
  color: var(--status-ink);
  border-top: 1px solid var(--face-lo);
  box-shadow: inset 0 1px var(--face-hi);
  font-size: 12px;
}

.status div {
  flex: 1;
  min-width: 0;
  padding: 5px 10px;
  min-height: 25px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status div+div {
  flex: 0 1 auto;
  border-left: 1px solid var(--status-sep);
  box-shadow: inset 1px 0 var(--status-hi);
}

.status::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 12px;
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cg fill='%23fff'%3E%3Crect x='9' y='3' width='2' height='2'/%3E%3Crect x='6' y='6' width='2' height='2'/%3E%3Crect x='9' y='6' width='2' height='2'/%3E%3Crect x='3' y='9' width='2' height='2'/%3E%3Crect x='6' y='9' width='2' height='2'/%3E%3Crect x='9' y='9' width='2' height='2'/%3E%3C/g%3E%3Cg fill='%23a19d8a'%3E%3Crect x='8' y='2' width='2' height='2'/%3E%3Crect x='5' y='5' width='2' height='2'/%3E%3Crect x='8' y='5' width='2' height='2'/%3E%3Crect x='2' y='8' width='2' height='2'/%3E%3Crect x='5' y='8' width='2' height='2'/%3E%3Crect x='8' y='8' width='2' height='2'/%3E%3C/g%3E%3C/svg%3E") center/contain no-repeat;
  opacity: .9;
}
