/* TWEST-dashboard: tab bar of the four plant pages, and the status cards of the NOW page */

.twest-tabs {
  display: flex; flex-wrap: nowrap; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin: 0 40px 16px; padding: 0; border-bottom: 1px solid #e3e1da;   /* same side margins as the cards */
  font: 600 14px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: .06em;
}
/* tabs: left; plant state: right */
.twest-tabs-list { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; margin-right: auto; }
.twest-tabs a.twest-tab,
.twest-tabs a.twest-tab:visited {
  padding: 10px 16px; margin-bottom: -1px; border-bottom: 3px solid transparent;
  color: #6b6a66; text-decoration: none; box-shadow: none; white-space: nowrap;
}
.twest-tabs a.twest-tab:hover,
.twest-tabs a.twest-tab:focus { color: #1f1e1d; border-bottom-color: #b9b6ad; }
.twest-tabs a.twest-tab.is-on { color: #1f1e1d; border-bottom-color: #5b2d8a; }
@media (max-width: 768px) {
  .twest-tabs { margin-left: 30px; margin-right: 30px; }
}
@media (max-width: 600px) {
  .twest-tabs { font-size: 11px; letter-spacing: .02em; gap: 6px; }
  /* one row; on very narrow screens the tabs scroll sideways instead of wrapping */
  .twest-tabs-list { gap: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .twest-tabs-list::-webkit-scrollbar { display: none; }
  .twest-tabs a.twest-tab { padding: 9px 5px; margin-bottom: 0; }
}

/* ---------- NOW page ---------- */

.twest-view-now #tes-status-bar { display: none; }
.twest-view-now .wp-block-image,
.twest-view-now figure.wp-block-image { position: relative; margin: 0; width: 100%; max-width: 100%; overflow: visible; }
.twest-view-now .wp-block-image img { width: 100%; height: auto; display: block; }

#tes-overlay { font-size: clamp(10px, 1.8vw, 16px); }
#tes-overlay .tes-card {
  min-width: 0; padding: 0.3em 0.45em;
  background: rgba(10,12,20,.78); color: #f4f6fb;
  font: 1em/1.25 ui-sans-serif, system-ui, sans-serif;
  border-radius: 0.35em; border: 1px solid rgba(255,255,255,.18); text-align: left;
}
#tes-overlay .tes-k { opacity: .7; font-size: .75em; letter-spacing: .05em; text-transform: uppercase; margin-bottom: .12em; text-align: left; color: inherit; }
#tes-overlay .tes-v { text-align: left; color: inherit; font: inherit; }

/* on the plant picture */
#tes-overlay.is-placed { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
#tes-overlay.is-placed .tes-card { position: absolute; max-width: 35%; width: max-content; z-index: 6; }
#tes-overlay.is-placed .tes-time    { left: 8%;   top: 3%; }
#tes-overlay.is-placed .tes-weather { right: 8%;  top: 3%; }
#tes-overlay.is-placed .tes-heat    { right: 52%; top: 30%; }
#tes-overlay.is-placed .tes-steam   { right: 32%; top: 52%; max-width: 42%; }
#tes-overlay.is-placed .tes-store   { right: 8%;  top: 30%; max-width: 42%; }
@media (max-width: 400px) {   /* narrow phones: keep the TES card clear of the MV supply card */
  #tes-overlay.is-placed .tes-store { right: 2%; max-width: 46%; }
}

/* no picture on the page: a plain row of cards */
#tes-overlay:not(.is-placed) { display: flex; flex-wrap: wrap; gap: .5em; margin-top: 1em; font-size: 15px; }

/* ---------- plant state, right end of the tab bar ---------- */

.twest-state {
  flex: none; margin: 0 0 6px auto; display: inline-flex; align-items: center;
  padding: 5px 12px 5px 9px; border-radius: 999px; border: 1px solid currentColor;
  letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.twest-state-item { display: none; align-items: center; gap: 6px; }
.twest-state svg { display: block; flex: none; }
.twest-state[data-state="discharging"] [data-for="discharging"],
.twest-state[data-state="charging-discharging"] [data-for="charging-discharging"],
.twest-state[data-state="charging"] [data-for="charging"],
.twest-state[data-state="hot-standby"] [data-for="hot-standby"],
.twest-state[data-state="cold-standby"] [data-for="cold-standby"] { display: inline-flex; }

/* green: operating; yellow: hot standby; red: cold standby */
.twest-state[data-state="discharging"],
.twest-state[data-state="charging-discharging"],
.twest-state[data-state="charging"] { color: #15803d; background: #eaf6ee; }
.twest-state[data-state="hot-standby"] { color: #8a6100; background: #fff4c2; border-color: #e0b100; }
.twest-state[data-state="hot-standby"] svg { color: #d99a00; }
.twest-state[data-state="cold-standby"] { color: #c81e1e; background: #fdecec; }
/* phones: symbol only; the text stays available to screen readers and as a tooltip */
@media (max-width: 600px) {
  .twest-state { padding: 5px; margin-bottom: 5px; }
  .twest-state svg { width: 18px; height: 18px; }
  .twest-state-label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
}

/* ---------- same frame on all four pages, so the tab bar does not move between them ---------- */

/* keep the scrollbar's space even when a page is short enough not to scroll */
html { scrollbar-gutter: stable; }

/* no theme padding around the article on any of the four pages (the NOW page is set this way in GeneratePress) */
body[class*="twest-view-"] .inside-article,
body[class*="twest-view-"].one-container .site-content { padding: 0; }

/* the dashboard brings its own inner spacing instead */
#twest-dashboard.tes { padding: 8px 40px 40px; }
@media (max-width: 768px) {
  #twest-dashboard.tes { padding: 8px 30px 30px; }
}

/* phones: tab labels without "LAST " (DAY, WEEK, MONTH, YEAR) */
@media (max-width: 600px) {
  .twest-tab-pre { display: none; }
}

/* ---------- NOW page: lifetime cards below the plant picture ---------- */

.twest-lifetime {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 20px 0 0;
  padding: 0 40px 40px; box-sizing: border-box;   /* same side margins as the dashboard on the LAST pages */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: #1f1e1d;
}
.twest-life-card { background: #fff; border: 1px solid #e3e1da; border-radius: 8px; padding: 14px 16px; min-width: 0; }
.twest-life-k { color: #6b6a66; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.twest-life-v { font-family: Georgia, "Times New Roman", serif; font-size: 30px; line-height: 1.2; font-variant-numeric: tabular-nums; margin: 4px 0 2px; white-space: nowrap; }
.twest-life-v small { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: #6b6a66; margin-left: 5px; }
.twest-life-n { color: #6b6a66; font-size: 13px; line-height: 1.35; }
.twest-life-since { grid-column: 1 / -1; margin: 0; color: #6b6a66; font-size: 13px; }
@media (max-width: 768px) {
  .twest-lifetime { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 30px 30px; }
  .twest-life-v { font-size: 24px; }
}

/* ---------- site header: logos in line with the tabs and cards ---------- */
/* The theme header spans the whole window; its logo row (.tes-brand) gets the content's width instead:
   1200 px content minus 40 px on each side. Below 1200 px the header's own 40/30 px padding already matches. */
body[class*="twest-view-"] .tes-brand { max-width: 1120px; margin-left: auto; margin-right: auto; }

/* ---------- light / dark switch, right end of the tab bar ---------- */

.twest-tabs button.twest-theme {
  flex: none; margin: 0 0 6px 8px; padding: 0; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #d6d3cc; border-radius: 999px; background: transparent; color: #6b6a66; cursor: pointer; box-shadow: none;
}
.twest-tabs button.twest-theme:hover,
.twest-tabs button.twest-theme:focus-visible { color: #1f1e1d; border-color: #b9b6ad; background: transparent; }
.twest-theme svg { display: block; }
.twest-theme svg.twest-theme-sun, html.twest-dark .twest-theme svg.twest-theme-moon { display: none; }
html.twest-dark .twest-theme svg.twest-theme-sun { display: block; }
@media (max-width: 600px) {
  .twest-tabs button.twest-theme { width: 30px; height: 30px; margin: 0 0 5px 4px; }
}

/* ---------- dark display ---------- */

html.twest-dark { color-scheme: dark; }
html.twest-dark body { background: #121417; color: #e6e4df; }
html.twest-dark .site-header,
html.twest-dark .inside-article,
html.twest-dark .site-info { background: #121417; color: #e6e4df; }
html.twest-dark .site-info a { color: #b9a4e6; }
/* page text (Impressum, Datenschutz): headings, links and code follow the dark display */
html.twest-dark .inside-article h1, html.twest-dark .inside-article h2, html.twest-dark .inside-article h3,
html.twest-dark .entry-title { color: #e6e4df; }
html.twest-dark .entry-content a, html.twest-dark .entry-content a:visited { color: #b9a4e6; }
html.twest-dark .entry-content code { background: #1c1f24; color: #e6e4df; }
/* the logos are drawn for a white background: keep them on a small white plate */
html.twest-dark .tes-logo { background: #fff; border-radius: 6px; padding: 4px 8px; box-sizing: content-box; }

html.twest-dark .twest-tabs { border-bottom-color: #30353c; }
html.twest-dark .twest-tabs a.twest-tab,
html.twest-dark .twest-tabs a.twest-tab:visited { color: #a3a19b; }
html.twest-dark .twest-tabs a.twest-tab:hover,
html.twest-dark .twest-tabs a.twest-tab:focus { color: #e6e4df; border-bottom-color: #5a5f67; }
html.twest-dark .twest-tabs a.twest-tab.is-on { color: #e6e4df; border-bottom-color: #a98ae0; }
html.twest-dark .twest-tabs button.twest-theme { border-color: #3a3f47; color: #a3a19b; }
html.twest-dark .twest-tabs button.twest-theme:hover,
html.twest-dark .twest-tabs button.twest-theme:focus-visible { color: #e6e4df; border-color: #5a5f67; }

html.twest-dark .twest-state[data-state="discharging"],
html.twest-dark .twest-state[data-state="charging-discharging"],
html.twest-dark .twest-state[data-state="charging"] { color: #4ade80; background: rgba(34,197,94,.12); }
html.twest-dark .twest-state[data-state="hot-standby"] { color: #facc15; background: rgba(234,179,8,.12); border-color: #ca9a04; }
html.twest-dark .twest-state[data-state="hot-standby"] svg { color: #facc15; }
html.twest-dark .twest-state[data-state="cold-standby"] { color: #f87171; background: rgba(239,68,68,.12); }

html.twest-dark .twest-lifetime { color: #e6e4df; }
html.twest-dark .twest-life-card { background: #1c1f24; border-color: #30353c; }
html.twest-dark .twest-life-k,
html.twest-dark .twest-life-v small,
html.twest-dark .twest-life-n,
html.twest-dark .twest-life-since { color: #a3a19b; }

/* ---------- tab bar: EN/DE switch ---------- */
.twest-tabs button.twest-lang {
  flex: none; margin: 0 0 6px 8px; padding: 0; width: 32px; height: 32px; border: 1px solid #d6d3cc; border-radius: 999px;
  background: transparent; color: #6b6a66; font: 700 11px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; letter-spacing: .04em; cursor: pointer; box-shadow: none;
}
.twest-tabs button.twest-lang:hover, .twest-tabs button.twest-lang:focus-visible { color: #1f1e1d; border-color: #b9b6ad; background: transparent; }
html.twest-dark .twest-tabs button.twest-lang { border-color: #3a3f47; color: #a3a19b; }
html.twest-dark .twest-tabs button.twest-lang:hover, html.twest-dark .twest-tabs button.twest-lang:focus-visible { color: #e6e4df; border-color: #5a5f67; }
@media (max-width: 600px) {
  .twest-tabs button.twest-lang { width: 30px; height: 30px; margin: 0 0 5px 4px; }
}

/* phones: room for five tabs plus state, language and display buttons */
@media (max-width: 600px) {
  .twest-tabs { letter-spacing: 0; gap: 4px; }
  .twest-tabs a.twest-tab { padding: 9px 4px; }
  .twest-tabs button.twest-lang, .twest-tabs button.twest-theme { width: 26px; height: 26px; margin: 0 0 7px 2px; }
  .twest-tabs button.twest-theme svg { width: 15px; height: 15px; }
  .twest-tabs button.twest-lang { font-size: 10px; }
  .twest-state { padding: 3px; }
  .twest-state svg { width: 16px; height: 16px; }
}
@media (max-width: 400px) {
  .twest-tabs { font-size: 10.5px; }
  .twest-tabs a.twest-tab { padding: 9px 3px; }
}
