/* Shared components. Blocks sit on the ground with an 8px gap between them; no radius, no shadow, no hairlines. */

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--bg); }
.site-header .bar { max-width: var(--maxw); margin-inline: auto; height: var(--header-h); padding-inline: var(--gutter); display: flex; align-items: center; gap: var(--sp-4); }
.brand { display: inline-flex; align-items: center; gap: var(--sp-3); min-height: 44px; text-decoration: none; font: 800 1.3125rem/1 var(--font-display); letter-spacing: -0.01em; white-space: nowrap; }
.header-tools .lang-btn .icon { display: none; }
.header-tools .user-btn { display: none; }
@media (min-width: 360px) { .header-tools .user-btn { display: inline-flex; } }
@media (min-width: 720px) { .brand { font-size: 1.5rem; } .header-tools .lang-btn .icon { display: block; } }
.brand-mark { display: grid; gap: 3px; width: 26px; flex: none; }
.brand-mark i { display: block; height: 6px; }
.brand-mark i:nth-child(1) { background: var(--tier-s); width: 100%; }
.brand-mark i:nth-child(2) { background: var(--tier-a); width: 74%; }
.brand-mark i:nth-child(3) { background: var(--tier-b); width: 48%; }

.nav { display: none; }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: var(--gap); }
.site-header .menu-btn { display: inline-flex; }
.site-header .tool-submit { display: none; }

/* phone + tablet: the nav is a full-width panel under the bar */
.nav.open { display: flex; flex-direction: column; gap: var(--gap); position: absolute; left: 0; right: 0; top: var(--header-h); max-height: calc(100dvh - var(--header-h)); overflow-y: auto; background: var(--bg); padding: var(--gap) var(--gutter) var(--sp-5); }
.nav a { display: flex; align-items: center; gap: var(--sp-3); white-space: nowrap; min-height: 52px; padding: 0 var(--sp-4); background: var(--surface); text-decoration: none; font-weight: 600; font-size: var(--fs-lg); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.nav a.nav-submit { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.nav .nav-key { width: 10px; height: 22px; flex: none; }

@media (min-width: 1080px) {
  .nav, .nav.open { display: flex; flex-direction: row; position: static; padding: 0; gap: var(--sp-1); overflow: visible; max-height: none; margin-left: var(--sp-5); }
  .nav a { min-height: 44px; padding: 0 var(--sp-3); background: none; font-size: var(--fs-md); color: var(--ink-2); }
  .nav a[aria-current="page"] { background: none; color: var(--ink); box-shadow: inset 0 -3px 0 var(--gold); }
  .nav .nav-key, .nav a.nav-submit, .nav a.nav-more { display: none; }
  .site-header .menu-btn { display: none; }
  .site-header .tool-submit { display: inline-flex; }
  @media (hover: hover) and (pointer: fine) { .nav a:hover { color: var(--ink); } }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 44px; padding: 0 var(--sp-4); border: 0; background: var(--surface-2); color: var(--ink); font: 600 var(--fs-md)/1.15 var(--font); text-decoration: none; text-align: center; max-width: 100%; padding-block: var(--sp-2); transition: background-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out); }
.btn:active { transform: scale(0.97); }
/* long labels (German) wrap inside narrow containers instead of pushing the page sideways; the header keeps one line */
.site-header .btn { white-space: nowrap; }
.btn.primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.gold { background: var(--gold); color: var(--tier-ink); font-weight: 700; }
.btn.danger { background: var(--tier-d); color: #fff; font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn.wide { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--surface); color: var(--ink-3); cursor: not-allowed; transform: none; }
@media (pointer: coarse) { .btn.small { min-height: 44px; } }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--surface-3); }
  .btn.primary:hover { background: #fff; }
  .btn.gold:hover { background: #ffc93a; }
  .btn.danger:hover { background: #e63a2d; }
  .btn.ghost:hover { background: var(--surface-2); }
  .btn[disabled]:hover { background: var(--surface); }
}

/* ---------- form controls ---------- */
.field { display: grid; gap: var(--sp-2); }
.field > label, .field > .label { font-weight: 600; }
.field .hint { color: var(--ink-2); font-size: var(--fs-sm); }
.field .error { color: var(--danger); font-size: var(--fs-sm); font-weight: 600; }
.input, .select, .textarea { width: 100%; min-height: 48px; padding: var(--sp-3) var(--sp-4); border: 0; background: var(--surface-2); color: var(--ink); box-shadow: inset 0 -3px 0 var(--line-strong); }
.textarea { min-height: 132px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 44px; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); opacity: 1; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; box-shadow: none; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { box-shadow: inset 0 -3px 0 var(--danger); }
.check { display: flex; align-items: flex-start; gap: var(--sp-3); min-height: 44px; padding: var(--sp-2) 0; cursor: pointer; }
.check input { appearance: none; flex: none; width: 24px; height: 24px; margin: 1px 0 0; background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--line-strong); }
.check input:checked { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316171a' stroke-width='3.5' stroke-linecap='square'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center/18px no-repeat; box-shadow: none; }
.check input[type="radio"] { clip-path: circle(50%); }

/* ---------- tier blocks, chips ---------- */
.tier { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; background: var(--tier-n); color: var(--tier-n-ink); font: 800 1.375rem/1 var(--font-display); }
.tier.big { width: 64px; height: 64px; font-size: 2.75rem; }
.tier.small { width: 26px; height: 26px; font-size: 1rem; }
.tier[data-tier="S"], [data-tier="S"] > .tier-fill { background: var(--tier-s); color: var(--tier-ink); }
.tier[data-tier="A"], [data-tier="A"] > .tier-fill { background: var(--tier-a); color: var(--tier-ink); }
.tier[data-tier="B"], [data-tier="B"] > .tier-fill { background: var(--tier-b); color: var(--tier-ink); }
.tier[data-tier="C"], [data-tier="C"] > .tier-fill { background: var(--tier-c); color: var(--tier-ink); }
.tier[data-tier="D"], [data-tier="D"] > .tier-fill { background: var(--tier-d); color: var(--tier-d-ink); }
.chip { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: 24px; padding: 0 var(--sp-2); background: var(--surface-3); color: var(--ink); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.chip.demo { background: var(--warn-soft); color: var(--warn); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.info { background: var(--info-soft); color: var(--info); }

/* ---------- menus ---------- */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + var(--gap)); z-index: 50; min-width: 220px; display: grid; gap: 2px; padding: var(--gap); background: var(--surface-3); }
.menu a, .menu button { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 44px; padding: 0 var(--sp-3); border: 0; background: var(--surface-2); color: var(--ink); text-align: left; text-decoration: none; font-weight: 600; font-size: var(--fs-sm); }
.menu .menu-head { padding: var(--sp-2) var(--sp-3) var(--sp-1); font: 800 var(--fs-lg)/1.1 var(--font-display); }
.menu .menu-label { padding: var(--sp-3) var(--sp-3) var(--sp-1); color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .menu a:hover, .menu button:hover { background: var(--accent); color: var(--accent-ink); } }

/* ---------- say-box: the witch speaks from the margin ---------- */
.say { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: var(--sp-4); background: var(--surface-2); padding: var(--sp-4) var(--sp-4) 0 var(--sp-3); }
.say .witch { align-self: end; margin-top: calc(var(--sp-5) * -1); }
.say-text { align-self: center; min-width: 0; padding-bottom: var(--sp-4); display: grid; gap: var(--sp-2); }
.say-text strong { font: 800 var(--fs-xl)/1.05 var(--font-display); }
.say-text span { color: var(--ink-2); font-size: var(--fs-sm); }
.say-text .say-tour { justify-self: start; margin-top: var(--sp-1); background: var(--surface-3); }
.witch-wave { transform-origin: 200px 280px; transform-box: view-box; animation: witch-wave 2.4s var(--ease-in-out) infinite; }
@keyframes witch-wave { 0%, 60%, 100% { transform: rotate(0deg); } 70% { transform: rotate(-7deg); } 85% { transform: rotate(5deg); } }
@media (prefers-reduced-motion: reduce) { .witch-wave { animation: none; } }

/* ---------- notices, empty, loading ---------- */
.demo-banner { background: var(--surface); color: var(--ink-2); font-size: var(--fs-sm); }
.demo-banner > div { max-width: var(--maxw); margin-inline: auto; padding: var(--sp-2) var(--gutter); display: flex; gap: var(--sp-2); align-items: center; }
.demo-banner b { color: var(--warn); font-weight: 700; }
.empty { display: grid; justify-items: center; gap: var(--sp-4); padding: var(--sp-7) var(--sp-4); text-align: center; background: var(--surface); }
.empty p { color: var(--ink-2); max-width: 46ch; }
.page-loading { padding: var(--sp-7) 0; color: var(--ink-2); }
.notice { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); background: var(--info-soft); color: var(--ink); }
.notice.warn { background: var(--warn-soft); }
.notice.danger { background: var(--danger-soft); }
.notice.ok { background: var(--ok-soft); }

/* ---------- dialog, toasts ---------- */
dialog.modal { width: min(560px, calc(100vw - 2 * var(--gutter))); max-height: calc(100dvh - 48px); padding: 0; border: 0; background: var(--surface); color: var(--ink); overflow: auto; }
dialog.modal::backdrop { background: rgba(8, 8, 10, 0.72); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-5); background: var(--surface-2); }
.modal-body { padding: var(--sp-5); display: grid; gap: var(--sp-4); }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--gap); padding: 0 var(--sp-5) var(--sp-5); }
.toasts { position: fixed; left: 50%; bottom: var(--sp-5); z-index: 90; transform: translateX(-50%); display: grid; gap: var(--gap); width: min(440px, calc(100vw - 2 * var(--gutter))); }
.toast { padding: var(--sp-3) var(--sp-4); background: var(--accent); color: var(--accent-ink); font-weight: 600; animation: toast-in var(--dur-2) var(--ease-out); }
.toast.is-leaving { opacity: 0; transition: opacity 160ms linear; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- footer ---------- */
.site-footer { background: var(--surface); margin-top: var(--sp-8); }
.site-footer .inner { max-width: var(--maxw); margin-inline: auto; padding: var(--sp-7) var(--gutter) var(--sp-6); display: grid; gap: var(--sp-6); }
.site-footer h4 { font-size: var(--fs-md); margin-bottom: var(--sp-2); }
.site-footer li a { display: inline-flex; align-items: center; min-height: 36px; color: var(--ink-2); text-decoration: none; }
.site-footer .about { color: var(--ink-2); max-width: 44ch; margin-top: var(--sp-3); }
.site-footer .legal-note { color: var(--ink-3); font-size: var(--fs-sm); display: grid; gap: var(--sp-1); }
@media (pointer: coarse) { .site-footer li a { min-height: 44px; } }
@media (hover: hover) and (pointer: fine) { .site-footer li a:hover { color: var(--ink); text-decoration: underline; } }
@media (min-width: 720px) { .site-footer .inner { grid-template-columns: 1.6fr 1fr 1fr 1fr; } .site-footer .legal-note { grid-column: 1 / -1; } }

/* ---------- design field (a design inside a row or a grid) ---------- */
.dfield { position: relative; display: flex; flex-direction: column; background: var(--surface-2); text-decoration: none; min-width: 0; transition: background-color var(--dur-1) var(--ease-out); }
.dfield-cover { position: relative; aspect-ratio: 16 / 10; background: var(--bg); overflow: hidden; }
.dfield-cover img { width: 100%; height: 100%; object-fit: cover; }
.dfield-cover .tier { position: absolute; left: 0; top: 0; }
.dfield-cover .chip { position: absolute; right: 0; top: 0; }
.dfield-body { display: grid; gap: 2px; padding: var(--sp-2) var(--sp-3) var(--sp-3); }
.dfield-title { font-size: var(--fs-sm); font-weight: 600; line-height: 1.2; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dfield-rate { font: 700 var(--fs-lg)/1.1 var(--font-display); }
.dfield-meta { color: var(--ink-3); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dfield:focus-visible { outline-offset: -3px; }
/* the six criteria only appear inside an opened tier row (home.css); hover never covers the design */
.dfield-crit { display: none; }
.dfield-crit .crit { gap: 2px; }
.dfield-crit .crit-row { font-size: 0.75rem; line-height: 1.15; }
.dfield-crit .crit-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dfield-crit .crit-bar { grid-template-columns: repeat(5, 9px); }
.dfield-crit .crit-bar i { height: 7px; background: var(--bg); }
.dfield-crit .crit-bar i.on { background: var(--ink); }
/* hover only lifts the field slightly: lighter ground, brighter title, cover a touch brighter */
.dfield-cover img { transition: filter var(--dur-1) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .dfield:hover { background: var(--surface-3); } .dfield:hover .dfield-title { color: var(--ink); } .dfield:hover .dfield-cover img { filter: brightness(1.08); } }

/* six criteria as bars: same order everywhere, readable as a row */
.crit { display: grid; gap: 3px; }
.crit-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); font-weight: 600; }
.crit-bar { display: grid; grid-template-columns: repeat(5, 14px); gap: 2px; }
.crit-bar i { height: 8px; background: var(--surface-3); }
.crit-bar i.on { background: var(--ink); }
