/* ================================
   RESET
   ================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ================================
   VARIABILI SOXDEV
   ================================ */
:root {
  --sox-red: #bb3232;
  --sox-red-dark: #6e1414;

  --text-dark: #111;

  --angle: 6deg;
  --sidebar-w: 200px;
  --intro-logo-delay: 1.45s;
  --intro-secondary-delay: 1.3s;
  --intro-manual-delay: 0s;
  --intro-motto-transition-duration: 0.45s;
}

/* ================================
   BODY
   ================================ */
body {
  min-height: 100vh;
  font-family: "Exo 2", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #ffffff;
  color: var(--text-dark);

  display: flex;
  flex-direction: column;
  overflow-x: hidden;

  position: relative;
  isolation: isolate;
}

/* ================================
   SIDEBAR SINISTRA
   ================================ */
.sidebar--left {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: 5;

  background: linear-gradient(180deg, var(--sox-red), var(--sox-red-dark));
  clip-path: polygon(
    0 0,
    var(--sidebar-w) 0,
    calc(var(--sidebar-w) - 100vh * tan(var(--angle))) 100%,
    0 100%
  );

  display: flex;
  flex-direction: column;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
}

.sidebar-photo {
  flex-shrink: 0;
  width: 100%;
  height: 180px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  overflow: hidden;
}

.sidebar-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.65);
}

.sidebar-contacts {
  flex: 1;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-decoration: none;
  color: inherit;
}

a.contact-item {
  transition: opacity 0.2s ease;
}

a.contact-item:hover {
  opacity: 0.7;
}

.contact-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.contact-value {
  font-size: 0.72rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(var(--sidebar-w) - 28px);
}

/* ================================
   SIDEBAR DESTRA
   ================================ */
.sidebar--right {
  position: fixed;
  right: 0;
  top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: 5;

  background: linear-gradient(180deg, var(--sox-red), var(--sox-red-dark));
  clip-path: polygon(
    calc(100vh * tan(var(--angle))) 0,
    100% 0,
    100% 100%,
    0 100%
  );

  display: flex;
  align-items: flex-end;
  justify-content: center;
  -webkit-user-select: none;
  user-select: none;
}

.sidebar-motto {
  font-size: clamp(1rem, 2vw, 1.6rem);
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-align: center;

  background: linear-gradient(90deg, var(--sox-red), #000000);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;

  opacity: 0.96;
  margin-bottom: 20px;
  animation: fadeSlideUp 0.55s ease-out 0.35s both;
}

/* ================================
   SIDEBAR NAV
   ================================ */
.sidebar-nav {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
}

.nav-item {
  display: block;
  padding: 10px 14px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.55);
  border-left: 3px solid transparent;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-item--active {
  color: #fff;
  border-left-color: rgba(255, 255, 255, 0.85);
}

/* La voce "Blog" del menu parte nascosta: script.js le toglie questa classe
   solo se il server conferma che il blog è pubblico. Se il blog è privato
   (o se il JS non gira) il link resta invisibile. Fail-safe verso il privato. */
.nav-item--hidden {
  display: none !important;
}

/* ================================
   TOP NAV MOBILE
   ================================ */
.topnav {
  display: none;
}

/* ================================
   CONTENUTO CENTRALE
   ================================ */
.container {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 40px calc(var(--sidebar-w) + 24px);
  position: relative;
  z-index: 1;
}

.content {
  text-align: center;
  padding: 12px;
}

.intro-philosophy {
  display: grid;
  justify-items: center;
  gap: 22px;
}

.intro-code {
  width: min(100%, 540px);
  margin: 0;
  padding: 20px 24px;
  border-left: 3px solid rgba(187, 50, 50, 0.78);
  border-radius: 0 16px 16px 0;
  background:
    linear-gradient(180deg, rgba(17, 17, 17, 0.045), rgba(17, 17, 17, 0.02)),
    rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 60px rgba(17, 17, 17, 0.08);
  text-align: left;
  overflow-x: auto;
}

.intro-code-text {
  display: block;
  font-family: ui-monospace, SFMono-Regular, SFMono, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: clamp(0.95rem, 1.8vw, 1.08rem);
  line-height: 1.75;
  color: #1f1f1f;
  white-space: pre;
}

/* ================================
   LOGO
   ================================ */
.logo img {
  width: min(900px, 100%);
  height: auto;
  margin-bottom: 28px;
}

/* ================================
   ANIMAZIONI D'INGRESSO
   ================================ */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translate(32px, 22px);
  }
  to {
    opacity: 1;
    transform: translate(0, 0);
  }
}

.logo img {
  animation: fadeSlideUp 0.55s ease-out both;
}

.has-intro .logo img {
  animation-delay: var(--intro-logo-delay);
}

.has-intro .sidebar-motto {
  animation-delay: var(--intro-secondary-delay);
}

.has-intro .intro-motto {
  animation-delay: var(--intro-manual-delay);
}

.has-intro .coming-soon {
  animation-delay: var(--intro-secondary-delay);
}

/* ================================
   INTRO SIPARIO
   ================================ */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.intro-panel {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--sox-red), var(--sox-red-dark));
  animation-duration: 1s;
  animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
  animation-delay: 0.4s;
  animation-fill-mode: both;
}

.intro-panel--left {
  clip-path: polygon(0 0, 50% 0, calc(50% - 100vh * tan(var(--angle))) 100%, 0 100%);
  animation-name: sipario-left;
}

.intro-panel--right {
  clip-path: polygon(50% 0, 100% 0, 100% 100%, calc(50% - 100vh * tan(var(--angle))) 100%);
  animation-name: sipario-right;
}

@keyframes sipario-left {
  from { transform: translateX(0); }
  to   { transform: translateX(-110%); }
}

@keyframes sipario-right {
  from { transform: translateX(0); }
  to   { transform: translateX(110%); }
}

@keyframes sipario-close-left {
  from { transform: translateX(-110%); }
  to   { transform: translateX(0); }
}

@keyframes sipario-close-right {
  from { transform: translateX(110%); }
  to   { transform: translateX(0); }
}

.intro-overlay--exit .intro-panel {
  animation-delay: 0s;
}

.intro-overlay--exit .intro-panel--left {
  animation-name: sipario-close-left;
}

.intro-overlay--exit .intro-panel--right {
  animation-name: sipario-close-right;
}

@media (prefers-reduced-motion: reduce) {
  .intro-panel {
    display: none;
  }
}

/* ================================
   COMING SOON
   ================================ */
.coming-soon {
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;

  background: linear-gradient(90deg, var(--sox-red), #000000);
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;

  opacity: 0.96;
  animation: fadeSlideUp 0.55s ease-out 0.2s both;
}

@media (prefers-reduced-motion: reduce) {
  .logo img,
  .coming-soon {
    animation: none;
  }
}

/* ================================
   SEZIONI GENERALI
   ================================ */
.section {
  position: relative;
  z-index: 1;
  padding: clamp(60px, 8vw, 100px) calc(var(--sidebar-w) + clamp(24px, 3vw, 48px));
}

.section-inner {
  max-width: 900px;
  margin: 0 auto;
}

.section-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--sox-red);
  margin-bottom: 20px;
}

/* ================================
   TAGLINE
   ================================ */
.section--tagline {
  background: #111;
  color: #fff;
}

.tagline {
  font-size: clamp(2rem, 4.5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 24px;
  min-height: 1.1em;
}

.typing::after {
  content: '|';
  color: var(--sox-red);
  animation: blink-cursor 0.75s step-end infinite;
}

@keyframes blink-cursor {
  50% { opacity: 0; }
}

.tagline-sub {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  font-weight: 300;
  line-height: 1.75;
  max-width: 560px;
  color: rgba(255, 255, 255, 0.65);
}

.cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
  align-items: center;
}

.simdco-cta {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: #fff;
  background: var(--sox-red);
  border: 1.5px solid var(--sox-red);
  padding: 10px 22px;
  transform: skewX(calc(-1 * var(--angle)));
  transition: opacity 0.2s ease;
}

.simdco-cta span {
  display: inline-block;
  transform: skewX(var(--angle));
}

.simdco-cta:hover {
  opacity: 0.75;
}

.discord-link {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--sox-red);
  background: #fff;
  border: 1.5px solid var(--sox-red);
  padding: 10px 22px;
  transform: skewX(calc(-1 * var(--angle)));
  transition: opacity 0.2s ease;
}

.discord-link span {
  display: inline-block;
  transform: skewX(var(--angle));
}

.discord-link:hover {
  opacity: 0.75;
}

/* ================================
   CARDS
   ================================ */
.section--cards {
  background: #f4f4f4;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.card {
  background: #fff;
  border-left: 3px solid var(--sox-red);
  transform: skewX(-5deg);
  overflow: hidden;
}

/* Indice posizionale della card, usato per l'animazione scaglionata
   (vedi transition su .js .card). Ricavato dalla posizione con :nth-child
   invece che da uno style inline nell'HTML. */
.cards-grid .card:nth-child(1) { --i: 0; }
.cards-grid .card:nth-child(2) { --i: 1; }
.cards-grid .card:nth-child(3) { --i: 2; }

.card-inner {
  transform: skewX(5deg);
  padding: 32px 28px;
}

.card-num {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--sox-red);
  margin-bottom: 14px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-dark);
}

.card-text {
  font-size: 0.9rem;
  line-height: 1.65;
  color: #555;
}

/* ================================
   SEZIONE ABOUT (HOME)
   ================================ */
.section--about {
  background: #ffffff;
}

.about-text {
  font-size: clamp(0.95rem, 1.3vw, 1.1rem);
  font-weight: 400;
  line-height: 1.85;
  max-width: 640px;
  color: #444;
  margin-bottom: 28px;
}

.about-contact {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sox-red);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: opacity 0.2s ease;
}

.about-contact:hover {
  opacity: 0.65;
}

/* ================================
   PAGINE INTERNE
   ================================ */
.container.container--page {
  flex: none;
  padding-top: 50px;
  padding-bottom: 10px;
}

.logo--small img {
  width: min(360px, 70%);
  margin-bottom: 8px;
}

/* ================================
   LISTA PROGETTI
   ================================ */
.projects-list {
  margin-top: 32px;
}

.project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.project-item:first-child {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.project-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #aaa;
}

.project-item--active .project-status {
  color: var(--sox-red);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sox-red);
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}

.status-dot--standby {
  background: #ccc;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.project-name {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  font-weight: 600;
  color: var(--text-dark);
}

.project-item--active .project-name {
  color: var(--sox-red);
}

.project-brief {
  font-size: 0.85rem;
  color: #777;
  line-height: 1.5;
  max-width: 520px;
}

.project-link {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--sox-red);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: opacity 0.2s;
}

.project-link:hover {
  opacity: 0.6;
}

/* ================================
   SCROLL ANIMATIONS
   ================================ */
@media (prefers-reduced-motion: no-preference) {
  .js [data-animate] {
    opacity: 0;
    translate: 48px 32px;
    transition: opacity 0.65s ease-out, translate 0.65s ease-out;
  }

  .js [data-animate].visible {
    opacity: 1;
    translate: none;
  }

  .js .card {
    opacity: 0;
    translate: 36px 24px;
    transition:
      opacity 0.5s ease-out calc(var(--i, 0) * 0.13s),
      translate 0.5s ease-out calc(var(--i, 0) * 0.13s);
  }

  .js .section--cards.visible .card {
    opacity: 1;
    translate: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .js .intro-motto {
    opacity: 0;
    transform: translateY(16px);
    animation: none;
    transition:
      opacity var(--intro-motto-transition-duration) ease,
      transform var(--intro-motto-transition-duration) ease;
  }

  .js .intro-motto.intro-motto--visible {
    opacity: 0.96;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .intro-motto {
    opacity: 0.96;
    transform: none;
    transition: none;
    animation: none;
  }
}

/* ================================
   BLOG – LISTA ARTICOLI
   ================================ */
.blog-list {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.blog-post-item {
  padding: 28px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.blog-post-item:first-child {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.blog-post-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #aaa;
}

.blog-post-tags {
  color: var(--sox-red);
}

.blog-post-tags--hero {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 12px;
}

.blog-post-title {
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  font-weight: 600;
  color: var(--text-dark);
  margin: 0;
}

.blog-post-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.blog-post-title a:hover {
  color: var(--sox-red);
}

.blog-post-excerpt {
  font-size: 0.9rem;
  color: #777;
  line-height: 1.6;
  max-width: 600px;
  margin: 0;
}

/* ================================
   BLOG – SINGOLO ARTICOLO
   ================================ */
.section--post {
  background: #ffffff;
}

.post-content {
  max-width: 680px;
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
  line-height: 1.85;
  color: #333;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-weight: 700;
  line-height: 1.2;
  margin: 2em 0 0.6em;
  color: var(--text-dark);
}

.post-content h1 { font-size: clamp(1.6rem, 2.5vw, 2rem); }
.post-content h2 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
.post-content h3 { font-size: 1.15rem; }
.post-content h4 { font-size: 1rem; }

.post-content p  { margin: 0 0 1.2em; }

.post-content a {
  color: var(--sox-red);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-content strong { font-weight: 700; }
.post-content em     { font-style: italic; }

.post-content ul,
.post-content ol {
  padding-left: 1.5em;
  margin-bottom: 1.2em;
}

.post-content li { margin-bottom: 0.4em; }

.post-content blockquote {
  border-left: 3px solid var(--sox-red);
  margin: 1.5em 0;
  padding: 0.6em 0 0.6em 1.2em;
  color: #666;
  font-style: italic;
}

.post-content blockquote p { margin: 0; }

.post-content code {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.88em;
  background: #f4f4f4;
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.post-content pre {
  background: #111;
  color: #f4f4f4;
  padding: 20px 24px;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1.4em;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.88em;
  color: inherit;
  border-radius: 0;
}

.post-content hr {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  margin: 2em 0;
}

.post-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5em 0;
}

.post-back {
  display: inline-block;
  margin-top: 48px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sox-red);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: opacity 0.2s ease;
}

.post-back:hover { opacity: 0.65; }

/* ================================
   FOOTER
   ================================ */
.footer {
  background: #000000;
  padding: 18px 12px 24px;
  text-align: center;
  font-size: 1.05rem;
  color: #ffffff;
  z-index: 1;
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 768px) {
  :root {
    --topnav-h: 52px;
  }

  .sidebar--left,
  .sidebar--right {
    display: none;
  }

  .topnav {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--topnav-h);
    z-index: 10;
    overflow: hidden;
  }

  .topnav-inner {
    transform: skewX(-6deg);
    background: linear-gradient(180deg, var(--sox-red), var(--sox-red-dark));
    width: calc(100% + 14px);
    margin-left: -7px;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 16px;
  }

  .topnav .nav-item {
    transform: skewX(6deg);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 0 8px;
  }

  .topnav .nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
  }

  .topnav .nav-item--active {
    color: #fff;
    border-left: none;
    border-bottom-color: rgba(255, 255, 255, 0.85);
  }

  body {
    padding-top: var(--topnav-h);
  }

  .container {
    padding: 0 20px 40px;
  }

  .intro-code {
    width: min(100%, 460px);
    padding: 18px 18px 18px 20px;
  }

  .section {
    padding-left: clamp(40px, 10vw, 80px);
    padding-right: clamp(40px, 10vw, 80px);
  }
}

@media (max-width: 600px) {
  .coming-soon {
    letter-spacing: 0.18em;
  }

  .intro-philosophy {
    gap: 18px;
  }

  .intro-code {
    padding: 16px 14px 16px 16px;
    border-radius: 0 14px 14px 0;
  }

  .intro-code-text {
    font-size: 0.92rem;
    line-height: 1.68;
  }

  .sidebar-motto.intro-motto {
    letter-spacing: 0.2em;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .card {
    transform: skewX(-3deg);
  }

  .card-inner {
    transform: skewX(3deg);
  }
}