/* kraus.cx – v4 (v3 ohne Formular-Cursor): Design aus v1 + Aufbau-Animation aus v2 (unten). Ältere Stände: versions/ */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1c1d1f;
  --muted: #62656b;
  --line: #e3e1da;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --ok-bg: #e6f3ee;
  --ok-text: #17573f;
  --err-bg: #fbeaea;
  --err-text: #9b2c2c;
  --code-bg: #f0eee8;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416;
    --surface: #1a1d20;
    --text: #e7e7e4;
    --muted: #9a9ea4;
    --line: #2b2f33;
    --accent: #5cc7a8;
    --accent-ink: #0d1a16;
    --ok-bg: #15302a;
    --ok-text: #8fe0c6;
    --err-bg: #3a1c1c;
    --err-text: #f2a8a8;
    --code-bg: #101214;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 4rem 1.25rem 3rem;
}

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

h1, h2 { line-height: 1.2; margin: 0 0 .75rem; }
h1 { font-size: clamp(2rem, 5vw, 2.6rem); letter-spacing: -.02em; }
h2 {
  font-family: var(--mono);
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.dim { color: var(--muted); }

/* Hero */
.hero { margin-bottom: 2.5rem; }
.prompt {
  font-family: var(--mono);
  color: var(--accent);
  margin: 0 0 .5rem;
  font-size: .95rem;
}
.cursor {
  display: inline-block;
  width: .55em;
  height: 1.05em;
  margin-left: .15em;
  vertical-align: -.15em;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }
.lede { color: var(--muted); font-size: 1.08rem; max-width: 36rem; margin: 0; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Form */
.row { display: grid; gap: 0 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 34rem) { .row { grid-template-columns: 1fr; } }

.field { margin-bottom: 1rem; }
label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .35rem; }

input, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .6rem .75rem;
}
textarea { resize: vertical; min-height: 9rem; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[aria-invalid="true"] { border-color: var(--err-text); }
.field-err { color: var(--err-text); font-size: .88rem; margin: .3rem 0 0; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; }
button {
  font: inherit;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  padding: .65rem 1.2rem;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
.hint { flex: 1 1 16rem; margin: 0; font-size: .85rem; color: var(--muted); }

.notice { border-radius: 8px; padding: .75rem 1rem; margin: 0 0 1rem; }
.notice.ok { background: var(--ok-bg); color: var(--ok-text); }
.notice.err { background: var(--err-bg); color: var(--err-text); }

/* PGP */
.card p { margin: 0 0 .9rem; }
.fpr { display: flex; flex-direction: column; gap: .25rem; }
.fpr .label { font-size: .8rem; color: var(--muted); }
code, pre { font-family: var(--mono); }
.fpr code { font-size: .95rem; word-break: break-word; }
.btn-ghost {
  display: inline-block;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: .5rem 1rem;
}
.btn-ghost:hover { background: var(--code-bg); }
.cmd {
  margin: 0;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .7rem .9rem;
  overflow-x: auto;
  font-size: .88rem;
}

/* Projekte */
#projekte { margin: 2.5rem 0 1.5rem; }
.projects { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 34rem) { .projects { grid-template-columns: 1fr; } }
.projects a {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  transition: border-color .15s, transform .15s;
}
.projects a:hover { border-color: var(--accent); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .projects a { transition: none; } .projects a:hover { transform: none; } }
.p-title { font-weight: 700; }
.p-url { font-family: var(--mono); font-size: .82rem; color: var(--accent); margin-bottom: .5rem; }
.p-desc { font-size: .92rem; color: var(--muted); }

/* Footer */
.foot { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.foot p { margin: 0 0 .5rem; }

/* =====================================================================
   v3: Aufbau-Animation aus v2 (Terminal-Effekt) auf dem v1-Design.
   Nur CSS – die CSP der App erlaubt kein JavaScript. Gesamtdauer ~1,5 s.
   ===================================================================== */

:root { --char: 28ms; }   /* Tippgeschwindigkeit pro Zeichen */

/* Einschalten: kurzer Strich in der Bildschirmmitte, der aufgeht und verlischt */
html::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background: var(--accent);
  opacity: 0;
  animation: crt-on .26s ease-out both;
}
@keyframes crt-on {
  0%   { opacity: .55; clip-path: inset(49.85% 50% 49.85% 50%); }
  45%  { opacity: .55; clip-path: inset(49.85% 0 49.85% 0); }
  100% { opacity: 0;   clip-path: inset(0 0 0 0); }
}

/* Prompt-Zeile: "~/kraus.cx" wird getippt, der Cursor wandert mit */
.prompt { display: flex; align-items: center; }
.cursor { flex: none; vertical-align: baseline; animation-delay: 1s; } /* beim Tippen ruhig */
.type {
  display: inline-block;
  animation: type calc(var(--n) * var(--char)) steps(var(--n), end) var(--d) backwards;
}
.t-prompt { --n: 10; --d: .28s; }
@keyframes type {
  from { width: 0;                    overflow: hidden; white-space: nowrap; }
  to   { width: calc(var(--n) * 1ch); overflow: hidden; white-space: nowrap; }
}

/* Überschrift: von links in 13 Schritten aufgedeckt (ein Schritt je Zeichen) */
.t-h1 {
  width: fit-content;
  animation: reveal calc(13 * var(--char)) steps(13, end) .62s backwards;
}
@keyframes reveal {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}

/* Blöcke erscheinen nacheinander, zeilenweise von oben */
.out { animation: print .16s steps(6, end) var(--d) backwards; }
.o1 { --d: 1.00s; }
.o2 { --d: 1.08s; }
.o3 { --d: 1.18s; }
.o4 { --d: 1.26s; }
.o5 { --d: 1.32s; }
@keyframes print {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0 0 0 0); }
}

/* Nach dem Absenden (Danke / Fehler) nicht noch einmal aufbauen */
html:has(.notice, .field-err)::after { display: none; }
html:has(.notice, .field-err) .type,
html:has(.notice, .field-err) .t-h1,
html:has(.notice, .field-err) .out { animation: none; }

/* Formular: nur der normale Cursor, in Akzentfarbe (ein einziger blinkender
   Cursor auf der Seite ist der hinter ~/kraus.cx) */
input, textarea { caret-color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  html::after { display: none; }
  .type, .t-h1, .out { animation: none; }
}
