/* =========================================================
   Joscha Tschanz — Startseite
   Ein Foto, eine gruppierte Liste. Systemschrift, Hairlines,
   sofortiges Press-Feedback, kein Overshoot.
   (styles.css gehört weiterhin dem Portfolio.)
   ========================================================= */

:root {
  color-scheme: dark;
  --bg: #000;
  --surface: #1c1c1e;
  --surface-pressed: #2c2c2e;
  --hairline: rgba(255, 255, 255, 0.1);
  --text: #f5f5f7;
  --text-secondary: rgba(235, 235, 245, 0.6);
  --accent: #4c9dff;

  --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
  --radius: 1.5rem;
}

.theme-light {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #fff;
  --surface-pressed: #e8e8ed;
  --hairline: rgba(0, 0, 0, 0.08);
  --text: #1d1d1f;
  --text-secondary: rgba(60, 60, 67, 0.6);
  --accent: #0a66c2;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto,
    sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.45s ease, color 0.45s ease;
}

::selection {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}

/* =============== LAYOUT =============== */
.page {
  width: min(100% - 2rem, 28rem);
  margin-inline: auto;
  padding-block: max(1rem, env(safe-area-inset-top)) max(2rem, env(safe-area-inset-bottom));
}

/* =============== HERO =============== */
/* Foto-Stapel, darunter Name und Kontakt: ein Block, eine Mitte */
.hero {
  display: grid;
  justify-items: center;
  gap: 1.75rem;
  padding-top: 2.5rem;
  margin-bottom: 2.25rem;
  text-align: center;
}

.hero__text {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
}

.hero__name {
  font-size: clamp(2rem, 9vw, 2.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.hero__bio {
  max-width: 19rem;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text-secondary);
  text-wrap: balance;
}

.contact {
  margin-top: 0.625rem;
  padding: 0.625rem 1.5rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.006em;
  text-decoration: none;
}

/* =============== LISTE =============== */
.links {
  margin-top: 1rem;
}

.links ul {
  list-style: none;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
}

/* Trennlinie beginnt beim Text, nicht beim Icon; die Zeile selbst läuft randlos */
.links li + li {
  border-top: 1px solid var(--hairline);
  margin-left: 3.375rem;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-left: -3.375rem;
  padding: 0.8125rem 1rem;
  color: var(--text);
  text-decoration: none;
}

.links li:first-child .row {
  margin-left: 0;
}

.row__icon {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--text-secondary);
}

.row__text {
  flex: 1;
  min-width: 0;
}

.row__title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.row__sub {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--text-secondary);
}

.row::after {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-top: 2px solid var(--text-secondary);
  border-right: 2px solid var(--text-secondary);
  border-radius: 1px;
  opacity: 0.55;
  transform: rotate(45deg);
  transition: transform 0.4s var(--ease-out), opacity 0.4s var(--ease-out);
}

/* =============== FOTO-STAPEL =============== */
.stack {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 1.5rem;
}

.stack__deck {
  position: relative;
  width: min(72%, 17rem);
  aspect-ratio: 4 / 5;
  padding: 0;
  border: 0;
  border-radius: 1.5rem;
  background: none;
  cursor: grab;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
.stack__deck:active { cursor: grabbing; }
.stack__deck:focus-visible { outline: 2px solid var(--accent); outline-offset: 12px; }

.stack__card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1.5rem;
  background: var(--surface);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.14);
  transition: transform 0.32s cubic-bezier(0.33, 0, 0.67, 1), opacity 0.32s;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.stack__card[data-pos="0"] { z-index: 4; object-position: 50% 35%; }
.stack__card[data-pos="1"] { z-index: 3; transform: translate(14px, -10px) rotate(5deg) scale(0.95); }
.stack__card[data-pos="2"] { z-index: 2; transform: translate(-14px, -16px) rotate(-6deg) scale(0.9); }
.stack__card[data-pos="3"] { z-index: 1; transform: translate(-14px, -16px) rotate(-6deg) scale(0.9); opacity: 0; }

.stack__dots { display: flex; gap: 0.5rem; }
.stack__dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hairline);
  transition: background-color 0.3s;
}
.stack__dots .is-on { background: var(--text); }

/* =============== FEEDBACK =============== */
.pressable {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.4s var(--ease-out), background-color 0.4s var(--ease-out);
}

/* Schnell rein, langsam raus */
.pressable.is-pressed {
  transition-duration: 0.1s;
}
.contact.is-pressed {
  transform: scale(0.96);
}
.row.is-pressed {
  background: var(--surface-pressed);
}

@media (hover: hover) and (pointer: fine) {
  .row:hover {
    background: var(--surface-pressed);
  }
  .row:hover::after {
    transform: translateX(2px) rotate(45deg);
    opacity: 1;
  }
}

.row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.contact:focus-visible,
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* =============== THEME-TOGGLE =============== */
.theme-toggle {
  position: fixed;
  top: max(1.75rem, calc(env(safe-area-inset-top) + 0.75rem));
  right: max(1.75rem, calc((100vw - 28rem) / 2 + 0.75rem));
  z-index: 100;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle__icons {
  position: relative;
  width: 1.125rem;
  height: 1.125rem;
}

.theme-toggle svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.32s var(--ease-out), transform 0.42s var(--ease-out);
}

.icon-sun {
  opacity: 0;
  transform: rotate(-70deg) scale(0.6);
}
.theme-light .icon-sun {
  opacity: 1;
  transform: none;
}
.theme-light .icon-moon {
  opacity: 0;
  transform: rotate(70deg) scale(0.6);
}

/* =============== EINBLENDEN =============== */
.reveal {
  animation: reveal 0.6s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* =============== BARRIEREFREIHEIT =============== */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    animation: fade-in 0.28s ease both;
  }
  .pressable,
  .row::after,
  .theme-toggle svg {
    transition: opacity 0.2s ease, background-color 0.2s ease !important;
  }
  .contact.is-pressed {
    transform: none !important;
  }
  .row:hover::after {
    transform: rotate(45deg) !important;
  }
  .icon-sun,
  .theme-light .icon-moon {
    transform: none;
  }
  @keyframes fade-in {
    from {
      opacity: 0;
    }
  }
}


@media (prefers-contrast: more) {
  :root {
    --text-secondary: rgba(235, 235, 245, 0.88);
    --hairline: rgba(255, 255, 255, 0.5);
  }
  .theme-light {
    --text-secondary: rgba(28, 28, 30, 0.9);
    --hairline: rgba(0, 0, 0, 0.45);
  }
}
