/* Methodology full-screen modal. Always renders Sovereign Dark, regardless of
   the page theme, so the moved sections read consistently. */

.method-modal[open] {
  display: flex;
  flex-direction: column;
}
.method-modal {
  /* pin the dark palette locally */
  --paper: #0b0f0d;
  --paper-2: #121815;
  --paper-3: #141a17;
  --ink: #f2eee3;
  --ink-2: #cdc9bd;
  --green: #1cba80;
  --green-2: #16a374;
  --terracotta: #d2613f;
  --gold: #c9a44e;
  --ink-rgb: 242, 238, 227;
  color-scheme: dark;

  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0b0f0d;
  color: var(--ink);
  overflow: hidden;
}
/* "Always-dark stage" sections (.sovereignty, .ontology, .architecture, .use-cases,
   .fde) paint themselves as dark bands: they use var(--ink) as their own background
   and var(--paper)/var(--paper-3) as LIGHT text. The modal pins the dark palette
   above, which would flip --paper dark and make those headings vanish on the dark
   ground (the "Built for Saudi data" title bug). Re-pin the light palette locally so
   they read exactly as the standalone dark bands they were designed to be. */
.method-modal .sovereignty,
.method-modal .ontology,
.method-modal .architecture,
.method-modal .use-cases,
.method-modal .fde {
  --paper: #f2eee3;
  --paper-2: #e9e2d1;
  --paper-3: #fbf8ee;
  --ink: #111711;
  --ink-2: #223028;
  --ink-rgb: 17, 23, 17;
}

.method-modal::backdrop {
  background: rgba(4, 8, 6, 0.7);
}
html.method-open,
body.method-open {
  overflow: hidden;
}

/* top bar */
.method-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem 2rem;
  border-bottom: 1px solid rgba(242, 238, 227, 0.14);
  background: rgba(11, 15, 13, 0.92);
  backdrop-filter: blur(8px);
}
.method-bar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
/* Brand lockup matches the site header (.brand-mark / .brand-copy): square
   tile, sans wordmark + "Business of Smart Things" subtitle. */
.method-brand-mark {
  display: inline-flex;
  width: 36px;
  height: 36px;
  border-radius: 1px;
  overflow: hidden;
  flex: 0 0 auto;
  background: #0A2A22;
}
.method-brand-mark svg { width: 100%; height: 100%; display: block; }
.method-brand-copy {
  display: grid;
  gap: 0.1rem;
  line-height: 1.15;
}
.method-brand-copy strong {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
}
.method-brand-copy small {
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  opacity: 0.9;
  display: block;
}
/* Section label after the brand, divided by a hairline. */
.method-bar-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(242, 238, 227, 0.5);
  padding-inline-start: 1rem;
  margin-inline-start: 0.2rem;
  border-inline-start: 1px solid rgba(242, 238, 227, 0.16);
  white-space: nowrap;
}
@media (max-width: 900px) {
  .method-bar-label { display: none; }
}
.method-toc {
  display: flex;
  gap: 0.4rem;
  flex: 1 1 auto;
  flex-wrap: wrap;
}
.method-toc a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.4rem 0.7rem;
  border-radius: 7px;
  text-decoration: none;
  color: rgba(242, 238, 227, 0.72);
  font-size: 0.86rem;
  transition: color 0.18s ease, background 0.18s ease;
}
.method-toc a:hover {
  color: var(--ink);
  background: rgba(28, 186, 128, 0.12);
}
.method-toc-num {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--green-2);
}
.method-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(242, 238, 227, 0.2);
  background: transparent;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.method-close:hover {
  border-color: var(--terracotta);
  background: rgba(210, 97, 63, 0.14);
}

/* scroll area */
.method-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  scroll-behavior: smooth;
}
/* Focused on open (instead of the brand link) so the dialog lands in its
   content without painting a focus ring on the logo. */
.method-scroll:focus,
.method-scroll:focus-visible { outline: none; }

/* chapters */
.method-chapter {
  border-top: 1px solid rgba(242, 238, 227, 0.1);
}
.method-chapter:first-child {
  border-top: 0;
}
.method-chapter-head {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3.5rem 2rem 0.5rem;
}
.method-chapter-num {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--green-2);
}
.method-chapter-title {
  margin: 0.4rem 0 0.5rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
}
.method-chapter-sub {
  margin: 0;
  max-width: 640px;
  color: var(--ink-2);
  font-size: 1.05rem;
}

/* moved sections: tame the standalone full-page spacing */
.method-modal .method-section.section {
  padding: 2.6rem 2rem 3rem;
  min-height: 0;
  max-width: 1140px;
  margin: 0 auto;
  background: transparent;
}
.method-modal .method-section {
  scroll-margin-top: 80px;
}

/* Hierarchy: the chapter title is the dominant heading. Demote each moved
   section's own title to a sub-level so they read as content under the
   chapter, not competing H2s. Kickers stay (they carry extra info). */
.method-modal .method-section .section-head {
  margin-bottom: 1.6rem;
}
.method-modal .method-section .section-head > h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  line-height: 1.15;
}
/* Kill the one literal duplicate: the commitments title repeats chapter 04's
   own head ("What you can hold us to"). Drop it; keep the kicker + intro. */
.method-modal #commitments .section-head > h2 {
  display: none;
}

/* Closing call-to-action band: the modal must not dead-end on the last section. */
.method-cta {
  max-width: 900px;
  margin: 1rem auto 0;
  padding: 4rem 2rem 5rem;
  text-align: center;
  border-top: 1px solid rgba(242, 238, 227, 0.12);
}
.method-cta-line {
  margin: 0 auto 1.8rem;
  max-width: 620px;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.2;
  color: var(--ink);
}
.method-cta-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
}

@media (max-width: 760px) {
  .method-bar { gap: 0.8rem; padding: 0.8rem 1.1rem; }
  .method-toc { display: none; }
  .method-chapter-head { padding: 2.5rem 1.1rem 0.5rem; }
  .method-modal .method-section.section { padding: 2rem 1.1rem 2.4rem; }
  .method-cta { padding: 3rem 1.1rem 3.5rem; }
}

/* === Contact modal (small, centered) === */
.contact-modal {
  --green: #1cba80;
  --green-2: #16a374;
  --terracotta: #d2613f;
  border: 1px solid rgba(242, 238, 227, 0.16);
  border-radius: 16px;
  padding: 0;
  width: min(480px, calc(100vw - 2rem));
  background: #0f1512;
  color: #f2eee3;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
.contact-modal::backdrop {
  background: rgba(4, 8, 6, 0.66);
  backdrop-filter: blur(3px);
}
.contact-modal-inner {
  position: relative;
  padding: 2.2rem 2rem 2rem;
}
.contact-close {
  position: absolute;
  top: 0.9rem;
  inset-inline-end: 0.9rem;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(242, 238, 227, 0.2);
  background: transparent;
  color: #f2eee3;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.contact-close:hover { border-color: var(--terracotta); background: rgba(210, 97, 63, 0.14); }
.contact-modal-title {
  margin: 0 0 0.5rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.9rem;
  line-height: 1.05;
}
.contact-modal-lede {
  margin: 0 0 1.4rem;
  color: #cdc9bd;
  font-size: 0.95rem;
  line-height: 1.5;
}
.contact-modal-form { display: flex; flex-direction: column; gap: 0.9rem; }
.contact-field { display: flex; flex-direction: column; gap: 0.35rem; }
.contact-field span {
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(242, 238, 227, 0.6);
}
.contact-field input,
.contact-field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(242, 238, 227, 0.2);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.25);
  color: #f2eee3;
  font: inherit;
  resize: vertical;
}
.contact-field input:focus,
.contact-field textarea:focus {
  outline: none;
  border-color: var(--green-2);
  box-shadow: 0 0 0 2px rgba(28, 186, 128, 0.22);
}
.contact-submit { margin-top: 0.4rem; align-self: flex-start; cursor: pointer; }
.contact-status { margin: 0.2rem 0 0; font-size: 0.85rem; line-height: 1.4; color: var(--green); }
.contact-status[hidden] { display: none; }
.contact-status.is-error { color: var(--terracotta); }
