/*
Theme Name:   Platformr 2.0
Theme URI:    https://www.platformr.cloud
Description:  Platformr 2.0 — a dense, console-style design system for platformr.cloud. Dark navy surfaces, tabular data, hairline structure, terracotta reserved for status and actions. Child of the Techkit theme, built for Elementor.
Author:       Platformr
Version:      2.0.0
Template:     techkit
Text Domain:  platformr-2-0
*/

/* ==========================================================================
   PLATFORMR 2.0
   Design intent: the page should read like the product — a control plane.
   Density is the aesthetic. Vertical rhythm is deliberately tight so the
   whole argument fits in two or three screens instead of seven.
   ========================================================================== */

/* --- 1. Tokens ----------------------------------------------------------- */

:root {
  /* Surfaces */
  --p-bg:        #192139; /* dominant surface */
  --p-bg-deep:   #080A10; /* top bar, footer */
  --p-panel:     #272F48; /* raised panel on navy */
  --p-light:     #F3F3F3; /* the single light band */
  --p-white:     #FFFFFF;

  /* Accent — status and actions only, never decoration */
  --p-accent:    #C95439;
  --p-accent-dk: #A8422B;
  --p-peach:     #FCE5CD;

  /* Ink */
  --p-ink:        #FFFFFF;
  --p-ink-muted:  rgba(255, 255, 255, 0.64);
  --p-ink-faint:  rgba(255, 255, 255, 0.40);
  --p-ink-dark:   #192139;
  --p-ink-dark-2: #666E7F;

  /* Structure */
  --p-rule:       rgba(255, 255, 255, 0.12);
  --p-rule-dark:  rgba(25, 33, 57, 0.14);

  /* Status */
  --p-ok:   #3FA06A;
  --p-warn: #C95439;

  /* Type */
  --p-head: "Sarabun", system-ui, sans-serif;
  --p-body: "Roboto", system-ui, sans-serif;

  /* Rhythm — tight on purpose */
  --p-band:   clamp(2.75rem, 4.5vw, 4rem);
  --p-gutter: clamp(1.25rem, 3vw, 2.5rem);
  --p-max:    1240px;
  --p-bar:    58px;
}

/* --- 2. Base ------------------------------------------------------------- */

html { box-sizing: border-box; scroll-padding-top: calc(var(--p-bar) + 12px); }
*, *::before, *::after { box-sizing: inherit; }
html, body { overflow-x: clip; max-width: 100%; }

body {
  margin: 0;
  font-family: var(--p-body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--p-ink-muted);
  background: var(--p-bg);
  -webkit-font-smoothing: antialiased;
}

img, svg, video, iframe { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  font-family: var(--p-head);
  color: var(--p-ink);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 4.2vw, 2.75rem); }   /* capped at 44px */
h2 { font-size: clamp(1.5rem, 2.8vw, 1.9375rem); }
h3 { font-size: 1.125rem; letter-spacing: -0.01em; }
h4 { font-size: 1rem; }

p { margin: 0 0 1rem; max-width: 62ch; }
p:last-child { margin-bottom: 0; }

a { color: var(--p-accent); text-underline-offset: 0.2em; }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--p-accent);
  outline-offset: 3px;
}

.p-wrap {
  width: min(var(--p-max), 100% - (2 * var(--p-gutter)));
  margin-inline: auto;
}

/* Light band inverts the ink */
.p-band--light { background: var(--p-light); color: var(--p-ink-dark-2); }
.p-band--light :is(h1, h2, h3, h4) { color: var(--p-ink-dark); }

.p-band { padding-block: var(--p-band); }
.p-band--deep { background: var(--p-bg-deep); }

/* --- 3. Top bar ---------------------------------------------------------- */

.p-bar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  height: var(--p-bar);
  background: var(--p-bg-deep);
  border-bottom: 1px solid var(--p-rule);
}

.p-bar__inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 100%;
}

/* Logo sits top-left, always. */
.p-bar__logo { margin-right: auto; display: flex; align-items: center; }
.p-bar__logo img { height: 22px; width: auto; }

.p-nav { display: flex; align-items: center; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
.p-nav a {
  color: var(--p-ink-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  height: var(--p-bar);
  border-bottom: 2px solid transparent;
}
.p-nav a:hover { color: var(--p-ink); border-bottom-color: var(--p-accent); }

.p-bar__toggle {
  display: none;
  background: none;
  border: 1px solid var(--p-rule);
  color: var(--p-ink);
  width: 42px; height: 38px;
  border-radius: 3px;
  align-items: center; justify-content: center;
  cursor: pointer;
}

/* The live site's header is rendered by Techkit, not by the page template.
   These rules pull that header into the 2.0 bar: compact, dark, logo hard
   left. Upload assets/platformr-logo-horiz-white.png as the WordPress custom
   logo (Appearance → Customize → Site Identity) so the mark is the real
   lockup and not a text wordmark. */
.site-header,
.header-style-5 {
  background: var(--p-bg-deep);
  border-bottom: 1px solid var(--p-rule);
  box-shadow: none;
}

.site-header .custom-logo-link,
.site-header .navbar-brand { margin-right: auto; }

.site-header .custom-logo,
.site-header .navbar-brand img { height: 22px; width: auto; }

.site-header .menu-item > a,
.mega-menu-primary .mega-menu-item > a {
  color: var(--p-ink-muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.site-header .menu-item > a:hover,
.mega-menu-primary .mega-menu-item > a:hover { color: var(--p-ink); }

/* --- 4. Buttons ---------------------------------------------------------- */

.p-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1.4rem;
  font-family: var(--p-body);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 3px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.p-btn--primary { background: var(--p-accent); color: var(--p-white); }
.p-btn--primary:hover { background: var(--p-accent-dk); color: var(--p-white); }

.p-btn--quiet {
  background: transparent;
  border-color: var(--p-rule);
  color: var(--p-ink);
}
.p-btn--quiet:hover { border-color: var(--p-accent); color: var(--p-white); }

.p-band--light .p-btn--quiet { border-color: var(--p-rule-dark); color: var(--p-ink-dark); }

.p-btn--sm { min-height: 36px; font-size: 0.875rem; padding: 0 1rem; }

/* --- 5. Hero ------------------------------------------------------------- */

.p-hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: center;
  padding-block: clamp(2.5rem, 4vw, 3.5rem);
}

.p-hero p { font-size: 1.0625rem; max-width: 46ch; color: var(--p-ink-muted); }

.p-hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

/* Small meta line under the CTA — carries the real objection, not a slogan. */
.p-hero__meta {
  margin-top: 0.9rem;
  font-size: 0.8125rem;
  color: var(--p-ink-faint);
}

/* --- 6. Console panel (the hero's right side) ---------------------------- */

.p-console {
  background: var(--p-panel);
  border: 1px solid var(--p-rule);
  border-radius: 4px;
  overflow: hidden;
}

.p-console__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--p-rule);
  background: rgba(0, 0, 0, 0.18);
}

.p-console__title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--p-ink);
  letter-spacing: 0.01em;
}

.p-console__stamp { font-size: 0.75rem; color: var(--p-ink-faint); font-variant-numeric: tabular-nums; }

.p-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--p-rule);
  font-size: 0.875rem;
  color: var(--p-ink-muted);
}
.p-row:last-child { border-bottom: 0; }

.p-row__name { color: var(--p-ink); font-weight: 400; }
.p-row__sub { display: block; font-size: 0.75rem; color: var(--p-ink-faint); }

/* Status pill encodes state — the one place colour carries meaning. */
.p-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.p-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-pill--ok   { color: var(--p-ok);   background: rgba(63, 160, 106, 0.12); }
.p-pill--warn { color: var(--p-accent); background: rgba(201, 84, 57, 0.14); }

/* --- 7. Metric strip (sits inside the hero band — no extra padding) ------ */

.p-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--p-rule);
}

.p-metric {
  padding: 1.25rem 1.5rem 1.25rem 0;
  border-right: 1px solid var(--p-rule);
}
.p-metric:last-child { border-right: 0; }
.p-metric:not(:first-child) { padding-left: 1.5rem; }

.p-metric__value {
  font-family: var(--p-head);
  font-size: clamp(1.6rem, 2.6vw, 2.125rem);
  font-weight: 600;
  line-height: 1;
  color: var(--p-ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.p-metric__value em { font-style: normal; color: var(--p-accent); }

.p-metric__label {
  margin-top: 0.4rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--p-ink-faint);
}

/* --- 8. Spec table (replaces the three-card row) ------------------------- */

.p-spec { border-top: 1px solid var(--p-rule-dark); }

.p-spec__row {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr auto;
  gap: 1.5rem;
  align-items: baseline;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--p-rule-dark);
}

.p-spec__name {
  font-family: var(--p-head);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--p-ink-dark);
  letter-spacing: -0.01em;
}

.p-spec__desc { font-size: 0.9375rem; color: var(--p-ink-dark-2); max-width: 54ch; }

.p-spec__out {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--p-accent);
  white-space: nowrap;
}

/* --- 9. Proof row -------------------------------------------------------- */

.p-proof {
  display: grid;
  grid-template-columns: 1fr 1px 1.2fr;
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: center;
}

.p-proof__divider { background: var(--p-rule); width: 1px; height: 100%; }

.p-creds { list-style: none; margin: 0; padding: 0; }
.p-creds li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.9375rem;
  color: var(--p-ink-muted);
  padding: 0.4rem 0;
}
.p-creds li::before { content: ""; width: 5px; height: 5px; background: var(--p-accent); flex: none; }

.p-quote {
  font-family: "Merriweather", Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.45;
  color: var(--p-ink);
  margin: 0;
  max-width: 40ch;
}
.p-quote__by { margin-top: 0.75rem; font-family: var(--p-body); font-size: 0.8125rem; color: var(--p-ink-faint); }

/* --- 10. Closing CTA + footer, merged into one band ---------------------- */

.p-close {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
  padding-bottom: var(--p-band);
  border-bottom: 1px solid var(--p-rule);
}

.p-close h2 { margin-bottom: 0.35rem; }
.p-close p { color: var(--p-ink-muted); margin: 0; }

.p-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 2rem;
  padding-top: 1.5rem;
  font-size: 0.8125rem;
  color: var(--p-ink-faint);
}
.p-foot img { height: 20px; width: auto; }
.p-foot a { color: var(--p-ink-faint); text-decoration: none; }
.p-foot a:hover { color: var(--p-ink); }
.p-foot__links { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-left: auto; }

/* --- 11. Forms ----------------------------------------------------------- */

.ff-el-form-control,
input:not([type="submit"]), select, textarea {
  font-family: var(--p-body);
  font-size: 16px; /* stops iOS zooming on focus */
  min-height: 44px;
  width: 100%;
  color: var(--p-ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--p-rule);
  border-radius: 3px;
  padding: 0.6rem 0.8rem;
}
.ff-el-form-control:focus, input:focus, textarea:focus {
  border-color: var(--p-accent);
  outline: none;
}
.p-band--light :is(input, select, textarea, .ff-el-form-control) {
  background: var(--p-white);
  color: var(--p-ink-dark);
  border-color: var(--p-rule-dark);
}

/* ==========================================================================
   12. Mobile
   Elementor breakpoints: 1024 / 767 / 480.
   Density holds on phones — rows stay rows, they just lose the second column.
   ========================================================================== */

@media (pointer: coarse) {
  .p-nav a, .p-foot a { min-height: 44px; display: inline-flex; align-items: center; }
}

@media (max-width: 1024px) {
  .p-hero { grid-template-columns: 1fr; gap: 2rem; }
  .p-hero p { max-width: none; }
  .p-metrics { grid-template-columns: repeat(2, 1fr); }
  .p-metric:nth-child(2) { border-right: 0; }
  .p-metric:nth-child(-n+2) { border-bottom: 1px solid var(--p-rule); }
  .p-spec__row { grid-template-columns: 0.9fr 1.1fr; }
  .p-spec__out { grid-column: 1 / -1; }
  .p-proof { grid-template-columns: 1fr; }
  .p-proof__divider { width: 100%; height: 1px; }
}

@media (max-width: 767px) {
  :root { --p-band: 2.25rem; --p-gutter: 1.125rem; }

  .p-nav, .p-bar .p-btn { display: none; }
  .p-bar__toggle { display: inline-flex; }
  .p-bar.is-open .p-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: absolute;
    inset: var(--p-bar) 0 auto 0;
    background: var(--p-bg-deep);
    border-bottom: 1px solid var(--p-rule);
    padding: 0.25rem var(--p-gutter) 0.75rem;
  }
  .p-bar.is-open .p-nav a { height: 48px; width: 100%; border-bottom: 1px solid var(--p-rule); }
  .p-bar.is-open .p-nav li:last-child a { border-bottom: 0; }

  .p-hero { padding-block: 1.75rem 1.5rem; }
  .p-hero__actions { gap: 0.6rem; }
  .p-hero__actions .p-btn { flex: 1 1 100%; }

  /* Metrics stay two-up rather than stacking to four rows — keeps the
     strip to one screen-third instead of a full scroll. */
  .p-metrics { grid-template-columns: repeat(2, 1fr); }
  .p-metric { padding: 0.9rem 0.9rem 0.9rem 0; }
  .p-metric:not(:first-child) { padding-left: 0.9rem; }
  .p-metric:nth-child(odd) { padding-left: 0; }
  .p-metric:nth-child(even) { border-right: 0; }

  /* Spec rows stack label over description, output chip inline below. */
  .p-spec__row { grid-template-columns: 1fr; gap: 0.3rem; padding: 0.9rem 0; }
  .p-spec__desc { max-width: none; }
  .p-spec__out { white-space: normal; }

  .p-console__head { padding: 0.6rem 0.8rem; }
  .p-row { padding: 0.6rem 0.8rem; grid-template-columns: 1fr auto; gap: 0.6rem; }

  .p-quote { font-size: 1.0625rem; max-width: none; }

  .p-close { grid-template-columns: 1fr; gap: 1.25rem; }
  .p-close .p-btn { width: 100%; }
  .p-foot { gap: 1rem; }
  .p-foot__links { margin-left: 0; width: 100%; }
}

@media (max-width: 480px) {
  :root { --p-gutter: 1rem; }
  h1 { font-size: 1.875rem; }
  .p-metric__value { font-size: 1.5rem; }
  .p-console__stamp { display: none; }
}

@supports (padding: max(0px)) {
  .p-wrap {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

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

@media print {
  body { background: #fff; color: #000; }
  .p-bar, .p-hero__actions { display: none; }
  :is(h1, h2, h3, h4) { color: #000; }
}
