/*
  NAVATION — Neo-retro blue hybrid
  - Single page, scroll navigation
  - Dark default (no prefers-color-scheme)
  - Light = blue, not white
  - Thin-line grid background for all non-image areas
  - No HUD texts
*/

:root {
  --header-height: 84px;
  --page-max: 1240px;
  --page-gutter: 24px;

  --radius-lg: 18px;
  --radius-md: 14px;

  --image-height: 520px; /* same base image panel height across sections */
  --content-overlap: 270px; /* default overlap; can be overridden per section */

  --grid-size: 32px; /* consistent spacing */

  --font-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --shadow-soft: 0 18px 60px rgba(0, 0, 0, 0.35);
}

/* Lift the main content panels (Hero / Software / Projects) higher onto the image panel
   to match the reference neo-retro layout. Contact stays slightly lower. */
.section--hero,
#software.section,
#projects.section {
  /* Larger overlap => content panel starts closer to the image-panel top (but still below the centered section title) */
  --content-overlap: 360px;
}

html,
body {
  height: 100%;
}

html {
  scroll-behavior: smooth;
}

/* Theme tokens */
html[data-theme="dark"] {
  /* Dark mode should read as deep blue (not near-black) like the reference neo-retro model */
  --bg: #0b2854;
  --bg-2: #0a244c;
  --header-bg: #061a38;

  --text: rgba(255, 255, 255, 0.94);
  --text-muted: rgba(255, 255, 255, 0.72);
  --text-dim: rgba(255, 255, 255, 0.56);

  --border: rgba(255, 255, 255, 0.14);
  --border-2: rgba(255, 255, 255, 0.10);

  /* Primary Blue locked (same in both themes) */
  --primary: #2e6bff;
  --primary-2: #8ec5ff;

  /* Grid lines (thin) */
  --grid-line: rgba(255, 255, 255, 0.07);

  /* Panel backgrounds */
  --panel-bg: rgba(8, 20, 52, 0.78);
  --panel-bg-solid: #0a244c;

  /* Image filter overlay */
  --img-tint-1: rgba(0, 110, 255, 0.20);
  --img-tint-2: rgba(0, 40, 120, 0.45);
}

html[data-theme="light"] {
  /* Light blues (not white) */
  --header-bg: #80aadd; /* L1 */
  --bg: #9fbfe5;        /* L2 */
  --bg-2: #b2ccea;      /* L3 */

  --text: rgba(8, 16, 30, 0.92);
  --text-muted: rgba(8, 16, 30, 0.72);
  --text-dim: rgba(8, 16, 30, 0.56);

  --border: rgba(8, 16, 30, 0.18);
  --border-2: rgba(8, 16, 30, 0.12);

  /* Primary Blue locked (same in both themes) */
  --primary: #2e6bff;
  --primary-2: #8ec5ff;

  /* Grid lines (thin) */
  --grid-line: rgba(8, 16, 30, 0.10);

  --panel-bg: rgba(245, 248, 255, 0.78);
  --panel-bg-solid: rgba(245, 248, 255, 1);

  /* Image filter overlay (same "system" feel) */
  --img-tint-1: rgba(0, 90, 210, 0.18);
  --img-tint-2: rgba(0, 40, 120, 0.30);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background-color: var(--bg);

  /* NEO-RETRO GRID BACKGROUND (thin lines, no perspective) */
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);

  /* keep grid crisp */
  background-attachment: fixed;
}

.wrap {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-gutter);
}

/* HEADER */
.topbar {
  position: static;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--header-bg); /* flat; hides grid */
  
  isolation: isolate;
transform: translateZ(0);
backface-visibility: hidden;
}

.topbar__inner {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo-slot {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 192px;
}

.logo-slot__img {
  height: 192px;
  width: auto;
  display: block;
}

.topnav {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 34px;
}

.topnav__link {
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 10px 6px;
  border-radius: 10px;
}

html[data-theme="light"] .topnav__link {
  color: #ffffff !important;
}

html[data-theme="light"] .topnav__link:hover,
html[data-theme="light"] .topnav__link:focus-visible {
  color: #ffffff !important;
  opacity: 0.85;
}

.topnav__link:hover {
  color: var(--text);
}

.topbar__controls {
  display: flex;
  align-items: center;
  gap: 12px;
  
  position: relative;
  isolation: isolate;
  contain: paint;
  transform: translateZ(0);
  backface-visibility: hidden;
}
.topbar__controls .toggle[aria-label="Language"] {
  width: 112px;
  display: flex;
}

.topbar__controls .toggle[aria-label="Language"] .toggle__btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .toggle {
  /* Distinct from header background so toggles don't visually disappear */
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(8, 16, 30, 0.28);
}

.toggle__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* Button separators inside toggles (subtle system detail) */
.toggle__btn:not(:last-child) {
  border-right: 1px solid var(--border-2);
}

html[data-theme="light"] .toggle__btn {
  color: rgba(8, 16, 30, 0.84);
  /* Give inactive halves a faint surface so they don't match the header blue */
  background: rgba(255, 255, 255, 0.18);
}

.toggle__btn:hover {
  color: var(--text);
}

.toggle__btn.is-active {
  color: var(--text);
  background: rgba(46, 107, 255, 0.22);
}

html[data-theme="light"] .toggle__btn.is-active {
  color: rgba(8, 16, 30, 0.96);
  background: rgba(46, 107, 255, 0.28);
}

.flag {
  display: block;
  width: 16px;
  height: 12px;
  flex: 0 0 16px;
  object-fit: cover;
  overflow: hidden;
  transform: translateZ(0);
  backface-visibility: hidden;
}
}

.topbar__line {
  height: 1px;
  background: var(--border);
}

/* MAIN */
.main { padding: var(--header-height) 0 0; 
    
}

.section {
  padding: 26px 0 54px;
}

.section__wrap {
  position: relative;
}

.section {
  scroll-margin-top: calc(var(--header-height) + 18px);
}

/* IMAGE PANEL */
.image-panel {
  position: relative;
  height: var(--image-height);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  isolation: isolate;
transform: translateZ(0);
}

.image-panel__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* "system filter" base */
  filter: saturate(0.88) contrast(1.06) brightness(0.92);
    transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
}

.image-panel__filter {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(8, 28, 60, 0.35);
    transform: translateZ(0);
will-change: transform;
backface-visibility: hidden;
}

/* SECTION TITLE PANEL (centered) */
.section-title {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 22px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.20);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  /* Larger title so attention lands here before the content panel */
  font-size: 24px;
  color: var(--text);
}

html[data-theme="light"] .section-title {
  color: #ffffff;
}

html[data-theme="light"] .section-title {
  background: rgba(255, 255, 255, 0.30);
}

/* CONTENT PANEL */
.content-panel {
  margin-top: calc(-1 * var(--content-overlap));
  max-width: 780px;
  width: 100%;

  /* left anchored */
  margin-left: 18px;

  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--panel-bg); /* semi transparent; text stays opaque */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);

  padding: 22px 22px 20px;
}

/* prevent the content panel from ever rising above the image-panel top */
.section__wrap {
  padding-top: 0;
}

/* HERO specifics */
.content-panel--hero {
  max-width: 860px;
}

.hero__h1 {
  margin: 0;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.05;
}

.hero__lead {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 15px;
}

.prose {
  margin-top: 16px;
}

.prose p {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}

.h3 {
  margin: 22px 0 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 14px;
  color: var(--text);
}

.blocks {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.block {
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  padding: 14px 14px 12px;
  background: rgba(0, 0, 0, 0.10);
}

html[data-theme="light"] .block {
  background: rgba(255, 255, 255, 0.24);
}

.block__title {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 13px;
  color: var(--text);
}

.block__body {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
}

/* Tech list */
.tech {
  margin-top: 18px;
}

.tech__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.tech-item {
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  padding: 12px 12px 10px;
  background: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .tech-item {
  background: rgba(255, 255, 255, 0.20);
}

.tech-item__k {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--text);
}

.tech-item__v {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.4;
}

/* Approach list */
.list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--text-muted);
}

.list li {
  margin: 8px 0;
  line-height: 1.4;
}

/* CTAs (optional; max 2) */
.cta-row {
  margin-top: 14px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 12px;
  border: 1px solid var(--border);
  color: var(--text);
  background: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .btn {
  background: rgba(255, 255, 255, 0.20);
}

.btn--primary {
  border-color: rgba(46, 107, 255, 0.6);
  background: rgba(46, 107, 255, 0.22);
}

.btn:hover {
  border-color: rgba(46, 107, 255, 0.75);
}

/* CONTACT */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
}

.contact__text {
  margin: 0 0 10px;
  color: var(--text-muted);
  line-height: 1.5;
}

.contact__link {
  margin: 0 0 10px;
}

.link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(46, 107, 255, 0.0);
}

.link:hover {
  border-bottom-color: rgba(46, 107, 255, 0.65);
}

/* MAP BLOCK (grid must NOT show under the map surface) */
.map-section {
  padding: 4px 0 28px; /* minimal gap after contact section */
}

.map-surface {
  background: var(--panel-bg-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.map-link {
  display: block;
  text-decoration: none;
}

.map-image {
  display: block;
  width: 100%;
  height: auto;
}

.map-actions {
  display: flex;
  justify-content: flex-end;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--panel-bg);
}

.map-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--button-bg, transparent);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.map-open-btn:hover {
  background: var(--panel-hover, rgba(255,255,255,0.04));
}

/* FOOTER */
.footer {
  padding: 0 0 34px;
}

.footer__line {
  height: 1px;
  background: var(--border);
}

.footer__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
}

.footer__brand {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
  color: var(--text);
}

.footer__tagline {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 14px;
}

.footer__right {
  color: var(--text-muted);
  font-size: 14px;
  padding-top: 2px;
}

/* RESPONSIVE */
@media (max-width: 980px) {
  :root {
    --image-height: 480px;
    --content-overlap: 240px;
  }

  .topnav {
    gap: 18px;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 96px;
    --page-gutter: 16px;
    --image-height: 420px;
    --content-overlap: 210px;
  }
  .topnav { display: none; }
  
  .topbar{
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--dark-header-bg);
  }

  .topbar__inner{
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  gap: 12px;
}
.logo-slot{
  align-self: center;
  min-width: 0;
}

.topbar__controls{
  align-self: center;
  justify-self: end;
  margin: 0;
}

.logo-slot__img{
  height: 64px;
  width: auto;
}


  /* Keep nav visible but allow horizontal scroll instead of wrapping */
  .topnav {
    justify-content: flex-start;
    overflow-x: auto;
    white-space: nowrap;
    gap: 16px;
    padding-bottom: 4px;
  }

  .topnav::-webkit-scrollbar {
    height: 0;
  }

  .content-panel {
    margin-left: 0;
    max-width: 100%;
    padding: 18px 16px 16px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .tech__grid {
    grid-template-columns: 1fr;
  }

  .footer__inner {
    flex-direction: column;
  }

  .footer__right {
    padding-top: 0;
}

@media (max-width: 430px) {

  :root {
    --header-height: 96px;
  }

  .topbar__inner {
    display: grid;
    grid-template-columns: auto 1fr !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

 .topbar__controls {
  justify-self: end;
  display: flex;
  gap: 2px;
  max-width: 100%;
  flex-wrap: nowrap;
  

.topbar__controls > * {
  flex: 0 0 auto;
}

.topbar__controls .toggle button {
  padding: 0 4px !important;
  min-height: 34px !important;
  min-width: 44px !important;
  font-size: 12px !important;
}

.topbar__controls .toggle[aria-label="Theme"] .toggle__btn {
  min-width: 44px;
  padding: 0 4px;
}

.topbar__controls .flag {
  width: 16px;
  height: 16px;
}

.topbar__controls .code {
  font-size: 13px;
}

  .logo-slot__img {
  height: 40px;
  width: auto;
}

.topbar__controls .toggle__btn {
  padding: 4px 6px !important;
  min-width: 42px !important;
}

}

@media (max-width: 360px) {
  .topbar__controls .toggle[aria-label="Language"] .code {
    display: none;
  }

  .topbar__controls .toggle[aria-label="Language"] .toggle__btn {
    padding: 0 6px;
  }
  
  .topbar__controls {
  margin-left: 6px;
}

  .logo-slot__img {
    height: 44px;
    width: auto;
  }
}

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

:root { --dark-bg: #10223d; --dark-header-bg: #0a1a2f; }

/* Light mode header nav white */
html[data-theme="light"] .topnav__link {
  color: #ffffff;
}

html[data-theme="light"] .topnav__link:hover {
  color: #ffffff;
  opacity: 0.85;
}

#hero {
  margin-bottom: 64px;
}

/* Force image panel images to actually show */
.image-panel__img,
.image-panel__img {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;

  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}
.image-panel {
  position: relative;
  min-height: 420px; /* tai mitä teillä on kuvapaneelin korkeutena */
}

.image-panel__img {
  position: absolute;
  inset: 0;
}

/* Ensure actual photo is the bottom layer inside the panel */
.image-panel {
  position: relative;
  overflow: hidden;
}

/* Photo layer */
.image-panel__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;          /* photo at base */
  opacity: 1 !important;
    transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
}

/* System overlay layer */
.image-panel__filter {
  position: absolute;
  inset: 0;
  z-index: 1;          /* overlay above photo */
  background: rgba(8, 28, 60, 0.25);
  pointer-events: none;
  transform: translateZ(0);
will-change: transform;
backface-visibility: hidden;
}

/* Titles/content above */
.content-panel {
  position: relative;
  z-index: 2;
}

/* ===== Flags: always visible + readable (desktop + mobile) ===== */
.topbar .flag {
  display: inline-block;
  font-size: 18px;      /* säädä 16–20 */
  line-height: 1;
  width: 1.25em;        /* varaa tilaa ettei puristu */
  text-align: center;
  opacity: 0.95;
}

/* Prevent flex from shrinking the flag */
.topbar .toggle__btn .flag {
  flex: 0 0 auto;
}

/* Space between flag + text inside toggle buttons */
.topbar .toggle__btn {
  gap: 8px;
}

/* Force proper emoji rendering for flags */
.topbar .flag {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif !important;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  font-size: 18px;
  line-height: 1;
  width: 1.25em;
  display: inline-block;
  text-align: center;
}

/* SVG flags inside language toggle */
.topbar .flag {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: middle;
}

/* Prevent the img from shrinking weirdly in flex */
.lang-toggle .toggle__btn,
.topbar__controls .toggle__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Mobile header layout fix (logo vs language/theme toggles) */
@media (max-width: 720px){
  .topbar__inner{ 
    flex-wrap: wrap; 
    gap: 10px; 
  }

  .logo-slot{ 
    flex: 1 1 auto; 
    min-width: 140px; 
  }

  .topbar__controls{ 
    margin-left: auto; 
  }

  .topnav{ 
    flex: 1 0 100%; 
    justify-content: center; 
  }
}

/* Header must stay on top and never "stop" mid-page */
.topbar{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
}

@media (max-width: 430px) {
  .topbar__controls .toggle__btn {
    padding: 4px 6px;
    min-width: 42px;
  }
}

@media (max-width: 760px) {

  .content-panel {
  margin-top: -128px !important;
  position: relative;
  z-index: 1;
}

  .image-panel {
    position: relative;
  }

 .section-title {
  position: absolute;
  top: 12px;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  z-index: 2;
  text-align: center;
 }
 
section {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  
  section.section {
  margin-bottom: 8px !important;
}

}

.topbar {
  outline: 3px solid lime !important;
}

