/* ============================================================================
   Hi-Tech Homes Portal — component styles
   Ported from the Industry design system, retuned to Hi-Tech's brand.
   Requires tokens.css.
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-2);
}
h1 { font-size: 42px; }
h2 { font-size: 32px; }
h3 { font-size: 25px; }
h4 { font-size: 20px; }
h5 { font-size: 16px; }
h6 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }

p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent-800); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
figure { margin: 0; }
figcaption {
  font-size: 11px;
  margin-top: var(--space-1);
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}

.text-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap;
}

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent-700); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* — registration marks — the system's signature ------------------------- */

.blueprint {
  position: relative;
  border: 1px solid var(--color-divider);
  border-radius: 0;
}
.blueprint > .corner {
  position: absolute;
  width: 11px; height: 11px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.blueprint > .corner::before,
.blueprint > .corner::after { content: ""; position: absolute; background: currentColor; }
.blueprint > .corner::before { left: 5px; top: 0; width: 1px; height: 100%; }
.blueprint > .corner::after  { top: 5px; left: 0; width: 100%; height: 1px; }
.blueprint > .corner.tl { top: -6px; left: -6px; }
.blueprint > .corner.tr { top: -6px; right: -6px; }
.blueprint > .corner.bl { bottom: -6px; left: -6px; }
.blueprint > .corner.br { bottom: -6px; right: -6px; }

/* — rules — */
.hr { height: 1px; border: 0; margin: var(--space-4) 0; background: var(--color-divider); }

/* — buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; line-height: 1.2;
  color: var(--color-text);
  background: transparent;
  border: 1px solid var(--color-divider);
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: 0;
}
.btn svg { display: block; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); color: var(--color-on-accent); border-color: var(--color-accent); }
.btn-primary:hover { background: var(--color-accent-400); }
.btn-primary:active { background: var(--color-accent-600); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-secondary:active { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn-ghost { color: var(--color-accent-800); border-color: transparent; padding-inline: var(--space-1); }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-block { width: 100%; margin-top: var(--space-2); }

/* — forms — */
.field > label {
  display: block; font-size: 12px; margin-bottom: 5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.input {
  width: 100%; min-height: 36px; padding: 6px 10px;
  font: inherit; font-size: 14px;
  color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: 0;
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent-600); outline-offset: 0; }
textarea.input { min-height: 90px; resize: vertical; }

/* — cards — transparent line drawings, never filled ---------------------- */
.card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3);
  background: transparent;
  border: 1px solid var(--color-divider);
  border-radius: 0;
}
.card-kicker {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-accent-800);
}
.card-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 17px; line-height: 1.2;
}
.card-body { margin: 0; font-size: 13px; opacity: 0.8; flex: 1; }
.card-meta {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}
.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-md); }
.elev-lg { box-shadow: var(--shadow-lg); }

/* — tags — */
.tag {
  display: inline-flex; align-items: center;
  font-size: 11px; letter-spacing: 0.02em;
  padding: 3px 10px; border-radius: 0;
}
.tag-accent { background: var(--color-accent-100); color: var(--color-accent-800); }
.tag-neutral { background: var(--color-neutral-100); color: var(--color-neutral-800); }
.tag-outline { border: 1px solid var(--color-accent-600); color: var(--color-accent-800); }

/* — dialog — used for the lightbox and the post-update composer ---------- */
.dialog {
  width: min(620px, 92vw);
  padding: 0; border: 1px solid var(--color-divider); border-radius: 0;
  background: var(--color-bg);
  box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: color-mix(in srgb, var(--color-accent-900) 92%, transparent); }
.dialog-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 20px;
}
.dialog-body { font-size: 14px; opacity: 0.85; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

/* — toast — bottom centre, auto-dismiss 2600ms -------------------------- */
.toast {
  position: fixed; left: 50%; bottom: var(--space-8);
  transform: translateX(-50%);
  background: var(--color-accent-900); color: var(--color-bg);
  padding: var(--space-3) var(--space-6);
  font-size: 14px; z-index: 60;
}

/* — layout scaffolding -------------------------------------------------- */
.hhp-shell { display: grid; grid-template-columns: var(--sidebar-width) 1fr; min-height: 100vh; }
.hhp-main { padding: var(--space-6) var(--space-8); max-width: var(--content-max); }

/* No transitions. Entrance animations were removed deliberately upstream
   after they caused stuck opacity. Keep it still. */

/* — mobile — the design was desktop-only; owners will use phones --------- */
@media (max-width: 900px) {
  .hhp-shell { grid-template-columns: 1fr; }
  h1 { font-size: 30px; }
  h2 { font-size: 24px; }
  h3 { font-size: 20px; }
  .hhp-main { padding: var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --- touch devices -------------------------------------------------------- */

/*
 * Found on a real iPhone 14 and a real Galaxy S22 on 15 September 2026, after
 * weeks of desktop testing showed nothing.
 *
 * Two faults, both on the screens a customer meets first:
 *
 *   Targets too small   Sign in on the landing page was 32px, and the login
 *                       email, password and submit were 36, 36 and 32. The
 *                       recognised comfortable minimum is 44.
 *
 *   iOS zoom on focus   Safari on iOS zooms the whole page when a form field
 *                       under 16px takes focus. Our inputs were 14px, so a
 *                       customer tapping the email box on an iPhone watched the
 *                       page lurch and then had to pinch back out to reach the
 *                       password. Every iPhone customer, first interaction.
 *
 * Scoped to pointer: coarse rather than a width breakpoint, because the
 * question is whether somebody is using a finger, not how wide their screen is.
 * That covers phones, tablets and touchscreen laptops, and leaves the mouse
 * driven layout exactly as designed.
 */
@media (pointer: coarse) {
  .input,
  select,
  textarea.input {
    min-height: 44px;
    /* 16px is the threshold, not a preference. Below it, iOS zooms. */
    font-size: 16px;
  }

  .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* A ghost button is still a target even though it has no border. */
  .btn-ghost { padding-inline: var(--space-3); }

  /* Checkboxes are the easiest thing in a form to miss with a thumb. */
  input[type="checkbox"],
  input[type="radio"] { min-width: 20px; min-height: 20px; }
}
