/* =========================================================================
   Smart farms (farms.html) · page-only styles, loaded after home.css.
   home.css tokens only: no hex, rgb or cubic-bezier here. Owner: Kallirroi.
   ========================================================================= */

/* ---- 2 · Clients: one named agriculture client, static (nothing to scroll) */
.fclients__row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.fclients__logos { display: flex; padding-left: 28px; border-left: 1px solid var(--line); }
.fclients__logos li { width: 216px; }
.fclients__go { margin-left: auto; }
/* the four farms by name, each with its town (no logo files): a full-width second row under the logo */
.fclients__names { order: 4; flex-basis: 100%; margin: 4px 0 0; max-width: none; justify-content: flex-start; gap: 8px 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.fclients__names li { font-size: var(--fs-body); color: var(--body); }
.fclients__names li::before { opacity: 1; }

/* ---- 5 and 7 · screens that are not 16:9 (overview, shading, week chart) show whole inside the same 16:9
   frame, on the app's dark surface. Their hotspot regions are measured on the letterboxed frame. */
.viewer__frame > img.fit, .day__screen > img.fit { object-fit: contain; background: var(--navy-900); }
/* the week chart fills the frame and the ring sits on it, so its reading moves to the top-right, over the date buttons */
#dayScreen:has(> img[data-screen="thiw"].is-on) .day__dc { left: auto; bottom: auto; top: 12px; right: 12px; }

/* ---- 7 · viewer: the farm the screens come from, under the screen tabs */
.vw-from { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: var(--fs-small); font-weight: 500; line-height: 1.4; color: var(--ink); }
.vw-from__k { font-size: var(--fs-micro); letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--muted); }

/* ---- 5 · Day: generated drawings sit in the same frame as the real screen (page-farms.js shows the one the moment names) */
.day__screen > .dart { position: absolute; inset: 0; opacity: 0; visibility: hidden;
  transition: opacity var(--dur-slow) var(--ease-std), visibility 0s linear var(--dur-slow); }
.day__screen > .dart.is-on { opacity: 1; visibility: visible; transition-delay: 0s; }
.dart > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.dart__chip { position: absolute; z-index: 1; left: 12px; top: 12px; }

/* the day chart: THI against the setpoint, and the fan stage, morning to night (no values: an illustration) */
.fd-bg { fill: var(--pl-bg); }
.fd-cols { fill: none; stroke: var(--pl-line); stroke-width: 2; stroke-dasharray: 2 10; }
.fd-axis { fill: none; stroke: var(--pl-line); stroke-width: 2; }
.fd-set { fill: none; stroke: var(--pl-strong); stroke-width: 3; stroke-dasharray: 16 12; }
.fd-thi { fill: none; stroke: var(--pl-on); stroke-width: 7; stroke-linecap: round; }
.fd-g0 { stop-color: var(--pl-on); stop-opacity: 0.3; }
.fd-g1 { stop-color: var(--pl-on); stop-opacity: 0; }
.fd-sun circle, .fd-sun path { fill: none; stroke: var(--pl-on); stroke-width: 4; stroke-linecap: round; }
.fd-moon { fill: var(--pl-strong); }
.fd-f { color: var(--pl-off); }
.fd-f.is-on { color: var(--s-agri); }
.fdf-ring { fill: none; stroke: currentColor; stroke-width: 2.5; }
.fdf-blades path { fill: currentColor; }
.fdf-hub { fill: currentColor; }
.fd-lbl { position: absolute; font-size: var(--fs-label); font-weight: 500; line-height: 1.2; white-space: nowrap; color: var(--body); }
.fd-lbl--t { translate: -50% 0; }
.fd-lbl--thi { left: 6%; top: 44%; color: var(--pl-on); }
.fd-lbl--set { right: 4%; top: 28.5%; color: var(--ink); }
.fd-lbl--fan { left: 6%; top: 60.5%; color: var(--s-agri-ink); }
.dart__none { display: block; }
.fd-s { display: none; }

/* ---- 7 · Barn ventilation demo (page-farms.js): same app frame and parts as the Home dashboard demo */
.fdemo__vis > .fbarn { inset: 0 0 auto 0; height: calc(100% - 76px); }
.fb-stalls rect { fill: var(--pl-furn); }
.fb-air path { fill: none; stroke: var(--pl-on); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 3 7; opacity: var(--fair, 0.5); transition: opacity var(--dur-base) var(--ease-std); }
.fbarn:not(.is-off) .fb-air path { animation: march var(--dur-march) linear infinite; }
.fb-fan { color: var(--s-agri-ink); transition: color var(--dur-base) var(--ease-std); }
.fb-spin { transform-box: fill-box; transform-origin: center; animation: fbspin var(--fspin, 2.6s) linear infinite; }
.fbarn.is-off .fb-spin { animation-play-state: paused; }
.fbarn.is-off .fb-fan { color: var(--pl-off); }
@keyframes fbspin { to { rotate: 360deg; } }

.fgauge { position: absolute; left: 14px; right: 14px; bottom: 12px; display: grid; gap: 10px; }
.fgauge__track { position: relative; height: 10px; border-radius: var(--r-pill); background: var(--app-line); }
.fgauge__band { position: absolute; left: 0; top: 0; bottom: 0; width: var(--x, 54%); border-radius: inherit; background: color-mix(in srgb, var(--accent-ink) 28%, transparent);
  transition: width var(--dur-base) var(--ease-std); }
.fgauge__set { position: absolute; top: -6px; left: var(--x, 60%); width: 3px; height: 22px; margin-left: -1.5px; border-radius: 2px; background: var(--ink);
  transition: left var(--dur-base) var(--ease-std); }
.fgauge__thi { position: absolute; top: 50%; left: var(--x, 54%); width: 18px; height: 18px; translate: -50% -50%; border-radius: 50%; background: var(--accent-ink); border: 3px solid var(--app-bg);
  transition: left var(--dur-base) var(--ease-std); }
.fgauge__legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-size: var(--fs-label); font-weight: 500; color: var(--body); }
.fgauge__legend > span { display: inline-flex; align-items: center; gap: 8px; }
.fgauge__k { flex: none; display: inline-block; }
.fgauge__k--thi { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-ink); }
.fgauge__k--set { width: 3px; height: 14px; border-radius: 2px; background: var(--ink); }
.fgauge__ends { margin-left: auto; color: var(--muted); }

.frange__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.frange__v { font-size: var(--fs-small); font-weight: 500; color: var(--ink); }
.frange { display: block; width: 100%; height: 44px; margin: 0; accent-color: var(--accent-ink); background: transparent; cursor: pointer; }
.frange:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-chip); }
.fdemo__note { font-size: var(--fs-label); line-height: 1.4; color: var(--muted); }
.state.is-warn .dot { background: var(--warn); }

/* ---- responsive */
@media (max-width: 767.98px) {
  .fclients__logos { order: 3; width: 100%; padding-left: 0; border-left: 0; }
  .fclients__logos li { width: 160px; }
}
@media (max-width: 639.98px) {
  .fd-lbl { font-size: var(--fs-micro); }
  .fd-l { display: none; }
  .fd-s { display: inline; }
  .fd-lbl--set { right: auto; left: 6%; top: 24%; }   /* phones: the setpoint label moves left, clear of the moon */
  .dart__chip { left: 8px; top: 8px; }
  .fdemo__vis { min-height: 210px; }
}
