/* Pension Alwin – Gästemappe · mobil zuerst (iPhone/iPad), skaliert bis Desktop */
:root {
  --accent: #448890;
  --accent-dark: #2f6168;
  --accent-soft: #e4f0f1;
  --bg: #f3f6f6;
  --card: #ffffff;
  --text: #1c2a2c;
  --muted: #5d6e70;
  --line: #d9e3e4;
  --radius: 10px;
  --radius-sm: 7px;
  --faint: #94a5a7;
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #5ba5ae;
    --accent-dark: #7bbac2;
    --accent-soft: #1f3336;
    --bg: #111a1b;
    --card: #1a2628;
    --text: #e8f0f0;
    --muted: #9db0b2;
    --line: #2a3b3d;
    --faint: #6c8183;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 120px; }
body {
  margin: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  padding-left: var(--sal);
  padding-right: var(--sar);
}
a { color: var(--accent-dark); }
h1, h2 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: clamp(1.5rem, 5vw, 2.2rem); }
h2 { font-size: 1.2rem; color: var(--accent-dark); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Kopfzeile */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + var(--sat)) 16px 10px;
  background: var(--card);
  border-bottom: 3px solid var(--accent);
}
.top { flex-wrap: wrap; }
.actions { display: inline-flex; align-items: center; gap: 16px; }
.call {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 1.5px solid var(--accent); border-radius: var(--radius); background: transparent;
  color: var(--accent-dark); text-decoration: none;
}
.call:active { background: var(--accent); color: #fff; }
.call svg { flex: 0 0 auto; }
.brand { display: inline-flex; align-items: center; text-decoration: none; min-height: 44px; }
.brand img { display: block; height: 44px; width: auto; max-width: 60vw; object-fit: contain; }
.brand-text { font-weight: 700; font-size: 1.25rem; color: var(--accent-dark); }
.lang { display: inline-flex; border: 1.5px solid var(--accent); border-radius: var(--radius); overflow: hidden; }
.lang button {
  appearance: none; border: 0; background: transparent; color: var(--accent-dark);
  font: inherit; font-weight: 600; min-width: 48px; min-height: 44px; padding: 0 12px; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* Navigation: horizontal scrollbar, klebt oben */
.tabs {
  position: sticky; top: 0; z-index: 10;
  display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 8px 16px; background: var(--bg);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto; display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 16px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--accent-dark);
  text-decoration: none; font-weight: 600; white-space: nowrap;
}
.tabs a:active, .tabs a:hover { background: var(--accent); color: #fff; }

/* Raster: 1 Spalte (Handy), 2 (iPad), 3 (PC) */
[hidden] { display: none !important; }
main {
  display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr);
  max-width: 1200px; margin: 0 auto; padding: 16px;
}
@media (min-width: 700px) {
  main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Reihenfolge wie im HTML: Wetter/Webcam, Lawinen, Gästeinfo, Skigebiet, Events, Restaurants, TV */
  #weather { order: 1; } #avalanche { order: 2; } #info { order: 3; } #ski { order: 4; }
  #events { order: 5; } #restaurants { order: 6; } #tv { order: 7; }
  /* mit Lawinenbericht stünden die Events allein in der letzten Zeile -> volle Breite */
  body:not(.no-av) #events { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  main { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* mit Lawinen:  Wetter | Lawinen (2)  //  Gästeinfo | Skigebiet | Events
     ohne Lawinen: Wetter (2) | Gästeinfo //  Skigebiet | Events (2) */
  #avalanche { grid-column: span 2; }
  body:not(.no-av) #events { grid-column: auto; }
  body.no-av #weather, body.no-av #events { grid-column: span 2; }
}
.wide { grid-column: 1 / -1; }
.card, .hero {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); min-width: 0;
}
.hero { border-left: 6px solid var(--accent); }
.hero p { margin: 0; color: var(--muted); }
.credit { margin: 10px 0 0; font-size: .6rem; color: var(--faint); }
.muted { color: var(--muted); }

.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  appearance: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; text-align: center;
  min-height: 48px; padding: 0 22px; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; text-decoration: none;
}
.btn.secondary { background: var(--accent-soft); color: var(--accent-dark); box-shadow: inset 0 0 0 1.5px var(--accent); }
.btns { display: grid; gap: 8px; margin-top: 12px; }
.linkline { margin: 14px 0 0; text-align: center; font-size: .9rem; }
.btn:active { background: var(--accent-dark); }

/* Laden / Fehler */
[data-state="loading"]::after { content: "…"; color: var(--muted); }
.err { color: var(--muted); }

/* Wetter */
.now { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.now .big { font-size: 3rem; font-weight: 700; line-height: 1; }
.now .ico { font-size: 2.6rem; }
.now .txt { color: var(--muted); }
#weather { display: flex; flex-direction: column; }
#weather .body { flex: 1; display: flex; flex-direction: column; }
.wbox { flex: 1; display: flex; flex-direction: column; }
.days { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.day {
  background: var(--accent-soft); border-radius: var(--radius-sm); padding: 14px 4px; font-size: .95rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.day .d { font-weight: 600; }
.day .i { font-size: 2.2rem; line-height: 1.1; }
.day .t { white-space: nowrap; }
.day .s { color: var(--muted); font-size: .8rem; }

/* Lawinen */
.lvl-row { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.lvl-row > span:last-child { flex: 1; min-width: 0; }
.lvl { flex: 0 0 auto; }
.lvl {
  min-width: 48px; height: 48px; border-radius: var(--radius-sm); display: inline-flex;
  align-items: center; justify-content: center; font-weight: 800; font-size: 1.4rem; color: #000;
}
.lvl-1 { background: #ccff66; }
.lvl-2 { background: #ffff00; }
.lvl-3 { background: #ff9900; }
.lvl-4 { background: #ff0000; color: #fff; }
.lvl-5 { background: #1a1a1a; color: #fff; border: 3px solid #ff0000; }
.lvl-0 { background: var(--line); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 4px 12px; font-size: .85rem; }
.small { font-size: .85rem; }
details.more { margin-top: 8px; }
details.more summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--accent-dark); font-weight: 600; }

/* Webcam */
/* Reiter in einer Box (Wetter / Webcam) */
.seg {
  display: grid; grid-template-columns: 1fr 1fr; margin: 10px 0 14px;
  border: 1.5px solid var(--accent); border-radius: var(--radius-sm); overflow: hidden;
}
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--accent-dark);
  font: inherit; font-weight: 600; min-height: 44px; padding: 0 12px; cursor: pointer;
}
.seg button + button { border-left: 1.5px solid var(--accent); }
.seg button[aria-selected="true"] { background: var(--accent); color: #fff; }
.seg button:focus-visible { outline: 3px solid var(--accent-dark); outline-offset: -3px; }

.cam { display: block; }
.cam img { display: block; width: 100%; height: auto; border-radius: var(--radius-sm); background: var(--line); }

/* Akkordeon Gästeinfo */
.acc { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.acc details { background: var(--accent-soft); border-radius: var(--radius-sm); }
.acc summary {
  list-style: none; cursor: pointer; min-height: 52px; padding: 0 16px;
  display: flex; align-items: center; gap: 12px; font-weight: 600;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after { content: "＋"; margin-left: auto; color: var(--accent-dark); }
.acc details[open] summary::after { content: "−"; }
.acc .txt { padding: 0 16px 14px; }
.acc .txt p { margin: .2rem 0; }
.acc .draft { opacity: .6; }
.acc .txt p a { font-weight: 700; padding: 4px 2px; }
.acc .txt .btn { margin-top: 10px; }

/* Events */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list a {
  display: block; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft);
  text-decoration: none; color: var(--text); min-height: 48px;
}
.list .t { font-weight: 600; display: block; }
.list .m { color: var(--muted); font-size: .85rem; }
.list a:active { background: var(--accent); color: #fff; }
.list a:active .m { color: #fff; }

/* TV */
.search { display: block; margin-bottom: 10px; }
.search input {
  width: 100%; min-height: 48px; padding: 0 14px; font: inherit; /* 16px: kein iOS-Zoom */
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--text);
}
.search input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.tv { max-height: 460px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tvgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); column-gap: 24px; }
.tvrow { display: flex; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.tvrow .nr { flex: 0 0 3em; font-weight: 700; color: var(--accent-dark); }

/* Skigebiet-Bericht */
.report { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); margin: 8px 0 4px; }
.rgroup { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 12px 14px; }
.rgroup h3 { margin: 0 0 6px; font-size: 1rem; color: var(--accent-dark); }
.rrow { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.rrow:last-child { border-bottom: 0; }
.rrow .v { font-weight: 700; text-align: right; }

/* Restaurants */
#rest-frame iframe {
  width: 100%; height: min(80vh, 760px); min-height: 520px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; margin-bottom: 12px;
}

.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 8px 16px calc(24px + var(--sab)); }

@media (min-width: 900px) {
  .top { padding-left: max(24px, calc((100vw - 1200px) / 2 + 16px)); padding-right: max(24px, calc((100vw - 1200px) / 2 + 16px)); }
  .tabs { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.ver { font-size: .6rem; opacity: .5; margin: .3rem 0 0; }
