/* Digital Jibia — shared component styles. Layout uses Tailwind utilities in templates. */
:root {
  --ink: #14181a;
  --brand: #0b6b4d;
  --brand-dark: #083f2e;
  --brand-tint: #e4f0ea;
  --brand-soft: #8fcdb5;
  --gold: #d9a441;
  --line: #e3e1d8;
  --muted: #555b61;
  --paper: #fafaf7;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
}

html { scroll-behavior: smooth; }
body { margin: 0; padding-top: 72px; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.chip:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 40px); box-sizing: border-box; }
.sec { position: relative; overflow: hidden; padding: 88px 0; }
.sec > .wrap { position: relative; z-index: 1; }
.sec-line { border-top: 1px solid var(--line); }


/* Animated wireframe backgrounds (verbatim from the design): circuits, robotics arms, servers, networks */
.fx { position:absolute; inset:0; pointer-events:none; z-index:0; }
.fx .draw{stroke-dasharray:1;stroke-dashoffset:0;animation:fx-draw 10s ease-in-out infinite alternate}
@keyframes fx-draw{0%{stroke-dashoffset:1}60%,100%{stroke-dashoffset:0}}
.fx .flow{stroke-dasharray:6 10;animation:fx-flow 3s linear infinite}
.fx .flow-r{stroke-dasharray:6 10;animation:fx-flow 4s linear infinite reverse}
@keyframes fx-flow{to{stroke-dashoffset:-32}}
.fx .pulse{animation:fx-pulse 3s ease-in-out infinite}
@keyframes fx-pulse{0%,100%{opacity:.2}50%{opacity:1}}
.fx .ping{transform-box:fill-box;transform-origin:center;animation:fx-ping 4s ease-out infinite}
@keyframes fx-ping{0%{transform:scale(.3);opacity:.9}100%{transform:scale(2.4);opacity:0}}
.fx .spin{animation:fx-spin 26s linear infinite}
.fx .spin-r{animation:fx-spin 19s linear infinite reverse}
@keyframes fx-spin{to{transform:rotate(360deg)}}
.fx .sw1{animation:fx-sw1 7s ease-in-out infinite alternate}
@keyframes fx-sw1{from{transform:rotate(-14deg)}to{transform:rotate(16deg)}}
.fx .sw2{animation:fx-sw2 5s ease-in-out infinite alternate}
@keyframes fx-sw2{from{transform:rotate(-26deg)}to{transform:rotate(20deg)}}
.fx .sw3{animation:fx-sw3 3.5s ease-in-out infinite alternate}
@keyframes fx-sw3{from{transform:rotate(-12deg)}to{transform:rotate(18deg)}}
.fx .bar{transform-box:fill-box;transform-origin:left center;animation:fx-bar 5s ease-in-out infinite alternate}
@keyframes fx-bar{from{transform:scaleX(.25)}to{transform:scaleX(1)}}
.fx .belt{animation:fx-belt 6s linear infinite}
@keyframes fx-belt{from{transform:translateX(0)}to{transform:translateX(150px)}}
@media (prefers-reduced-motion:reduce){.fx *{animation:none !important}}

/* Type */
.h1, .h2, .h3, .display { font-family: var(--display); color: var(--ink); margin: 0; text-wrap: balance; }
.h1 { font-weight: 600; font-size: clamp(40px, 5.2vw, 72px); line-height: 1.05; letter-spacing: -.03em; }
.h1-page { font-size: clamp(36px, 4.4vw, 56px); }
.h2 { font-weight: 600; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.1; letter-spacing: -.02em; }
.h3 { font-weight: 600; font-size: 22px; line-height: 1.2; letter-spacing: -.01em; }
.lead { margin: 0; font-size: clamp(17px, 2vw, 20px); line-height: 1.6; color: var(--muted); text-wrap: pretty; max-width: 640px; }
.body { margin: 0; font-size: 15px; line-height: 1.6; color: var(--muted); }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.num { font-family: var(--display); font-weight: 500; font-size: 40px; letter-spacing: -.02em; color: var(--brand); line-height: 1; }
.on-dark .h1, .on-dark .h2, .on-dark .h3, .on-dark .display { color: #fff; }
.on-dark .lead, .on-dark .body { color: #c9d0cc; }
.on-dark .eyebrow { color: var(--gold); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 24px;
  box-sizing: border-box; border-radius: 10px; border: 1px solid transparent; font: 600 16px/1 "Inter", system-ui, sans-serif;
  white-space: nowrap; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.btn-p { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-p:hover { background: #094f39; }
.btn-g { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-g:hover { background: var(--ink); color: #fff; }
.btn-l { background: #fff; border-color: #fff; color: var(--brand-dark); }
.btn-l:hover { background: var(--brand-tint); }
.btn-o { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn-o:hover { background: #c9922f; }
.btn-gd { background: transparent; border-color: #fff; color: #fff; }
.btn-gd:hover { background: #fff; color: var(--ink); }
.btn-k { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-k:hover { background: #2b3438; }
.btn-sm { min-height: 44px; }
.btn.htmx-request { opacity: .7; pointer-events: none; }

/* Cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-sizing: border-box; }
a.card { transition: border-color .15s; }
a.card:hover { border-color: var(--ink); }
.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--brand); }
.link-arrow svg { transition: transform .15s; }
a:hover > .link-arrow svg, a.link-arrow:hover svg { transform: translateX(3px); }

.tag { display: inline-flex; align-items: center; min-height: 28px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--brand-tint); color: var(--brand-dark); }
.tag-gold { background: #f7e6bf; color: #5b4310; }
.tag-line { background: #fff; border: 1px solid var(--line); color: var(--muted); font-weight: 500; }

/* Filter chips: a radio hidden inside a label */
.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px; box-sizing: border-box;
  border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 15px; font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }

/* Forms */
.label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--ink); }
.field {
  width: 100%; min-height: 48px; box-sizing: border-box; padding: 12px 14px; border-radius: 10px; border: 1px solid #c9d0cc;
  background: #fff; color: var(--ink); font: 400 16px/1.4 "Inter", system-ui, sans-serif;
}
.field::placeholder { color: #7a8187; }
.field:focus { border-color: var(--brand); outline: 2px solid var(--brand); outline-offset: 0; }
.field[aria-invalid="true"] { border-color: #b3261e; }
.err { margin: 6px 0 0; font-size: 13px; color: #b3261e; }
.check { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 15px; color: var(--ink); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.notice { border-radius: 12px; padding: 20px 22px; background: var(--brand-tint); color: var(--brand-dark); font-size: 15px; line-height: 1.55; }
.notice strong { display: block; font-family: var(--display); font-size: 20px; margin-bottom: 4px; }

/* Nav */
.nav-a { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; box-sizing: border-box; }
.nav-a:hover { color: var(--brand); }
.nav-a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); }
/* Desktop (>=900px): inline links + CTA, no hamburger. Below: hamburger + drop-down panel. */
header .nav-links { display: flex; }
header .menu-btn { display: none; }
header .menu-panel { display: block; }
header .menu-panel[hidden] { display: none; }
@media (max-width: 899px) {
  header .nav-links, header .nav-cta { display: none; }
  header .menu-btn { display: inline-flex; }
}
@media (min-width: 900px) { header .menu-panel { display: none; } }
.foot-a { color: #c9d0cc; font-size: 15px; }
.foot-a:hover { color: #fff; }

/* htmx page-swap feel */
#content { transition: opacity .15s ease; }
#content.htmx-swapping { opacity: 0; }
#content.htmx-settling { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
#progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--gold); z-index: 50; transition: width .3s ease, opacity .3s; opacity: 0; }
#progress.on { opacity: 1; width: 70%; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Responsive tuning */
.filters-box > summary { list-style: none; }
.filters-box > summary::-webkit-details-marker { display: none; }
@media (min-width: 1024px) { .filters-box { border: 0 !important; background: transparent !important; } .filters-box > div { padding: 0 !important; } }
@media (max-width: 640px) {
  .sec:not(footer) { padding-top: 56px !important; padding-bottom: 56px !important; }
  footer.sec { padding-top: 56px !important; }
  .card { padding: 22px; }
  .btn { white-space: normal; text-align: center; }
  .num { font-size: 32px; }
}

/* Header is fixed: reserve its height so content starts below it */
@media (min-width: 640px) { body { padding-top: 96px; } }
@media (min-width: 900px) and (max-width: 1100px) { header .nav-a { font-size: 14px; } header .nav-cta { padding: 0 16px; font-size: 15px; } }

/* Mobile menu: links scroll if the screen is short, Join button stays pinned at the bottom */
header .menu-panel:not([hidden]) { display: flex; flex-direction: column; max-height: calc(100dvh - 72px); }
@media (min-width: 640px) { header .menu-panel:not([hidden]) { max-height: calc(100dvh - 96px); } }
header .menu-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
header .menu-cta { flex: none; padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 900px) { header .menu-panel, header .menu-panel:not([hidden]) { display: none; } }

/* Frosted cards: let the animated wireframe show through text cards on light sections */
.sec:not(.on-dark) .wrap :is(.card, .bg-white, .bg-paper):not(.btn):not(.chip):not(.field):not([style]) {
  background-color: rgba(255, 255, 255, .97) !important;
}
.sec:not(.on-dark) .wrap :is(.card, .bg-white, .bg-paper):not(.btn):not(.chip):not(.field):not([style]):is(a:hover) {
  background-color: rgba(255, 255, 255, .97) !important;
}
/* Sections that are plain white/paper: keep nested forms readable */
.sec .form-wrap .field { background: #fff; }

/* Extra wireframe layers, mirrored so the art tiles across tall sections */
.fx-flip { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.fx-flip-1 { transform: scaleX(-1); }
.fx-flip-2 { transform: scaleY(-1); }
.fx svg { opacity: .1 !important; }
.on-dark .fx svg { opacity: .1 !important; }
footer.on-dark .fx svg { opacity: .38 !important; }

body.admin { padding-top: 0 !important; }

/* Readability: calmer art behind hero text */
#content > section:first-child .fx svg { opacity: .32 !important; }

/* Rendered Markdown (public pages and admin preview) */
.md > * + * { margin-top: .8em; }
.md ul, .md ol { padding-left: 1.25em; }
.md ul { list-style: disc; }
.md ol { list-style: decimal; }
.md li + li { margin-top: .3em; }
.md a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.md h2, .md h3, .md h4 { font-family: var(--display); font-weight: 600; color: var(--ink); line-height: 1.2; letter-spacing: -.01em; }
.md h2 { font-size: 1.5em; } .md h3 { font-size: 1.25em; } .md h4 { font-size: 1.05em; }
.on-dark .md h2, .on-dark .md h3, .on-dark .md h4 { color: #fff; }
.md blockquote { border-left: 3px solid var(--gold); padding-left: 1em; color: var(--muted); }
.md code { background: rgba(20,24,26,.07); border-radius: 4px; padding: .1em .35em; font-size: .92em; }
.md pre { background: var(--ink); color: #fff; border-radius: 10px; padding: 1em; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md img { max-width: 100%; height: auto; border-radius: 10px; }
.md hr { border: 0; border-top: 1px solid var(--line); }
.md table { width: 100%; border-collapse: collapse; font-size: .95em; }
.md th, .md td { border: 1px solid var(--line); padding: .5em .75em; text-align: left; }

/* Admin Markdown editor tabs */
.md-tab { min-height: 32px; padding: 0 14px; border-radius: 6px; font-weight: 600; color: var(--muted); cursor: pointer; }
.md-tab-on { background: var(--ink); color: #fff; }
.md-editor textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
