/*
Theme Name: Pyramind
Theme URI: https://pyramind.se
Description: Bespoke dark, technical theme for Pyramind — engineering intelligent systems for the power industry. Standalone block-friendly theme built with native WordPress content and no page builder dependency.
Author: Pyramind
Version: 1.1.0
Text Domain: pyramind
*/

/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --bg: #0B0F14;
  --bg-2: #111821;
  --card: #151D27;
  --text: #F5F7FA;
  --text-muted: #9AA6B2;
  --blue: #18A8F2;
  --cyan: #2ED3E6;
  --green: #43D17A;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --maxw: 1200px;
  --gap: clamp(1.25rem, 3vw, 2.5rem);
  --section-y: clamp(4rem, 9vw, 8rem);
  --radius: 4px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 84px;
  overflow-x: hidden;
}

body.pyramind {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Prevent grid/flex children from overflowing on narrow screens */
.hero-grid > *, .intro-grid > *, .about-grid > *, .contact-grid > *,
.services-grid > *, .projects-grid > *, .process-grid > *,
.principles-grid > *, .capabilities > *, .footer-grid > *, .nav-inner > * {
  min-width: 0;
}

/* Offset in-page anchors so they clear the fixed header */
section[id] { scroll-margin-top: 84px; }

img { max-width: 100%; height: auto; display: block; }

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--blue); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 0.6em;
}

p { margin: 0 0 1.1em; color: var(--text); }

::selection { background: rgba(24, 168, 242, 0.3); color: #fff; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Layout helpers */
.wrap { width: min(var(--maxw), 100% - 2 * clamp(1.25rem, 5vw, 3rem)); margin-inline: auto; }
.section { padding-block: var(--section-y); }
.section--alt { background: var(--bg-2); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 1.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.eyebrow::before {
  content: "";
  width: 28px; height: 1px;
  background: var(--cyan);
  opacity: 0.6;
}

.lead { color: var(--text-muted); font-size: 1.08rem; max-width: 60ch; }

h2.section-title { font-size: clamp(1.9rem, 4vw, 2.9rem); max-width: 18ch; }

/* ============================================================
   Reveal on scroll
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  will-change: opacity, transform;
}
.reveal.in-view { opacity: 1; transform: none; }

/* ============================================================
   Header
   ============================================================ */
.pyramind .site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: rgba(11, 15, 20, 0.55);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 0.3s ease, border-color 0.3s ease;
}
.site-header.scrolled {
  background: rgba(11, 15, 20, 0.92);
  border-bottom-color: var(--border);
}
/* Offset the fixed header below the WordPress admin bar when logged in */
.admin-bar.pyramind .site-header { top: 32px; }
@media screen and (max-width: 782px) {
  .admin-bar.pyramind .site-header { top: 46px; }
}

/* Inner pages (privacy, cookie, single project, etc.) */
.page-shell {
  padding-top: clamp(7.5rem, 16vh, 10rem);
  padding-bottom: var(--section-y);
  min-height: 60vh;
}
.page-content { max-width: 820px; }
.page-content .page-title { font-size: clamp(2rem, 4.5vw, 3.2rem); margin-bottom: 1.5rem; }
.page-content h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin-top: 2rem; }
.page-content h3 { margin-top: 1.5rem; }
.page-content ul, .page-content ol { padding-left: 1.25rem; color: var(--text); }
.page-content li { margin-bottom: 0.4rem; }
.page-content a { text-decoration: underline; }
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 68px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { color: var(--text); }
.brand .dot { color: var(--cyan); }

.nav-links {
  display: flex;
  gap: 1.9rem;
  list-style: none;
  margin: 0; padding: 0;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s ease;
}
.nav-links a:hover { color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.btn--primary {
  background: var(--blue);
  color: #04121d;
  border-color: var(--blue);
}
.btn--primary:hover { background: var(--cyan); border-color: var(--cyan); color: #04121d; transform: translateY(-1px); }
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--ghost:hover { border-color: var(--cyan); color: var(--cyan); }
.btn--sm { padding: 0.55rem 1rem; font-size: 0.9rem; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  width: 42px; height: 38px;
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  display: block;
  width: 18px; height: 2px;
  background: var(--text);
  position: relative;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle span::before { position: absolute; top: -6px; }
.nav-toggle span::after { position: absolute; top: 6px; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { transform: translateY(-6px) rotate(-45deg); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  padding-top: clamp(8rem, 16vh, 11rem);
  padding-bottom: var(--section-y);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 80% 0%, rgba(24,168,242,0.10), transparent 55%);
  pointer-events: none;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  position: relative;
  z-index: 1;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.04;
  max-width: 16ch;
}
.hero-sub {
  color: var(--text-muted);
  font-size: 1.12rem;
  max-width: 52ch;
  margin-bottom: 2rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; }

.hero-visual {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  padding: 1.25rem;
  aspect-ratio: 5 / 4;
}
.hero-visual svg { width: 100%; height: 100%; display: block; }
.hero-visual .viz-label {
  position: absolute;
  top: 1.1rem; left: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Animated technical visualization */
.viz-grid line { stroke: var(--border); stroke-width: 1; }
.viz-axis { stroke: var(--border-strong); stroke-width: 1; }
.viz-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 6 10;
  animation: viz-flow 3.5s linear infinite;
}
.viz-line.blue { stroke: var(--blue); }
.viz-line.cyan { stroke: var(--cyan); animation-duration: 4.6s; }
.viz-line.green { stroke: var(--green); animation-duration: 5.4s; opacity: 0.85; }
.viz-line.solid { stroke-dasharray: none; opacity: 0.5; }
.viz-node { fill: var(--cyan); animation: viz-pulse 2.8s ease-in-out infinite; }
.viz-node.b { fill: var(--blue); animation-delay: 0.7s; }
.viz-node.g { fill: var(--green); animation-delay: 1.4s; }
.viz-link { stroke: var(--border-strong); stroke-width: 1; }

@keyframes viz-flow { to { stroke-dashoffset: -48; } }
@keyframes viz-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ============================================================
   Intro + capabilities
   ============================================================ */
.intro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: start; }
.capabilities {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cap {
  background: var(--bg);
  padding: 1.6rem 1.5rem;
}
.cap .ico { color: var(--cyan); margin-bottom: 0.9rem; }
.cap h3 { font-size: 1.05rem; margin-bottom: 0.35rem; }
.cap p { color: var(--text-muted); font-size: 0.92rem; margin: 0; }
.cap .num { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); float: right; }

/* ============================================================
   Services
   ============================================================ */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 3rem;
}
.service-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem 1.6rem;
  transition: border-color 0.25s ease, transform 0.25s ease, background 0.25s ease;
}
.service-card:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.service-card .ico { color: var(--cyan); margin-bottom: 1.1rem; }
.service-card h3 { font-size: 1.2rem; margin-bottom: 0.55rem; }
.service-card > p { color: var(--text-muted); font-size: 0.95rem; }
.service-card .examples {
  list-style: none;
  padding: 1rem 0 0;
  margin: 1rem 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.service-card .examples li {
  font-size: 0.86rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding-left: 1.1rem;
  position: relative;
}
.service-card .examples li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.55em;
  width: 5px; height: 5px;
  background: var(--green);
  border-radius: 50%;
}

/* ============================================================
   Industries
   ============================================================ */
.industries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 2.5rem;
}
.industry {
  background: var(--bg-2);
  padding: 1.5rem 1.6rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  transition: background 0.25s ease;
}
.industry:hover { background: var(--card); }
.industry .ico { color: var(--blue); flex: none; }
.industry span { font-weight: 500; font-size: 0.98rem; }

/* ============================================================
   Process timeline
   ============================================================ */
.process-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-top: 3rem;
}
.step {
  position: relative;
  padding-top: 2rem;
  border-top: 1px solid var(--border-strong);
}
.step::before {
  content: "";
  position: absolute;
  top: -1px; left: 0;
  width: 42px; height: 2px;
  background: var(--cyan);
}
.step .num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--cyan);
  display: block;
  margin-bottom: 0.8rem;
}
.step h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.step p { color: var(--text-muted); font-size: 0.93rem; margin: 0; }

/* ============================================================
   Projects
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 3rem;
}
.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.25s ease, transform 0.25s ease;
  display: flex;
  flex-direction: column;
}
.project-card:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.project-card .pviz {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--bg-2), var(--bg));
  border-bottom: 1px solid var(--border);
}
.project-card .pviz svg { width: 100%; height: 100%; }
.project-card .pviz--img { overflow: hidden; }
.project-card .pviz--img img { width: 100%; height: 100%; object-fit: cover; }
.project-card .pbody { padding: 1.5rem 1.5rem 1.7rem; }
.project-card .pcat {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
  display: block;
  margin-bottom: 0.7rem;
}
.project-card h3 { font-size: 1.12rem; margin-bottom: 0.5rem; }
.project-card p { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 1rem; }
.project-card .tech {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  margin: 0 0 1rem; padding: 0; list-style: none;
}
.project-card .tech li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.2rem 0.5rem;
}
.project-card .result {
  font-size: 0.86rem;
  color: var(--green);
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ============================================================
   About + principles
   ============================================================ */
.about-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(2rem,5vw,3.5rem); align-items: center; }
.about-visual {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  aspect-ratio: 4 / 3;
  padding: 1.25rem;
}
.about-visual svg { width: 100%; height: 100%; }
.principles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-top: 3rem;
}
.principle { border-top: 1px solid var(--border-strong); padding-top: 1.4rem; }
.principle .ico { color: var(--green); margin-bottom: 0.8rem; }
.principle h3 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.principle p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

/* ============================================================
   Contact
   ============================================================ */
.contact-grid { display: grid; grid-template-columns: 0.95fr 1.05fr; gap: clamp(2rem,5vw,4rem); align-items: start; }
.contact h2 { font-size: clamp(2rem, 4.5vw, 3.2rem); max-width: 14ch; }
.contact-email {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  display: inline-block;
  margin-top: 1.5rem;
}
.contact-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 3vw, 2.2rem);
  display: grid;
  gap: 1.1rem;
}
.field { display: grid; gap: 0.45rem; }
.field.two { grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.field label, .form-row label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.contact-form input,
.contact-form select,
.contact-form textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.98rem;
  padding: 0.75rem 0.9rem;
  transition: border-color 0.2s ease;
}
.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  border-color: var(--cyan);
  outline: none;
}
.contact-form textarea { resize: vertical; min-height: 120px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-note { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.form-alert {
  border: 1px solid var(--green);
  background: rgba(67,209,122,0.08);
  color: var(--green);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  font-size: 0.92rem;
}
.form-alert.error { border-color: #f2685a; background: rgba(242,104,90,0.08); color: #f2a79e; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding-block: clamp(3rem, 6vw, 4.5rem) 2rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--gap);
}
.footer-grid .brand { font-size: 1rem; margin-bottom: 1rem; display: inline-block; }
.footer-desc { color: var(--text-muted); font-size: 0.92rem; max-width: 34ch; }
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.footer-col a { color: var(--text-muted); font-size: 0.92rem; }
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  .hero-grid, .intro-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .services-grid, .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .process-grid, .principles-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-visual { order: -1; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* Mobile navigation: hamburger menu */
@media (max-width: 820px) {
  .nav-links, .nav-cta-desktop { display: none; }
  .nav-toggle { display: inline-flex; }
  .site-header.open .nav-links {
    display: flex;
    position: absolute;
    top: 68px; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(11, 15, 20, 0.98);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
  }
  .site-header.open .nav-links li { width: 100%; }
  .site-header.open .nav-links a {
    display: block;
    padding: 0.95rem clamp(1.25rem, 5vw, 3rem);
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 640px) {
  body.pyramind { font-size: 16px; }
  .services-grid, .projects-grid, .process-grid,
  .principles-grid, .capabilities, .footer-grid { grid-template-columns: 1fr; }
  .field.two { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; }
  .hero { padding-top: clamp(7rem, 22vh, 9rem); }
  .hero-actions .btn { flex: 1 1 auto; justify-content: center; }
  .hero-visual { aspect-ratio: 4 / 3; padding: 0.9rem; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .pyramind [data-animate] { animation: none !important; }
}
