/* ------------------------------------------------------------------
   Mirko Thiele — Kreativer Hamburger
   A single page with 4 colour themes that can be toggled or
   driven by the time of day. The freistellten illustrations are
   black-on-transparent; on dark themes we invert them so they
   show as cream lines.
   ------------------------------------------------------------------ */

/* ---- Design-system fonts ---- */
@font-face {
  font-family: 'Brittany';
  src: url('fonts/BrittanySignature.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Caveat';
  src: url('fonts/Caveat-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Caveat';
  src: url('fonts/Caveat-Bold.ttf') format('truetype');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  /* Type tokens from the deinmirko-de design system */
  --font-display: 'Brittany', 'Brush Script MT', 'Lucida Handwriting', cursive;
  --font-body:    'Caveat', 'Bradley Hand', 'Marker Felt', cursive;
  /* Fluid type — scales with the viewport so headings never overflow
     on a phone, yet stay capped at the design size on a wide screen. */
  --size-display:  clamp(40px, 9vw,   72px);
  --size-headline: clamp(30px, 6vw,   42px);
  --size-subhead:  clamp(24px, 4.6vw, 30px);
  --size-lead:     clamp(21px, 3.8vw, 26px);
  --size-body:     clamp(18px, 3vw,   20px);
  --size-nav:      22px;
  --size-meta:     16px;
  --line-tight:    1.0;
  --line-snug:     1.2;
  --line-body:     1.5;
  --tracking-nav:  0.2em;

  /* default = "day" theme, mirrors the original cream paper look */
  --bg-start:       #F5EBDC;
  --bg-end:         #ECE0CC;
  --bg-grain:       rgba(120, 90, 60, 0.04);
  --ink:            #1A1410;
  --ink-soft:       #5A4A3A;
  --accent:         #8B6F47;
  --pictogram-hover-bg: rgba(139, 111, 71, 0.10);
  --subject-filter: none;
  --shadow:         rgba(80, 50, 30, 0.20);
}

[data-theme="dusk"] {
  /* Sunset — warm orange sky fading into cream. The sun itself sits in the
     ::after layer as a glowing disc, similar to the moon at night. */
  --bg-start:       #FFA868;
  --bg-mid:         #FFD2A8;
  --bg-end:         #FFF1D9;
  --bg-grain:       rgba(180, 80, 30, 0.04);
  --ink:            #2A1F1A;
  --ink-soft:       #6A4030;
  --accent:         #FF6B3D;
  --pictogram-hover-bg: rgba(255, 107, 61, 0.10);
  --subject-filter: none;
  --shadow:         rgba(180, 80, 30, 0.22);
}

[data-theme="night"] {
  --bg-start:       #0E163A;
  --bg-end:         #1B2660;
  --bg-grain:       rgba(180, 164, 255, 0.04);
  --ink:            #E4DCFF;
  --ink-soft:       #9A8EE8;
  --accent:         #B4A4FF;
  --pictogram-hover-bg: rgba(180, 164, 255, 0.12);
  --subject-filter: invert(1) hue-rotate(180deg);
  --shadow:         rgba(0, 0, 0, 0.55);
  --show-night-sky: 1;
}

[data-theme="sky"] {
  /* "Miami Vice" — light blue sky bleeding into warm cream paper */
  --bg-start:       #B6DDF4;
  --bg-mid:         #DDE9F2;
  --bg-end:         #F8E6CC;
  --bg-grain:       rgba(120, 90, 60, 0.03);
  --ink:            #1A1410;
  --ink-soft:       #5A4A3A;
  --accent:         #4A90C2;
  --pictogram-hover-bg: rgba(74, 144, 194, 0.12);
  --subject-filter: none;
  --shadow:         rgba(50, 80, 110, 0.20);
}

[data-theme="rain"] {
  /* Hamburg-Schmuddelwetter — pale rainy grey-cream */
  --bg-start:       #C8CBC8;
  --bg-mid:         #D4D2CC;
  --bg-end:         #E0DCD2;
  --bg-grain:       rgba(60, 60, 60, 0.03);
  --ink:            #1A1410;
  --ink-soft:       #5A5A5A;
  --accent:         #4A6C7A;
  --pictogram-hover-bg: rgba(74, 108, 122, 0.10);
  --subject-filter: none;
  --shadow:         rgba(40, 50, 60, 0.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--line-body);
  color: var(--ink);
  background:
    linear-gradient(
      to bottom,
      var(--bg-start) 0%,
      var(--bg-mid, var(--bg-end)) 55%,
      var(--bg-end) 100%
    );
  min-height: 100vh;
  transition: background-color 0.6s ease, color 0.6s ease;
  position: relative;
  overflow-x: hidden;
}
/* a subtle paper-grain layer */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      45deg,
      var(--bg-grain) 0,
      var(--bg-grain) 1px,
      transparent 1px,
      transparent 4px
    );
  z-index: 0;
}

/* --- celestial decoration layer (moon at night, sun at dusk) --- */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
  background-repeat: no-repeat;
}

/* Night: cream moon + many tiny stars scattered across the upper half */
:root[data-theme="night"] body::after {
  opacity: 1;
  background-image:
    radial-gradient(circle at 82% 14%, #F5E6C0 22px, rgba(245, 230, 192, 0.35) 32px, transparent 60px),
    radial-gradient(2px 2px at 8% 18%,  #E8EFFF 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 22% 7%,  #FFFFFF 50%, transparent 100%),
    radial-gradient(2px 2px at 32% 22%, #DFE7FF 50%, transparent 100%),
    radial-gradient(1px 1px at 45% 9%,   #FFFFFF 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 58% 16%, #E8EFFF 50%, transparent 100%),
    radial-gradient(2px 2px at 71% 6%,  #FFFFFF 50%, transparent 100%),
    radial-gradient(1px 1px at 78% 23%, #DFE7FF 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 92% 28%, #FFFFFF 50%, transparent 100%),
    radial-gradient(1px 1px at 14% 32%, #FFFFFF 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 39% 35%, #DFE7FF 50%, transparent 100%),
    radial-gradient(1px 1px at 64% 38%, #E8EFFF 50%, transparent 100%),
    radial-gradient(2px 2px at 89% 42%, #FFFFFF 50%, transparent 100%),
    radial-gradient(1px 1px at 19% 47%, #E8EFFF 50%, transparent 100%);
}

/* Dusk: a warm sun disc sitting in the upper-right with a wide soft halo
   that bleeds into the orange sky behind it. */
:root[data-theme="dusk"] body::after {
  opacity: 1;
  background-image:
    radial-gradient(circle at 82% 18%,
      #FFE08C 0,
      #FFD56B 48px,
      rgba(255, 180, 90, 0.55) 70px,
      rgba(255, 150, 70, 0.30) 110px,
      rgba(255, 130, 50, 0.10) 170px,
      transparent 220px);
}

/* --- Pisces constellation, visible only on the night theme --- */
.constellation {
  position: absolute;
  /* Anchored inside .hero-wrap, in % of the hero image — so Pisces always
     sits just above the TV-tower tip (~25% / 39% of the image) regardless
     of screen size. */
  top: 5%;
  left: 4%;
  width: 21%;
  height: auto;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
}
:root[data-theme="night"] .constellation { opacity: 0.85; }

/* Pisces stars light up one by one, then fade back together.
   The JS toggles .lit; CSS handles the actual glow + timing. */
.constellation circle {
  transition: filter 0.5s ease;
}
.constellation circle.lit {
  filter: drop-shadow(0 0 2px #FFFFFF) drop-shadow(0 0 5px #B4A4FF);
}
.constellation circle.fading {
  transition: filter 5s ease;   /* slow collective fade-out */
}

/* Twinkling background stars — a sparse layer of single dots that
   pulse at random intervals. Only visible on the night theme. */
.twinkle-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}
:root[data-theme="night"] .twinkle-layer { opacity: 1; }
.twinkle-star {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #FFFFFF;
  animation: twinkle ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50%      { opacity: 1; transform: scale(2); box-shadow: 0 0 5px #E8EFFF; }
}

/* --- Retro gimmick: a fly buzzes across in the dusk theme --- */
.fly {
  position: fixed;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  z-index: 90;
  pointer-events: none;
  animation: fly-path 17s linear forwards;
}
.fly svg { width: 100%; height: 100%; display: block; }
/* Each waypoint has two keyframes: a quick dart to the spot, then a
   longer hover where the fly only drifts a hair. Reads as: zip — pause —
   zip — pause, the way a real fly behaves. */
@keyframes fly-path {
  0%   { transform: translate(-6vw, 32vh) rotate(20deg);  }
  7%   { transform: translate(20vw, 14vh) rotate(-22deg); }  /* dart */
  19%  { transform: translate(21vw, 15vh) rotate(-15deg); }  /* hover */
  26%  { transform: translate(11vw, 42vh) rotate(48deg);  }  /* dart */
  39%  { transform: translate(12vw, 41vh) rotate(43deg);  }  /* hover */
  45%  { transform: translate(46vw, 24vh) rotate(-10deg); }  /* dart */
  58%  { transform: translate(45vw, 25vh) rotate(-3deg);  }  /* hover */
  64%  { transform: translate(63vw, 47vh) rotate(33deg);  }  /* dart */
  77%  { transform: translate(64vw, 46vh) rotate(27deg);  }  /* hover */
  83%  { transform: translate(52vw, 13vh) rotate(-18deg); }  /* dart */
  94%  { transform: translate(53vw, 14vh) rotate(-11deg); }  /* hover */
  100% { transform: translate(112vw, 30vh) rotate(15deg); }  /* exit */
}
/* wings flutter — a fast little wobble layered on the body */
.fly .wings {
  transform-origin: center;
  animation: fly-wings 0.08s steps(2) infinite;
}
@keyframes fly-wings {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0.4); }
}

/* --- Drifting cloud, sky theme: a soft white cloud crosses very slowly --- */
.cloud {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  width: 150px;
  height: auto;
  opacity: 0.85;
  filter: blur(0.4px);
  animation: cloud-drift linear forwards;
}
@keyframes cloud-drift {
  from { transform: translateX(-22vw); }
  to   { transform: translateX(122vw); }
}

/* --- Shooting star: pixelated streak across the night sky every ~4 min --- */
.shooting-star {
  position: fixed;
  top: var(--start-y, 12vh);
  left: -8vw;
  z-index: 1;
  pointer-events: none;
  display: flex;
  flex-direction: row-reverse;     /* brightest pixel leads */
  align-items: center;
  transform-origin: left center;
  animation: shoot var(--duration, 1.6s) linear forwards;
}
.shooting-star span {
  display: block;
  width: 5px;
  height: 5px;
  background: #FFFFFF;
  image-rendering: pixelated;
  flex: 0 0 auto;
}
@keyframes shoot {
  0%   { transform: rotate(var(--angle, 22deg)) translateX(0);     opacity: 0; }
  8%   { opacity: 1; }
  100% { transform: rotate(var(--angle, 22deg)) translateX(125vw); opacity: 0; }
}

/* --- RAIN overlay, only visible on the rain theme --- */
.rain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
  overflow: hidden;
}
:root[data-theme="rain"] .rain-overlay { opacity: 1; }

.raindrop {
  position: absolute;
  top: -10vh;
  width: 1.5px;
  height: 18px;
  background: linear-gradient(to bottom, transparent 0%, var(--ink) 50%, transparent 100%);
  animation: rainfall linear infinite;
  opacity: 0.55;
}
@keyframes rainfall {
  from { transform: translateY(-10vh); }
  to   { transform: translateY(115vh); }
}

/* --- MODAL for pictogram inline content (video / audio / idea) --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 12, 8, 0.65);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop.open { display: flex; animation: modal-fade 0.25s ease; }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: relative;
  background: var(--bg-end);
  color: var(--ink);
  border-radius: 16px;
  padding: 28px 28px 22px;
  max-width: 720px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  animation: modal-pop 0.3s ease;
}
@keyframes modal-pop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}
.modal-close:hover { background: var(--pictogram-hover-bg); }

.modal-icon { width: 60px; display: block; margin: 0 auto 8px; filter: var(--subject-filter); }
.modal-title { text-align: center; font-size: 20px; margin: 0 0 16px; color: var(--ink); font-weight: normal; letter-spacing: 0.05em; }

.modal-video iframe,
.modal-video video {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  border: none;
  background: #000;
}

/* Thumbnail-link fallback for videos that don't allow embedding */
.modal-video .video-thumb {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  transition: transform 0.25s ease;
}
.modal-video .video-thumb:hover { transform: scale(1.01); }
.modal-video .video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.modal-video .video-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #FFF;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 6px;            /* optical centring of the triangle */
  transition: background-color 0.2s ease;
}
.modal-video .video-thumb:hover .video-play { background: rgba(204, 24, 30, 0.85); }
.modal-video .video-hint {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
}

.modal-audio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 0 12px;
}
.modal-audio audio { width: 100%; }
.modal-audio .placeholder {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 14px;
}

.modal-idea {
  font-size: 18px;
  line-height: 1.7;
  padding: 4px 4px 8px;
}
.modal-idea .idea-line {
  font-family: var(--font-display);
  font-size: var(--size-headline);
  text-align: center;
  color: var(--ink);
  margin: 12px 0;
  letter-spacing: 0.02em;
}
.modal-idea .placeholder {
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  margin-top: 16px;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 60px 24px 40px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-height: 100vh;
}

/* ---- TITLE ---- */
.title { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.title-name    { width: min(560px, 75%); }
.title-tagline { width: min(380px, 55%); }

/* ---- HERO ---- */
.hero { display: flex; justify-content: center; margin: 8px 0 12px; }
.hero-wrap {
  position: relative;
  display: block;
  width: min(640px, 92%);
  margin: 0 auto;
  line-height: 0;
}
.hero-portrait {
  width: 100%;
  display: block;
  filter: var(--subject-filter) drop-shadow(0 8px 24px var(--shadow));
}

/* ---- PICTOGRAMS ---- */
.pictograms {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 8px;
}
/* The pictogram itself is the button — no padding, no background,
   no surrounding card. A subtle scale on hover does all the work. */
.pictogram-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: inherit;
}
.pictogram-link:focus { outline: none; }
.pictogram-link:focus-visible .pictogram {
  /* a thin halo for keyboard users, doesn't show on mouse hover */
  filter: var(--subject-filter) drop-shadow(0 0 6px var(--accent));
}
.pictogram {
  /* scales smoothly with the viewport instead of jumping at one breakpoint */
  width: clamp(72px, 17vw, 110px);
  height: clamp(72px, 17vw, 110px);
  object-fit: contain;
  transition: transform 0.25s ease;
}
.pictogram-link:hover .pictogram,
.pictogram-link:focus-visible .pictogram { transform: scale(1.12); }
/* Captions removed — pictograms speak for themselves */

/* ---- TEXT NAV (the original "Über mich  Portfolio  Kontakt") ---- */
.text-nav {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  margin-top: auto;
  padding: 16px 8px 0;
}
.text-nav a {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 8px;
  transition: background-color 0.25s ease, transform 0.25s ease;
}
.text-nav a:hover {
  background: var(--pictogram-hover-bg);
  transform: translateY(-1px);
}
/* All nav words rendered at the same content height (40px), regardless of
   how the original ChatGPT image was cropped. The asset files were
   tight-trimmed so this height maps directly to the actual lettering. */
.nav-word { height: clamp(24px, 5.5vw, 40px); width: auto; display: block; }

/* ---- subject illustration filter ---- */
.subject { filter: var(--subject-filter); }

/* ---- Legal footer ---- */
.legal-footer {
  margin-top: 24px;
  padding: 12px 0 0;
  text-align: center;
  font-family: var(--font-body);
  font-size: var(--size-meta);
  color: var(--ink-soft);
  letter-spacing: 0.05em;
  opacity: 0.75;
}
.legal-footer a {
  color: inherit;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.legal-footer a:hover { color: var(--ink); background: var(--pictogram-hover-bg); }
.legal-footer span { margin: 0 4px; opacity: 0.5; }

/* ---- THEME SWITCHER PILL ---- */
.theme-switcher {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10;
  display: flex;
  gap: 4px;
  padding: 6px;
  border-radius: 999px;
  background: var(--pictogram-hover-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--ink-soft);
}
.theme-switcher button {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  color: var(--ink);
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}
.theme-switcher button:hover { background: var(--pictogram-hover-bg); }
.theme-switcher button.active {
  background: var(--accent);
  color: var(--bg-start);
}

/* ---- responsive ----
   Most sizing is now fluid (clamp/min/%), so this block only handles
   spacing tweaks that don't lend themselves to a formula. */
@media (max-width: 600px) {
  .page { padding: 40px 16px 24px; gap: 24px; }
  .modal-backdrop { padding: 14px; }
  .modal { padding: 24px 18px 18px; }
}
