/* ============================================================
   DRIVE — STYLESHEET
   Cinematic procedural horror interface
   ============================================================ */


/* ROOT
   ============================================================ */

:root {
  --bg:     #05070b;
  --text:   #edf2f7;
  --muted:  rgba(255,255,255,.55);
  --green:  #7dffb3;
  --red:    #ff6b6b;
  --border: rgba(255,255,255,.05);
  --ease:   cubic-bezier(.16,.84,.44,1);
}


/* BASE
   ============================================================ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  overscroll-behavior: none;
}

.mono {
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: .22em;
}


/* GRAIN
   ============================================================ */

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .04;
  mix-blend-mode: soft-light;
  background-image: url("assets/noise.svg");
  z-index: 2;
}


/* LAYOUT — HERO
   ============================================================ */

.hero {
  height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding:
    max(26px, env(safe-area-inset-top))
    24px
    max(24px, env(safe-area-inset-bottom));
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(rgba(0,0,0,.65), rgba(0,0,0,.88)),
    url('assets/hero.jpg') center center / cover no-repeat;
}

.nav,
.center,
.footer {
  position: relative;
  z-index: 3;
}


/* NAVBAR
   ============================================================ */

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(8,10,14,.32);
  backdrop-filter: blur(18px) saturate(110%);
  -webkit-backdrop-filter: blur(18px) saturate(110%);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0,0,0,.22);
}

.logo {
  font-size: 14px;
}

.links {
  display: flex;
  gap: 18px;
}

.links button {
  background: none;
  border: none;
  color: rgba(255,255,255,.58);
  font-size: 11px;
  cursor: pointer;
  transition: opacity .4s ease;
}

.links button:hover {
  opacity: .7;
}


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

.center {
  margin: auto 0;
  max-width: 720px;
}

.label {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 30px;
}

.label span {
  width: 58px;
  height: 1px;
  background: rgba(255,255,255,.28);
}

.label p {
  font-size: 10px;
  opacity: .6;
}

h1 {
  font-weight: 200;
  line-height: .9;
  letter-spacing: -.05em;
  font-size: clamp(38px, 5.5vw, 82px);
  max-width: 900px;
}

.desc {
  margin-top: 26px;
  max-width: 540px;
  line-height: 1.6;
  font-size: 15px;
  color: var(--muted);
}

.access {
  display: inline-block;
  margin-top: 38px;
  padding-bottom: 10px;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,.32);
  background: none;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: opacity .4s ease;
}

.access:hover {
  opacity: .7;
}


/* STATUS FOOTER
   ============================================================ */

.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  opacity: .72;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 50;
  animation: statusPulse 2.4s ease-in-out infinite;
}

/* Expanded tap target */
.dot::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 36px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.dot.alert {
  background: var(--red);
  box-shadow: 0 0 18px var(--red);
  animation: none;
}

.system-status {
  transition: color .4s ease;
}

.system-status.alert {
  color: var(--red);
}

@keyframes statusPulse {
  0%   { opacity: .35; transform: scale(.9);  box-shadow: 0 0  4px var(--green); }
  50%  { opacity: 1;   transform: scale(1);   box-shadow: 0 0 18px var(--green); }
  100% { opacity: .35; transform: scale(.9);  box-shadow: 0 0  4px var(--green); }
}


/* OVERLAY
   ============================================================ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s ease;
  display: flex;
  flex-direction: column;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.overlay-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: max(26px, env(safe-area-inset-top)) 24px 18px;
  background: rgba(8,10,14,.26);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}


/* CARDS
   ============================================================ */

.cards {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 24px 24px;
  padding-inline-start: 24px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

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

.card {
  position: relative;
  flex: 0 0 86vw;
  height: 68svh;
  overflow: hidden;
  scroll-snap-align: start;
  border: 1px solid var(--border);
}

.card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(.48) contrast(1.12) saturate(1.35) hue-rotate(-4deg);
}

/* Bottom gradient */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.9), rgba(0,0,0,.15));
}

/* Cinematic color depth */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at top,    rgba(120,160,255,.08), transparent 55%),
    radial-gradient(circle at bottom, rgba(0,120,255,.06),   transparent 60%);
  mix-blend-mode: screen;
  pointer-events: none;
}

.card-content {
  position: absolute;
  left: 24px;
  bottom: 24px;
  z-index: 2;
  max-width: 78%;
}

.card-content h2 {
  font-weight: 300;
  font-size: 40px;
  margin-bottom: 14px;
}

.card-content p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}

.enter-btn {
  display: inline-block;
  margin-top: 22px;
  padding-bottom: 8px;
  font-size: 12px;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,.24);
  background: none;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: opacity .4s ease;
}

.enter-btn:hover {
  opacity: .7;
}


/* SHARED BUTTON STYLES
   ============================================================ */

.close-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  transition: opacity .4s ease;
}

.close-btn:hover {
  opacity: .7;
}


/* LEGAL PANELS
   ============================================================ */

.legal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5,7,11,.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity     .65s var(--ease),
    visibility  .65s ease;
}

.legal.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.legal-box {
  width: min(760px, calc(100vw - 48px));
  max-height: 82svh;
  overflow: auto;
  padding: 24px;
  background: rgba(8,10,14,.58);
  backdrop-filter: blur(24px) saturate(115%);
  -webkit-backdrop-filter: blur(24px) saturate(115%);
  border: 1px solid rgba(255,255,255,.045);
  box-shadow: 0 40px 120px rgba(0,0,0,.48);
  opacity: 0;
  transform: translateY(24px) scale(.985);
  transition:
    opacity   .7s var(--ease),
    transform .7s var(--ease);
}

.legal.active .legal-box {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.legal-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 28px;
}

pre {
  white-space: pre-wrap;
  font-family: 'IBM Plex Mono', monospace;
  line-height: 1.8;
  font-size: 13px;
  color: rgba(255,255,255,.58);
}


/* SIGNAL FEED — impila i messaggi sopra il footer / status
   ============================================================ */

.signal-feed {
  position: fixed;
  bottom: calc(max(24px, env(safe-area-inset-bottom)) + 44px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  pointer-events: none;
  white-space: nowrap;
}

.signal-line {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: .2em;
  color: rgba(255,255,255,.72);
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity   .55s ease,
    transform .55s ease;
}

.signal-line.active {
  opacity: 1;
  transform: translateY(0);
}

.signal-line.hello {
  color: rgba(255,255,255,.95);
}

/* Hero flicker on activation */
.hero.signal-flicker {
  animation: signalPulse .28s linear;
}

@keyframes signalPulse {
  0%   { filter: brightness(1); }
  50%  { filter: brightness(1.06); }
  100% { filter: brightness(1); }
}


/* ROTATE SCREEN
   ============================================================ */

.rotate-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity    .8s var(--ease),
    visibility .8s ease;
}

.rotate-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .05;
  mix-blend-mode: soft-light;
  background-image: url("assets/noise.svg");
}

.rotate-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px;
}

.rotate-label {
  font-size: 11px;
  opacity: .42;
  margin-bottom: 28px;
}

.rotate-line {
  width: 90px;
  height: 1px;
  background: rgba(255,255,255,.14);
  margin: 0 auto 32px;
}

.rotate-title {
  font-size: 62px;
  font-weight: 200;
  letter-spacing: -.04em;
  line-height: .95;
  margin-bottom: 24px;
  color: var(--text);
}

.rotate-sub {
  font-size: 13px;
  line-height: 1.9;
  color: rgba(255,255,255,.38);
}


/* ANIMATIONS
   ============================================================ */

/* Landscape lock — applies to phones only (max-width excludes desktop) */
@media (orientation: landscape) and (max-width: 1100px) {
  .rotate-screen {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}


/* MOBILE
   ============================================================ */

@media (max-width: 430px) {
  .access {
    margin-bottom: 12px;
  }

  .footer {
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
}


/* QUERIES FIX */
#queries .legal-box,
#terms .legal-box,
#privacy .legal-box{
  max-height:80svh;
  overflow:hidden;
}

#queries pre,
#terms pre,
#privacy pre{
  overflow-y:auto;
  max-height:calc(80svh - 80px);
}


/* BURGER MENU */
.burger-btn{
  display:none;
  background:none;
  border:none;
  color:rgba(255,255,255,.65);
  font-size:11px;
  cursor:pointer;
}

.burger-menu{
  position:fixed;
  inset:0;
  z-index:900;
  opacity:0;
  pointer-events:none;
  transition:opacity .35s ease;
}

.burger-menu.active{
  opacity:1;
  pointer-events:auto;
}

.burger-backdrop{
  position:absolute;
  inset:0;
  background:rgba(5,7,11,.78);
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
}

.burger-panel{
  position:relative;
  height:100%;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap:28px;
}

.burger-panel button{
  background:none;
  border:none;
  color:var(--text);
  font-size:13px;
  cursor:pointer;
}

#burgerClose{
  position:absolute;
  top:max(26px, env(safe-area-inset-top));
  right:24px;
}

@media (max-width:768px) and (orientation:portrait){
  .links{display:none !important;}
  .burger-btn{display:block;}
}


/* BURGER PERFORMANCE FIX
   Safari dislikes fullscreen backdrop-filter during fade.
   Use static dark overlay instead. */
.burger-backdrop{
  backdrop-filter:none !important;
  -webkit-backdrop-filter:none !important;
  background:rgba(5,7,11,.92) !important;
}

.burger-menu{
  will-change:opacity;
}

.burger-panel{
  will-change:opacity;
}


.signal-feed{display:none !important;}

.signal-popup{
 position:fixed;
 inset:0;
 display:flex;
 align-items:center;
 justify-content:center;
 opacity:0;
 pointer-events:none;
 transition:opacity .4s ease;
 z-index:1000;
}

.signal-popup.active{
 opacity:1;
}

.signal-popup-box{
 width:min(88vw,520px);
 background:rgba(5,7,11,.92);
 border:1px solid rgba(255,255,255,.08);
 padding:24px;
 backdrop-filter:blur(8px);
 -webkit-backdrop-filter:blur(8px);
}

.signal-popup-title{
 margin-bottom:16px;
 letter-spacing:.2em;
}

#signalPopupContent{
 white-space:pre-line;
 line-height:1.8;
}


/* DRIVE V1.1 POLISHED SYSTEM FEED */
.signal-popup-box{
 width:min(82vw,420px) !important;
 background:rgba(5,7,11,.94) !important;
 border:1px solid rgba(255,255,255,.05) !important;
 padding:22px !important;
 backdrop-filter:blur(6px) !important;
 -webkit-backdrop-filter:blur(6px) !important;
 color:rgba(255,255,255,.78) !important;
}

.signal-popup-title{
 letter-spacing:.22em !important;
 font-size:11px !important;
 opacity:.75;
 margin-bottom:10px !important;
}

.signal-popup-title::after{
 content:'';
 display:block;
 margin-top:12px;
 height:1px;
 background:rgba(255,255,255,.06);
}

#signalPopupContent{
 font-size:11px;
 line-height:1.9;
 letter-spacing:.04em;
 text-align:left;
}


.includes{
  margin-top:16px;
  padding-top:14px;
  border-top:1px solid rgba(255,255,255,.06);
  font-size:11px;
  opacity:.82;
}

.includes p{
  margin-bottom:8px;
  letter-spacing:.18em;
}

.includes ul{
  margin:0;
  padding-left:16px;
}

.includes li{
  margin:4px 0;
}


.nav-hint{
  text-align:center;
  opacity:.55;
  font-size:11px;
  letter-spacing:3px;
  padding:10px 0 4px;
}



.overlay-nav{
display:flex;
justify-content:center;
align-items:center;
padding:18px 0 28px;
font-size:11px;
letter-spacing:4px;
opacity:.55;
animation: driveOverlayFade 1.5s ease forwards;
}
@keyframes driveOverlayFade{from{opacity:0}to{opacity:.55}}


.overlay-nav{
display:flex;
justify-content:center;
gap:40px;
align-items:center;
padding:18px 0 28px;
font-size:12px;
letter-spacing:4px;
opacity:.6;
animation: fadeNav 1.2s ease;
}
.overlay-nav span{opacity:.4}
@keyframes fadeNav{from{opacity:0}to{opacity:.6}}
