/* Huisey.nl: mobile / Safari (iOS) usability fixes.
   Loaded on every page alongside the Tailwind play CDN. Kept small and
   additive: nothing here overrides the existing desktop design. */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  /* Keep content clear of the iPhone home indicator / rounded corners */
  padding-bottom: env(safe-area-inset-bottom);
}

header {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* iOS Safari zooms the page in when a focused input's font-size is below
   16px. A lot of this design uses text-xs / text-sm on inputs, which
   triggers that zoom. Force a readable, zoom-safe size while typing on
   small screens only -- desktop keeps the original compact look. */
@media (max-width: 767px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="search"],
  input[type="password"],
  input[type="submit"],
  input[type="button"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* Safari (including slightly older iOS versions) needs the -webkit- prefix
   for backdrop-filter to actually blur anything. */
.glass-nav,
.app-nav {
  -webkit-backdrop-filter: blur(20px);
}
.glass-card {
  -webkit-backdrop-filter: blur(4px);
}

/* Snappier taps, no ghost-click delay, and no lingering blue tap flash on
   iOS Safari for interactive elements. */
a,
button,
input,
select,
textarea,
[role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Mobile hamburger menu + panel injected by assets/site.js */
#mobile-menu-panel a {
  -webkit-tap-highlight-color: transparent;
}

/* A handful of headers pack a logo, a status badge/link and (now) the
   language toggle + hamburger into one fixed-height (h-20) row. That's
   fine on desktop, but on narrow phones the combined content can be wider
   than the screen. Rather than clipping controls off-screen, let the row
   grow and wrap onto a second line on small screens. */
@media (max-width: 767px) {
  header .h-20 {
    height: auto;
    min-height: 5rem;
    flex-wrap: wrap;
    row-gap: 0.5rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
}

/* ----------------------------------------------------------------------
 * Dark mode
 * Toggled by adding/removing the "dark" class on <html> (see the
 * no-flash init script in <head>, and the Light/Dark/Auto control the
 * site.js injects into the footer). Written as plain overrides keyed to
 * the utility class names already used throughout the markup, so the
 * whole site gets a dark theme without needing a "dark:" variant added
 * next to every single class, on every page, by hand.
 * -------------------------------------------------------------------- */
.dark { color-scheme: dark; }

.dark body { background-color: #0B1220; }

/* Surface backgrounds (cards, panels, headers, inputs): white or
 * slate-50/100/200, at any opacity. Attribute-selector substring
 * matches so every opacity variant already used across the site's 39
 * pages (bg-white/95, bg-slate-50/70, bg-slate-50/40, ...) is covered
 * without having to enumerate each one by hand -- and any new one added
 * later is covered automatically too. Low-opacity bg-white/5|10|20|30
 * is deliberately excluded: those are decorative accents drawn on top
 * of a colored badge (e.g. the round step-number dot), not page
 * surfaces, and forcing them dark would make that badge unreadable. */
.dark .bg-white,
.dark [class*="bg-white/4"],
.dark [class*="bg-white/5"],
.dark [class*="bg-white/6"],
.dark [class*="bg-white/7"],
.dark [class*="bg-white/8"],
.dark [class*="bg-white/9"] { background-color: #0B1220; }
.dark [class*="bg-slate-50"] { background-color: #131C2E; }
.dark [class*="bg-slate-100"] { background-color: #1B2438; }
.dark [class*="bg-slate-200"] { background-color: #253046; }

/* Tinted icon badges, status pills and info panels built on a light
 * color-50/100 tone (any opacity): soften to a translucent neutral chip
 * rather than leaving the light-mode tint as-is. */
.dark [class*="bg-blue-50"],
.dark [class*="bg-blue-100"],
.dark [class*="bg-blue-500/"],
.dark [class*="bg-orange-50"],
.dark [class*="bg-orange-100"],
.dark [class*="bg-emerald-50"],
.dark [class*="bg-emerald-100"],
.dark [class*="bg-amber-50"],
.dark [class*="bg-amber-100"],
.dark [class*="bg-purple-100"],
.dark [class*="bg-lime-50"],
.dark [class*="bg-cyan-100"] { background-color: rgba(255, 255, 255, 0.08); }

/* Colored "-200" borders (info/warning panels, status cards) are tuned
 * for a light-mode tint background and read as too bright/saturated
 * once that background goes dark -- soften to the same neutral border
 * used everywhere else in dark mode. */
.dark [class*="border-amber-200"],
.dark [class*="border-blue-200"],
.dark [class*="border-emerald-200"],
.dark [class*="border-orange-200"],
.dark [class*="border-purple-200"] { border-color: #2A3852; }

.dark .glass-nav,
.dark .app-nav { background: rgba(11, 18, 32, 0.9); border-color: #1E293B; }
.dark .glass-card { background: rgba(19, 28, 46, 0.85); border-color: #1E293B; }
.dark .app-card { background: rgba(19, 28, 46, 0.9); border-color: #1E293B; }
.dark .glass-pill { background: rgba(27, 36, 56, 0.85); border-color: #1E293B; }
.dark .glass-input { background: #131C2E; border-color: #2A3852; }

.dark .text-slate-800,
.dark .text-slate-900,
.dark .text-brand-blue-dark { color: #E7ECF3; }
.dark .text-slate-700 { color: #CBD5E1; }
.dark .text-slate-600,
.dark .text-slate-500 { color: #94A3B8; }
.dark .text-slate-400 { color: #64748B; }

/* Badge/pill *text* colors meant for a light-50/100 background (e.g.
 * text-emerald-800 on bg-emerald-100 "Te koop"). Now that the
 * background above is a dark, low-opacity chip, these near-black shades
 * are unreadable -- lighten each to the equivalent light tint so the
 * badge keeps its original meaning/colour but stays legible. */
.dark .text-emerald-700,
.dark .text-emerald-800 { color: #6EE7B7; }
.dark .text-emerald-600 { color: #6EE7B7; }
.dark .text-amber-600,
.dark .text-amber-800 { color: #FCD34D; }
.dark .text-blue-800 { color: #93C5FD; }
.dark .text-purple-800 { color: #D8B4FE; }
.dark .text-orange-800 { color: #FDBA74; }

.dark .border-slate-200,
.dark .border-slate-100,
.dark .border-slate-300,
.dark .divide-slate-200\/80 { border-color: #1E293B; }

.dark input,
.dark textarea,
.dark select {
  background-color: #131C2E;
  border-color: #1E293B;
  color: #E7ECF3;
}
.dark input::placeholder,
.dark textarea::placeholder { color: #64748B; }

.dark .shadow-sm,
.dark .shadow-lg,
.dark .shadow-xl,
.dark .shadow-2xl { box-shadow: none; }

/* A "sold / no longer available" card is deliberately faded with
 * opacity-80 in light mode -- against dark-on-dark that reads as
 * near-invisible instead of "muted", so bring it back up in dark mode
 * and let the already-muted slate text/badge colours carry the
 * "unavailable" look instead. */
.dark .opacity-80 { opacity: 0.96; }

/* Theme control injected into the footer by site.js. Plain CSS (not
 * Tailwind utility classes) on purpose: this element is added to the
 * page after load, and if the Tailwind CDN script hasn't finished
 * re-scanning the DOM for new class names yet (or fails to, on some
 * devices/network conditions), utility classes on a JS-injected node
 * can end up unstyled -- which would make the switch fall back to
 * plain block-level flow instead of being centered. Defining its
 * layout here in the stylesheet means it's never dependent on that
 * runtime re-scan at all. */
.theme-switch-row-mobile {
  display: flex;
  justify-content: center;
  padding-top: 1.5rem;
  grid-column: 1 / -1;
}
.theme-switch-row-desktop {
  display: none;
}
@media (min-width: 1024px) {
  /* On desktop the theme switch sits on the same row as the copyright
     line, right-aligned, instead of its own full-width centered bar
     (which is what reads best on mobile/tablet instead). */
  .theme-switch-row-mobile {
    display: none;
  }
  .theme-switch-row-desktop {
    display: flex;
  }
}
.theme-switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.theme-switch-label {
  font-size: 12px;
  font-weight: 700;
  color: inherit;
  opacity: 0.7;
}
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.12);
}
.theme-switch button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  color: inherit;
  opacity: 0.6;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.theme-switch button[aria-pressed="true"] {
  background: rgba(148, 163, 184, 0.25);
  opacity: 1;
}
.dark .theme-switch { background: rgba(148, 163, 184, 0.15); }
.dark .theme-switch button[aria-pressed="true"] { background: rgba(148, 163, 184, 0.3); }

/* Give each option its own recognisable icon colour (kept the same in
 * both light and dark mode, and whether or not that option is the
 * active one, so the icons stay identifiable at a glance). */
.theme-icon-sun { color: #F59E0B; }
.theme-icon-moon { color: #818CF8; }
.theme-icon-auto { color: #64748B; }

/* Cookie consent banner injected by site.js. Plain CSS for the same
 * reason as the theme switch above -- reliable regardless of when/if
 * the Tailwind CDN re-scans JS-injected markup. */
.cookie-consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 1rem;
  background: #ffffff;
  border-top: 1px solid #E2E8F0;
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.08);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.cookie-consent-hidden {
  transform: translateY(100%);
  opacity: 0;
}
.cookie-consent-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.cookie-consent-text {
  flex: 1 1 20rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #475569;
  margin: 0;
}
.cookie-consent-text a {
  color: #0066FF;
  font-weight: 700;
  text-decoration: underline;
}
.cookie-consent-actions {
  display: flex;
  gap: 0.625rem;
  flex-shrink: 0;
}
.cookie-consent-btn {
  padding: 0.625rem 1.125rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.cookie-consent-btn-ghost {
  background: transparent;
  color: #475569;
  border: 1px solid #CBD5E1;
}
.cookie-consent-btn-ghost:hover {
  background: #F1F5F9;
}
.cookie-consent-btn-primary {
  background: #FF7A00;
  color: #ffffff;
}
.cookie-consent-btn-primary:hover {
  background: #E66E00;
}
.dark .cookie-consent {
  background: #0B1220;
  border-color: #1E293B;
}
.dark .cookie-consent-text {
  color: #94A3B8;
}
.dark .cookie-consent-btn-ghost {
  color: #CBD5E1;
  border-color: #2A3852;
}
.dark .cookie-consent-btn-ghost:hover {
  background: #131C2E;
}

/* Slightly larger body text site-wide. The site leans on text-xs/text-sm
 * for almost everything (labels, list items, card copy, buttons), which
 * reads a bit small on both mobile and desktop. Bumped by about 1px each
 * with matching line-height, using !important since these need to win
 * over the Tailwind Play CDN's own (later-injected) utility rules. This
 * intentionally does NOT touch text-lg/xl/4xl/6xl and up, so the
 * homepage hero headline and intro paragraph (which use those larger
 * classes) are left exactly as they are. */
.text-xs { font-size: 0.875rem !important; line-height: 1.25rem !important; }
.text-sm { font-size: 1rem !important; line-height: 1.5rem !important; }
.text-base { font-size: 1.0625rem !important; line-height: 1.6875rem !important; }

/* The site also has ~150 places using arbitrary pixel sizes (Tailwind's
 * text-[10px] / text-[11px]) for small labels and captions -- most
 * commonly inside cards and tiles (partner network cards, comparison
 * matrix badges, status pills). Those don't match the .text-xs/.text-sm
 * selectors above at all, which is why some tiles still read noticeably
 * smaller than the rest of the (now bumped) page. Bumped by the same
 * ~1px so those tiles feel consistent with the rest of the site again. */
.text-\[10px\] { font-size: 0.75rem !important; line-height: 1.125rem !important; }
.text-\[11px\] { font-size: 0.8125rem !important; line-height: 1.25rem !important; }

/* Justified body text, desktop only. Applies to plain paragraphs -- not
 * headings, buttons, labels or nav links, which aren't flowing body
 * copy and shouldn't be justified. Kept mobile/tablet untouched (below
 * 1024px) since justify on a narrow column tends to create ugly gaps
 * between words. A bare "p" selector has low specificity, so any
 * paragraph that already carries an explicit Tailwind alignment class
 * (text-center, text-left, text-right) is unaffected -- that class
 * naturally wins. The two rules below additionally cover paragraphs
 * that are centered only by inheriting from a ".text-center" ancestor
 * (e.g. the homepage hero intro), which a plain "p" rule would
 * otherwise override since inheritance always loses to a matching
 * element rule. */
@media (min-width: 1024px) {
  p {
    text-align: justify;
  }
  .text-center p,
  .text-center {
    text-align: center;
  }
  /* The footer's "Volg Huisey" column (and any other narrow footer
   * text) is too narrow for justify to look right -- with only a
   * handful of words per line, the browser has to stretch huge gaps
   * between them to fill the line. Left-align stays readable at any
   * width, so footer copy is excluded here. */
  footer p {
    text-align: left;
  }
  /* Same reasoning for any paragraph inside a CSS grid: on this site
   * that's always a multi-column card layout (USP tiles, property
   * cards, partner tiles, dashboard stat cards, ...), each column
   * narrow enough that justify creates the same oversized gaps. The
   * policy pages (privacy, terms, cookies) use a plain stacked layout,
   * not a grid, so they're unaffected and stay justified. */
  .grid p {
    text-align: left;
  }
}

/* Footer column headings ("Aanbod & markt", "Juridisch", ...) are meant
 * to read as small, muted labels above the actual links -- not as
 * prominent headings. The global text-xs bump above (for body copy
 * elsewhere) would otherwise carry over here too and make them look
 * heavier than intended, on both mobile and desktop. Pinned back down
 * regardless of viewport width. */
footer h3 {
  font-size: 0.75rem !important;
  line-height: 1rem !important;
}

/* The "118 m² • Grachtenpand • Energielabel A" style property meta line
 * on peilen.html/ruilen.html has 3 segments and needs to fit on one
 * line inside a fairly narrow card. It's given its own dedicated,
 * fixed-size class here (rather than reusing .text-xs) specifically so
 * that it's immune to the global text-xs bump above -- that bump is
 * exactly what pushed it from one line to two. */
.property-meta-compact {
  font-size: 0.75rem !important;
  line-height: 1.125rem !important;
}

/* Safety net: a heading with a single long compound word (e.g.
 * "gebruikersvoorwaarden") can overflow its card on a narrow phone
 * screen if the browser has no natural break point inside that word --
 * seen on real-device Safari even though it didn't reproduce in every
 * test browser. overflow-wrap/word-break only kick in as an absolute
 * last resort when a word genuinely doesn't fit any other way, so
 * headings can never push past their container. (Deliberately NOT
 * using hyphens: auto here -- that hyphenates proactively, splitting
 * words like "anders" into "an-ders" across two lines even when there
 * was no overflow risk at all, which reads as a typo, not a fix.) */
h1, h2, h3 {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Landingspagina, "Peil woningen" carrousel, alleen telefoon (< 768px).
 * De tegels staan naast elkaar en zijn even hoog, maar de titel van
 * tegel 1 ("Keizersgracht buurt, Amsterdam") loopt over twee regels
 * terwijl de andere titels op een regel passen. Daardoor stonden meta
 * (m2 + energielabel) en prijs op verschillende hoogtes. Hier krijgt de
 * titel de overgebleven ruimte van de tegel (flex: 1), zodat de meta-regel
 * en de prijs onderaan elke tegel op dezelfde hoogte staan, gebaseerd op
 * de hoogte van de hoogste tegel (tegel 1). Desktop blijft ongewijzigd. */
@media (max-width: 767px) {
  .peil-woningen-carousel > a {
    display: flex;
    flex-direction: column;
  }
  .peil-woningen-carousel > a > :first-child {
    flex-shrink: 0;
  }
  .peil-woningen-carousel > a > :last-child {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }
  .peil-woningen-carousel > a > :last-child > h3 {
    flex: 1 1 auto;
  }
}

/* ---- Desktop-only layout fixes (>= 1024px) ---- */
@media (min-width: 1024px) {

  /* Partners, de 5 tegels: alle tegels even groot en zonder de lege ruimte
   * onderin. Voorheen was er een vaste minimumhoogte (min-h-[13.5rem]) die
   * veel meer ruimte gaf dan de tekst nodig had. Nu staan de tegels in een
   * grid met 6 kolommen (elke tegel = 2 kolommen, dus dezelfde breedte als
   * eerst, 3 op de eerste rij en 2 gecentreerd op de tweede rij) en zijn
   * alle rijen even hoog als de tegel met de meeste tekst. Tekstgrootte
   * blijft ongewijzigd. */
  div.partners-pijlers {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-rows: 1fr;
  }
  div.partners-pijlers > div {
    width: auto;
    min-height: 0;
    grid-column: span 2;
  }
  div.partners-pijlers > div:nth-child(4) { grid-column: 2 / span 2; }
  div.partners-pijlers > div:nth-child(5) { grid-column: 4 / span 2; }

  /* Peilen & Ruilen, woningtegels: het grijze (peilen) en groene (ruilen)
   * blok binnen de tegel is per tegel even groot en staat op dezelfde lijn.
   * De tegels zijn al even hoog binnen een rij; het blok krijgt nu de
   * resterende ruimte in de tegel (flex: 1) in plaats van alleen zijn
   * eigen tekstlengte. Zo beginnen alle blokken op dezelfde hoogte (onder
   * de meta-regel) en eindigen ze op dezelfde hoogte (boven de knop). */
  .kopen-tegel > div:first-child,
  .ruilen-tegel > div:first-child {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }
  .kopen-tegel > div:first-child > div:first-child,
  .ruilen-tegel > div:first-child > div:first-child {
    flex-shrink: 0;
  }
  .kopen-tegel > div:first-child > div:last-child,
  .ruilen-tegel > div:first-child > div:last-child {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }
  .kopen-tegel > div:first-child > div:last-child > div:last-child,
  .ruilen-tegel > div:first-child > div:last-child > div:last-child {
    flex: 1 1 auto;
  }

  /* Meta-regel ("132 m2 . Eengezinswoning . Energielabel B") altijd op
   * 1 regel, zonder de lettergrootte te veranderen. */
  .kopen-tegel .property-meta-compact,
  .ruilen-tegel .property-meta-compact {
    white-space: nowrap;
  }
}
