/* ==========================================================================
   main.css — FES-Ehemalige feature-specific styles
   All values must use tokens from tokens.css.
   ========================================================================== */

/* ---------- Global Reset / Base ---------- */

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image: url("../img/bg_main.663197984372.jpg");
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
}

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

a {
  color: var(--color-link);
  font-weight: bold;
  text-decoration: none;
}

a:hover {
  color: var(--color-link-hover);
}

strong,
b {
  color: var(--color-text-strong);
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  color: var(--color-text-strong);
  margin: 15px 0 10px;
}

h1:first-child,
h2:first-child,
h3:first-child {
  margin-top: 0;
}

h1 { font-size: var(--text-4xl); line-height: 1em; }
h2 { font-size: var(--text-2xl); line-height: 1.125em; }
h3 { font-size: var(--text-base); line-height: var(--leading-tight); }

/* ---------- Modifier ---------- */

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-3 {
  margin-bottom: var(--space-3);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

/* ---------- Container ---------- */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* ---------- Skip Link (accessibility) ---------- */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: var(--fw-bold);
}

.skip-link:focus {
  top: var(--space-2);
}

/* ---------- Navbar Top (slim fixed bar) ---------- */

.navbar-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99;
  background: linear-gradient(to bottom, #44494c, #4f5559, #44494c);
  border-bottom: 1px solid #bdccd4;
}

.navbar-inner {
  width: 973px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-user-item {
  position: relative;
  height: 30px;
  line-height: 30px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0px -1px 0px #000;
  padding: 0 6px;
  margin: 10px 0 9px;
}

.nav-user-item a,
.nav-user-btn {
  color: #fff;
  text-decoration: none;
  text-shadow: 0px -1px 0px #000;
  cursor: pointer;
  line-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-user-item a:hover,
.nav-user-btn:hover {
  text-decoration: underline;
}

.nav-chevron {
  font-size: 10px;
}

.nav-user-dlm {
  color: #fff;
  text-shadow: 0px -1px 0px #000;
  line-height: 30px;
  padding: 0 2px;
}

/* Logout button styled as a nav link — no JS needed */
.nav-logout-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #fff;
  font-weight: bold;
  text-shadow: 0px -1px 0px #000;
  cursor: pointer;
  line-height: 30px;
}

.nav-logout-btn:hover {
  text-decoration: underline;
}

/* User dropdown subnav */
.nav-user-subnav {
  display: none;
  position: absolute;
  top: 30px;
  left: 0;
  right: 0;
  min-width: 120px;
  background: #fff;
  border: 1px solid #e4e4e4;
  border-bottom: 0 none;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.75);
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 100;
}

.nav-user-item--name:hover .nav-user-subnav {
  display: block;
}

.nav-user-subnav li a {
  display: block;
  padding: 0 12px;
  color: #4f5559;
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: normal;
  text-shadow: none;
  border-bottom: 1px solid #e4e4e4;
  white-space: nowrap;
}

.nav-user-subnav li a:hover {
  text-decoration: underline;
}

/* Nav functions: search + who is who — pushed to the right */
.nav-functions {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 30px;
  padding: 0 8px;
  margin: 10px 0 9px;
  margin-left: auto;
}

.nav-wikilink {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-weight: bold;
  text-decoration: none;
  text-shadow: 0px -1px 0px #000;
  white-space: nowrap;
  line-height: 30px;
  padding: 0 4px;
}

.nav-wikilink:hover {
  color: #fff;
  text-decoration: underline;
}

.nav-wikilink-icon {
  height: 22px;
  vertical-align: middle;
}

.nav-search-form {
  display: flex;
  align-items: center;
  background: var(--color-primary);
  border-radius: 15px;
  height: 30px;
  width: 289px;
}

.nav-search-input {
  flex: 1;
  height: 28px;
  margin: 1px 0 1px 1px;
  border-radius: 14px 0 0 14px;
  border: none;
  padding: 0 10px;
  font-size: 14px;
  color: #1e1e1f;
  background: #fff;
  outline: none;
}

.nav-search-input::placeholder {
  color: #90999e;
}

.nav-search-btn {
  width: 42px;
  height: 30px;
  background: transparent url("../img/btn_search.145615650c8b.png") no-repeat center center;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 0 15px 15px 0;
  flex-shrink: 0;
  font-size: 0;
}

.nav-search-btn:hover {
  background-color: var(--color-primary-dark);
}

/* Push page content below fixed navbar-top */
body {
  padding-top: 50px;
}

/* ---------- Messages ---------- */

.messages-container {
  padding-top: var(--space-4);
}

.alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  border-radius: var(--radius-md);
  border: var(--border-width) solid var(--color-border);
}

.alert--info,
.alert--debug {
  background-color: var(--color-info-bg);
  border-color: var(--color-info);
  color: var(--color-info);
}

.alert--success {
  background-color: var(--color-success-bg);
  border-color: var(--color-success);
  color: var(--color-success);
}

.alert--warning {
  background-color: var(--color-warning-bg);
  border-color: var(--color-warning);
  color: var(--color-warning);
}

.alert--error,
.alert--danger {
  background-color: var(--color-danger-bg);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.alert__text {
  flex: 1;
}

.alert__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-xl);
  line-height: 1;
  padding: 0;
  color: inherit;
  opacity: 0.7;
  flex-shrink: 0;
}

.alert__close:hover {
  opacity: 1;
}

/* ---------- Main Box (973px centered content box over background image) ---------- */

.main-box {
  width: 973px;
  margin: 10px auto 0;
  position: relative;
  box-shadow: var(--shadow-main);
}

.main-inner {
  padding: 33px 40px 20px;
  background-color: #fff;
}

/* ---------- Content Top (logo + main nav) ---------- */

.content-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.logo-box {
  flex-shrink: 0;
}

.logo-box img {
  max-width: 235px;
  height: auto;
}

.main-nav-box {
  margin-left: 150px;
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  text-align: right;
  padding: 18px 0 4px 0;
}

/* ---------- Main Content ---------- */

#main-content {
  min-height: 50vh;
}

/* ---------- Anonymous Homepage ---------- */

.content-row {
  margin-bottom: 16px;
}

.testimonial1-box {
  height: 269px; /* 189px content + 80px padding-top */
  background: url("../img/testimonial1.bb8bd202dc40.jpg") no-repeat;
  border-radius: var(--radius-lg);
  margin: 0 0 10px;
  padding: 80px 57px 0 342px;
}

.content-box-grey {
  background-color: #dde0e2;
  padding: 20px;
	border-radius:5px;
}

.content-box-grey p {
  margin: 0 0 10px;
}

.content-box-grey a {
  color: var(--color-link);
}

.login-form-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.login-form-row__field {
  flex: 1;
}

.login-form-row__btn {
  flex-shrink: 0;
}

.std-text {
  padding: 5px 8px;
  border: 1px solid #ccc;
  font-size: 14px;
  line-height: 1.4;
}

.std-text.full-width {
  width: 100%;
}

.std-button {
  background-color: #a71528;
  color: #fff;
  border: none;
  border-radius: 2px;
  padding: 6px 16px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.std-button:hover {
  background-color: #8b1120;
}

/* ---------- Site Footer ---------- */

.site-footer {
  background-color: rgba(79, 85, 89, 0.9);
  color: #fff;
  font-size: 0.875em;
  line-height: 1.14286em;
  padding: 20px 40px 40px;
}

.site-footer__inner {
  /* padding handled by .site-footer */
}

.site-footer__columns {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}

.site-footer__col {
  flex: 1 1 150px;
}

.site-footer__heading {
  font-weight: bold;
  color: #fff;
  margin: 0 0 8px 0;
}

.site-footer__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.site-footer__links a {
  color: #fff;
  text-decoration: none;
  font-weight: normal;
}

.site-footer__links a:hover {
  color: #00a0d7;
  text-decoration: underline;
}

.site-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: var(--space-4);
}

.site-footer__copyright {
  margin: 0;
  color: #fff;
  font-size: var(--text-xs);
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
  .site-footer__columns {
    flex-wrap: wrap;
  }
  .site-footer__col {
    flex: 1 1 45%;
  }
}

@media (max-width: 480px) {
  .site-footer__col {
    flex: 1 1 100%;
  }
}


/* ============================================================
   COMPONENT LIBRARY
   ============================================================ */

/* === Button === */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--fw-medium);
  line-height: var(--leading-tight);
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.btn--primary {
  background-color: var(--color-primary);
  color: var(--color-bg);
  border-color: var(--color-primary);
}

.btn--primary:hover {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: var(--color-bg);
}

.btn--secondary {
  background-color: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn--secondary:hover {
  background-color: var(--color-primary);
  color: var(--color-bg);
}

.btn--danger {
  background-color: var(--color-danger);
  color: var(--color-bg);
  border-color: var(--color-danger);
}

.btn--danger:hover {
  background-color: var(--color-danger-bg);
  color: var(--color-danger);
}

.btn--disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* === Card === */

.card {
  position: relative;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}

.card--clickable:hover {
  box-shadow: var(--shadow-md);
}

.card__link {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.card__image {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background-color: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__image--placeholder {
  aspect-ratio: 1 / 1;
  max-height: 120px;
}

.card__avatar-placeholder {
  font-size: var(--text-4xl);
  color: var(--color-text-muted);
}

.card__body {
  padding: var(--space-4) var(--space-5);
}

.card__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
}

.card__title a {
  color: var(--color-text);
  text-decoration: none;
  position: relative;
  z-index: 1;
}

.card__title a:hover {
  color: var(--color-link);
}

.card__subtitle {
  margin: 0 0 var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.card__content {
  margin: 0;
  font-size: var(--text-base);
}

.card--person .card__image {
  aspect-ratio: 1 / 1;
}

/* === Form Field === */

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
}

.form-field__label {
  font-weight: var(--fw-medium);
  font-size: var(--text-sm);
  color: var(--color-text);
}

.form-field__required {
  color: var(--color-danger);
  margin-left: var(--space-1);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(167, 21, 40, 0.15);
}

.form-field--error input,
.form-field--error select,
.form-field--error textarea {
  border-color: var(--color-danger);
}

.form-field__error {
  color: var(--color-danger);
  font-size: var(--text-sm);
}

.form-field__help {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.form--compact .form-field {
  margin-bottom: var(--space-2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

/* === Alert === */

.alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  margin-bottom: var(--space-4);
}

.alert__text {
  flex: 1;
}

.alert__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-xl);
  line-height: 1;
  padding: 0;
  color: currentColor;
  opacity: 0.7;
  flex-shrink: 0;
}

.alert__close:hover {
  opacity: 1;
}

.alert--info {
  background-color: var(--color-info-bg);
  color: var(--color-info);
  border-color: var(--color-info);
}

.alert--success {
  background-color: var(--color-success-bg);
  color: var(--color-success);
  border-color: var(--color-success);
}

.alert--warning {
  background-color: var(--color-warning-bg);
  color: var(--color-warning);
  border-color: var(--color-warning);
}

.alert--error,
.alert--danger {
  background-color: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

/* Django message tags mapping */
.alert--debug { background-color: var(--color-surface); color: var(--color-text-muted); border-color: var(--color-border); }

/* === Pagination === */

.pagination {
  display: flex;
  justify-content: center;
  margin: var(--space-6) 0;
}

.pagination__list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-1);
  flex-wrap: wrap;
  justify-content: center;
}

.pagination__item {
  display: inline-flex;
}

.pagination__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.pagination__link:hover {
  background-color: var(--color-surface);
  color: var(--color-primary);
}

.pagination__item--active .pagination__link,
.pagination__link--current {
  background-color: var(--color-primary);
  color: var(--color-bg);
  border-color: var(--color-primary);
  font-weight: var(--fw-bold);
}

.pagination__item--active .pagination__link:hover {
  background-color: var(--color-primary-dark);
  color: var(--color-bg);
}

.pagination__item--disabled .pagination__link {
  color: var(--color-text-muted);
  cursor: not-allowed;
  pointer-events: none;
}

.pagination__item--ellipsis .pagination__link {
  border-color: transparent;
  pointer-events: none;
}

/* === Breadcrumbs === */

.breadcrumbs {
  border-top: var(--border-width) solid var(--color-border-strong);
  margin-bottom: var(--space-4);
  padding: var(--space-2);
}

.breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.breadcrumbs__item {
  display: flex;
  align-items: center;
}

.breadcrumbs__item:not(:last-child)::after {
  content: "»";
  margin-left: var(--space-1);
  color: var(--color-border);
}

.breadcrumbs__link {
  color: var(--color-link);
  text-decoration: none;
}

.breadcrumbs__link:hover {
  text-decoration: underline;
}

.breadcrumbs__current {
  color: var(--color-text-muted);
}

/* === Modal === */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal__dialog {
  position: relative;
  background-color: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal__dialog:focus {
  outline: none;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-4);
}

.modal__title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
}

.modal__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-2xl);
  line-height: 1;
  color: var(--color-text-muted);
  padding: 0;
  flex-shrink: 0;
}

.modal__close:hover {
  color: var(--color-text);
}

.modal__body {
  padding: var(--space-5) var(--space-6);
  flex: 1;
}

/* Modal transition classes */
.modal-transition-enter { transition: opacity 0.2s ease, transform 0.2s ease; }
.modal-transition-enter-start { opacity: 0; }
.modal-transition-enter-end { opacity: 1; }
.modal-transition-leave { transition: opacity 0.15s ease; }
.modal-transition-leave-start { opacity: 1; }
.modal-transition-leave-end { opacity: 0; }

/* === Navigation === */

/* x-cloak: hide Alpine.js elements before init to prevent flash of unstyled content */
[x-cloak] { display: none !important; }

/* Body scroll lock when mobile panel is open */
body.no-scroll {
  overflow: hidden;
}

/* --- Desktop nav (≥ 1024px): horizontal list, hidden on mobile --- */
.nav__desktop {
  display: none;
}

.nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 26px;
}

.nav__item {
  position: relative;
  height: 35px;
  display: flex;
  align-items: center;
}

.nav__item--has-children::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 6px;
  pointer-events: auto;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 7px;
  color: var(--color-link);
  text-decoration: none;
  font-size: var(--text-lg);
  font-weight: normal;
  white-space: nowrap;
  transition: color 0.15s ease;
}

/* Reset default button styles for toggle buttons */
.nav__toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.nav__link:hover,
.nav__toggle:hover {
  color: var(--color-primary-dark);
  text-decoration: none;
}

.nav__link--active,
.nav__item--active > .nav__link,
.nav__item--active > .nav__toggle {
  font-weight: bold;
}

.nav__chevron {
  font-size: 0.6em;
  opacity: 0.8;
}

/* Dropdown panel */
.nav__dropdown {
  position: absolute;
  top: 41px;
  left: 50%;
  transform: translateX(-50%);
  list-style: none;
  margin: 0;
  padding: 3px 0;
  background-color: #a71528;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.75);
  width: 452px;
  z-index: 9999;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  text-align: left;
}

.nav__dropdown::before,
.nav__dropdown::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
}

.nav__dropdown::before {
  top: -10px;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-bottom: 11px solid rgba(0, 0, 0, 0.2);
}

.nav__dropdown::after {
  top: -9px;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid #a71528;
}

/* Right-aligned dropdown for last item */
.nav__item:last-of-type .nav__dropdown {
  left: auto;
  right: -35px;
  transform: none;
}

.nav__item:last-of-type .nav__dropdown::before,
.nav__item:last-of-type .nav__dropdown::after {
  right: 118px;
  left: auto;
  transform: none;
}

.nav__dropdown-item {
  margin: 0 10px;
  padding: 12px 10px 10px;
  border-top: 1px solid #b13141;
  box-shadow: 0 -3px 1px -2px rgba(0, 0, 0, 0.1);
}

.nav__dropdown-item:nth-child(-n+2) {
  border-top: 0 none;
  box-shadow: none;
}

.nav__dropdown-link {
  display: block;
  color: #fff;
  text-decoration: none;
  font-weight: normal;
  text-align: left;
}

.nav__dropdown-title {
  display: block;
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
  text-shadow: 0px -1px 0px #000;
}

.nav__dropdown-desc {
  display: block;
  font-weight: normal;
  font-size: 0.875em;
  line-height: 19px;
}

.nav__dropdown-link:hover {
  text-decoration: none;
  color: #fff;
}

.nav__dropdown-item.nav__item--active .nav__dropdown-link {
  color: #fff;
  font-weight: var(--fw-bold);
}

/* Alpine.js fade transition for dropdown */
.nav-fade-enter { transition: opacity 0.15s ease; }
.nav-fade-enter-start { opacity: 0; }
.nav-fade-enter-end { opacity: 1; }

/* --- Mobile nav (< 1024px): hamburger + slide-out panel --- */
.nav__mobile {
  display: block;
}

/* Hamburger button */
.nav__hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  transition: background-color 0.15s ease;
}

.nav__hamburger:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.nav__hamburger:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

.nav__hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 22px;
}

.nav__hamburger-icon span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--color-text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Overlay backdrop */
.nav__mobile-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 300;
}

/* Slide-out panel */
.nav__mobile-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 85vw);
  background-color: var(--color-bg);
  z-index: 400;
  overflow-y: auto;
  padding: var(--space-6) var(--space-4);
  box-shadow: var(--shadow-lg);
}

/* Slide transitions */
.nav-slide-enter { transition: transform 0.25s ease; }
.nav-slide-enter-start { transform: translateX(100%); }
.nav-slide-enter-end { transform: translateX(0); }
.nav-slide-leave { transition: transform 0.2s ease; }
.nav-slide-leave-start { transform: translateX(0); }
.nav-slide-leave-end { transform: translateX(100%); }

.nav__mobile-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__mobile-item {
  border-bottom: 1px solid var(--color-border);
}

.nav__mobile-item:last-child {
  border-bottom: none;
}

.nav__mobile-link {
  display: block;
  padding: var(--space-3) var(--space-2);
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: var(--fw-medium);
  transition: color 0.1s ease;
}

.nav__mobile-link:hover {
  color: var(--color-primary);
}

.nav__mobile-link.nav__link--active {
  color: var(--color-primary);
  font-weight: var(--fw-bold);
}

.nav__mobile-sub {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--space-2) var(--space-4);
}

.nav__mobile-link--sub {
  font-size: var(--text-sm);
  font-weight: var(--fw-normal);
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-2);
}

.nav__mobile-link--sub:hover {
  color: var(--color-primary);
}

/* Focus styles for keyboard nav */
.nav__link:focus-visible,
.nav__toggle:focus-visible,
.nav__dropdown-link:focus-visible,
.nav__mobile-link:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

/* --- Responsive breakpoint: ≥ 1024px → desktop nav --- */
@media (min-width: 1024px) {
  .nav__desktop {
    display: block;
    flex: 0 0 auto;
  }

  .nav__mobile {
    display: none;
  }
}

/* Legacy nav-menu styles kept for component gallery backward-compat */
.nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.nav-menu__item {
  position: relative;
}

.nav-menu__link {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  color: var(--color-bg);
  text-decoration: none;
  font-size: var(--text-base);
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease;
}

.nav-menu__link:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: var(--color-bg);
}

.nav-menu__link--active,
.nav-menu__item--active > .nav-menu__link {
  background-color: rgba(255, 255, 255, 0.2);
  font-weight: var(--fw-bold);
}

.nav-menu__sub {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  list-style: none;
  margin: var(--space-1) 0 0;
  padding: var(--space-2) 0;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 200;
}

.nav-menu__item:hover .nav-menu__sub {
  display: block;
}

.nav-menu__sub .nav-menu__link {
  color: var(--color-text);
  padding: var(--space-2) var(--space-4);
  display: block;
  border-radius: 0;
}

.nav-menu__sub .nav-menu__link:hover {
  background-color: var(--color-surface);
  color: var(--color-primary);
}

/* === Loading Indicator === */

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Spinner variant */
.loading-spinner {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.loading-spinner__icon {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton variant */
.loading-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.loading-skeleton__line {
  height: 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg,
    var(--color-surface) 25%,
    var(--color-border) 50%,
    var(--color-surface) 75%
  );
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.loading-skeleton__line--full  { width: 100%; }
.loading-skeleton__line--wide  { width: 75%; }
.loading-skeleton__line--narrow { width: 50%; }

@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* HTMX indicator support */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-flex; }
.htmx-request.htmx-indicator { display: inline-flex; }

/* === Global HTMX Spinner === */
.global-spinner {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 9999;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-2) var(--space-3);
}

/* === Step Indicator === */
.step-indicator {
  display: flex;
  list-style: none;
  margin: 0 0 var(--space-8);
  padding: 0;
  gap: 0;
  counter-reset: none;
}

.step-indicator__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  text-align: center;
}

.step-indicator__item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 1rem;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.step-indicator__item--done:not(:last-child)::after {
  background: var(--color-primary);
}

.step-indicator__number {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  border: 2px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  z-index: 1;
  position: relative;
  transition: border-color var(--transition-base), background var(--transition-base), color var(--transition-base);
}

.step-indicator__item--current .step-indicator__number {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.step-indicator__item--done .step-indicator__number {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.step-indicator__label {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.step-indicator__item--current .step-indicator__label {
  color: var(--color-primary);
  font-weight: var(--fw-medium);
}

.step-indicator__item--done .step-indicator__label {
  color: var(--color-text);
}

/* === Toast Notifications === */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 24rem;
  width: calc(100vw - var(--space-12));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  box-shadow: var(--shadow-md);
  background: var(--color-bg);
}

.toast__message {
  flex: 1;
  font-size: var(--text-sm);
}

.toast__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-xl);
  line-height: 1;
  padding: 0;
  color: currentColor;
  opacity: 0.7;
  flex-shrink: 0;
}

.toast__close:hover { opacity: 1; }

.toast--success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: var(--color-success);
}

.toast--error,
.toast--danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.toast--warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border-color: var(--color-warning);
}

.toast--info {
  background: var(--color-info-bg);
  color: var(--color-info);
  border-color: var(--color-info);
}

/* Toast Alpine.js transitions */
.toast-enter { transition: transform 0.2s ease, opacity 0.2s ease; }
.toast-enter-start { transform: translateX(100%); opacity: 0; }
.toast-enter-end { transform: translateX(0); opacity: 1; }
.toast-leave { transition: transform 0.15s ease, opacity 0.15s ease; }
.toast-leave-start { transform: translateX(0); opacity: 1; }
.toast-leave-end { transform: translateX(100%); opacity: 0; }

/* === File Preview === */
.form-field__file-preview {
  margin-top: var(--space-2);
}

.form-field__file-thumb {
  max-width: 8rem;
  max-height: 8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  object-fit: cover;
}

.form-field__file-name {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* HTMX inline validation error */
.form-field__htmx-errors:empty { display: none; }

/* Accordion support (max-height transition) */
.accordion__body {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--transition-slow);
}

.accordion--open .accordion__body {
  max-height: 1000px;
}

/* === Lead Text (Vorspann) === */

/* Introductory paragraph displayed at larger size above body content.
   Mirrors the legacy `.text-vorspann` style (19 px / 22 px line-height). */
.lead-text {
  font-size: var(--text-lg);
  line-height: var(--leading-base);
  color: var(--color-text-strong);
  margin: 0 0 var(--space-4);
}

/* === Caption === */

/* Image caption paragraph, migrated from legacy `.text-bild` class. */
.caption {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: var(--space-1) 0 var(--space-4);
}

/* === Callout === */

/* Highlighted text box used in content pages.
   --color-border (#dde0e2) doubles as the legacy "content-box-grey" value. */
.callout {
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-4) 0;
}

.callout--grey {
  background-color: var(--color-border);
}

.callout p {
  margin: 0 0 var(--space-3);
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout a {
  color: var(--color-link);
}

/* === Content Row (multi-column grid layout) === */

/* Fixed layout presets using fr units.
   The editor selects one of five proportional layouts; each maps to a CSS
   class that defines grid-template-columns directly. */
.content-row {
  display: grid;
  gap: var(--space-6);
  margin: 0 0 var(--space-4);
}

.content-row--1-1     { grid-template-columns: 1fr 1fr; }
.content-row--1-2     { grid-template-columns: 1fr 2fr; }
.content-row--2-1     { grid-template-columns: 2fr 1fr; }
.content-row--1-1-1   { grid-template-columns: repeat(3, 1fr); }
.content-row--1-1-1-1 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 600px) {
  .content-row--1-1,
  .content-row--1-2,
  .content-row--2-1,
  .content-row--1-1-1,
  .content-row--1-1-1-1 {
    grid-template-columns: 1fr;
  }
}

/* === Event Program Timetable (block) === */

.timetable {
  margin: var(--space-4) 0;
}

.timetable__table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-4);
}

.timetable__day-heading {
  caption-side: top;
  text-align: left;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-strong);
  padding: var(--space-3) 0;
  border-bottom: 2px solid var(--color-primary);
}

.timetable__entry {
  border-bottom: 1px solid var(--color-border);
}

.timetable__entry:last-child {
  border-bottom: none;
}

.timetable__time {
  vertical-align: top;
  white-space: nowrap;
  padding: var(--space-3) var(--space-4) var(--space-3) 0;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
  width: 1%;
}

.timetable__detail {
  vertical-align: top;
  padding: var(--space-3) 0;
}

.timetable__title {
  display: block;
  font-weight: 600;
}

.timetable__description {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

@media (max-width: 600px) {
  .timetable__time {
    white-space: normal;
  }
}

/* ============================================================
   HomePage – Hero Section
   ============================================================ */
.hero {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--color-primary);
  margin-bottom: var(--space-8);
}

.hero__image {
  width: 100%;
  line-height: 0;
}

.hero__img {
  width: 100%;
  height: 400px;
  object-fit: cover;
  display: block;
}

.hero__text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-6) var(--space-8);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
  color: #fff;
}

.hero__text p {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* No hero image: show as coloured banner */
.hero:not(:has(.hero__image)) .hero__text {
  position: static;
  background: var(--color-primary);
  color: var(--color-on-primary, #fff);
  padding: var(--space-10) var(--space-8);
}

@media (max-width: 768px) {
  .hero__img {
    height: 220px;
  }

  .hero__text {
    padding: var(--space-4) var(--space-4);
  }

  .hero__text p {
    font-size: var(--text-base);
  }
}

/* ============================================================
   HomePage – Body Content
   ============================================================ */
.homepage-body {
  padding-top: var(--space-6);
  padding-bottom: var(--space-10);
}

/* ============================================================
   ContentPage – Two-Column Layout
   ============================================================ */
.content-layout {
  display: grid;
  grid-template-columns: 3fr 13fr;
  gap: 76px;
  padding-top: var(--space-6);
  padding-bottom: var(--space-10);
  max-width: var(--container-max);
  margin-inline: auto;
  /* padding-inline: var(--space-4); */
}

.content-layout--full {
  grid-template-columns: 1fr;
  padding-inline: 0;
}

.content-layout__main {
  min-width: 0;
}

.content-layout__sidebar {
  min-width: 0;
}

@media (max-width: 768px) {
  .content-layout {
    grid-template-columns: 1fr;
  }
}

/* ── Event Page ──────────────────────────────────────────── */
.event-detail {
    max-width: 800px;
    margin: 0 auto;
}

.event-detail__header {
    margin-bottom: var(--space-6);
}

.event-detail__title {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-3);
}

.event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.event-meta__date,
.event-meta__location {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.event-meta__icon {
    flex-shrink: 0;
    color: var(--color-primary);
}

.event-detail__body {
    margin-bottom: var(--space-8);
}

.event-program {
    border-top: 2px solid var(--color-primary);
    padding-top: var(--space-6);
    margin-bottom: var(--space-8);
}

.event-program__title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-4);
}

.event-detail__back {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-4);
}

/* ============================================================
   Section Navigation (sidebar left-nav)

   Visual level mapping:
     .section-nav__root-link  → L1  bold section title (comes from the page,
                                     not a menu item)
     depth 0 items            → L2  plain list
     depth 1 items            → L3  indented; items with children are collapsible
     depth 2 items            → L4  revealed when depth-1 parent is toggled open
   ============================================================ */

.section-nav__list,
.section-nav__sublist {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Shared link base ── */
.section-nav__link {
  display: block;
  padding: var(--space-1) 0;
  color: var(--color-link);
  font-weight: var(--fw-normal);
  text-decoration: none;
  line-height: var(--leading-base);
}

.section-nav__link:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

/* ── Active state ── */
.section-nav__link--active {
  color: var(--color-primary);
  font-weight: var(--fw-bold);
}

/* ── Root link (L1 — section title page, bold, outside depth system) ── */
.section-nav__root-link {
  display: block;
  padding: var(--space-1) 0 var(--space-2);
  font-weight: var(--fw-bold);
  font-size: var(--text-base);
  color: var(--color-text-strong);
  text-decoration: none;
  line-height: var(--leading-base);
}

.section-nav__root-link:hover {
  color: var(--color-primary);
}

.section-nav__root-link--active {
  color: var(--color-primary);
}

/* ── Depth 0 — L2 (direct menu items) ── */
.section-nav__link--depth-0 {
  font-size: var(--text-sm);
}

.section-nav__link--depth-0:hover {
  color: var(--color-link-hover);
}

/* ── Depth 1 — L3 (collapsible when item has children; sublist revealed on toggle) ── */
.section-nav__sublist--depth-0 {
  padding-left: var(--space-4);
  padding-top: var(--space-1);
  padding-bottom: var(--space-2);
}

.section-nav__link--depth-1 {
  font-size: var(--text-sm);
}

/* ── Depth 2 — L4 (revealed when depth-1 parent is open) ── */
.section-nav__sublist--depth-1 {
  padding-left: var(--space-4);
  padding-top: var(--space-1);
}

.section-nav__link--depth-2 {
  font-size: var(--text-sm);
}

/* ── Depth 3 — L5 (deeper nesting) ── */
.section-nav__sublist--depth-2 {
  padding-left: var(--space-4);
  padding-top: var(--space-1);
}

.section-nav__link--depth-3 {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.section-nav__link--depth-3:hover,
.section-nav__link--depth-3.section-nav__link--active {
  color: var(--color-primary);
}

/* ── Collapsible depth-1 items (L3 with children) ── */
.section-nav__toggle-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-1);
}

.section-nav__toggle-row .section-nav__link--depth-1 {
  flex: 1;
}

.section-nav__chevron {
  background: none;
  border: none;
  cursor: pointer;
  margin-left: -0.15rem;
  padding: 0 var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  line-height: 1;
  flex-shrink: 0;
}

.section-nav__chevron:hover {
  color: var(--color-primary);
}

/* Hide Alpine x-cloak elements until Alpine initialises */
[x-cloak] { display: none !important; }

/* ── Gallery grid ───────────────────────────────────────────────────────────── */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-2);
  margin-block: var(--space-4);
}

.gallery-grid__link {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background-color: var(--color-surface);
  border-radius: var(--radius-sm, 4px);
  text-decoration: none;
}

.gallery-grid__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.gallery-grid__link:hover .gallery-grid__thumb,
.gallery-grid__link:focus-visible .gallery-grid__thumb {
  opacity: 0.85;
  transform: scale(1.03);
}

.gallery-grid__empty {
  grid-column: 1 / -1;
  color: var(--color-text-muted);
}

/* ── GalleryBlock wrapper ── */

.gallery-block__title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  margin-block-end: var(--space-3);
  color: var(--color-text);
}

.gallery-block__more-indicator {
  margin-block-start: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* === Profile === */

.profile-layout {
  padding-top: var(--space-6);
}

.profile-deceased-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-left: 4px solid var(--color-text-strong);
  border-radius: var(--radius-md);
  color: var(--color-text);
}

.profile-deceased-notice__icon {
  font-size: var(--text-2xl);
  line-height: 1;
  flex-shrink: 0;
  color: var(--color-text-strong);
}

.profile-deceased-notice__body {
  flex: 1;
}

.profile-deceased-notice__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--color-text-strong);
  margin: 0 0 var(--space-1) 0;
}

.profile-deceased-notice__text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

.profile-card .card__body {
  padding: var(--space-5);
}

.spacer {
  height: var(--space-4);
}

.profile-card .card__body > *:first-child {
  margin-top: 0;
  padding-top: 0;
}

.profile-card .card__body > *:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Tab / "Karteikarte" lip — small rounded tab sits above the top-right corner */
.profile-card {
  overflow: visible;
}

.profile-content-row {
  margin: var(--space-6) 0;
  padding-top: var(--space-6); /* room for the tab above the card */
}

.profile-card__tab {
  position: absolute;
  top: 0;
  right: var(--space-5);
  transform: translateY(-100%);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  white-space: nowrap;
}

.profile-card__tab-title {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.profile-card__tab .btn-icon svg {
  width: 16px;
  height: 16px;
}

.profile-card__tab .btn-icon {
  padding: 0;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0.2rem;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}
.btn-icon:hover {
    color: var(--color-primary);
    background: var(--color-surface-raised);
}
.btn-icon--danger {
    color: var(--color-text-muted);
}
.btn-icon--danger:hover {
    color: var(--color-error, #c0392b);
    background: color-mix(in srgb, var(--color-error, #c0392b) 10%, transparent);
}
.formset-row--deleted .form-field {
    opacity: 0.4;
    text-decoration: line-through;
}
.formset-row__delete {
    display: grid;
    align-items: center;
    padding-top: 1.4rem;
    margin-bottom: var(--space-2);
}
.formset-row__delete > * {
    grid-area: 1 / 1;
}
.formset-row__delete .btn-icon svg {
    width: 20px;
    height: 20px;
}

.profile-card__actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

#section-stammdaten:has(.form--compact) .profile-card__actions,
#section-ueber-mich:has(form) .profile-card__actions {
  display: none;
}

.profile-card__edit-title {
  font-size: var(--text-base);
  margin-top: 0;
  margin-bottom: var(--space-3);
}

.profile-address {
  margin-top: var(--space-3);
  margin-bottom: var(--space-3);
}

/* Two-column data table used in profile sections (e.g. Studienfach). */
.profile-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px 0;
  font-size: var(--text-base);
}

.profile-table thead th {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-weight: var(--fw-medium);
  font-size: var(--text-sm);
  color: var(--color-bg);
  background-color: var(--color-surface-raised);
  border-bottom: 2px solid var(--color-surface-raised);
}

.profile-table tbody td {
  padding: var(--space-2) var(--space-3);
  vertical-align: middle;
  border-bottom: 1px solid var(--color-surface-raised);
}

.profile-table--shrink-first th:first-child,
.profile-table--shrink-first td:first-child {
  width: 1%;
  white-space: nowrap;
}


/* ── Profile preview bar ────────────────────────────────────────────────────── */

.profile-preview-bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background: var(--color-warning-bg, #fef9c3);
  border: 1px solid var(--color-warning-border, #fde047);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}

.profile-hidden-bar {
  background: var(--color-error-bg, #fef2f2);
  border-color: var(--color-error-border, #fca5a5);
}

.profile-hidden-bar__icon {
  font-size: 1.2em;
  flex-shrink: 0;
}

.profile-hidden-bar__action {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
}

.profile-preview-bar__label {
  color: var(--color-text-muted);
}

.profile-preview-bar__link {
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
}

.profile-preview-bar__link:hover {
  text-decoration: underline;
}

.form-section-divider {
  border: none;
  border-top: 1px solid var(--color-border, #e5e7eb);
  margin: var(--space-4) 0 var(--space-2);
}

.form-section-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-2);
}

.contact-entries-body {
  padding-top: 0;
}

/* Editable card section: content area + vertical separator + pen icon */
.card__body--editable {
  display: flex;
  align-items: stretch;
  padding: 0;
}

.card__body--editable .card__body-content {
  flex: 1;
  min-width: 0;
  padding: 0 var(--space-5) 0 0;
}

.card__body--editable .section-edit-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--color-border);
  border-radius: 0;
  padding: 0 var(--space-3);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.card__body--editable .section-edit-btn:hover {
  background: var(--color-surface-hover, rgba(0,0,0,.04));
  color: var(--color-text);
}

/* ── Profile top two-column layout ─────────────────────────────────────────── */

.profile-top-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--space-6);
  align-items: start;
  padding-top: var(--space-6);
}

.profile-top-row__main {
  min-width: 0;
}

.profile-top-row__main h1 {
  margin-top: 0;
}

/* Heading row: h1 + settings gear aligned side-by-side */
.profile-heading-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.profile-heading-row h1 {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

/* Gear icon + dropdown */
.profile-settings-menu {
  position: relative;
  flex-shrink: 0;
}

.profile-settings-menu__btn svg {
  width: 20px;
  height: 20px;
}

.profile-settings-subnav {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  background: #fff;
  border: 1px solid #e4e4e4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-sm);
  list-style: none;
  margin: 0;
  padding: var(--space-1) 0;
  z-index: 200;
}

.profile-settings-subnav__item {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: none;
  text-align: left;
  font-size: var(--text-base);
  color: var(--color-text);
  cursor: pointer;
  white-space: nowrap;
}

.profile-settings-subnav__item:hover {
  background: var(--color-surface-raised);
  color: var(--color-primary);
}

/* First card in the main column needs room for its tab lip */
.profile-top-row__main .profile-card:first-of-type {
  margin-top: var(--space-8);
}

.profile-top-row__main .profile-content-row {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: var(--space-1);
}

.profile-top-row__side {
  min-width: 0;
}

.profile-top-row__avatar {
  margin-bottom: var(--space-6);
}

.profile-admin-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted, #888);
  padding: 0 var(--space-2);
}

.admin-meta-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
  min-height: 1.6em;
}

.admin-meta-form {
  display: contents;
}

.admin-meta-edit-btn,
.admin-meta-action-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--color-text-muted, #aaa);
  line-height: 1;
  display: flex;
  align-items: center;
}

.admin-meta-edit-btn svg {
  width: 0.75rem;
  height: 0.75rem;
}

.admin-meta-edit-btn:hover,
.admin-meta-action-btn:hover {
  color: var(--color-primary, #333);
}

.admin-meta-action-btn {
  font-size: 0.85rem;
  font-weight: bold;
  width: 1.3em;
  justify-content: center;
}

.admin-meta-action-btn--cancel {
  color: var(--color-text-muted, #aaa);
}

.admin-meta-key {
  font-weight: bold;
  white-space: nowrap;
  min-width: 110px;
  flex-shrink: 0;
}

.admin-meta-val {
  flex: 1;
  word-break: break-all;
}

.admin-meta-input {
  flex: 1;
  font-size: 0.8rem;
  padding: 1px 4px;
  border: 1px solid var(--color-border, #ccc);
  border-radius: 3px;
  min-width: 0;
}

.profile-avatar {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

@media (max-width: 640px) {
  .profile-top-row {
    grid-template-columns: 1fr;
  }

  .profile-top-row__side {
    order: -1;
  }
}

#section-kontakt .card__body p {
  margin: 0 0 var(--space-1) 0;
}

#section-kontakt .card__body p:last-child {
  margin-bottom: 0;
}

/* ── Avatar frame ───────────────────────────────────────────────────────────── */

.profile-avatar {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 250px;
  margin: 0 auto;
  padding: 10px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--color-surface-alt, #f0f0f0);
  border: 1px solid var(--color-border);
}

.profile-avatar__image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.profile-avatar__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

.profile-avatar__placeholder svg {
  width: 80px;
  height: 80px;
}

/* Edit button overlay — bottom-right corner of the avatar frame */
.profile-avatar__edit-btn {
  position: absolute;
  bottom: var(--space-2);
  right: var(--space-2);
  background: var(--color-surface);
  border-radius: var(--radius-full, 9999px);
  box-shadow: var(--shadow-sm);
  opacity: 0.85;
}

.profile-avatar__edit-btn:hover {
  opacity: 1;
}

/* Upload form inside avatar section */
.profile-avatar__current {
  width: 120px;
  height: 120px;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--color-surface-alt, #f0f0f0);
}

.profile-avatar__current img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.profile-avatar__upload {
  margin-bottom: var(--space-3);
}

.profile-avatar__hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.profile-avatar__actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

/* ── Responsive: stack on small screens ─────────────────────────────────────── */

@media (max-width: 640px) {
  .profile-avatar {
    max-width: 150px;
  }
}

/* ── Stammdaten privacy rows ─────────────────────────────────────────────────── */

.stammdaten-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0 0 var(--space-3) 0;
}

.stammdaten-row:last-child {
  margin-bottom: 0;
}

.btn-icon--privacy {
  flex-shrink: 0;
  color: var(--color-text-muted);
  align-self: flex-start;
  padding: 0;
  margin-top: 2px;
}

.btn-icon--privacy svg {
  width: 14px;
  height: 14px;
}

.btn-icon--privacy:hover {
  color: var(--color-primary);
}

.btn-icon--static {
  cursor: default;
  opacity: 0.35;
}

.btn-icon--static:hover {
  color: var(--color-text-muted);
  background: none;
}
