/* Google Fonts loaded via <link> in HTML for better performance */

/* --- Design Tokens ---
   Every colour in the sheet resolves through these, so the dark theme below
   only has to restate the palette — never the rules that use it. */
:root {
  color-scheme: light dark;

  --bg: #eceff4;
  --surface: #ffffff;
  --surface-border: transparent;
  --text: #2e3440;
  --text-muted: #4c566a;
  --accent: #5e81ac;
  --accent-hover: #339af0;
  --accent-warm: #ee6363;

  --term-bg: #4c566a;
  --term-chrome: #ded6d8;
  --term-text: #ffffff;
  --term-value: #ebcb8b;
  --term-link: #00ffff;
  --term-link-hover: #ffffff;
  --term-punct: #a3adbf;

  --shadow-rest: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 6px 12px rgba(0, 0, 0, 0.15);
  --shadow-term: 0 10px 30px rgba(46, 52, 64, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #242933;
    --surface: #2e3440;
    --surface-border: #3b4252;
    --text: #d8dee9;
    --text-muted: #9aa5b6;
    --accent: #88c0d0;
    --accent-hover: #8fbcbb;
    --accent-warm: #d08770;

    --term-bg: #1c2027;
    --term-chrome: #3b4252;
    --term-punct: #6b7688;

    --shadow-rest: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.45);
    --shadow-term: 0 10px 30px rgba(0, 0, 0, 0.4);
  }
}

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

html,
body {
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  height: 100%;
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow-x: hidden;
  line-height: 1.6;
}

::selection {
  background-color: var(--accent);
  color: var(--bg);
}

/* Cross-document fade between pages. Ignored where unsupported. */
@view-transition {
  navigation: auto;
}

/* --- Typografie --- */
h1 {
  font-size: clamp(1.75rem, 5vw, 3.4rem);
  color: var(--accent);
  margin-bottom: 1.5rem;
  text-align: center;
}

p {
  font-size: clamp(0.875rem, 2vw, 1rem);
  color: var(--text);
  margin-bottom: 0.5rem;
}

.big-text {
  font-size: 1.75rem;
  color: var(--accent);
}

/* --- Links --- */
a {
  color: var(--text);
  text-decoration: none;
  padding: 0.25rem;
  transition: color 0.3s ease;
}

a:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
  border-radius: 2px;
}

a:hover {
  color: var(--accent-hover);
}

a.terminal {
  color: var(--term-link);
  text-decoration: none;
}

a.terminal:hover {
  color: var(--term-link-hover);
}

a.here {
  color: var(--accent-warm);
}

a.here:hover {
  color: var(--accent-hover);
}

/* Keyboard-only escape hatch past the nav. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background-color: var(--surface);
  color: var(--text);
  padding: 0.75rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  z-index: 10;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* --- Basis Layout --- */
header {
  padding: 1rem;
  margin-bottom: 2rem;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

footer {
  margin-top: auto;
  display: flex;
  justify-content: center;
  padding: 2rem 0;
  gap: 2rem;
  flex-wrap: wrap;
}

/* Navigation */
nav {
  width: 100%;
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  list-style-type: none;
}

nav a {
  position: relative;
  color: var(--text-muted);
  font-size: clamp(0.9rem, 2vw, 1rem);
}

nav a:hover {
  color: var(--accent-hover);
}

nav a::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--accent-hover);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

nav a:hover::after {
  transform: scaleX(1);
}

/* The page you are on stays underlined. */
nav a[aria-current="page"] {
  color: var(--accent);
}

nav a[aria-current="page"]::after {
  transform: scaleX(1);
  background-color: var(--accent);
}

ul li {
  list-style-type: none;
}

nav ul li a {
  color: var(--text-muted);
}

nav ul li a[aria-current="page"] {
  color: var(--accent);
}

.flex-container-nav {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  margin-right: 20%;
}

@media (max-width: 768px) {
  .flex-container-nav {
    margin-right: 0;
    justify-content: center;
  }
}

/* --- Projekt-Box --- */
.project-container {
  width: 100%;
}

.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.section-title {
  text-align: left;
  margin-bottom: 2rem;
}

.project-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 1.5rem;
  height: auto;
  min-height: 30vh;
  box-shadow: var(--shadow-rest);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
}

.project-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  flex: 0 1 45%;
  margin-right: 1.5rem;
}

.project-header img {
  object-fit: contain;
}

.project-header h2 {
  width: 100%;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: var(--text);
  margin: 0.25rem 0 0;
}

.project-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  text-align: right;
}

.project-features {
  margin: 1.6rem 0;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.project-link {
  color: var(--text);
  text-decoration: none;
  transition: color 0.3s ease;
  margin-top: auto;
}

.project-desc {
  margin: 0.75rem 0 1.25rem;
  line-height: 1.6;
  font-size: 0.95rem;
  text-align: right;
  max-width: 65ch;
  margin-left: auto;
}

.project-link:hover {
  color: var(--accent-hover);
}

.project-link:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

.button {
  display: inline-block;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  font-size: 0.875rem;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.button:hover {
  background-color: var(--accent);
  color: var(--bg);
}

/* --- Terminal Style --- */
.fakeMenu,
.fakeScreen {
  margin: 0 auto;
  width: 100%;
}

.fakeMenu {
  background-color: var(--term-chrome);
  padding: 0.5rem 1rem;
  border-radius: 8px 8px 0 0;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.fakeButtons,
.fakeMinimize,
.fakeZoom {
  height: 12px;
  width: 12px;
  border-radius: 50%;
  border: none;
}

.fakeButtons {
  background-color: #ee6363;
}

.fakeMinimize {
  background-color: #fdb924;
}

.fakeZoom {
  background-color: #51cf66;
}

/* Window title, sits centred in the chrome bar. */
.fakeTitle {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 0 -3.5rem;
  letter-spacing: 0.5px;
}

.fakeScreen {
  background-color: var(--term-bg);
  padding: 1.5rem;
  border-radius: 0 0 8px 8px;
  overflow-x: auto;
  color: var(--term-text);
  box-shadow: var(--shadow-term);
  /* Barely-there CRT scanlines. */
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.02) 0 1px,
    transparent 1px 3px
  );
}

.terminal-block {
  margin-bottom: 2rem;
}

/* Prompt */
.line1 {
  color: var(--term-text);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

/* The `>` chevron ahead of each command */
.prompt {
  color: #51cf66;
  user-select: none;
}

/* Object / property split, so the command reads as code */
.obj {
  color: #88c0d0;
}

.prop {
  color: var(--term-text);
}

/* Value */
.line2 {
  color: var(--term-value);
  margin: 0.1rem 0;
}

/* Error output on the 404 page. Must follow .line2 to win on equal specificity. */
.line2.term-error {
  color: #ee6363;
}

/* Brackets, quotes and commas around values */
.punct {
  color: var(--term-punct);
}

/* JSON Key */
.json-key {
  color: #88c0d0;
  font-weight: 600;
}

/* JSON String */
.json-string {
  color: var(--term-value);
}

/* JSON Arrays */
.json-array {
  color: var(--term-value);
}

/* Closing cursor line */
.line4 {
  color: var(--term-text);
}

.indent-1 {
  padding-left: 1rem;
}

.indent-2 {
  padding-left: 2rem;
}

@media (max-width: 480px) {
  .line2 {
    word-break: break-word;
  }

  .indent-2 {
    padding-left: 1rem;
  }
}

/* Utilities */
.center {
  text-align: center;
}

main.center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.container-flex {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.text-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto 1.5rem;
}

.container-inline-block {
  display: inline-block;
}

.contactIcons {
  width: clamp(2.5rem, 5vw, 3rem);
  height: clamp(2.5rem, 5vw, 3rem);
  vertical-align: middle;
  transition: transform 0.3s ease;
}

.contactIcons:hover {
  transform: scale(1.1);
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
  padding: 2rem 0;
}

/* Dark mode ships no dark-on-dark logo variants, so lift the flat black
   icons off the background instead of shipping a second set of PNGs. */
@media (prefers-color-scheme: dark) {
  .contactIcons[src$="github_icon.png"] {
    filter: invert(1) brightness(0.92);
  }

  .project-header img {
    filter: brightness(1.08);
  }
}

/* --- Animationen --- */
@keyframes blink {
  0%,
  40% {
    opacity: 0;
  }

  50%,
  90% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes type {
  from {
    width: 0;
  }
}

.typewriter-text {
  font-size: clamp(2rem, 8vw, 4.45rem);
  text-align: left;
  margin-bottom: 0.75rem;
  letter-spacing: clamp(2px, 1vw, 10px);
  border-right: 5px solid;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  animation:
    type 1.5s steps(40),
    cursor 0.4s step-end infinite alternate;
}

@keyframes cursor {
  50% {
    border-color: transparent;
  }
}

.cursor {
  color: var(--term-text);
  animation: blink 1.3s steps(2) infinite;
}

/* Boot sequence: the terminal window drops in once the name has finished
   typing, then answers one command at a time. */
@keyframes window-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes line-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.fakeMenu,
.fakeScreen {
  animation: window-in 0.4s ease-out 1.2s backwards;
}

.fakeScreen > * {
  animation: line-in 0.3s ease-out backwards;
}

.fakeScreen > *:nth-child(1) {
  animation-delay: 1.6s;
}

.fakeScreen > *:nth-child(2) {
  animation-delay: 1.75s;
}

.fakeScreen > *:nth-child(3) {
  animation-delay: 1.9s;
}

.fakeScreen > *:nth-child(4) {
  animation-delay: 2.05s;
}

.fakeScreen > *:nth-child(5) {
  animation-delay: 2.2s;
}

.fakeScreen > *:nth-child(6) {
  animation-delay: 2.35s;
}

.fakeScreen > *:nth-child(7) {
  animation-delay: 2.5s;
}

.fakeScreen > *:nth-child(8) {
  animation-delay: 2.65s;
}

/* Respect the OS-level motion preference: show everything, animate nothing. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .typewriter-text {
    border-right: none;
  }
}

/* --- Media Queries --- */
@media (min-width: 768px) {
  h1 {
    font-size: 3.4rem;
  }

  .fakeMenu,
  .fakeScreen {
    max-width: 800px;
    width: 100%;
  }
}

@media (max-width: 600px) {
  .project-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-header {
    flex: none;
    width: 100%;
    margin-right: 0;
    margin-bottom: 1rem;
  }

  .project-content {
    text-align: left;
    width: 100%;
  }

  .project-desc {
    text-align: left;
    margin-left: 0;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0.5rem;
  }

  header {
    padding: 0.5rem;
    margin-bottom: 1rem;
  }

  nav ul {
    gap: 1rem;
  }

  .typewriter-text {
    font-size: clamp(1.5rem, 7vw, 2rem);
    letter-spacing: 1px;
  }

  .fakeScreen {
    padding: 1rem;
  }

  .fakeTitle {
    display: none;
  }

  .terminal-block {
    margin-bottom: 1.25rem;
  }

  footer {
    gap: 1rem;
  }
}
