/* ==========================================================
   SPAZIO — HOME RETRO
   Stile anni '90 / pixel / quasi monocromatico
   ========================================================== */

:root {
  --bg: #2d3135;
  --bg-2: #3a3f44;
  --panel: #d1d1d1;
  --panel-light: #ededed;
  --panel-dark: #90959a;
  --ink: #111317;
  --ink-soft: #33383e;
  --line: #0f1114;
  --white: #f7f7f4;

  /* Colore solo per piccoli dettagli e icone */
  --pink: #ff4f8a;
  --cyan: #26d6d6;
  --yellow: #ffd45d;
  --green: #34d16c;
  --blue: #4d7cff;
  --purple: #7d64ff;

  --shadow: 4px 4px 0 rgba(0, 0, 0, 0.78);
  --radius: 0px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(255,255,255,.07), transparent 32rem),
    linear-gradient(180deg, #3e444a 0, #2b2f33 45%, #23272b 100%);
  font-family: "Courier New", "Lucida Console", monospace;
  font-weight: 700;
  letter-spacing: -0.02em;
  image-rendering: pixelated;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: .16;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(0, 0, 0, 0) 0,
      rgba(0, 0, 0, 0) 3px,
      rgba(0, 0, 0, .33) 4px
    );
  mix-blend-mode: multiply;
}

.page-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9997;
  opacity: .07;
  background-image:
    repeating-radial-gradient(circle at 0 0, #000 0 1px, transparent 1px 3px);
  background-size: 5px 5px;
}

/* =========================
   TOP BAR
   ========================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: 48px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: stretch;
  border: 2px solid #111;
  border-top: 0;
  background: #d8d8d8;
  box-shadow: 0 3px 0 rgba(0,0,0,.72);
}

.brand,
.main-nav a,
.topbar-status {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  padding: 0 22px;
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(1.05rem, 1.8vw, 1.55rem);
  border-right: 2px solid #888;
}

.brand-mark {
  color: var(--yellow);
  -webkit-text-stroke: 1.2px #111;
}

.main-nav {
  display: flex;
  min-width: 0;
}

.main-nav a {
  padding: 0 20px;
  color: #17191c;
  text-decoration: none;
  border-right: 1px solid transparent;
  border-left: 1px solid transparent;
  white-space: nowrap;
}

.main-nav a:hover,
.main-nav a:focus-visible,
.main-nav a.active {
  background: #b6b8bd;
  border-color: #888b90;
  outline: none;
}

.topbar-status {
  gap: 15px;
  padding: 0 14px;
  white-space: nowrap;
  font-size: .95rem;
}

.sound-button {
  border: 0;
  background: transparent;
  padding: 8px 5px;
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.sound-button:hover,
.sound-button:focus-visible {
  background: #b5b5b5;
  outline: 2px solid #111;
  outline-offset: -2px;
}

/* =========================
   LAYOUT
   ========================= */

.site-shell {
  width: min(1500px, calc(100% - 44px));
  margin: 30px auto 16px;
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(330px, .82fr);
  gap: 20px;
  align-items: stretch;
}

.main-column,
.sidebar {
  min-width: 0;
}

/*
 * La colonna sinistra si estende sempre fino all'altezza della sidebar.
 * Chi sono + Novità restano in fondo; tutto lo spazio aggiuntivo viene
 * assorbito dalla finestra BENVENUTO.
 */
.main-column {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 18px;
  align-self: stretch;
}

.sidebar {
  display: grid;
  gap: 18px;
  align-content: start;
}

.lower-grid {
  margin-top: 0;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 18px;
}

/* =========================
   FINESTRA RETRO
   ========================= */

.retro-window {
  min-width: 0;
  overflow: hidden;
  border: 3px solid var(--line);
  background: var(--panel);
  box-shadow:
    inset 2px 2px 0 var(--white),
    inset -2px -2px 0 #6d7175,
    var(--shadow);
}

.window-titlebar {
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-bottom: 2px solid #111;
  background:
    repeating-linear-gradient(
      180deg,
      #dadada 0 2px,
      #b7b7b7 2px 4px
    );
}

.window-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .96rem;
  white-space: nowrap;
  overflow: hidden;
}

.window-title > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-icon {
  flex: 0 0 auto;
  font-size: 1.05rem;
  color: var(--yellow);
  -webkit-text-stroke: .6px #111;
}

.window-controls {
  flex: 0 0 auto;
  display: flex;
  gap: 7px;
}

.control {
  width: 12px;
  height: 12px;
  border: 2px solid #151515;
  border-radius: 50%;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.7);
}

.control-pink { background: var(--pink); }
.control-yellow { background: var(--yellow); }
.control-cyan { background: var(--cyan); }

.icon-heart { color: var(--pink); }
.icon-star { color: var(--yellow); }
.icon-folder { color: var(--yellow); }
.icon-document { color: var(--cyan); }
.icon-globe { color: var(--blue); }
.icon-music { color: var(--purple); }

/* =========================
   HERO
   ========================= */

/*
 * La finestra hero è l'elemento elastico della colonna sinistra.
 * Quando la sidebar diventa più lunga, cresce questa finestra e non
 * viene creato spazio vuoto sotto Chi sono / Novità.
 */
.hero-window {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hero-window .window-titlebar {
  flex: 0 0 auto;
}

.hero-scene {
  position: relative;
  flex: 1 1 auto;
  min-height: 515px;
  overflow: hidden;
  isolation: isolate;
  color: #f7f7f4;
  background: #13171c;
}

.pixel-sky {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, #15191e 0%, #252a30 38%, #6b7075 70%, #c4c4c1 100%);
}

.pixel-sky::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .25;
  background:
    repeating-linear-gradient(90deg, transparent 0 5px, rgba(255,255,255,.12) 5px 6px),
    repeating-linear-gradient(0deg, transparent 0 5px, rgba(0,0,0,.26) 5px 6px);
  mix-blend-mode: overlay;
}

.moon {
  position: absolute;
  width: 58px;
  height: 58px;
  top: 19%;
  right: 9%;
  border-radius: 50%;
  background: #ebebe7;
  box-shadow: -16px 0 0 #15191e inset;
}

.star {
  position: absolute;
  color: #fff;
  font-weight: 400;
}

.star-1 { left: 30%; top: 15%; font-size: 1.7rem; }
.star-2 { left: 54%; top: 22%; }
.star-3 { left: 74%; top: 11%; font-size: 1.35rem; }
.star-4 { left: 89%; top: 29%; }

.mountains {
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: 26%;
  height: 30%;
  clip-path: polygon(
    0 82%, 8% 55%, 14% 73%, 23% 31%, 32% 69%,
    42% 41%, 51% 74%, 61% 31%, 68% 65%, 77% 39%,
    88% 72%, 100% 32%, 100% 100%, 0 100%
  );
}

.mountains-back {
  background: #70757a;
  opacity: .85;
}

.mountains-front {
  bottom: 18%;
  height: 31%;
  transform: scaleX(1.12);
  background: #3e4449;
  clip-path: polygon(
    0 87%, 13% 45%, 25% 77%, 37% 33%, 49% 72%,
    60% 49%, 71% 81%, 84% 39%, 100% 78%, 100% 100%, 0 100%
  );
}

.city {
  position: absolute;
  left: 39%;
  right: 0;
  bottom: 12%;
  height: 32%;
  border-bottom: 8px solid #111519;
}

.city span {
  position: absolute;
  left: var(--x);
  bottom: 0;
  width: var(--w);
  height: var(--h);
  min-height: 46px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 7px,
      rgba(255,255,255,.75) 7px 9px,
      transparent 9px 14px
    ),
    repeating-linear-gradient(
      0deg,
      #171b20 0 9px,
      #2c3136 9px 13px
    );
  border: 2px solid #0e1115;
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: min(620px, 68%);
  padding: 86px 0 0 10%;
  text-shadow: 3px 3px 0 rgba(0,0,0,.5);
}

.eyebrow {
  display: inline-block;
  margin: 0 0 15px;
  padding: 4px 7px;
  color: #111;
  background: #dedede;
  border: 2px solid #111;
  text-shadow: none;
  font-size: .76rem;
  letter-spacing: .08em;
}

.hero-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(2.6rem, 6vw, 5.35rem);
  line-height: .98;
  letter-spacing: .08em;
}

.hero-copy p {
  max-width: 560px;
  margin: 0 0 26px;
  font-size: clamp(.95rem, 1.55vw, 1.3rem);
  line-height: 1.55;
  text-transform: uppercase;
}

.retro-button,
.small-retro-button,
.spotify-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #111;
  background: #d8d8d8;
  border: 3px solid #111;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #777,
    3px 3px 0 rgba(0,0,0,.7);
  text-decoration: none;
  text-shadow: none;
}

.retro-button {
  padding: 12px 18px;
  font-size: 1rem;
}

.retro-button:hover,
.small-retro-button:hover,
.spotify-button:hover,
.retro-button:focus-visible,
.small-retro-button:focus-visible,
.spotify-button:focus-visible {
  color: #fff;
  background: #33383d;
  outline: none;
}

.hero-computer {
  position: absolute;
  z-index: 2;
  left: 4.5%;
  bottom: 5%;
  width: 235px;
  height: 170px;
  filter: grayscale(1);
  transform: rotate(-2deg);
}

.computer-screen {
  width: 130px;
  height: 112px;
  margin-left: 28px;
  display: grid;
  place-items: center;
  color: #f1f1ef;
  background: #1a1f23;
  border: 14px solid #bababa;
  outline: 3px solid #111;
  box-shadow:
    inset 0 0 0 4px #52575b,
    6px 6px 0 rgba(0,0,0,.32);
}

.computer-screen span {
  transform: translateY(-2px);
  font-size: 1.7rem;
}

.computer-base {
  width: 160px;
  height: 34px;
  margin: -1px 0 0 12px;
  background: #aaa;
  border: 3px solid #111;
  clip-path: polygon(12% 0, 90% 0, 100% 100%, 0 100%);
}

.keyboard {
  width: 190px;
  height: 32px;
  margin: 4px 0 0 28px;
  border: 3px solid #111;
  background:
    repeating-linear-gradient(90deg, #bbb 0 10px, #666 10px 11px);
  transform: skewX(-20deg);
}

/* =========================
   ABOUT + NEWS
   ========================= */

.about-content {
  display: grid;
  grid-template-columns: 42% 1fr;
  gap: 16px;
  padding: 14px;
  align-items: stretch;
}

.about-content p {
  margin: 2px 0 16px;
  font-size: .84rem;
  line-height: 1.45;
}

.mini-landscape,
.album-art {
  position: relative;
  overflow: hidden;
  min-height: 170px;
  border: 3px solid #111;
  background:
    linear-gradient(180deg, #282d32 0 45%, #74787b 45% 63%, #1c2024 63%);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.38);
}

.mini-landscape::after,
.album-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0 4px,
      rgba(0,0,0,.18) 4px 5px
    );
}

.mini-moon {
  position: absolute;
  width: 25px;
  height: 25px;
  top: 18%;
  right: 18%;
  border-radius: 50%;
  background: #ecece9;
  box-shadow: -8px 0 0 #282d32 inset;
}

.mini-city {
  position: absolute;
  left: 13%;
  right: 10%;
  bottom: 18%;
  height: 34%;
  background:
    repeating-linear-gradient(90deg, #161a1e 0 16px, #30353a 16px 20px);
  clip-path: polygon(
    0 100%, 0 50%, 10% 50%, 10% 20%, 18% 20%, 18% 65%, 27% 65%,
    27% 36%, 39% 36%, 39% 55%, 51% 55%, 51% 10%, 60% 10%,
    60% 49%, 70% 49%, 70% 30%, 80% 30%, 80% 62%, 90% 62%,
    90% 40%, 100% 40%, 100% 100%
  );
}

.small-retro-button {
  padding: 8px 12px;
  font-size: .82rem;
}

.news-list > a,
.menu-list > a {
  color: var(--ink);
  text-decoration: none;
}

.news-list > a {
  display: grid;
  grid-template-columns: 70px minmax(0,1fr) 18px;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 12px;
  border-bottom: 1px solid #8c8f92;
}

.news-list > a:last-child {
  border-bottom: 0;
}

.news-list a:hover,
.news-list a:focus-visible,
.menu-list a:hover,
.menu-list a:focus-visible {
  background: #b5b8bb;
  outline: none;
}

.news-list span,
.menu-list a > span:nth-child(2) {
  min-width: 0;
}

.news-list strong,
.news-list small,
.menu-list strong,
.menu-list small {
  display: block;
}

.news-list strong,
.menu-list strong {
  margin-bottom: 2px;
  font-size: .88rem;
}

.news-list small,
.menu-list small {
  color: var(--ink-soft);
  font-size: .74rem;
  font-weight: 700;
  line-height: 1.22;
}

/* =========================
   LISTE SIDEBAR
   ========================= */

.menu-list {
  padding: 6px 0;
}

.menu-list > a {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) 18px;
  gap: 9px;
  align-items: center;
  min-height: 63px;
  padding: 7px 12px;
}

.menu-icon {
  width: 37px;
  min-height: 37px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  color: #111;
  border: 2px solid #111;
  background: #f0f0ee;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #838383;
  text-align: center;
}

.menu-list b,
.news-list b {
  font-size: 1.8rem;
  line-height: 1;
}

.icon-agri { color: var(--green); }
.icon-map { color: var(--purple); }
.icon-code { color: var(--cyan); font-size: .82rem; }
.icon-tools { color: var(--yellow); }
.icon-monitor { color: var(--blue); }
.icon-check { color: var(--yellow); }
.icon-bulb { color: var(--yellow); }
.icon-wrench { color: var(--cyan); }
.icon-spotify { color: var(--green); }
.icon-discord { color: var(--purple); }
.icon-github { color: #171717; }
.icon-chatgpt { color: var(--green); }
.icon-linkedin { color: var(--blue); font-size: 1rem; }

/* =========================
   PLAYER
   ========================= */

.music-player {
  width: min(1500px, calc(100% - 44px));
  margin: 18px auto 16px;
}

.player-content {
  display: grid;
  grid-template-columns: 90px minmax(150px,.7fr) 50px 190px minmax(240px,1.2fr) auto;
  gap: 18px;
  align-items: center;
  padding: 12px 16px 14px;
}

.album-art {
  min-height: 72px;
  height: 72px;
  background:
    linear-gradient(180deg, #33383e 0 52%, #85898d 52% 68%, #171b1f 68%);
}

.album-art span {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 13%;
  height: 26%;
  background: #171b1f;
}

.track-info strong,
.track-info small {
  display: block;
}

.track-info strong {
  margin-bottom: 4px;
}

.track-info small {
  color: #3e4348;
}

.player-icon-button,
.player-controls button {
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.player-icon-button {
  font-size: 1.7rem;
}

.player-icon-button:hover,
.player-controls button:hover,
.player-icon-button:focus-visible,
.player-controls button:focus-visible {
  background: #aaaeb1;
  outline: 2px solid #111;
}

.player-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.player-controls button {
  width: 44px;
  height: 42px;
  font-size: 1.2rem;
}

.progress-block {
  min-width: 0;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: .78rem;
}

.fake-progress {
  height: 10px;
  border: 2px solid #111;
  background: #b8b9b9;
}

.fake-progress span {
  display: block;
  width: 34%;
  height: 100%;
  background: #343a40;
}

.spotify-button {
  padding: 10px 13px;
  white-space: nowrap;
  font-size: .78rem;
}

/* =========================
   FOOTER + TOAST
   ========================= */

.site-footer {
  width: min(1500px, calc(100% - 44px));
  margin: 0 auto 30px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 5px 0;
  color: #d5d6d6;
  font-size: .76rem;
}

.status-led {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-led i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  border: 1px solid #101010;
  box-shadow: 0 0 8px rgba(52,209,108,.65);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10000;
  transform: translate(-50%, 25px);
  padding: 11px 14px;
  color: #111;
  background: #e5e5e2;
  border: 3px solid #111;
  box-shadow: 4px 4px 0 rgba(0,0,0,.75);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s linear, transform .15s linear;
  font-size: .8rem;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: auto 1fr;
  }

  .topbar-status {
    grid-column: 1 / -1;
    min-height: 34px;
    justify-content: flex-end;
    border-top: 1px solid #8d8d8d;
  }

  .site-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-columns: repeat(3, minmax(0,1fr));
  }

  .player-content {
    grid-template-columns: 80px 1fr auto;
  }

  .player-controls,
  .progress-block,
  .spotify-button {
    grid-column: span 1;
  }
}

@media (max-width: 850px) {
  .topbar {
    position: static;
    display: block;
  }

  .brand {
    min-height: 48px;
    border-right: 0;
    border-bottom: 1px solid #8b8b8b;
  }

  .main-nav {
    overflow-x: auto;
    border-bottom: 1px solid #8b8b8b;
  }

  .main-nav a {
    min-height: 42px;
    padding: 0 14px;
  }

  .topbar-status {
    min-height: 38px;
  }

  .site-shell,
  .music-player,
  .site-footer {
    width: min(100% - 24px, 1500px);
  }

  .hero-scene {
    min-height: 500px;
  }

  .hero-copy {
    width: 86%;
    padding: 60px 0 0 7%;
  }

  .hero-computer {
    transform: scale(.82) rotate(-2deg);
    transform-origin: left bottom;
  }

  .lower-grid,
  .sidebar {
    grid-template-columns: 1fr;
  }

  .about-content {
    grid-template-columns: 180px 1fr;
  }

  .player-content {
    grid-template-columns: 70px 1fr auto;
    gap: 12px;
  }

  .player-controls,
  .progress-block,
  .spotify-button {
    grid-column: 1 / -1;
  }

  .player-controls {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .topbar-status {
    gap: 9px;
    padding-inline: 9px;
    font-size: .78rem;
  }

  .site-shell,
  .music-player,
  .site-footer {
    width: min(100% - 14px, 1500px);
  }

  .window-titlebar {
    min-height: 34px;
  }

  .window-title {
    font-size: .77rem;
  }

  .control {
    width: 10px;
    height: 10px;
  }

  .hero-scene {
    min-height: 480px;
  }

  .hero-copy {
    width: 95%;
    padding: 48px 22px 0;
  }

  .hero-copy p {
    font-size: .9rem;
  }

  .hero-computer {
    left: 2%;
    bottom: 2%;
    transform: scale(.67) rotate(-2deg);
  }

  .about-content {
    grid-template-columns: 1fr;
  }

  .mini-landscape {
    min-height: 120px;
  }

  .menu-list > a {
    min-height: 58px;
  }

  .player-content {
    grid-template-columns: 62px minmax(0,1fr) 38px;
    padding-inline: 10px;
  }

  .album-art {
    height: 60px;
    min-height: 60px;
  }

  .site-footer {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}
