/* Layout: rail (sidebar), shell, header, search, footer — from mockup A «Tischkante». */

/* ---------- brand: emblem image (source/logo) + set wordmark ---------- */
.mark { width: 36px; height: 36px; flex: none; display: block; }
.wordmark { font: 400 22px/1 var(--ff-display); letter-spacing: .01em; white-space: nowrap; }
.wordmark i { color: var(--color-brand); }

/* ---------- rail ---------- */
.rail {
  position: fixed; inset: 0 auto 0 0; width: var(--rail); z-index: var(--z-rail);
  display: flex; flex-direction: column; padding: 14px 12px;
  background: linear-gradient(180deg, #0e1116, #0b0d11);
  border-right: 1px solid var(--line-soft);
  transition: width var(--dur-slow) var(--ease);
}
.rail-open .rail { width: var(--rail-open); }
.rail__brand { display: flex; align-items: center; gap: 12px; height: 44px; margin-bottom: 18px; padding-left: 6px; overflow: hidden; }
.rail__brand .wordmark { opacity: 0; transition: opacity var(--dur-base); }
.rail-open .rail__brand .wordmark { opacity: 1; }
.rail__nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: hidden auto; scrollbar-width: none; }
.rail__group {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3);
  padding: 14px 12px 6px; white-space: nowrap; opacity: 0; transition: opacity var(--dur-fast);
}
.rail-open .rail__group { opacity: 1; }
.rail__link {
  position: relative; display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 18px; flex: none;
  border-radius: var(--r-m); color: var(--text-2); white-space: nowrap; text-align: left;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.rail__link span { opacity: 0; transform: translateX(-6px); transition: opacity var(--dur-fast), transform var(--dur-slow) var(--ease); }
.rail-open .rail__link span { opacity: 1; transform: none; }
.rail__link:hover { background: var(--surface-2); color: var(--text); }
.rail__link.is-active { color: var(--color-brand); background: rgba(213, 180, 107, .08); }
.rail__link.is-active::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--color-brand); }
.rail__link .tip {
  position: absolute; left: calc(100% + 14px); top: 50%; translate: -4px -50%;
  background: var(--surface-3); color: var(--text); font: 500 13px/1 var(--ff-body); font-style: normal;
  padding: 8px 10px; border-radius: var(--r-s); pointer-events: none; opacity: 0;
  transition: opacity var(--dur-fast), translate var(--dur-base) var(--ease); box-shadow: var(--shadow-1);
}
html:not(.rail-open) .rail__link:hover .tip, html:not(.rail-open) .rail__link:focus-visible .tip { opacity: 1; translate: 0 -50%; }
.rail__more { display: none; }
.rail__toggle {
  height: 44px; display: flex; align-items: center; gap: 14px; padding: 0 18px; flex: none;
  border-radius: var(--r-m); color: var(--text-3); border-top: 1px solid var(--line-soft); margin-top: 8px; white-space: nowrap; overflow: hidden;
}
.rail__toggle:hover { color: var(--text); background: var(--surface-2); }
.rail__toggle .icon { transition: rotate var(--dur-slow) var(--ease); }
.rail-open .rail__toggle .icon { rotate: 180deg; }
.rail__toggle span { opacity: 0; transition: opacity var(--dur-fast); }
.rail-open .rail__toggle span { opacity: 1; }

/* ---------- shell + header ---------- */
.shell { margin-left: var(--rail); transition: margin var(--dur-slow) var(--ease); min-width: 0; }
.rail-open .shell { margin-left: var(--rail-open); }
.head {
  position: sticky; top: 0; z-index: var(--z-head); height: var(--head);
  display: flex; align-items: center; gap: 16px; padding: 0 var(--sec-x);
  background: rgba(16, 19, 24, .72); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--dur-base);
}
.head.is-scrolled { background: rgba(12, 15, 19, .9); }
.head__mark { display: none; align-items: center; gap: 10px; }
.head__end { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.search { position: relative; flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 14px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line-soft); color: var(--text-3); transition: border-color var(--dur-fast); }
.search:focus-within { border-color: var(--color-brand); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-size: 14px; }
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { filter: invert(.7); }
.search kbd { font: 500 11px/1 var(--ff-body); padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line-soft); color: var(--text-3); }
.search__results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); max-height: min(70vh, 520px); overflow: auto;
  padding: 8px; border-radius: var(--r-l); background: var(--surface-2); border: 1px solid var(--line); box-shadow: var(--shadow-2);
  animation: drop var(--dur-base) var(--ease);
}
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
.search__group { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); padding: 10px 10px 6px; }
.search__item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: var(--r-m); color: var(--text); text-align: left; }
.search__item:hover, .search__item[aria-selected="true"] { background: var(--surface-3); }
.search__item img { width: 44px; height: 44px; border-radius: var(--r-s); object-fit: cover; flex: none; }
.search__item .icon { color: var(--color-brand); margin: 0 12px; }
.search__item b { display: block; font-weight: 600; font-size: 14px; }
.search__item small { color: var(--text-3); font-size: 12.5px; }
.search__item mark { background: none; color: var(--color-brand-hi); }
.search__empty { padding: 14px 10px; color: var(--text-2); font-size: 14px; }

.lang { display: flex; padding: 3px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line-soft); }
.lang a { position: relative; font-size: 12px; font-weight: 600; letter-spacing: .06em; padding: 7px 10px; border-radius: var(--r-pill); color: var(--text-3); transition: background var(--dur-fast), color var(--dur-fast); }
.lang a:hover { color: var(--text); }
.lang a[aria-current] { background: var(--surface-3); color: var(--color-brand); }
.lang-mob { display: none; position: relative; }
.lang-mob select { appearance: none; background: var(--surface-2); color: var(--text); border: 1px solid var(--line-soft); border-radius: var(--r-pill); height: 40px; padding: 0 30px 0 12px; font: 600 12px var(--ff-body); cursor: pointer; }
.lang-mob .icon { position: absolute; right: 9px; top: 50%; translate: 0 -50%; width: 14px; height: 14px; pointer-events: none; color: var(--text-3); }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text); transition: background var(--dur-fast), transform var(--dur-fast); }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(.94); }
.search-btn { display: none; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--color-brand); color: var(--color-brand-ink); font: 600 13px/1 var(--ff-body); }
.avatar--lg { width: 52px; height: 52px; font-size: 20px; }
.head__user { padding-left: 6px !important; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line-soft); background: linear-gradient(180deg, var(--surface-1), var(--surface-0)); padding: 72px var(--sec-x) 32px; margin-top: 40px; position: relative; }
.footer::before { content: ""; position: absolute; left: 50%; top: -1px; width: min(560px, 70%); height: 1px; translate: -50% 0; background: linear-gradient(90deg, transparent, var(--color-brand), transparent); }
.footer__top { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 40px; max-width: var(--container); margin: 0 auto; }
.footer__logo { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.footer__brand p { color: var(--text-2); font-size: var(--fs-small); max-width: 42ch; }
.footer__age { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.footer__col h2 { font: 600 12px/1 var(--ff-body); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); margin-bottom: 16px; }
.footer__col ul { display: grid; gap: 4px; list-style: none; padding: 0; }
.footer__col a, .footer__col .linklike { position: relative; display: inline-block; padding: 4px 0; color: var(--text-2); font-size: var(--fs-small); text-decoration: none; transition: color var(--dur-fast); }
.footer__col a:hover, .footer__col .linklike:hover, .footer__col a[aria-current] { color: var(--color-brand-hi); }
.footer__data { max-width: var(--container); margin: 48px auto 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; padding: 24px; border-radius: var(--r-l); background: rgba(26, 31, 39, .6); border: 1px solid var(--line-soft); }
.footer__data h3 { font: 600 11.5px/1 var(--ff-body); letter-spacing: .14em; text-transform: uppercase; color: var(--color-brand); margin-bottom: 8px; }
.footer__data p { font-size: var(--fs-small); color: var(--text-2); overflow-wrap: anywhere; }
.footer__data a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.footer__bottom { max-width: var(--container); margin: 28px auto 0; display: flex; flex-wrap: wrap; gap: 12px 32px; justify-content: space-between; color: var(--text-3); font-size: 13px; }
.footer__rg { display: flex; align-items: center; gap: 8px; }
.footer__rg .icon { color: var(--color-brand); width: 18px; height: 18px; }

/* ---------- to top + toast ---------- */
.to-top { position: fixed; right: 20px; bottom: 20px; z-index: 50; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow-1); transition: transform var(--dur-base) var(--ease), background var(--dur-fast); }
.to-top:hover { background: var(--color-brand); color: var(--color-brand-ink); transform: translateY(-3px); }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: var(--z-toast); translate: -50% 0; max-width: min(92vw, 460px); padding: 12px 18px; border-radius: var(--r-pill); background: var(--surface-3); border: 1px solid var(--line); box-shadow: var(--shadow-2); font-size: 14px; animation: toast-in var(--dur-slow) var(--ease-spring); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }

/* ---------- ≤ 1100 ---------- */
@media (max-width: 1100px) {
  .footer__top { grid-template-columns: 1fr 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
}

/* ---------- ≤ 900: rail becomes a bottom tab bar ---------- */
@media (max-width: 900px) {
  :root { --sec-x: 16px; --sec-y: 72px; }
  .rail, .rail-open .rail {
    inset: auto 0 0 0; width: auto; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); flex-direction: row;
    padding: 6px 8px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--line-soft);
    background: rgba(11, 13, 17, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
  .rail .rail__brand, .rail__group, .rail__toggle, .rail .rail__link.hide-m { display: none; }
  .rail__nav { flex-direction: row; justify-content: space-around; overflow: visible; }
  .rail .rail__link { flex-direction: column; gap: 3px; height: 56px; padding: 6px 2px; font-size: 12px; letter-spacing: -.01em; justify-content: center; flex: 1; min-width: 0; }
  .rail .rail__link span { opacity: 1; transform: none; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .rail__link .tip { display: none; }
  /* short visible label on the tab bar; the full name stays the accessible name */
  .rail .rail__link span[data-short] { font-size: 0; }
  .rail .rail__link span[data-short]::after { content: attr(data-short); font-size: 12px; }
  .rail .rail__more { display: flex; }
  .rail__link.is-active::before { left: 30%; right: 30%; top: -6px; bottom: auto; width: auto; height: 3px; border-radius: 0 0 3px 3px; }
  .shell, .rail-open .shell { margin-left: 0; }
  body { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
  .head { gap: 8px; }
  .head__mark { display: flex; }
  .head__mark .wordmark { display: none; }
  .search { display: none; }
  .search.is-open { display: flex; position: absolute; left: 12px; right: 12px; top: 13px; max-width: none; z-index: 2; background: var(--surface-2); }
  .search-btn { display: grid; }
  .lang { display: none; }
  .lang-mob { display: block; }
  .head .btn.login { display: none; }
  .head .btn { height: 40px; padding: 0 14px; }
  .head__user-name { display: none; }
  .footer { padding: 56px var(--sec-x) 28px; }
  .footer__top { grid-template-columns: 1fr 1fr; gap: 28px; }
  .to-top { bottom: calc(var(--tabbar) + 16px); right: 14px; }
  .toast { bottom: calc(var(--tabbar) + 18px); }
}
@media (max-width: 420px) {
  .footer__top { grid-template-columns: 1fr; }
  .head .btn--gold { padding: 0 12px; font-size: 13px; }
}
