/* Home automation pages (site/home-automation/<lang>/), loaded after styles.css.
   Built on the tokens and components of styles.css; the site is dark only. */

:root {
  --ha-switch: #7dd3fc;
  --ha-outlet: #c4b5fd;
  --ha-motor: #fbbf24;
  --ha-sensor: #86efac;
  --ha-ap: #f8fafc;
  --ha-cabinet: #94a3b8;
}

/* The current page in the navigation. */
.site-nav a[aria-current="page"] {
  color: var(--text);
  background: rgba(125, 211, 252, 0.16);
}

/* Hero: a smaller heading than the home page (the headings here are sentences), and a watermark
   of its own instead of "deploy → validate → release". It starts right below the header, like the
   home page's: no height of its own (a share of the window left an empty band below the header on
   tall windows), and both cards start at the top, so a taller facts card never pushes the heading
   down. */
.ha-hero {
  align-items: start;
}

.ha-hero h1,
html[lang="hu"] .ha-hero h1 {
  font-size: clamp(2.35rem, 5.4vw, 4.6rem);
}

.ha-hero .hero-content::after {
  content: "plan → wire → automate";
}

html[lang="hu"] .ha-hero .hero-content::after {
  content: "terv → kábel → automatika";
}

.ha-hero .hero-card::before {
  /* The owner's logo (house, initials, three nodes), recoloured for the dark card. */
  background:
    url("../img/home-automation/ha-logo-391.png") center / auto 80% no-repeat,
    radial-gradient(circle at 50% 55%, rgba(125, 211, 252, 0.14), transparent 62%),
    rgba(255, 255, 255, 0.035);
}

/* The custom integrations page shows the house tile with the tracker mark. */
.ha-integrations .ha-hero .hero-card::before {
  background:
    url("../img/home-automation/ha-logo-tracker-400.png") center / auto 84% no-repeat,
    radial-gradient(circle at 50% 55%, rgba(125, 211, 252, 0.14), transparent 62%),
    rgba(255, 255, 255, 0.035);
}

/* The reference page shows the single-storey house version of the logo. */
.ha-reference .ha-hero .hero-card::before {
  background:
    url("../img/home-automation/ha-logo-bungalow-800.png") center / 84% auto no-repeat,
    radial-gradient(circle at 50% 55%, rgba(125, 211, 252, 0.14), transparent 62%),
    rgba(255, 255, 255, 0.035);
}

.section-lead {
  margin-top: 1rem;
  font-size: 1.06rem;
}

.ha-more,
.ha-links a {
  color: var(--accent);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.ha-links {
  margin-top: 1.4rem;
}

/* A list with a tick in front of each item. */
.ha-checklist,
.ha-ticks,
.ha-crosses {
  display: grid;
  gap: 0.7rem;
  padding: 0;
  margin: 1.25rem 0;
  list-style: none;
}

.ha-checklist li,
.ha-ticks li,
.ha-crosses li {
  position: relative;
  padding-left: 1.9rem;
  color: var(--muted-strong);
}

.ha-checklist li::before,
.ha-ticks li::before,
.ha-crosses li::before {
  position: absolute;
  top: 0.12rem;
  left: 0;
  display: grid;
  width: 1.25rem;
  height: 1.25rem;
  place-items: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
}

.ha-checklist li::before,
.ha-ticks li::before {
  content: "✓";
  color: #07111f;
  background: var(--accent);
}

.ha-crosses li::before {
  content: "✕";
  color: var(--text);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
}

/* Services: five cards in the three-column grid of styles.css. */
.ha-services .info-card {
  min-height: 0;
}

.ha-services .card-icon {
  margin-bottom: 1.2rem;
}

/* What I plan: the sketch beside the groups. */
.ha-plan {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1.2rem;
  align-items: start;
}

.ha-plan-figure {
  margin: 0;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border-radius: var(--radius-md);
}

.ha-plan-svg {
  display: block;
  width: 100%;
  height: auto;
}

.ha-wall {
  fill: rgba(255, 255, 255, 0.025);
  stroke: var(--muted);
  stroke-width: 3;
  stroke-linecap: round;
}

path.ha-wall {
  fill: none;
}

.ha-window {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
  stroke-opacity: 0.45;
}

.ha-cable {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-dasharray: 5 5;
  stroke-opacity: 0.55;
}

.ha-switch {
  fill: rgba(125, 211, 252, 0.2);
  stroke: var(--ha-switch);
  stroke-width: 2;
}

.ha-outlet {
  fill: rgba(196, 181, 253, 0.2);
  stroke: var(--ha-outlet);
  stroke-width: 2;
}

.ha-motor {
  fill: rgba(251, 191, 36, 0.22);
  stroke: var(--ha-motor);
  stroke-width: 2;
}

.ha-sensor {
  fill: var(--ha-sensor);
}

.ha-sensor-arc {
  fill: none;
  stroke: var(--ha-sensor);
  stroke-width: 2;
  stroke-linecap: round;
}

.ha-ap {
  fill: var(--ha-ap);
}

.ha-ap-wave {
  fill: none;
  stroke: var(--ha-ap);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-opacity: 0.7;
}

.ha-cabinet {
  fill: rgba(148, 163, 184, 0.22);
  stroke: var(--ha-cabinet);
  stroke-width: 2;
}

.ha-cabinet-lines {
  fill: none;
  stroke: var(--ha-cabinet);
  stroke-width: 1.5;
}

.ha-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  padding: 0;
  margin: 1rem 0 0;
  list-style: none;
  color: var(--muted-strong);
  font-size: 0.88rem;
}

.ha-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.ha-key {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid currentColor;
}

.ha-key--switch { color: var(--ha-switch); border-radius: 3px; background: rgba(125, 211, 252, 0.2); }
.ha-key--outlet { color: var(--ha-outlet); border-radius: 999px; background: rgba(196, 181, 253, 0.2); }
.ha-key--motor { color: var(--ha-motor); width: 1.15rem; height: 0.7rem; border-radius: 3px; background: rgba(251, 191, 36, 0.22); }
.ha-key--sensor { color: var(--ha-sensor); border-radius: 999px; background: var(--ha-sensor); width: 0.7rem; height: 0.7rem; }
.ha-key--ap { color: var(--ha-ap); border-radius: 999px; background: var(--ha-ap); box-shadow: 0 0 0 3px rgba(248, 250, 252, 0.25); width: 0.7rem; height: 0.7rem; }
.ha-key--cabinet { color: var(--ha-cabinet); width: 0.75rem; height: 1rem; border-radius: 2px; background: rgba(148, 163, 184, 0.22); }
.ha-key--cable { width: 1.4rem; height: 0; border: 0; border-top: 2px dashed var(--accent); }

.ha-plan-figure figcaption {
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.ha-plan-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.ha-plan-group {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.045);
}

.ha-plan-group:last-child {
  grid-column: 1 / -1;
}

.ha-plan-group h3,
.ha-timeline h3,
.ha-lessons h3 {
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.ha-plan-group p {
  margin-top: 0.4rem;
  font-size: 0.95rem;
}

/* How it works: a vertical line of steps, each with its moment in the build. */
.ha-timeline {
  position: relative;
  display: grid;
  gap: 0.9rem;
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: ha-step;
}

.ha-timeline::before {
  content: "";
  position: absolute;
  top: 1.1rem;
  bottom: 1.1rem;
  left: 1.05rem;
  width: 2px;
  background: linear-gradient(var(--accent), var(--accent-warm));
  opacity: 0.4;
}

.ha-timeline li {
  position: relative;
  padding: 1rem 1.1rem 1rem 3.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.045);
  counter-increment: ha-step;
}

.ha-timeline li::before {
  content: counter(ha-step);
  position: absolute;
  top: 1rem;
  left: 0.3rem;
  display: grid;
  width: 1.6rem;
  height: 1.6rem;
  place-items: center;
  border-radius: 999px;
  color: #07111f;
  background: linear-gradient(135deg, #ffffff, #7dd3fc);
  font-size: 0.8rem;
  font-weight: 850;
}

.ha-when {
  margin-bottom: 0.35rem;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ha-timeline li > p:last-child {
  margin-top: 0.35rem;
}

/* Packages. */
.ha-packages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.ha-package {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.35rem;
  border-radius: var(--radius-md);
}

.ha-package--full {
  border-color: rgba(125, 211, 252, 0.45);
}

.ha-package-number {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(125, 211, 252, 0.08);
  font-weight: 850;
}

.ha-hours {
  align-self: flex-start;
  margin-top: auto;
  padding: 0.45rem 0.8rem;
  border: 1px solid rgba(125, 211, 252, 0.35);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(125, 211, 252, 0.1);
  font-weight: 800;
}

/* Reference page: areas by floor, drawn as icon cards with generic room names. */
.ha-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ha-areas {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.ha-area-group {
  padding: 1.2rem;
  border-radius: var(--radius-md);
}

.ha-area-group p {
  margin-top: 1rem;
  font-size: 0.92rem;
}

.ha-area-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.55rem;
  padding: 0;
  margin: 1rem 0 0;
  list-style: none;
}

.ha-area-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.93rem;
  line-height: 1.25;
}

.ha-area-icon {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ha-area-group--tech .ha-area-icon {
  stroke: var(--ha-motor);
}

/* Reference page: the automation map. On narrow screens it scrolls sideways inside its card. */
.ha-map {
  margin: 0;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border-radius: var(--radius-md);
}

.ha-map-scroll {
  overflow-x: auto;
}

.ha-map-svg {
  display: block;
  width: 100%;
  min-width: 860px;
  height: auto;
}

.ha-map-node rect {
  stroke-width: 1.5;
}

.ha-map-node--auto rect {
  fill: rgba(125, 211, 252, 0.13);
  stroke: var(--accent);
}

.ha-map-node--script rect {
  fill: rgba(251, 191, 36, 0.13);
  stroke: var(--ha-motor);
}

.ha-map-node text {
  fill: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.ha-map-node .ha-map-when {
  fill: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
}

.ha-map-edge {
  fill: none;
  stroke-width: 2;
}

.ha-map-edge--runs { stroke: var(--muted-strong); }
.ha-map-edge--on { stroke: var(--ha-sensor); }
.ha-map-edge--off { stroke: #fca5a5; stroke-dasharray: 6 5; }
.ha-map-arrow--runs path { fill: var(--muted-strong); }
.ha-map-arrow--on path { fill: var(--ha-sensor); }
.ha-map-arrow--off path { fill: #fca5a5; }

.ha-key--auto { color: var(--accent); border-radius: 4px; background: rgba(125, 211, 252, 0.13); width: 1.3rem; }
.ha-key--script { color: var(--ha-motor); border-radius: 4px; background: rgba(251, 191, 36, 0.13); width: 1.3rem; }
.ha-key--runs { width: 1.6rem; height: 0; border: 0; border-top: 2px solid var(--muted-strong); }
.ha-key--on { width: 1.6rem; height: 0; border: 0; border-top: 2px solid var(--ha-sensor); }
.ha-key--off { width: 1.6rem; height: 0; border: 0; border-top: 2px dashed #fca5a5; }

.ha-map figcaption {
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* The phone screenshot is never drawn larger than its own width. */
.shot--native img[width="403"] {
  max-width: 403px;
}

/* The hourly rate: the only amount on these pages. */
.ha-rate-line {
  display: inline-block;
  margin-top: 1.1rem;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(125, 211, 252, 0.35);
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(125, 211, 252, 0.1);
}

.ha-rate-line strong {
  color: var(--accent);
  font-size: 1.15rem;
}

.ha-extras {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1.5rem;
  margin: 1.5rem 0 0;
}

.ha-extras div {
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
}

.ha-extras dt {
  color: var(--text);
  font-weight: 760;
}

.ha-extras dd {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.ha-note {
  margin-top: 1rem;
  font-size: 0.95rem;
}

/* Scope: what I do and what I don't. */
.ha-scope {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.ha-scope-col {
  padding: 1.35rem;
  border-radius: var(--radius-md);
}

.ha-scope-col .ha-ticks,
.ha-scope-col .ha-crosses {
  margin-bottom: 0;
}

/* Questions. */
.ha-faq {
  display: grid;
  gap: 0.7rem;
}

.ha-faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.045);
}

.ha-faq summary {
  padding: 1rem 1.1rem;
  color: var(--text);
  font-weight: 740;
  cursor: pointer;
}

.ha-faq summary::marker {
  color: var(--accent);
}

.ha-faq details[open] summary {
  border-bottom: 1px solid var(--line);
}

.ha-faq details p {
  padding: 0.9rem 1.1rem 1.1rem;
}

/* Reference page: the house in numbers, the lessons. */
.ha-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 0;
}

.ha-facts div {
  padding: 1.1rem;
  border-radius: var(--radius-sm);
}

.ha-facts dt {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ha-facts dd {
  margin: 0.4rem 0 0;
  color: var(--text);
  font-weight: 650;
}

.ha-lessons {
  display: grid;
  gap: 0.8rem;
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: ha-lesson;
}

.ha-lessons li {
  position: relative;
  padding: 1rem 1.1rem 1rem 3.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.045);
  counter-increment: ha-lesson;
}

.ha-lessons li::before {
  content: counter(ha-lesson, decimal-leading-zero);
  position: absolute;
  top: 1rem;
  left: 1rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 850;
}

.ha-lessons p {
  margin-top: 0.35rem;
}

/* Contact. */
.ha-contact .ha-checklist {
  margin: 1.2rem 0;
}

.ha-contact p + p {
  margin-top: 0.4rem;
}

@media (max-width: 980px) {
  .ha-plan,
  .ha-packages,
  .ha-scope,
  .ha-areas {
    grid-template-columns: 1fr;
  }

  .ha-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  /* Five menu entries do not fit one line on a phone. */
  .ha-page .site-nav {
    flex-wrap: wrap;
    justify-content: flex-start;
    border-radius: var(--radius-md);
  }

  .ha-plan-groups,
  .ha-extras,
  .ha-facts {
    grid-template-columns: 1fr;
  }

  .ha-timeline li,
  .ha-lessons li {
    padding-left: 3rem;
  }
}

/* Reference page: screenshots as thumbnails; a click opens the picture viewer of organ.js with
   the caption under the picture. */
.ha-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.ha-thumb {
  margin: 0;
  padding: 0.7rem;
  border-radius: var(--radius-md);
}

.ha-thumb-link {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: #ffffff;
  cursor: zoom-in;
}

.ha-thumb-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.ha-thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: top left;
  transition: transform 220ms ease;
}

.ha-thumb-link:hover img {
  transform: scale(1.03);
}

.ha-thumb figcaption {
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .ha-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .ha-gallery {
    grid-template-columns: 1fr;
  }
}

/* Picture viewer (organ.js), in the colours of these pages. */
html.o-viewer-open {
  overflow: hidden;
}
body.ha-page .o-viewer {
  box-sizing: border-box;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 4.25rem clamp(0.75rem, 6vw, 5.5rem) 1.5rem;
  overflow: hidden;
  border: 0;
  color: #f8fafc;
  background: transparent;
  touch-action: pinch-zoom;
}

body.ha-page .o-viewer[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

body.ha-page .o-viewer::backdrop {
  background: rgba(4, 7, 16, 0.93);
}

body.ha-page .o-viewer-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  min-height: 0;
  max-width: 100%;
  margin: 0;
}

body.ha-page .o-viewer-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 10rem);
  max-height: calc(100dvh - 10rem);
  border-radius: 10px;
  background: #0a1022;
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.25), 0 30px 80px rgba(0, 0, 0, 0.6);
}

body.ha-page .o-viewer-caption {
  max-width: 60ch;
  margin: 0;
  color: #dce8f7;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
}

body.ha-page .o-viewer-count {
  position: absolute;
  top: 1.35rem;
  left: 1.4rem;
  margin: 0;
  color: #7dd3fc;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

body.ha-page .o-viewer-button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  border: 1px solid rgba(125, 211, 252, 0.5);
  border-radius: 50%;
  color: #f8fafc;
  background: rgba(15, 23, 42, 0.75);
  cursor: pointer;
}

body.ha-page .o-viewer-button[hidden] {
  display: none;
}

body.ha-page .o-viewer-button:hover {
  background: rgba(125, 211, 252, 0.2);
}

body.ha-page .o-viewer-button:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 3px;
}

body.ha-page .o-viewer-button svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.ha-page .o-viewer-close {
  top: 0.75rem;
  right: 0.75rem;
}

body.ha-page :is(.o-viewer-prev, .o-viewer-next) {
  top: 50%;
  transform: translateY(-50%);
}

body.ha-page .o-viewer-prev {
  left: clamp(0.5rem, 2vw, 1.5rem);
}

body.ha-page .o-viewer-next {
  right: clamp(0.5rem, 2vw, 1.5rem);
}

@media (max-width: 640px) {
  body.ha-page .o-viewer {
    padding: 3.75rem 0.5rem 5rem;
  }

  body.ha-page :is(.o-viewer-prev, .o-viewer-next) {
    top: auto;
    bottom: 1rem;
    transform: none;
  }

  body.ha-page .o-viewer-prev {
    left: calc(50% - 3.6rem);
  }

  body.ha-page .o-viewer-next {
    right: calc(50% - 3.6rem);
  }
}

/* Section logo: the owner's cyan tile (house and initials), in place of the plain "JP" tile of the header.
   The file is the whole tile (also the favicon of these pages), so the text and the tile's own
   background are hidden. */
.ha-page .brand-mark {
  border: 0;
  background: url("../img/home-automation/ha-logo-tile-192.png") center / cover no-repeat;
  color: transparent;
  font-size: 0;
}
