/* ─── Fonts ─────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Sohne';
  src: url('font/sohne-web-buch.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: 'Sohne';
  src: url('font/sohne-web-buch-kursiv.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
}
@font-face {
  font-family: 'Sohne';
  src: url('font/sohne-web-kraftig.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
}
@font-face {
  font-family: 'Sohne';
  src: url('font/sohne-web-kraftig-kursiv.ttf') format('truetype');
  font-weight: 500;
  font-style: italic;
}
@font-face {
  font-family: 'Sohne';
  src: url('font/sohne-web-halbfett.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
}

/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:             hsl(0, 0%, 98%);
  --text-primary:   hsl(0, 0%, 5%);
  --text-secondary: hsl(0, 0%, 23%);
  --text-tertiary:  #a1a1aa;
  --hover-bg:       #f4f4f5;
  --font:           'Sohne', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-img:     12px;
  --container-max:  960px;
}

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

/* ─── Base ───────────────────────────────────────────────────────────────── */
html {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 100vw;
  overflow-x: clip;
}

/* ─── Container ──────────────────────────────────────────────────────────── */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 48px;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 32px;
  flex-shrink: 0;
}

.avatar-wrap {
  margin-bottom: 21px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.role {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-tertiary);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 15px;
  font-weight: 400;
  color: #a1a1aa;
  margin-top: 24px;
}

.header-nav a,
.role a {
  color: #a1a1aa;
  text-decoration: underline;
  text-decoration-color: #eeeff2;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s ease;
}

.about-text a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-color: #eeeff2;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s ease;
}

.header-nav a:hover,
.role a:hover {
  text-decoration-color: #ced0d4;
}

.about-text a:hover {
  text-decoration-color: #ced0d4;
}

.nav-dot {
  color: var(--text-tertiary);
  user-select: none;
}

.header-nav a.nav-current {
  color: #a1a1aa;
  text-decoration-color: #ced0d4;
}

.page-body {
  padding: 54px 0 48px;
  flex: 1;
}

/* ─── Two-Column Layout ──────────────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 45fr 55fr;
  gap: 0 5%;
}

.col-left {
  padding: 54px 0 48px;
  min-width: 0;
}

.col-right {
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: start;
  display: flex;
  align-items: center;
}

/* ─── Section Labels ─────────────────────────────────────────────────────── */
.section-label {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  margin-top: 0;
}

/* ─── Project List ───────────────────────────────────────────────────────── */
.project-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0 -16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.project-row {
  padding: 8px 12px 8px 16px;
  margin: 0 0 10px;
  border-radius: 16px;
  cursor: default;
  transition: all 0.2s cubic-bezier(.4, 0, .2, 1);
  opacity: 0;
  animation: about-enter 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  position: relative;
  --dx: 0px;
  --dy: 0px;
}

.project-row::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.10),
    0 0 0 1px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  pointer-events: none;
  opacity: 0;
  transform: translate(var(--dx), var(--dy));
  transition: opacity 0.2s ease;
}

.project-row.row-active::before {
  opacity: 1;
}

.project-row.row-active .project-title {
  transform: translate(calc(var(--dx) * 0.3), calc(var(--dy) * 0.3));
}

.project-row.row-active .project-meta,
.project-row.row-active .project-brief {
  display: block;
  transform: translate(calc(var(--dx) * 0.3), calc(var(--dy) * 0.3));
}

.project-row:nth-child(1)  { animation-delay: 0.05s; }
.project-row:nth-child(2)  { animation-delay: 0.11s; }
.project-row:nth-child(3)  { animation-delay: 0.17s; }
.project-row:nth-child(4)  { animation-delay: 0.23s; }
.project-row:nth-child(5)  { animation-delay: 0.29s; }
.project-row:nth-child(6)  { animation-delay: 0.35s; }
.project-row:nth-child(7)  { animation-delay: 0.41s; }
.project-row:nth-child(8)  { animation-delay: 0.47s; }
.project-row:nth-child(9)  { animation-delay: 0.53s; }
.project-row:nth-child(10) { animation-delay: 0.59s; }
.project-row:nth-child(11) { animation-delay: 0.65s; }
.project-row:nth-child(12) { animation-delay: 0.71s; }
.project-row:nth-child(13) { animation-delay: 0.77s; }

.project-row.row-active {
}

.project-title {
  display: block;
  width: fit-content;
  font-size: 15px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-color: #eeeff2;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.project-meta {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.project-brief {
  display: block;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-tertiary);
  margin-top: 4px;
  line-height: 1.5;
}

/* ─── Preview Pane ───────────────────────────────────────────────────────── */
.preview-pane {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-img);
  overflow: hidden;
}

.preview-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-img);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.preview-img.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── About Section ──────────────────────────────────────────────────────── */
@keyframes about-enter {
  0% {
    opacity: 0;
    filter: blur(6px);
    transform: translateY(18px);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

.about-section {
  margin-top: 48px;
}

.about-text {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 380px;
  padding-bottom: 12px;
  opacity: 0;
  animation: about-enter 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.about-text:nth-child(1) { animation-delay: 0.05s; }
.about-text:nth-child(2) { animation-delay: 0.15s; }
.about-text:nth-child(3) { animation-delay: 0.25s; }
.about-text:nth-child(4) { animation-delay: 0.35s; }
.about-text:nth-child(5) { animation-delay: 0.45s; }

/* ─── Connect Section ────────────────────────────────────────────────────── */
.connect-section {
  margin-top: 48px;
}

.social-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.social-list li {
  opacity: 0;
  animation: about-enter 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.social-list li:nth-child(1) { animation-delay: 0.05s; }
.social-list li:nth-child(2) { animation-delay: 0.15s; }
.social-list li:nth-child(3) { animation-delay: 0.25s; }
.social-list li:nth-child(4) { animation-delay: 0.35s; }

.social-link {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid #eeeff2;
  transition: border-bottom-color 0.2s ease;
}

.social-link:hover {
  border-bottom-color: #ced0d4;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: 30px;
  padding-bottom: 24px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.nav-chat-link {
  display: none;
}

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .container {
    padding: 0 24px;
  }

  .two-col {
    grid-template-columns: 1fr;
    min-height: unset;
  }

  .col-left {
    position: static;
    height: auto;
    overflow-y: visible;
    padding-top: 54px;
    padding-bottom: 40px;
  }

  .col-right {
    display: none;
  }

  .two-col--index .col-right {
    display: flex;
    padding-bottom: 40px;
  }
}

/* ─── Index Two-Column Layout ────────────────────────────────────────────── */
.two-col--index {
  grid-template-columns: 1fr 1fr;
}

.index-layout {
  padding: 54px 0 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.two-col--index .col-left {
  padding-top: 0;
  padding-bottom: 0;
}

.col-right--top {
  position: static;
  height: auto;
  align-items: flex-start;
}

.two-col--index .about-section {
  margin-top: 0;
}

.two-col--index .chat-section {
  margin-top: 0;
  max-width: none;
  width: 100%;
}

/* ─── Chat Section ───────────────────────────────────────────────────────── */
.chat-section {
  margin-top: 40px;
  max-width: 380px;
}

.api-key-note {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.api-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid #eeeff2;
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.api-key-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-secondary);
}

.api-key-input::placeholder {
  color: var(--text-tertiary);
}

.api-key-save {
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-tertiary);
  padding: 0;
  transition: color 0.2s ease;
}

.api-key-save:hover {
  color: var(--text-secondary);
}

.api-key-hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

@keyframes dot-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-5px); }
}

.chat-loading {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  height: 1.6em;
}

.chat-loading span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: dot-bounce 1.2s ease-in-out infinite;
}

.chat-loading span:nth-child(1) { animation-delay: 0s; }
.chat-loading span:nth-child(2) { animation-delay: 0.2s; }
.chat-loading span:nth-child(3) { animation-delay: 0.4s; }

#chat-wrap {
  opacity: 0;
  animation: about-enter 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 0.05s;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.chat-messages::-webkit-scrollbar {
  display: none;
}

.chat-msg {
  font-size: 14px;
  line-height: 1.6;
  opacity: 0;
  animation: about-enter 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.chat-msg--user {
  color: var(--text-tertiary);
  text-align: right;
}

.chat-msg--assistant {
  color: var(--text-secondary);
}

.chat-msg--assistant p {
  margin: 0 0 10px;
}

.chat-msg--assistant p:last-child {
  margin-bottom: 0;
}

.chat-msg--error {
  color: #e5534b;
}

.chat-msg a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-color: #eeeff2;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s ease;
}

.chat-msg a:hover {
  text-decoration-color: #ced0d4;
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 2px solid #eeeff2;
  padding-top: 12px;
}

.chat-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-secondary);
}

.chat-input::placeholder {
  color: var(--text-tertiary);
}

.chat-input:disabled {
  opacity: 0.5;
}

.chat-send {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: opacity 0.2s ease;
}

.chat-send img {
  display: block;
  opacity: 0.35;
}

.chat-send:hover img {
  opacity: 0.6;
}

.chat-sources {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  opacity: 0;
  animation: about-enter 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.chat-sources__favicons {
  display: flex;
  align-items: center;
}

.chat-sources__favicon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-left: -4px;
  object-fit: cover;
  background: #eeeff2;
}

.chat-sources__favicons .chat-sources__favicon:first-child {
  margin-left: 0;
}

.chat-sources__label {
  font-size: 12px;
  color: var(--text-tertiary);
}

.chat-suggestions {
  padding: 10px 0 8px;
  margin-top: 60px;
}

.chat-suggestions__label {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  margin: 0 0 15px;
}

.chat-suggestions__pills {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-suggestion-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid #eeeff2;
  border-radius: 10px;
  background: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-secondary);
  text-align: left;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.chat-suggestion-pill:hover {
  border-color: #ced0d4;
  color: var(--text-primary);
}

.chat-suggestion-pill__arrow {
  display: inline-block;
  flex-shrink: 0;
  font-size: 16px;
  color: var(--text-tertiary);
  line-height: 1;
}

/* ─── Mobile Chat Tab (≤480px) ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .nav-chat-link {
    display: inline;
  }

  .two-col--index {
    grid-template-columns: 1fr;
  }

  .two-col--index .col-right {
    display: none;
  }

  .index-layout.chat-tab .col-left {
    display: none;
  }

  .index-layout.chat-tab .col-right {
    display: flex;
    padding-bottom: 40px;
  }
}
