/* ========================================
Fonts & imports
======================================== */

@font-face {
  font-family: "FaktMono-Blond";
  src: url("/fonts/FaktMono-Blond.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
}


/* ========================================
Variables (light/dark mode)
======================================== */

:root {
  --bg-color: white;
  --text-color: black;

  --menu-toggle-color: black;
  --menu-bg-color: whitesmoke;
  --menu-color: black;
  --menu-accent-color: rgb(244, 141, 118);

  --text-bg-color: whitesmoke;
  --link-accent-color: rgb(244, 141, 118);

  --line-height: 1.8;
}

:root.dark-mode {
  --bg-color: black;
  --text-color: whitesmoke;

  --menu-toggle-color: whitesmoke;
  --menu-bg-color: rgb(18, 18, 18);
  --menu-color: whitesmoke;
  --menu-accent-color: rgb(244, 141, 118);

  --text-bg-color: rgb(18, 18, 18);
  --link-accent-color: rgb(244, 141, 118);
}


/* ========================================
Base styles
======================================== */

/* RESET */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Anti-flash fallback */
html { background: white; }
html.dark-mode { background: #000; }

html  {
  height: 100%;
  background: var(--bg-color);
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.0s, color 0.0s;
}


/* TYPOGRAPHY */

html {
  font-family: "FaktMono-Blond";
  font-weight: 400;
  font-style: normal;
  text-align: left;
  font-size: 14px;
  line-height: var(--line-height);
}

h2 {
  font-size: 1em;
  font-weight: 400;
}

address {
  font-style: normal;
}

a {
  color: var(--text-color);
  text-decoration: underline;
  text-decoration-style: solid;
  text-decoration-color: var(--link-accent-color);
}

button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  appearance: none;
  line-height: 1;
}

/* ========================================
LANGUAGE SWITCHER and DARK MODE
======================================== */

.language-dark-mode-container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5em;
  margin-top: 1.5em;
}

.language { display: none; }
.language.active { display: block; }

/* språkknappar */
.language-links {
  line-height: 1;
  cursor: pointer;
}

/* compact meny */
.language-links.menu-compact [data-language] { display: none; }
.language-links.menu-compact [data-language].active-language { display: inline; }

/* expanded meny */
.language-links.menu-expanded [data-language] { display: inline; }


/* language switcher AND light/dark mode switcher */

.language-links [data-language] {
  display: inline-block;
  text-decoration: none;
}

.language-links [data-language]:hover,
.language-links [data-language]:active {
  text-decoration: none;
}

.language-links [data-language].active-language {
  text-decoration: underline;
  text-decoration-color: var(--menu-color); 
}

#darkModeToggle { line-height: 1; }


/* ========================================
MENU - function, typo, and style
======================================== */

#menuToggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0em;
  right: 0.5em;
  width: 3em;
  height: 3em;
  z-index: 2;
  user-select: none;
}

#menu-checkbox {
  display: none;
}

#menuToggle-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 3;
}

.menuToggle-icon {
  display: flex;
  flex-direction: column;
  width:100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.menuToggle-line {
  display: block;
  transition: none;
  width: 1.8em;
  height: 0.14em;
  margin: 0.3em 0;
  background: var(--menu-toggle-color);
  border-radius: 0.14em;
}

.menuToggle-close {
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1em;
  color: var(--menu-color);
  line-height: 1;
}

#menu-checkbox:checked + #menuToggle-label .menuToggle-icon {
  display: none;
}

#menu-checkbox:checked + #menuToggle-label .menuToggle-close {
  display: flex;
  width: 100%;
  height: 100%;
}

#menu-checkbox:checked ~ #menu {
  display: block;
}

#menu {
  position: fixed;
  top: 0.4em;
  right: 0.5em;
  width: auto;
  min-width: 16.5em;
  height: auto;
  padding: 1.3em 1.2em 0.5em 1em;
  line-height: 1;
  background:  var(--menu-bg-color);
  list-style: none;
  z-index: 1;
  display: none;

  font-size: 14px;
}

#menu li {
  padding: 0.4em 0;
}

.submenu {
  display: none;
  list-style: none;
  padding: 0.5em 0 0 1em;
}

.submenu li {
  padding: 0.4em 0;
}

#menu a {
  color: var(--menu-color);
  text-decoration: none;
}

#menu a:hover,
#menu a:active{ text-decoration: underline solid var(--menu-color); }

/* inställning för den manuella radbrytningen i "litografie / bildbearbetning */
#menu .menu-lithography > a {
  line-height: 1.15;
}

/* ========================================
OVERLAY - function, typo, and style
======================================== */

.overlay-trigger { cursor: pointer; }

#project-overlay-trigger {
  text-decoration: underline;
  text-decoration-style: solid;
  text-decoration-color: var(--link-accent-color);
}

.overlay {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  width: 66vw;
  height: auto;
  background-color: var(--text-bg-color);
  z-index: 3;
  display: none;
}

.overlay.is-open { 
  display: grid;
}

.overlay-close {
  position: absolute;
  top: 0rem;
  right: 0rem;
  display: block;
  width: auto;
  height: auto;
 
  cursor: pointer;
  line-height: 1;
  z-index: 2;
}

.overlay-close button {
  padding: 0.7rem 1rem;
  line-height: 1;
}



.overlay-content {
  position: relative;
  min-height: 33vh;
  max-height: calc(100vh - 2rem);
  padding: 0.5rem 6rem 1.5rem 2.5rem;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; /* för smidig scroll på iOS */
  display: flex;
  flex-direction: column;
  z-index: 1;

  color: var(--text-color);
  font-size: 14px;
  gap: calc(var(--line-height) * 1em)
}

.overlay-content .language-links + * { margin-top: calc(var(--line-height) * 0.7em); }

.overlay-content .block {
  display: block;
  margin-top: calc(var(--line-height) * 0.425em);
}

.overlay-content .links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: calc(var(--line-height) * 0.425em);
}

.overlay-content .links a { display: block; }


/* ========================================
större klickytor
======================================== */

#darkModeToggle,
.language-links [data-language],
#project-overlay-trigger {
  position: relative;
  padding: 0.5rem;
  margin: -0.5rem;
}


/* ========================================
6. Media Queries Phone
======================================== */


/* -- Media Queries: Menu -- */
@media (orientation: portrait) {

  body.overlay-open #menuToggle { display: none; } /* gömmer menyn om overlay är öppet */

  #menuToggle {
    top: 0px;
    right: 0px;
  }
  #menu {
    top: 0px;
    right: 0px;
  }
}


/* -- Phone Overlay -- */
@media  (orientation: portrait) {

  .overlay {
    position: fixed;
    top: 0.7rem;
    right: 0.7rem;
    bottom: 0.7rem;
    left: 0.7rem;
    width: auto;
    height: auto;
    grid-template-columns: 1fr auto;
    grid-template-rows: 1fr;
  }
  .overlay-content {
    width: 100%;
    height: 100%;
    padding: 0.5rem 2rem 1rem 1rem;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch; /* för smidig scroll på iOS */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
  }
  .overlay-content::-webkit-scrollbar {
    display: none;  /* Chrome, Safari und neuere Edge-Versionen */
    width: 0;
    height: 0;
    background: transparent;
  }
}


/* -- Phone Typography -- */
@media  (max-width: 587px) and (orientation: portrait),
        (max-width: 1006px) and (orientation: landscape) {

  html  { font-size: 14px; }
}


/* ========================================
6. Media Queries Pad
======================================== */


/* -- iPad Typography -- */
@media  (min-width: 588px) and (max-width: 1032px) and (orientation: portrait),
        (min-width: 1007px) and (max-width: 1376px) and (orientation: landscape) {

  html  { font-size: 15px; }
}

/* Styr mobilwebbläsarens automatiska textförstoring */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}