/* A published mini website — shared by the page itself (pages/_base.html) and
   the editor preview (editor.html), so the two can't drift apart.

   Everything is scoped to .mw. Colours, fonts and shapes arrive as custom
   properties from app/services/styles.py → resolve() (published page) or its
   JS twin app/static/js/looks.js (editor); the design's axis values arrive as
   data attributes on .mw:

     data-header  classic | hero | framed | arch | sticker | textfirst | poster
     data-bar     bar | rule | none
     data-bg      paper | gradient | blur | dots | rays | grid
     data-btn     outline | soft | glass | card | inverse | underline | pop | bracket | ink
     data-photo   duotone | mono         (optional)
     data-align   center                 (optional)

   .mw.has-cover is set when the page has at least one photo.

   Tokens: --sheet (background), --text, --muted, --heading, --accent,
   --accent-text (accent readable as text), --accent-fill (accent readable
   under --on-accent), --on-accent, --soft-fill, --on-soft, --line, --surface, --font-*, --h1-*,
   --btn-*, --frame-*, --scrim, --photo (url of the first photo). */

.mw, .mw * { box-sizing: border-box; }
.mw {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--sheet);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
}

/* --- Backgrounds ----------------------------------------------------------- */
.mw[data-bg=gradient] {
  background: linear-gradient(165deg, var(--sheet) 0%, color-mix(in srgb, var(--accent) 16%, var(--sheet)) 100%);
}
.mw[data-bg=dots] {
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 35%, transparent) 1.6px, transparent 2px) 0 0 / 18px 18px, var(--sheet);
}
.mw[data-bg=rays] {
  background: repeating-conic-gradient(from -90deg at 50% -8%, color-mix(in srgb, var(--accent) 10%, var(--sheet)) 0deg 5deg, var(--sheet) 5deg 10deg);
}
.mw[data-bg=grid] {
  background:
    linear-gradient(color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--sheet);
}
/* Photo blur: the first photo, blurred, behind everything; the background
   colour washes over it so it still sets the mood (and the text colour). */
.mw[data-bg=blur].has-cover::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: var(--photo) center / cover;
  filter: blur(28px) saturate(1.2);
  transform: scale(1.25);
}
.mw[data-bg=blur].has-cover::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--sheet); opacity: 0.72;
}

/* --- Strip above the cover ----------------------------------------------------- */
.mw .theme-bar { height: 10px; background: var(--accent); }
.mw[data-bar=rule] .theme-bar { height: 0; margin: 14px 24px 0; border-top: 4px double var(--text); background: none; }
.mw[data-bar=none] .theme-bar { display: none; }

/* --- Cover ------------------------------------------------------------------------ */
.mw .cover {
  position: relative;
  isolation: isolate;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface);
}
.mw .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mw .cover-carousel {
  display: flex; width: 100%; height: 100%;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none; -ms-overflow-style: none;
}
.mw .cover-carousel::-webkit-scrollbar { display: none; }
.mw .cover-slide { flex: 0 0 100%; width: 100%; height: 100%; scroll-snap-align: center; }
/* Prev / next arrows only where there's a real pointer; touch swipes. */
.mw .cover-nav { display: none; }
@media (hover: hover) and (pointer: fine) {
  .mw .cover-nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
    background: rgba(0, 0, 0, 0.28); color: #fff; cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
  }
  .mw .cover-nav:hover { background: rgba(0, 0, 0, 0.45); }
  .mw .cover-nav:disabled { opacity: 0.3; cursor: default; }
  .mw .cover-nav--prev { left: 8px; }
  .mw .cover-nav--next { right: 8px; }
  .mw .cover-nav svg { width: 18px; height: 18px; display: block; }
}
.mw .cover-dots {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 2;
  display: flex; gap: 6px; padding: 4px 8px;
  background: rgba(0, 0, 0, 0.18); border-radius: 999px;
}
.mw .cover-dot {
  width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.55); cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.mw .cover-dot[aria-current="true"] { background: #fff; transform: scale(1.25); }

/* Framed: inset, with the design's own corner, border and shadow. */
.mw[data-header=framed] .cover {
  margin: 16px 16px 0;
  border-radius: var(--frame-radius);
  border: var(--frame-border);
  box-shadow: var(--frame-shadow);
  padding: var(--frame-pad);
  background: transparent;
}
.mw[data-header=framed] .cover img { border-radius: calc(var(--frame-radius) / 2); }
/* Arch: a tall photo with a rounded top, like a window. */
.mw[data-header=arch] .cover {
  margin: 20px 24px 0; aspect-ratio: 4 / 5;
  border-radius: 999px 999px var(--frame-radius) var(--frame-radius);
}
/* Polaroid: white border, slight tilt. */
.mw[data-header=sticker] .cover {
  margin: 24px 32px 4px; aspect-ratio: 4 / 3; overflow: hidden;
  border: 8px solid #fff; border-bottom-width: 22px; border-radius: 4px;
  box-shadow: 0 14px 28px -14px rgba(0, 0, 0, 0.45);
  transform: rotate(-2.5deg);
}
/* Title first: headline above the photo, photo inset below it. */
.mw[data-header=textfirst] .cover { margin: 0 24px; border-radius: var(--frame-radius); aspect-ratio: 4 / 3; }
.mw .content--head { padding-bottom: 20px; }
/* Hero: tall full-bleed photo; subtitle + title sit on a scrim. */
.mw[data-header=hero] .cover { aspect-ratio: 4 / 5; }
.mw[data-header=hero] .cover::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, transparent 35%, var(--scrim) 100%);
}
.mw[data-header=hero] .cover-dots { top: 12px; bottom: auto; }
.mw .hero-text { position: absolute; left: 24px; right: 24px; bottom: 24px; z-index: 2; }
.mw .hero-text h1 { color: #fff; font-size: calc(var(--h1-size) * 1.2); }
.mw .hero-text .subtitle { color: #fff; opacity: 0.9; }
.mw[data-header=hero]:not(.has-cover) > .content { padding-top: 64px; }
/* Poster: the title on a solid block of the accent; photo underneath. */
.mw .poster-head { background: var(--accent-fill); padding: 34px 24px 26px; }
.mw .poster-head h1, .mw .poster-head .subtitle { color: var(--on-accent); }
.mw .poster-head h1 { line-height: 0.92; margin: 0; }
.mw .poster-head .subtitle { margin-bottom: 12px; }

/* Photo treatments. */
.mw[data-photo=duotone] .cover { background: var(--accent); }
.mw[data-photo=duotone] .cover img { filter: grayscale(1) contrast(1.15) brightness(1.1); mix-blend-mode: multiply; }
.mw[data-photo=mono] .cover img { filter: grayscale(1) contrast(1.2); }

/* --- Content -------------------------------------------------------------------- */
.mw .content { padding: 20px 24px 32px; }
/* No cover photo: a little more air under the strip. */
.mw .theme-bar + .content { padding-top: 28px; }
.mw[data-align=center] .content, .mw[data-align=center] .hero-text { text-align: center; }

.mw h1 {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: var(--h1-size);
  letter-spacing: var(--h1-tracking);
  text-transform: var(--h1-transform);
  line-height: 1.1;
  margin: 0 0 8px;
  color: var(--heading);
  overflow-wrap: break-word;
}
.mw .subtitle, .mw .specs dt, .mw .section-label, .mw .wifi-kicker {
  font-family: var(--font-label);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--accent-text);
}
.mw .subtitle { margin-bottom: 6px; }
.mw .price {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 32px;
  color: var(--accent-text);
  margin: 4px 0 12px;
}
.mw .specs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 16px 0; margin: 16px 0;
}
.mw .specs dd { margin: 2px 0 0; font-size: 14px; font-weight: 500; }
.mw .description { white-space: pre-line; color: var(--muted); margin: 16px 0; }
/* Users paste raw URLs into free text; .mw clips overflow, so long words must wrap. */
.mw :is(.description, .programme-text, .location, .specs dd, .rules li, .checkout-steps li, .organizer, .date-row) { overflow-wrap: anywhere; }
.mw .section-label { margin: 20px 0 6px; }
.mw .location { color: var(--muted); font-size: 14px; }
.mw .map {
  height: 180px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); margin: 8px 0 0; overflow: hidden;
}
.mw .organizer, .mw .date-row { margin-top: 20px; font-size: 14px; color: var(--muted); text-align: center; }
.mw .organizer-label, .mw .date-label { font-weight: 600; color: var(--text); }

/* Gästemappe: Wi-Fi, house rules, check-out. */
.mw .wifi { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 4px 0 8px; }
.mw .wifi-network { margin-top: 2px; font-size: 18px; font-weight: 700; word-break: break-word; }
.mw .wifi-secret { margin-top: 14px; }
.mw .wifi-password {
  margin: 2px 0 0; font-size: 26px; font-weight: 700; letter-spacing: 0.04em;
  line-height: 1.25; word-break: break-all; user-select: all;
}
.mw .rules, .mw .checkout-steps { margin: 4px 0 0; padding-left: 1.2em; color: var(--muted); }
.mw[data-align=center] .rules, .mw[data-align=center] .checkout-steps { list-style-position: inside; padding-left: 0; }
.mw .rules li, .mw .checkout-steps li { margin: 6px 0; }
.mw .checkout-time { margin: 2px 0 0; font-size: 28px; font-weight: 700; letter-spacing: 0.02em; color: var(--heading); }

/* Kirchenheft: order of service. */
.mw .programme { list-style: none; padding: 0; margin: 8px 0 0; }
.mw .programme li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.mw .programme li:last-child { border-bottom: 0; }
.mw .programme-item { display: block; font-weight: 600; font-size: 15px; }
.mw .programme-detail { display: block; font-size: 13px; color: var(--muted); margin-top: 1px; }
.mw .programme-text {
  white-space: pre-line; font-size: 13px; color: var(--muted);
  margin-top: 6px; padding-left: 12px; border-left: 2px solid var(--line);
}

/* Impressum sub-view. */
.mw .back-link { font-size: 13px; margin: 0 0 16px; }
.mw .back-link a, .mw .impressum-value a { color: var(--accent-text); font-weight: 600; text-decoration: none; }
.mw .impressum-value { color: var(--muted); font-size: 15px; margin: 0 0 4px; overflow-wrap: anywhere; white-space: pre-line; }
.mw .impressum-note { color: var(--muted); font-size: 13px; margin-top: 20px; }

/* --- Buttons ----------------------------------------------------------------------
   Primary: the call button (.contact-btn.primary) — the accent, filled.
   Secondary: links, WhatsApp, email, the Wi-Fi copy button — styled by data-btn. */
.mw .link-buttons, .mw .contact-buttons { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.mw .link-buttons + .contact-buttons { margin-top: -10px; }
.mw .link-btn, .mw .contact-btn, .mw .wifi-copy {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px; border: 0; border-radius: var(--btn-radius);
  font-family: var(--font-button); font-size: 15px; font-weight: 600; line-height: 1.3;
  text-align: center; text-decoration: none; overflow-wrap: anywhere; cursor: pointer;
  background: transparent; color: var(--accent-text);
  transition: transform 0.15s;
}
.mw .wifi-copy { margin-top: 12px; }
.mw .link-btn:hover, .mw .contact-btn:hover { transform: translateY(-1px); }
.mw .contact-btn.primary {
  background: var(--accent-fill); color: var(--on-accent);
  border: var(--btn-border); box-shadow: var(--btn-shadow);
}
.mw .contact-btn.whatsapp::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; flex: none;
}

.mw[data-btn=outline] :is(.link-btn, .contact-btn:not(.primary), .wifi-copy) {
  border: 1.5px solid var(--accent-text);
}
.mw[data-btn=soft] :is(.link-btn, .contact-btn:not(.primary), .wifi-copy) {
  background: var(--soft-fill); color: var(--on-soft);
  box-shadow: 0 6px 18px -8px var(--accent);
}
.mw[data-btn=glass] :is(.link-btn, .contact-btn:not(.primary), .wifi-copy) {
  background: rgba(255, 255, 255, 0.14); color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.mw[data-btn=card] :is(.link-btn, .contact-btn:not(.primary), .wifi-copy) {
  background: #fff; color: #0a0a0a; border: var(--btn-border); box-shadow: var(--btn-shadow);
}
.mw[data-btn=pop] :is(.link-btn, .contact-btn:not(.primary), .wifi-copy) {
  background: #fff; color: #0a0a0a; border: var(--btn-border); box-shadow: var(--btn-shadow);
}
.mw[data-btn=pop] :is(.link-btn, .contact-btn):active { transform: translateY(3px); box-shadow: none; }
.mw[data-btn=inverse] :is(.link-btn, .contact-btn:not(.primary), .wifi-copy),
.mw[data-btn=ink] :is(.link-btn, .contact-btn:not(.primary), .wifi-copy) {
  background: var(--text); color: var(--sheet);
}
.mw[data-btn=inverse] .contact-btn.primary { box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.5); }
.mw[data-btn=bracket] :is(.link-btn, .contact-btn) { justify-content: flex-start; }
.mw[data-btn=bracket] :is(.link-btn, .contact-btn:not(.primary), .wifi-copy) { border: 1px dashed var(--accent-text); }
.mw[data-btn=bracket] :is(.link-btn, .contact-btn)::after { content: "›"; order: -1; font-weight: 700; }
.mw[data-btn=underline] .link-buttons { gap: 0; border-top: 1px solid var(--text); }
.mw[data-btn=underline] :is(.link-btn, .contact-btn:not(.primary)) {
  justify-content: space-between; padding: 14px 2px; border-radius: 0;
  border-bottom: 1px solid var(--line); color: var(--text); text-align: left;
}
.mw[data-btn=underline] :is(.link-btn, .contact-btn:not(.primary))::after { content: "→"; color: var(--accent-text); }
.mw[data-btn=underline] .link-buttons + .contact-buttons { margin-top: 16px; }
.mw[data-btn=underline] .wifi-copy { border: 1px solid var(--line); border-radius: 0; color: var(--text); }

/* --- Footer --------------------------------------------------------------------- */
.mw .footer {
  border-top: 1px solid var(--line); padding-top: 16px; margin-top: 24px;
  text-align: center; font-size: 12px; color: var(--muted);
}
.mw .footer a { color: var(--accent-text); text-decoration: none; font-weight: 600; }
.mw .footer .legal-links { margin-top: 8px; font-size: 11px; color: var(--muted); }
.mw .footer .legal-links a { color: var(--muted); font-weight: 400; text-decoration: underline; text-underline-offset: 2px; }
.mw .footer .legal-links a:hover { color: var(--text); }
