/*  Bas / Theme */
:root{
  --bg:#fafafa;
  --text:#0f0f0f;
  --muted:#6e6e6e;
  --accent:#111;
  --card:#ffffff;
  --line:#e9e9e9;
  --shadow:0 10px 30px rgba(0,0,0,.08);

  /* Hero/portrait */
  --portrait-size:88%;
  --blob-inset:-16% -26% -8% -18%;
}

body.night{
  --bg:#151515;
  --text:#f4f4f5;
  --muted:#a1a1aa;
  --accent:#f4f4f5;
  --card:#121217;
  --line:#202028;
  --shadow:0 21px 200px rgba(99,99,99,.5);
}



*{
  box-sizing:border-box;
}

html,
body{
  height:100%;
}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:"Barlow Condensed", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  letter-spacing:.2px;
}

/* Progress bar */
.progress-bar{
  position:fixed;
  inset:0 0 auto 0;
  height:4px;
  background-color:palevioletred;
  width:0;
  z-index:1000;
}

/* Header (with Safari-fallback & -webkit-backdrop-filter) */
header{
  position:sticky;
  top:0;
  z-index:800;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  align-items:center;

  /* Fallback before color-mix (for older motorer) */
  background:rgba(250,250,250,0.85);
  background:color-mix(in srgb, var(--bg) 70%, transparent);

  -webkit-backdrop-filter:saturate(180%) blur(6px);
  backdrop-filter:saturate(180%) blur(6px);

  border-bottom:1px solid var(--line);
  padding:20px 0 20px 20px;
  width:100%;
}

/* Dark mode for header (hjälper Safari) */
body.night header{
  background:rgba(21,21,21,0.75);
  background:color-mix(in srgb, var(--bg) 70%, transparent);
}

.header-section{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:50px;
  width:1000px;
  margin:0 auto;
}

.header-nav{
  max-width:1200px;
  margin:0 auto;
  display:flex;
  align-items:center;
  justify-content:space-around;
  gap:28px;
  padding:5px 0 0 20px;
}

.header-nav a{
  text-decoration:none;
  color:var(--text);
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:1.2rem;
  position:relative;
}

.header-nav a::after{
  content:"";
  position:absolute;
  left:0;
  bottom:-6px;
  height:2px;
  width:0;
  background:var(--text);
  transition:width .25s ease;
}

.header-nav a:hover::after{
  width:100%;
}

.theme-icon-btn{
  width:35px;
  height:35px;
  display:grid;
  place-items:center;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:999px;
  cursor:pointer;
}

.theme-icon-btn img{
  width:20px;
  height:20px;
  pointer-events:none;
}

.theme-icon-btn:focus-visible{
  outline:2px solid color-mix(in srgb, var(--text) 50%, transparent);
  outline-offset:2px;
}

/* Language toggle */
.lang-toggle{
  display:flex;
  justify-content:flex-end;
  gap:6px;
  margin-right:1rem;
}

.lang-toggle .sep{
  align-self:center;
  opacity:.6;
  font-size:1rem;
}

.lang-btn{
  background:none;
  border:0;
  padding:0;
  font:inherit;
  color:var(--muted);
  cursor:pointer;
  text-transform:uppercase;
  letter-spacing:.06em;
}

.lang-btn.is-active{
  color:var(--text);
  font-weight:700;
  text-decoration:underline;
}

input,
.lang-btn,
.lang-radio{
  border:none;
  background:transparent;
}

input{
  border-radius:45px;
}

/* Layout-ram  */
.main-container{
  max-width:1200px;
  /* margin:0 auto; */
  /* padding:0 20px; */
  margin:auto;
  padding:0 20px;
}

/*  Hero / Profil  */
.profile-section{
  position:relative;
  overflow:visible;
  display:grid;
  grid-template-columns:1.2fr .8fr;
  gap:1px;
  align-items:center;
  min-height:clamp(580px, 60vh, 650px);
  border-bottom:1px solid var(--line);
  max-width:1000px;
  justify-self:center !important;
}

.profile-content,
.profile-img-bg{
  position:relative;
  z-index:1;
}

.profile-content{
  justify-self:center;
  padding:1rem;
}

.profile-content h1{
  font-size:clamp(48px, 12vw, 74px);
  line-height:.9;
  margin:0 0 12px;
  letter-spacing:.01em;
}

.profile-content h2{
  font-weight:700;
  font-size:clamp(20px, 2.4vw, 28px);
  text-transform:uppercase;
  letter-spacing:.12em;
  margin:0 0 24px;
  color:var(--muted);
}

.buttons-row{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin:28px 0;
}

.button{
  appearance:none;
  border:1.5px solid var(--text);
  background:transparent;
  color:var(--text);
  padding:12px 18px;
  border-radius:999px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  cursor:pointer;
  transition:transform .08s ease, background .2s ease, color .2s ease;
}

.button:hover{
  background:var(--text);
  color:var(--bg);
  transform:translateY(-1px);
}

.social-row{
  display:flex;
  gap:14px;
  align-items:center;
}

.icon-img{
  width:35px;
  height:35px;
  opacity:.7;
  filter:grayscale(100%);
  transition:opacity .2s ease, transform .1s ease;
}

.icon-img:hover{
  opacity:1;
  transform:translateY(-1px);
}

/* Dark mode secure icon color (cross-browser) */
body.night .icon-img{
  filter:invert(1) grayscale(0);
  opacity:.9;
}

/* portrait column */
.profile-img-bg{
  width:min(42vw, 520px);
  aspect-ratio:3/3.7;
  border-radius:12px;
  justify-self:center;
  overflow:visible;
}

.profile-img-bg::before{
  content:"";
  position:absolute;
  inset:var(--blob-inset);  
  /* background:url('/public/images/background-dark- 1.svg') center / contain no-repeat; */
  background:url('/public/images/background-dark-.png') center / contain no-repeat;
  pointer-events:none;
  z-index:0;
  opacity:.96;
  
}


.profile-img{
  position:absolute;
  inset:0;
  z-index:1;
  border-radius:12px;
  background:url('/public/images/lo-portfolio-transparent.webp') center bottom / var(--portrait-size) auto no-repeat;
}

/*  Kort info (LIA)  */
.short-info{
  display:flex;
  flex-direction:column;
  align-items:center;
  margin-top:20px;
  padding:5px 10px;
}

.short-info p{
  margin:0;
  font-size:1.4rem;
}

/* Section lia-info-2 discard? */
.lia-info-2{
  display:flex;
  justify-content:center;
  align-items:center;
  color:var(--text);
  margin:2rem;
  border-radius:8px;
  padding:1rem;
  width:100%;
}

.lia-pdf-icon{
  width:130px;
}

.lia-p{
  width:20%;
  font-size:2rem;
  color:#ff8800;
}

/*  About */
#about{
  justify-self:center;
}

.about-me-container{
  max-width:850px;
  padding:56px 0;
  border-bottom:1px solid var(--line);
}

.about-me-container h3{
  font-size:clamp(24px, 3vw, 36px);
  margin:0 0 14px;
  text-transform:uppercase;
  letter-spacing:.14em;
}

.about-text{
  font-size:20px;
  line-height:1.6;
  color:var(--text);
  margin:10px 0 0;
}

.about-text + .about-text{
  margin-top:12px;
}


/* Skills row */
.skill-icons{
  display:none;
  padding-bottom:24px;
  justify-self: center;
}

.main-container img[alt*="icons of different"]{
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  width:70%;
  height:auto;
  margin:24px 0 0;
}

/*  Hero under row  */
.project-section{
  padding-top:64px;
  border-top:1px solid var(--line);
}

#p-project{
  font-size:clamp(22px, 2.2vw, 28px);
  color:var(--muted);
  margin:0;
}

#p-project strong{
  color:var(--text);
}

/* Project cardt */
.projects{
  padding:30px 0;
}

.card-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:20px;
}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden;
  /* box-shadow:var(--shadow); */
  transition:transform .13s ease, box-shadow .2s ease;
  position:relative;
}

.card:hover{
  transform:translateY(-4px);
  box-shadow:0 20px 40px rgba(0,0,0,.12);
}

.card-text{
  display:flex;
  flex-direction:column;
  padding:1px 14px 16px;
  font-size:18px;
  color:var(--muted);
}

.project-img{
  display:block;
  width:100%;
  object-fit:cover;
  border-bottom:1px solid var(--line);
}

.info{
  padding:12px 14px 0;
  font-size:18px;
  color:var(--muted);
}

.card-cta{
  align-self:flex-end;
  padding:12px 14px 0 14px;
  padding-bottom:0 !important;
  font-size:18px;
  text-decoration:none;
  color:var(--text);
  font-weight:500;
  text-transform:uppercase;
  letter-spacing:.08em;
  position:relative;
  display:inline-block;
}

.card-cta::after{
  content:"";
  position:absolute;
  left:0;
  bottom:-6px;
  height:2px;
  width:0;
  background:currentColor;
  transition:width .25s ease;
}

.card-cta:hover::after,
.card-cta:focus-visible::after{
  width:100%;
}

/* Back to top */
.back-to-top{
  position:fixed;
  right:200px;
  bottom:80px;
  display:none;
  background:var(--text);
  /* background:rgb(249, 52, 151); */
  /* color:var(--bg); */
  color:#fafafa;
  border:0;
  width:42px;
  height:42px;
  border-radius:50%;
  font-size:18px;
  cursor:pointer;
  box-shadow:var(--shadow);
}

/* Footer */
footer{
  border-top:1px solid var(--line);
  padding:20px;
  text-align:center;
  color:var(--muted);
  font-size:14px;
}

/*  Animations */
.fade-in{
  opacity:0;
  transform:translateY(8px);
  transition:opacity .6s ease, transform .6s ease;
  font-size:1.3rem;
}

.visible{
  opacity:1;
  transform:none;
  margin-bottom:0 !important;
}

/*  Responsivity */
@media (max-width:1024px){
  .header-section{
    max-width:750px;
  }
  .profile-section{
    grid-template-columns:1fr;
    min-height:auto;
    padding:40px 0;
  }
 .profile-img-bg{
    width:min(66vw, 380px);  aspect-ratio:3/3.3;

  }

  
  :root{
    --portrait-size:92%;
    --blob-inset:-26% -14% -12% -12%;
  }
  .theme-icon-btn{
    width:35px;
    height:35px;
  }
  .theme-icon-btn img{
    width:18px;
    height:18px;
  }

  .about-me-container{
  /* max-width:350px; */
  padding: 30px 20px ;
  border-bottom:1px solid var(--line);
}

.about-me-container p{
  margin-bottom: 125px;
}

.back-to-top{
  /* position:fixed; */
  right:60px;
  bottom:80px;
}
}

@media (max-width:840px){
  .header-section{
    max-width:500px;
  }
  .card-grid{
    grid-template-columns:repeat(2, 1fr);
  }
  .short-info{
    font-size:20px;
  }
  .header-nav{
    justify-content:center;
    gap:18px;
  }
}

@media (max-width:560px){
  :root{
    --portrait-size:94%;
    --blob-inset:-2% -30% -10% -50%;
  }
  .header-section{
    flex-direction:column;
    max-width:300px;
  }
  .header-nav{
    padding:5px 0 0 0;
  }
  .profile-img-bg{
    width:min(78vw, 340px);
  }
  .card-grid{
    grid-template-columns:1fr;
  }
  .skill-icons{
    /* content:url('/public/images/skills-box-block-night-transparent.svg'); */
    content:url('/public/images/skills-box-correct.svg');
    width:400px !important;
  }
}

@media (max-width:350px){
  .profile-section{
    gap:.5rem;
  }
  .profile-img-bg{
    max-width:300px;
    margin:0 auto;
     aspect-ratio: 3/3.25;
  }
  .profile-content h1{
    font-size:clamp(44px, 16vw, 92px);
  }
  .short-info{
    padding-top:1rem;
  }
}

/* Generell img style (cross-browser, replace justify-self-regel) */
img{
  display:block;
  max-width:100%;
  height:auto;
}

/*  LIA CTA (container) */
.lia-cta{
  margin:24px auto;
  max-width:900px;
  padding:0 16px;
}

.lia-cta__content{
  display:grid;
  grid-template-columns:1fr auto;
  align-items:center;
  gap:16px;
  background:var(--bg);
  border:1px solid #f2f2f2;
  /* border:1px solid #202028; */
  border-radius:12px;
  padding:16px 18px;
  /* border: solid salmon 3px; */
}

.lia-cta__title{
  margin:0 0 4px;
  font-size:clamp(18px, 2.2vw, 22px);
  line-height:1.25;
  color:var(--text);
}

.lia-cta__hint{
  margin:0;
  font-size:14px;
  color:var(--muted);
}

/* 'Accessibility' – "screen reader" */
.sr-only{
  position:absolute !important;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}



/* CORR: */
.lia-cta__button{
  display:block;
  /* width:min(100%, 520px); */
  width:250px;
  aspect-ratio:800 / 300;
  background-repeat:no-repeat;
  background-position:center;
  background-size:100% 100%;
  border:0;
  text-decoration:none;
  background-image:url('/public/icons/lia-pdf-button-swe-white-fill.svg');
  background-image:url('/public/icons/lia-pdf-button-swe-white-fill.svg');
  transition:transform .08s ease, filter .2s ease;
  outline:none;
}



/* cORR: */
.lia-cta__button:hover,
.lia-cta__button:focus-visible{
  transform:translateY(-1px);
}

.lia-cta__button:focus-visible{
  box-shadow:0 0 0 3px color-mix(in srgb, #ff8800 50%, transparent);
}

/* SWE */
.lia-cta__button:hover,
.lia-cta__button:focus-visible{
  /* background-image:url('/public/icons/lia-pdf-button-swe-dark-white-fill.svg'); */
  background-image:url('/public/icons/lia-pdf-button-swe.svg');
}

/* ENG */
body[data-lang="eng"] .lia-cta__button{
  background-image:url('/public/icons/lia-pdf-button-eng-dark-hover-white-fill.svg');
}

body[data-lang="eng"] .lia-cta__button:hover,
body[data-lang="eng"] .lia-cta__button:focus-visible{
  /* background-image:url('/public/icons/lia-pdf-button-eng-dark-white-fill.svg'); */
  background-image:url('/public/icons/lia-pdf-button-eng.svg');
}

/* Dark mode: keep neutral container */
body.night .lia-cta__content{
  /* background: color-mix(in srgb, var(--card) 82%, var(--text) 18%); */
  border-color:var(--line);
  background-color:#151515;
}

/* Responsivt */
@media (max-width:720px){
  .lia-cta__content{
    grid-template-columns:1fr;
    gap:12px;
  }
  /* .lia-cta__button{ width: min(100%, 420px); } */
  .lia-cta__button{
    width:180px;
  }
}

/* Header: mobile layout */
@media (max-width:800px){
  header{
    padding:14px 12px;
  }

  .header-section{
    display:grid;
    grid-template-columns:1fr 1fr;
    grid-template-areas:
      "lang  theme"
      "nav   nav";
    align-items:center;
    gap:5px;
    max-width:100%;
    padding-bottom:9px;
  }

  .lang-toggle{
    grid-area:lang;
    justify-content:flex-start;
    margin:0;
    margin-left:5px;
  }

  .theme-toggle{
    grid-area:theme;
    justify-self:end;
    margin-right:5px;
  }

  .header-nav{
    grid-area:nav;
    justify-content:center;
    gap:16px;
    padding:0;
    width:100%;
  }

  .header-nav a{
    font-size:1rem;
  }
}

/* even smaller when 560 */
@media (max-width:560px){
  .header-nav a{
    font-size:.95rem;
    letter-spacing:.06em;
  }
}


/*  Tilt cards (mouse control 3D + glans)  */
.card[data-tilt]{
  transform-style:preserve-3d;
  perspective:800px;
  transition:transform .12s ease;
  will-change:transform;
}

.card[data-tilt] .project-img{
  transform:translateZ(18px);
  transition:transform .2s ease;
}

.card[data-tilt]::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background:radial-gradient(900px 900px at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, #ffffff 22%, transparent), transparent 60%);
  opacity:0;
  transition:opacity .15s ease;
  mix-blend-mode:screen;
}

.card[data-tilt].tilting::after{
  opacity:.28;
}


/*  Magnetic buttons (hover-follow + glow)  */
.button[data-magnetic]{
  position:relative;
  overflow:hidden;
  will-change:transform;
}

.button[data-magnetic]::after{
  content:"";
  position:absolute;
  inset:auto -20% -160% -20%;
  background:radial-gradient(60% 60% at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--text) 12%, transparent), transparent 60%);
  opacity:0;
  transform:translateY(0);
  transition:opacity .2s ease, transform .2s ease;
  pointer-events:none;
  mix-blend-mode:soft-light;
}

.button[data-magnetic].is-hover::after{
  opacity:.45;
  transform:translateY(-60%);
}

/* reduced movment respected */
@media (prefers-reduced-motion: reduce){
  .button[data-magnetic]{
    transition:none;
  }
  .button[data-magnetic]::after{
    transition:none;
  }
}

/* Magnetic effect for the lia cta button */
.lia-cta__button[data-magnetic]{
  position:relative;
  overflow:hidden;
  will-change:transform;
}

/* Glow that follow the pointer */
.lia-cta__button[data-magnetic]::after{
  content:"";
  position:absolute;
  inset:auto -30% -160% -30%;
  background:radial-gradient(60% 60% at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--text) 16%, transparent), transparent 60%);
  opacity:0;
  transform:translateY(0);
  transition:opacity .2s ease, transform .2s ease;
  pointer-events:none;
  mix-blend-mode:soft-light;
}

/* Active hover  */
.lia-cta__button[data-magnetic].is-hover::after{
  opacity:.5;
  transform:translateY(-60%);
}

/* Important: let JS control transform, not the :hover-rule */
.lia-cta__button[data-magnetic]:hover,
.lia-cta__button[data-magnetic]:focus-visible{
  transform:none;
}

/* respect less movement */
@media (prefers-reduced-motion: reduce){
  .lia-cta__button[data-magnetic]{
    transition:none;
  }
  .lia-cta__button[data-magnetic]::after{
    transition:none;
  }
}



.back-to-top[data-magnetic]{
  overflow:hidden;
  will-change:transform;
  /* margin-right: 1.5rem; */
}

.back-to-top[data-magnetic]::after{
  content:"";
  position:absolute;
  inset:auto -40% -200% -40%;
  background:radial-gradient(60% 60% at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.35), transparent 60%);
  opacity:0;
  transform:translateY(0);
  transition:opacity .2s ease, transform .2s ease;
  pointer-events:none;
  mix-blend-mode:screen;
  border-radius:50%;
}

.back-to-top[data-magnetic].is-hover::after{
  opacity:.6;
  transform:translateY(-60%);
}



@media (prefers-reduced-motion: reduce){
  .back-to-top[data-magnetic]{
    transition:none;
  }
  .back-to-top[data-magnetic]::after{
    transition:none;
  }
}

