/* Termin-Button „Naht" – nach Figma „Tailor – Stitched Button Animation"
   Der Knopf ist ein Aufnäher: In Ruhe liegt er lose auf der Seite (leichte Wölbung, Schatten).
   Beim Hover läuft die Naht im Uhrzeigersinn herum (Sew 00…11), und im selben Takt wird der
   Aufnäher auf die Seite genäht: Er senkt sich, der Schatten wird flach. Danach wechseln die Farben (Fertig).
   Gedrückt: noch etwas tiefer. Themen: Messing (Standard auf dunkler Fläche), Elfenbein, Rand, Invertiert (helle Bereiche) */

@property --naht-farbe{syntax:'<color>';inherits:true;initial-value:#B8996A}

.btn{
  /* Messing */
  --bg:#B8996A;--fg:#0F141B;--naht:#0F141B;--rand:transparent;
  --bg-h:#CDB287;--fg-h:#0F141B;--naht-h:#0F141B;--rand-h:transparent;
  --naht-farbe:var(--naht);
  --naeh-dauer:.6s;
  /* Tiefe: Wölbung des Stoffs (Glanz), Stoffkante (innen), Schatten lose bzw. festgenäht.
     Beide Schattenlisten haben gleich viele Einträge, damit sie weich ineinander übergehen. */
  --glanz:linear-gradient(180deg,rgba(255,255,255,.16),rgba(255,255,255,0) 50%,rgba(15,20,27,.08));
  --kante:inset 0 1px 0 rgba(255,255,255,.34),inset 0 -1px 0 rgba(15,20,27,.18);
  --schatten:0 1px 2px rgba(0,0,0,.4),0 8px 18px -6px rgba(0,0,0,.6),0 18px 36px -16px rgba(0,0,0,.75);
  --schatten-fest:0 1px 1px rgba(0,0,0,.45),0 2px 5px -2px rgba(0,0,0,.4),0 0 0 rgba(0,0,0,0);
  position:relative;isolation:isolate;
  display:inline-flex;align-items:center;justify-content:center;
  min-height:52px;padding:0 44px;
  background-color:var(--bg);background-image:var(--glanz);color:var(--fg);
  border:1px solid var(--rand);border-radius:4px;
  box-shadow:var(--kante),var(--schatten);
  font:500 14px/1 Inter,system-ui,sans-serif;letter-spacing:.01em;text-transform:none;
  text-decoration:none;white-space:nowrap;cursor:pointer;
  transition:background-color .25s ease,color .25s ease,border-color .25s ease,--naht-farbe .25s ease,
    transform var(--naeh-dauer) cubic-bezier(.3,.6,.25,1),box-shadow var(--naeh-dauer) cubic-bezier(.3,.6,.25,1);
}
.btn-sm{min-height:44px;padding:0 24px}

/* Naht: nur ::after, erscheint erst beim Hover (in Ruhe keine Stiche) */
.btn::after{
  content:"";position:absolute;inset:3px;z-index:-1;pointer-events:none;border-radius:2px;
  background:
    linear-gradient(90deg,var(--naht-farbe) 6px,transparent 0) 4px 0 / 13px 2px repeat-x,
    linear-gradient(90deg,var(--naht-farbe) 6px,transparent 0) 4px 100% / 13px 2px repeat-x,
    linear-gradient(180deg,var(--naht-farbe) 6px,transparent 0) 0 5px / 2px 13px repeat-y,
    linear-gradient(180deg,var(--naht-farbe) 6px,transparent 0) 100% 5px / 2px 13px repeat-y;
}
.btn::after{
  -webkit-mask:var(--naht-maske);mask:var(--naht-maske);
  -webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;
  -webkit-mask-position:0 0,100% 0,100% 100%,0 100%;mask-position:0 0,100% 0,100% 100%,0 100%;
  -webkit-mask-size:0 2px,2px 0,0 2px,2px 0;mask-size:0 2px,2px 0,0 2px,2px 0;
  --naht-maske:linear-gradient(#000 0 0),linear-gradient(#000 0 0),linear-gradient(#000 0 0),linear-gradient(#000 0 0);
}

/* Nähen: oben → rechts → unten → links */
@keyframes naehen{
  0%  {-webkit-mask-size:0 2px,2px 0,0 2px,2px 0;mask-size:0 2px,2px 0,0 2px,2px 0}
  41% {-webkit-mask-size:100% 2px,2px 0,0 2px,2px 0;mask-size:100% 2px,2px 0,0 2px,2px 0}
  50% {-webkit-mask-size:100% 2px,2px 100%,0 2px,2px 0;mask-size:100% 2px,2px 100%,0 2px,2px 0}
  91% {-webkit-mask-size:100% 2px,2px 100%,100% 2px,2px 0;mask-size:100% 2px,2px 100%,100% 2px,2px 0}
  100%{-webkit-mask-size:100% 2px,2px 100%,100% 2px,2px 100%;mask-size:100% 2px,2px 100%,100% 2px,2px 100%}
}
.btn:hover::after,.btn:focus-visible::after{animation:naehen var(--naeh-dauer) linear forwards}

/* Festnähen: Während die Naht läuft, senkt sich der Aufnäher auf die Seite und der Schatten wird flach;
   die Hover-Farben kommen erst, wenn die Naht geschlossen ist (Fertig) */
.btn:hover,.btn:focus-visible{
  background-color:var(--bg-h);color:var(--fg-h);border-color:var(--rand-h);--naht-farbe:var(--naht-h);
  transform:translateY(1px);box-shadow:var(--kante),var(--schatten-fest);
  transition-delay:var(--naeh-dauer),var(--naeh-dauer),var(--naeh-dauer),var(--naeh-dauer),0s,0s;
}
/* Gedrückt: in den Stoff hineingedrückt */
.btn:active{
  background-color:var(--bg-h);color:var(--fg-h);border-color:var(--rand-h);--naht-farbe:var(--naht-h);
  transform:translateY(2px);
  box-shadow:inset 0 2px 3px rgba(15,20,27,.22),inset 0 -1px 0 rgba(255,255,255,.12),0 0 1px rgba(0,0,0,.4),0 0 0 rgba(0,0,0,0),0 0 0 rgba(0,0,0,0);
  transition-delay:0s;transition-duration:.08s;
}
.btn:active::after{animation:none;-webkit-mask-size:100% 2px,2px 100%,100% 2px,2px 100%;mask-size:100% 2px,2px 100%,100% 2px,2px 100%}
.btn[disabled]{opacity:.55;cursor:default;transform:none;box-shadow:var(--kante),var(--schatten-fest)}
.btn[disabled]::after{animation:none}

/* Themen */
.btn--elfenbein{
  --bg:#EFE9DC;--fg:#0F141B;--naht:#B8996A;
  --bg-h:#FFFFFF;--fg-h:#0F141B;--naht-h:#B8996A;
}
/* Rand: Nebenknopf ohne Fläche, deshalb in Ruhe ohne Wölbung und Schatten */
.btn--rand{
  --bg:transparent;--fg:#EFE9DC;--naht:#B8996A;--rand:#B8996A;
  --bg-h:#B8996A;--fg-h:#0F141B;--naht-h:#0F141B;--rand-h:#B8996A;
  --glanz:none;
  --kante:inset 0 0 0 rgba(0,0,0,0),inset 0 0 0 rgba(0,0,0,0);
  --schatten:0 0 0 rgba(0,0,0,0),0 0 0 rgba(0,0,0,0),0 0 0 rgba(0,0,0,0);
}
/* Invertiert (helle Bereiche): Der Aufnäher bleibt nach dem Festnähen dunkel und sichtbar;
   Schatten in Mitternachtsblau statt Schwarz, damit sie auf Elfenbein weich wirken */
.btn--invertiert,.kamera .btn,.b-termin .btn{
  --bg:#0F141B;--fg:#EFE9DC;--naht:#B8996A;--rand:transparent;
  --bg-h:#1C2430;--fg-h:#EFE9DC;--naht-h:#B8996A;--rand-h:transparent;
  --glanz:linear-gradient(180deg,rgba(255,255,255,.08),rgba(255,255,255,0) 50%,rgba(0,0,0,.14));
  --kante:inset 0 1px 0 rgba(255,255,255,.14),inset 0 -1px 0 rgba(0,0,0,.35);
  --schatten:0 1px 2px rgba(15,20,27,.3),0 8px 18px -6px rgba(15,20,27,.34),0 18px 36px -16px rgba(15,20,27,.42);
  --schatten-fest:0 1px 1px rgba(15,20,27,.4),0 2px 5px -2px rgba(15,20,27,.3),0 0 0 rgba(15,20,27,0);
}

@media (max-width:860px){
  .btn-sm{padding:0 16px;font-size:13px}
}
@media (max-width:520px){
  .hdr-r .btn-sm{padding:0 12px;font-size:12.5px;letter-spacing:0}
}
@media (prefers-reduced-motion:reduce){
  .btn,.btn::after{transition:none}
  .btn:hover,.btn:focus-visible{transform:none;transition-delay:0s}
  .btn:hover::after,.btn:focus-visible::after{animation:none;-webkit-mask-size:100% 2px,2px 100%,100% 2px,2px 100%;mask-size:100% 2px,2px 100%,100% 2px,2px 100%}
}
