/* =========================
   1) Base + variables
   ========================= */
:root{
  --bar-h: 64px;                 /* header & footer korkeus (desktop) */
  --bar-px: 22px;                /* sivupadding */
  --container-w: min(50vw, 980px);

  --link: #ff9a3c;
  --link-hover: #ffd1a6;

  --accent: #a855f7;             /* accent-viivojen väri */
  
  --nav-gap: 25px;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; margin: 0; }
html{ background: #000; }

/* Lukitaan koko sivun scroll; vain .content scrollaa */
body{
  font-family: Arial, Helvetica, sans-serif;
  color: #f5f5f5;
  overflow: hidden;

  /* Tausta + tumma overlay samassa backgroundissa */
  background-image:
    linear-gradient(rgba(0,0,0,0.30), rgba(0,0,0,0.30)),
    url("/img/Tarpia-bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* =========================
   2) Links
   ========================= */
a{
  color: var(--link);
  text-decoration: none;
}
a:hover,
a:focus-visible{
  color: var(--link-hover);
  text-decoration: underline;
  outline: none;
}

/* =========================
   3) Shared container (50% kaistale)
   ========================= */
.container{
  width: var(--container-w);
  margin: 0 auto;
}

/* =========================
   4) Header (fixed)
   ========================= */
.topbar{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;

  min-height: var(--bar-h);
  padding: 0 var(--bar-px);
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);

  display: flex;
  align-items: center;

  /* typography */
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  border-bottom: 2px solid var(--accent);
}

.topbar .container{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand{
  font-size: 1.15rem;
  font-weight: 800;
}

.nav a{
  color: #fff;
  opacity: .9;
  margin-left: 14px;
  text-decoration: none;
}
.nav a:hover,
.nav a:focus-visible{
  opacity: 1;
  text-decoration: underline;
}

/* =========================
   5) Scroll area (only this scrolls)
   ========================= */
.content{
  position: fixed;
  left: 0;
  right: 0;
  top: var(--bar-h);
  bottom: var(--bar-h);

  overflow: hidden;              /* scroll ei tässä */
  display: flex;
  justify-content: center;

  padding: 20px 0;               /* pysyvä rako ylös/alas */
}

.content > .container{
  width: var(--container-w);
  margin: 0;
  height: 100%;
  overflow: auto;                /* scroll tässä */
  -webkit-overflow-scrolling: touch;

  padding: 28px var(--bar-px) 30px;

  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
}

/* =========================
   6) Home page centering
   ========================= */
/* Keskitys tapahtuu vain etusivulla (home), ei muilla sivuilla */
.home{
  min-height: 100%;
  display: flex;
  align-items: center;             /* pysty */
  justify-content: center;         /* vaaka */
}

.wrapper{
  text-align: center;
  padding: 1rem;
  width: 100%;
}

.hero{
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.hero img{
  display: block;
  width: min(100%, 800px);         /* ei kasva yli tämän */
  height: auto;
  margin: 0 auto;
}

.subtitle{
  margin-top: 1.5rem;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* =========================
   7) Footer (fixed)
   ========================= */
.footer{
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;

  min-height: var(--bar-h);
  padding: 0 var(--bar-px);
  background: rgba(0,0,0,.45);

  display: flex;
  align-items: center;

  border-top: 2px solid var(--accent);
}

.footer .container{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Social */
.social{
  display: flex;
  gap: 12px;
  align-items: center;
}

.social a{
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  text-decoration: none;
}

.social a:hover,
.social a:focus-visible{
  background: rgba(255,255,255,0.08);
}

/* Ikonit yhtenäisiksi */
.social img{
  width: 24px;
  height: 24px;
  display: block;
  object-fit: contain;
}

/* =========================
   8) Responsive
   ========================= */
@media (max-width: 520px){
  :root{
    --container-w: min(92vw, 980px);
    --nav-gap: 25px;
  }

  .nav a{ margin-left: 10px; }

  .footer .container{
    flex-direction: column;
    justify-content: center;
    padding: 10px 0;
  }
}

/* Header: logo-linkki (mobiilia varten) */
.brand-logo{
  display: none;               /* desktopissa piilossa */
  text-decoration: none;
}

.brand-logo img{
  display: block;
  width: 34px;                 /* säädä 28–40 */
  height: 34px;
  object-fit: contain;
}

/* Pidä headerin sisälayout tiukkana */
.topbar-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Mobiili: piilota TARPIA-teksti ja näytä logo oikealla */
@media (max-width: 520px){
  .topbar .brand{
    display: none;
  }

  .brand-logo{
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .nav{
    display: flex;
    flex-wrap: wrap;           /* saa rivittyä nätisti */
    gap: var(--nav-gap);
  }

  .nav a{
    margin-left: 0;            /* ettei tule “tyhjiä välejä” */
    font-size: 0.95rem;
  }
}

/* Isompi väli nav-linkkien väliin */
.nav{
  display: flex;
  flex-wrap: wrap;
  gap: var(--nav-gap);          /* säädä esim. 14–24 */
}

/* Poista vanha margin-left, jotta gap määrää välin */
.nav a{
  margin-left: 0;
}

/* Logo näkyy aina (desktop + mobiili) */
.brand-logo{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.brand-logo img{
  display: block;
  width: 34px;     /* desktop-koko */
  height: 34px;
  object-fit: contain;
}

/* Mobiilissa voit halutessa kasvattaa hieman */
@media (max-width: 520px){
  .brand-logo img{
    width: 36px;
    height: 36px;
  }

  /* Piilota TARPIA-teksti mobiilissa */
  .topbar .brand{
    display: none;
  }
}

/* Header layout: vasen brand, oikea ryhmä (nav + logo) */
.topbar-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-right{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-left: auto; /* varmistaa että tämä ryhmä painuu oikealle */
}

/* Nav: älä anna sen venyä keskelle */
.nav{
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 18px;          /* säädä väliä tässä */
}

.nav a{
  margin-left: 0;     /* gap hoitaa välin */
}

/* Logo aina näkyvissä oikealla */
.brand-logo{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.brand-logo img{
  width: 34px;
  height: 34px;
  display: block;
  object-fit: contain;
}

/* Mobiili: piilota TARPIA-teksti, pidä nav+logo oikealla */
@media (max-width: 520px){
  .topbar .brand{ display: none; }
  .nav{ gap: 15px; }
  .nav a{ font-size: 0.95rem; }
}

/* Footer: pidä aina yhtenä rivinä (desktop) */
.footer .container{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
}

/* Älä anna somen tai copyrightin venyä oudosti */
.footer .social{ flex: 0 0 auto; }
.footer small{ flex: 0 0 auto; white-space: nowrap; }

/* Vasta pienillä näytöillä saa mennä allekkain */
@media (max-width: 520px){
  .footer .container{
    flex-direction: row;   /* pysyy rivinä myös mobiilissa, jos mahtuu */
    flex-wrap: wrap;       /* mutta saa wrapata tarvittaessa */
    justify-content: center;
  }

  .footer small{
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 520px){
  body{
    background-position: 33% center; /* tai left 50% */
  }
}

/* Matalat näytöt (esim. puhelin landscape): piilota footer */
@media (max-height: 450px){
  .footer{
    display: none;
  }

  /* Koska footer on pois, annetaan sisällölle koko alaosa */
  .content{
    bottom: 0;
  }
}

@media (max-width: 520px){
  .content > .container{
    height: calc(100% - 40px);
  }
}

/* =========================
   Shop / product layout
   ========================= */
.card h1{
  margin-top: 0;
  margin-bottom: 20px;
}

.product-card{
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: center;
  margin-top: 24px;
  padding: 20px;
}

.product-card:first-of-type{
  margin-top: 12px;
  padding-top: 20px;
}

.product-card + .product-card{
  border-top: 2px solid rgba(168, 85, 247, 0.45);
}

.product-image{
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image img{
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  border-radius: 12px;
}

.product-info h2{
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.1rem;
  word-break: break-word;
}

.product-info p{
  line-height: 1.6;
  margin: 0 0 12px;
}

.shop-button{
  display: inline-block;
  padding: 12px 18px;
  border-radius: 10px;
  background: rgba(168, 85, 247, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.45);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.shop-button:hover,
.shop-button:focus-visible{
  background: rgba(168, 85, 247, 0.28);
  text-decoration: none;
}

/* Mobiili */
@media (max-width: 700px){
  .product-card{
    grid-template-columns: 1fr;
    align-items: start;
  }

  .product-image{
    justify-content: flex-start;
  }

  .product-image img{
    max-width: 100%;
  }
}

.home-cta{
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.6;
}

.home-cta-button-wrap{
  margin-top: 0.5rem;
}