@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces-normal.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces-italic.woff2") format("woff2");
  font-weight: 300 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Quicksand";
  src: url("../assets/fonts/quicksand.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --ink: #222;
  --paper: #fdfcf9;
  --accent: #4b1fb5;
  --accent-light: #ece4fd;
  --serif: "Fraunces", Georgia, serif;
  --radius: 14px;
  --gap: clamp(12px, 2vw, 22px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 500 1.05rem/1.6 "Quicksand", system-ui, sans-serif;
}
body.no-scroll { overflow: hidden; }

img { max-width: 100%; height: auto; display: block; }

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

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 .6em;
}

/* Header */
.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(16px, 4vw, 40px) 20px 10px;
}
.logo img { width: min(560px, 88vw); height: auto; }
.logo .animated-logo { display: block; width: min(600px, 90vw); height: auto; overflow: visible; }
.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 28px;
  margin-top: 10px;
  font-weight: 700;
  font-size: .95rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.main-nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 4px 2px;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 0 3px no-repeat;
  transition: background-size .25s;
}
.main-nav a:hover, .main-nav a:focus-visible { background-size: 100% 3px; }

/* Filter */
.works { padding: 20px var(--gap) 60px; max-width: 1500px; margin: 0 auto; scroll-margin-top: 10px; }
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 28px;
}
.chip {
  font: 700 .95rem "Quicksand", sans-serif;
  border: none;
  background: var(--accent-light);
  color: var(--accent);
  padding: 7px 18px;
  border-radius: 99px;
  cursor: pointer;
  transition: transform .15s, background .15s, color .15s;
}
.chip:hover { transform: rotate(-3deg); background: #ddd0fb; }
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* Grid */
.grid { display: flex; gap: var(--gap); align-items: flex-start; }
.grid-col { flex: 1; min-width: 0; }
.card {
  position: relative;
  display: block;
  margin-bottom: var(--gap);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--accent-light);
  color: #fff;
  text-decoration: none;
  transition: transform .2s ease;
}
.card img { width: 100%; height: auto; transition: transform .4s ease; }
.card:hover, .card:focus-visible { transform: rotate(-1deg) scale(1.01); }
.card:nth-child(even):hover, .card:nth-child(even):focus-visible { transform: rotate(1deg) scale(1.01); }
.card:hover img { transform: scale(1.04); }
.card-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 40px 14px 12px;
  background: linear-gradient(transparent, rgba(20, 20, 40, .75));
  font-size: .95rem;
  opacity: 0;
  transition: opacity .2s;
}
.card-caption strong { font-family: var(--serif); font-weight: 600; }
.card:hover .card-caption, .card:focus-visible .card-caption { opacity: 1; }
.badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: .8rem;
  padding: 2px 9px;
  border-radius: 99px;
}
.card.missing { min-height: 220px; }
.card.missing img { display: none; }
.card.missing .card-caption { opacity: 1; color: var(--ink); background: none; }

/* About */
.about { background: var(--accent); color: #fff; }
.about-inner {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(32px, 6vw, 90px);
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(60px, 9vw, 120px) 24px;
}
.about-photo { margin: 0; justify-self: center; transform: rotate(-3deg); max-width: 440px; }
.about-photo img { background: #fdf8ee; padding: 12px; box-shadow: 0 20px 40px rgba(15, 10, 70, .35); }
.about-photo figcaption { margin-top: 10px; text-align: right; font-size: .8rem; color: rgba(255, 255, 255, .75); }
.eyebrow { margin: 0 0 14px; font-size: .8rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .85); }
.about h2 { font-size: clamp(2.6rem, 6vw, 4.4rem); font-weight: 500; letter-spacing: -0.02em; }
.about h2 em { font-style: italic; color: var(--yellow); }
.about-text p { max-width: 34em; }
.about-text a { color: var(--yellow); }
.about-text .text-link {
  display: inline-block;
  margin-top: 12px;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  padding-bottom: 4px;
  border-bottom: 2px solid currentColor;
  transition: color .15s;
}
.about-text .text-link:hover { color: var(--yellow); }

.about-photo figcaption a { color: inherit; text-underline-offset: 3px; }

/* Contact */
.contact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(24px, 5vw, 70px);
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(60px, 9vw, 120px) 24px;
}
.contact h2 { font-size: clamp(2rem, 4.5vw, 3.2rem); color: var(--accent); }
.social { list-style: none; padding: 0; margin: 24px 0 0; display: flex; gap: 14px; }
.social a { display: block; width: 46px; height: 46px; color: var(--accent); transition: transform .15s, color .15s; }
.social a:hover, .social a:focus-visible { transform: rotate(-8deg) scale(1.08); color: var(--accent); }
.social svg { width: 100%; height: 100%; display: block; }
.card-stack { position: relative; width: min(100%, 420px); aspect-ratio: 1 / 1.15; margin: 0 auto; }
.biz { position: absolute; height: auto; border-radius: 10px; box-shadow: 0 7px 18px rgba(0, 0, 0, .16); will-change: transform; }
.biz-back { left: 5%; top: 4%; width: 72%; transform: rotate(-9deg); }
.biz-front { left: 22%; top: 32%; width: 76%; transform: rotate(7deg); }
.card-stack.motion-ready .biz { opacity: 0; }
.card-stack.motion-ready .biz-back { transform: translate(-40px, -120%) rotate(-24deg); }
.card-stack.motion-ready .biz-front { transform: translate(60px, -140%) rotate(30deg); }
.card-stack.motion-ready.is-visible .biz { opacity: 1; transition: transform 1.1s cubic-bezier(.22, 1, .36, 1), opacity .35s ease; }
.card-stack.motion-ready.is-visible .biz-back { transform: rotate(-9deg); }
.card-stack.motion-ready.is-visible .biz-front { transform: rotate(7deg); transition-delay: .2s; }

/* Footer */
.site-footer {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 24px;
  font-size: .9rem;
}
.site-footer a { color: var(--ink); }

/* Detail dialog */
.work-dialog {
  width: min(1300px, 96vw);
  height: min(92vh, 1200px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: none;
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}
.work-dialog::backdrop { background: rgba(40, 30, 80, .55); backdrop-filter: blur(3px); }
.dialog-close {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  appearance: none;
  cursor: pointer;
}
.dialog-close svg { display: block; width: 24px; height: 24px; flex: none; }
.dialog-close:hover { background: var(--accent); }
.work-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr);
  height: 100%;
}
.work-images {
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: #fff;
}
.work-images img { width: auto; max-width: 100%; max-height: calc(min(92vh, 1200px) - 120px); height: auto; border-radius: 10px; margin: 0 auto; }
.scroll-hint {
  position: sticky;
  bottom: 18px;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: -8px;
  padding: 10px 18px;
  border: none;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font: 700 .95rem "Quicksand", sans-serif;
  box-shadow: 0 8px 20px rgba(40, 30, 120, .3);
  cursor: pointer;
  transition: opacity .3s, transform .3s;
}
.scroll-hint svg { width: 18px; height: 18px; animation: nudge 1.2s ease-in-out infinite; }
.scroll-hint.is-hidden { opacity: 0; transform: translateY(10px); pointer-events: none; }
@keyframes nudge { 50% { transform: translateY(4px); } }
.work-info {
  min-width: 0;
  overflow-wrap: anywhere;
  hyphens: auto;
  overflow-y: auto;
  padding: 70px 32px 32px;
  display: flex;
  flex-direction: column;
}
.work-meta { color: var(--accent); font-weight: 700; font-size: .9rem; margin: 0 0 8px; }
.work-info h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); max-width: 100%; }
.work-links { padding-left: 1.1em; }
.work-links a { font-weight: 700; }
.work-nav { margin-top: auto; display: flex; justify-content: space-between; gap: 10px; padding-top: 24px; }
.work-nav button {
  font: 700 .95rem "Quicksand", sans-serif;
  border: 2px solid var(--ink);
  background: transparent;
  padding: 6px 14px;
  border-radius: 99px;
  cursor: pointer;
}
.work-nav button:hover { background: var(--ink); color: #fff; }

@media (max-width: 760px) {
  .about-inner { grid-template-columns: 1fr; }
  .about-photo { max-width: 340px; }
  .work-dialog { width: 100vw; height: 100dvh; border-radius: 0; }
  .work-images img { max-height: none; width: 100%; }
  .work-detail { display: block; height: 100%; overflow-y: auto; }
  .work-images, .work-info { overflow: visible; padding: 16px; }
  .work-info { padding-top: 8px; }
  .card-caption { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; animation: none !important; }
}

/* Legal page */
.legal { max-width: 760px; margin: 0 auto; padding: 20px 24px 60px; }
.legal h1 { color: var(--accent); }
.legal h2 { font-size: 1.3rem; margin-top: 1.6em; }

.nav-shell { position: sticky; top: 0; z-index: 30; background: var(--paper); transition: box-shadow .25s; }
.nav-inner { position: relative; max-width: 1500px; margin: auto; min-height: 62px; display: flex; align-items: center; justify-content: center; padding: 8px 62px; }
.nav-shell .main-nav { margin: 0; }
.mini-logo { position: absolute; left: 20px; width: 36px; opacity: 0; visibility: hidden; transform: translateY(5px); transition: opacity .25s, transform .25s, visibility .25s; }
.nav-shell.is-stuck { box-shadow: 0 1px 0 #4b1fb51c, 0 5px 20px #22222208; }
.nav-shell.is-stuck .mini-logo { opacity: 1; visibility: visible; transform: translateY(0); }
#arbeiten, #about, #kontakt { scroll-margin-top: 78px; }
@media (max-width: 600px) {
  .nav-inner { min-height: 58px; padding: 9px 12px 9px 50px; }
  .nav-shell .main-nav { gap: 4px 12px; font-size: .7rem; letter-spacing: .045em; }
  .mini-logo { left: 12px; width: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .mini-logo, .nav-shell { transition: none; }
}
/* A short mechanical shuffle; the pencil remains completely still. */
.logo-is-drawing .logo-star { animation: star-shuffle 1.05s steps(1, end) both; }
.logo-is-drawing .star-0 { --star-step: 14px; animation-delay: 0s; }
.logo-is-drawing .star-1 { --star-step: -10px; animation-delay: .09s; }
.logo-is-drawing .star-2 { --star-step: 12px; animation-delay: .04s; }
.logo-is-drawing .star-3 { --star-step: -15px; animation-delay: .13s; }
@keyframes star-shuffle {
  0%, 18% { transform: translateX(var(--star-step)); }
  36% { transform: translateX(calc(var(--star-step) * -.7)) translateY(-5px); }
  54% { transform: translateX(calc(var(--star-step) * .45)) translateY(3px); }
  72% { transform: translateX(calc(var(--star-step) * -.2)); }
  90%, 100% { transform: none; }
}
.nav-shell.is-stuck .main-nav { font-size: .76rem; letter-spacing: .07em; font-weight: 500; color: #555; }
.mini-logo img { transform: rotate(var(--scroll-turn, 0deg)); }
.work-info h2.manual-hyphen { hyphens: manual; }
@media (max-width: 600px) { .nav-shell.is-stuck .main-nav { font-size: .65rem; letter-spacing: .035em; } }
@media (prefers-reduced-motion: no-preference) {
  .animated-logo:not(.logo-is-drawing) .logo-star { opacity: 0; }
}
