/* "Diese Woche in der Geschichte" ueber der Suche der Startseite (thisweek.js).
   Zu: ein Etikett "On this day" haengt links unter der Menuelinie, buendig mit "Resolutionen".
   Auf: die Tafel gleitet unter der Linie hervor, das Etikett im selben Moment hinter die Linie; ein runder
   Pfeil unten mittig (beim Ueberfahren, auf Touchgeraeten immer) klappt sie wieder ein.
   Rechner: Karte mit Ereignis und Bruecke (.tw-desk), Handy: Kalenderblatt (.tw-mob). */
.thisweek {
  --tw-ease: cubic-bezier(.22, .8, .24, 1); --tw-time: .55s;
  /* direkt an die Linie (.masthead hat 4px Abstand nach unten); seitlich Platz fuer den Schatten */
  margin: -4px -16px -12px;   /* unten: Raum fuer Schatten und Pfeil, ohne die Suche wegzuschieben */
}
.thisweek[hidden] { display: none; }
.tw-clip { position: relative; overflow: hidden; height: 0; }
.thisweek.ready .tw-clip { transition: height var(--tw-time) var(--tw-ease); }

.tw-tab, .tw-panel { position: absolute; top: 0; left: 16px; }
.tw-tab {
  font: 800 10.5px/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--un-deep);
  background: var(--un-softer); border: 1px solid var(--un-soft); border-top: 0; border-radius: 0 0 10px 10px;
  padding: 8px 14px 9px; cursor: pointer;
}
.tw-tab:hover, .tw-tab:focus-visible { background: var(--un-soft); outline: none; }
.tw-panel {
  right: 16px; background: var(--surface); border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 var(--r-card) var(--r-card); box-shadow: var(--shadow);
  transform: translateY(calc(-100% - 30px));   /* samt Pfeil ganz hinter der Linie */
}
.thisweek.ready .tw-tab, .thisweek.ready .tw-panel { transition: transform var(--tw-time) var(--tw-ease), box-shadow .2s, border-color .2s; }
.thisweek.open .tw-tab { transform: translateY(calc(-100% - 12px)); }
.thisweek.open .tw-panel { transform: none; }
.thisweek.open .tw-panel:hover { box-shadow: 0 2px 4px rgba(46, 65, 87, .06), 0 8px 22px rgba(46, 65, 87, .11); border-color: #D9E4EE; }

/* Zuklappen: Kreis mit schlichtem Winkel, halb ueber dem unteren Rand */
.tw-close {
  position: absolute; left: 50%; bottom: -14px; z-index: 3; width: 28px; height: 28px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--un-deep);
  box-shadow: 0 2px 6px rgba(46, 65, 87, .10);
  opacity: 0; transform: translate(-50%, -4px); transition: opacity .2s, transform .2s, background-color .15s, border-color .15s;
}
.tw-panel:hover .tw-close, .tw-close:focus-visible { opacity: 1; transform: translate(-50%, 0); }
.tw-close:hover, .tw-close:focus-visible { background: var(--un-deep); border-color: var(--un-deep); color: #fff; outline: none; }
@media (hover: none) { .tw-close { opacity: 1; transform: translate(-50%, 0); } }
.thisweek:not(.open) .tw-close { visibility: hidden; transition-delay: 0s, 0s, 0s, 0s; }
@media (prefers-reduced-motion: reduce) {
  .thisweek.ready .tw-clip, .thisweek.ready .tw-tab, .thisweek.ready .tw-panel { transition: none; }
}
/* die rechte Spalte hat eigenen Hintergrund: unten rechts mitrunden (die Tafel schneidet nicht ab,
   damit der Pfeil ueber den Rand ragen kann) */
.tw-grid > .tw-side:last-child { border-bottom-right-radius: calc(var(--r-card) - 1px); }
.tw-mob { display: none; }

.tw-label, .tw-kick {
  font: 800 10.5px var(--font-body); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0;
}
.tw-kick { display: flex; align-items: center; gap: 8px; }
.tw-kick.orange { color: #B5601E; }
.tw-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--un-deep); box-sizing: border-box; flex: none; }
.tw-kick.orange .tw-dot { background: #D9792B; border-color: #D9792B; }
.tw-more, .tw-link { font: 800 13.5px var(--font-body); color: var(--un-deep); text-decoration: none; }
a.tw-more:hover, .tw-link:hover { color: var(--un); }

.tw-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 22px; border-bottom: 1px solid #EEF3F8; }
.tw-hint { font: 700 12.5px var(--font-body); color: var(--faint); }
.tw-link { font-size: 12.5px; }

.tw-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.tw-grid.one { grid-template-columns: minmax(0, 1fr); }
.tw-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tw-grid.two > * + * { border-left: 1px solid #EEF3F8; }

.tw-event { padding: 18px 22px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.tw-title { margin: 0; font: 700 19px/1.25 var(--font-display); }
.tw-title a { color: var(--ink); text-decoration: none; }
.tw-title a:hover { color: var(--un-deep); }
.tw-text { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--muted); }

/* rechte Seite: Abstimmung (grau) oder Bruecke zur Abstimmung (orange, wie im Chronos) */
.tw-side { position: relative; padding: 18px 22px; display: flex; flex-direction: column; gap: 9px; color: var(--ink); text-decoration: none; }
.tw-grid > .tw-side { background: #F7FAFD; border-left: 1px solid #EEF3F8; }
.tw-grid.two > .tw-side { background: none; }
.tw-grid > .tw-bridge { background: #FBF6F1; border-left-color: #F1E2D3; }
.tw-bridge .tw-kick { color: #B5601E; }
.tw-bridge .tw-kick svg { color: #D9792B; flex: none; }
.tw-side:hover .tw-vtitle { color: var(--un-deep); }
.tw-cover { position: absolute; inset: 0; z-index: 1; }
.tw-vtitle { font: 600 16px/1.3 var(--font-display); }
.tw-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.tw-sym { font: 500 12.5px var(--font-mono); color: var(--un-deep); background: var(--un-softer); border-radius: 6px; padding: 3px 7px; }
.tw-sym.orange { color: #B5601E; background: #FBF0E6; border: 1px solid #F0D2B6; padding: 2px 7px; }
.tw-side .tw-more { margin-top: auto; }

.tw-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; }
.tw-bar .y { background: var(--yes-bg); } .tw-bar .n { background: var(--no-bg); }
.tw-bar .a { background: var(--abst-bg); } .tw-bar .x { background: var(--nv-bg); }
.tw-counts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; font: 700 12.5px var(--font-body); }
.tw-counts .y { color: var(--yes-ink); } .tw-counts .n { color: var(--no-ink); }
.tw-counts .a { color: var(--abst-ink); } .tw-counts .x { color: var(--nv-ink); }

/* Abstimmung gehoert zu einem Chronos-Ereignis */
.tw-context {
  position: relative; z-index: 2; align-self: flex-start; display: inline-flex; align-items: center; gap: 7px;
  font: 700 12.5px var(--font-body); color: #B5601E; text-decoration: none;
  background: #FBF0E6; border: 1px dashed #E8B98C; border-radius: var(--r-pill); padding: 3px 11px;
}
.tw-context::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #D9792B; }
.tw-context:hover { border-style: solid; }

/* ---------- Handy: Kalenderblatt ---------- */
@media (max-width: 640px) {
  .tw-panel { border-radius: 0 0 14px 14px; }
  .tw-tab { padding-left: 8px; padding-right: 8px; }   /* buendig mit "Resolutionen" (Menue hat hier 8px) */
  .tw-desk { display: none; }
  .tw-mob { display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 22px; }   /* unten Platz fuer den Pfeil */
  .tw-label { font-size: 10px; }
  .tw-mrow { display: flex; gap: 12px; align-items: flex-start; }
  .tw-mhead { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
  .tw-mtitle { font: 600 15.5px/1.3 var(--font-display); color: var(--ink); text-decoration: none; }
  .tw-tile { flex: none; width: 58px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; text-align: center; }
  .tw-tile b { display: block; background: var(--un-deep); color: #fff; font: 800 10px var(--font-body); letter-spacing: .1em; text-transform: uppercase; padding: 3px 0; }
  .tw-tile.orange b { background: #D9792B; }
  .tw-tile.grey b { background: #93A5B7; }
  .tw-tile span { display: block; font: 700 21px/1 var(--font-display); padding: 6px 0 1px; }
  .tw-tile i { display: block; font: normal 700 11px var(--font-display); color: #8FA6BD; padding-bottom: 6px; }
  .tw-text { font-size: 13.5px; line-height: 1.45; }
  .tw-bar { height: 10px; border-radius: 5px; }
  .tw-counts { font-size: 12px; gap: 2px 10px; }
  .tw-mvote, .tw-mbridge { display: flex; flex-direction: column; gap: 6px; text-decoration: none; }
  .tw-mbridge { background: #FBF6F1; border: 1px solid #F1E2D3; border-radius: 12px; padding: 10px 12px; }
  .tw-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
  .tw-pg { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--un-deep); cursor: pointer; display: grid; place-items: center; padding: 0; }
  .tw-pg:active { background: var(--un-softer); }
  .tw-dots { display: flex; gap: 7px; }
  .tw-dots i { width: 9px; height: 9px; border-radius: 50%; background: #C5D3E0; }
  .tw-dots i.ev { background: var(--un-deep); }
  .tw-dots i.on { outline: 2px solid var(--un-deep); outline-offset: 2px; }
}
