/* =========================================================
   SERA — Base styles & components
   ========================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 var(--sp-4); }
h1, h2, h3, h4 { margin: 0 0 var(--sp-4); line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); }
ul { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Latin brand text inside RTL flow */
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

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

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -100px;
  z-index: 1000;
  padding: .6rem 1rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.skip-link:focus { top: 1rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}

/* ---------------- Logo ---------------- */
.logo { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); }
.logo svg { height: 26px; width: auto; }
.logo .logo-accent { color: var(--purple-500); }
.logo-mark { width: 34px; height: 34px; flex: none; }

/* ---------------- Header / Nav ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.nav-list {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  list-style: none;
}
.nav-list a {
  display: block;
  padding: .45rem .85rem;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
  transition: color .2s, background-color .2s;
}
.nav-list a:hover { color: var(--text); background: var(--surface-2); }
.nav-list a[aria-current="page"] { color: var(--text); background: var(--accent-soft); }

.header-actions { display: flex; align-items: center; gap: var(--sp-2); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

/* Theme toggle: show moon in light mode, sun in dark mode */
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.nav-toggle { display: none; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 48px;
  padding: .7rem 1.4rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: var(--fs-sm);
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, transform .2s var(--ease), box-shadow .2s;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--btn-bg); color: var(--btn-text); box-shadow: 0 6px 22px var(--accent-glow); }
.btn-primary:hover { background: var(--btn-bg-hover); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-whatsapp { background: #128c4b; color: #fff; }
.btn-whatsapp:hover { background: #0e7a40; }
.btn-sm { min-height: 40px; padding: .5rem 1rem; }
.btn[disabled],
.btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

/* ---------------- Sections ---------------- */
.section { padding-block: var(--sp-9); }
.section-alt { background: var(--bg-elevated); border-block: 1px solid var(--border); }
.section-head { max-width: 680px; margin-bottom: var(--sp-7); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head p { color: var(--text-muted); font-size: var(--fs-md); }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: var(--sp-3);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .02em;
}
.eyebrow::before {
  content: "";
  width: 18px; height: 2px;
  background: currentColor;
  border-radius: 2px;
}
.section-foot { margin-top: var(--sp-6); display: flex; justify-content: center; }

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  padding-block: var(--sp-9) var(--sp-8);
  overflow: hidden;
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 720px;
  background:
    radial-gradient(closest-side at 70% 40%, var(--accent-glow), transparent 70%),
    radial-gradient(closest-side at 20% 30%, var(--accent-soft), transparent 70%);
  z-index: -1;
  pointer-events: none;
}
.hero-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
  opacity: .5;
}
.hero-content { max-width: 820px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .9rem;
  margin-bottom: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.hero-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--purple-500); box-shadow: 0 0 0 4px var(--accent-soft); }
.hero h1 { margin-bottom: var(--sp-5); }
.hero h1 .accent { color: var(--accent); }
.hero-lead { font-size: var(--fs-lg); color: var(--text-muted); max-width: 640px; margin-bottom: var(--sp-6); }
.hero-pillars {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  margin-top: var(--sp-7);
  list-style: none;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.hero-pillars li { display: inline-flex; align-items: center; gap: .5rem; }
.hero-pillars svg { width: 18px; height: 18px; color: var(--accent); }

/* Inner page hero */
.page-hero {
  position: relative;
  padding-block: var(--sp-8) var(--sp-7);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  isolation: isolate;
}
.page-hero::before {
  content: "";
  position: absolute;
  inset: -60% -20% auto 30%;
  height: 520px;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  z-index: -1;
}
.page-hero h1 { font-size: var(--fs-2xl); margin-bottom: var(--sp-3); }
.page-hero p { color: var(--text-muted); max-width: 640px; margin: 0; font-size: var(--fs-lg); }

/* ---------------- Cards & grids ---------------- */
.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color .25s, transform .25s var(--ease), box-shadow .25s;
}
.card:hover { border-color: var(--border-strong); }
a.card:hover, .card.is-link:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card h3 { margin-bottom: var(--sp-2); }
.card p { color: var(--text-muted); font-size: var(--fs-sm); }
.card .card-link {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--accent);
}
.card .card-link svg { width: 16px; height: 16px; transition: transform .2s; }
.card:hover .card-link svg { transform: translateX(-4px); }

.icon-tile {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: var(--sp-5);
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border);
}
.icon-tile svg { width: 26px; height: 26px; }

/* Steps (how we work) */
.steps { counter-reset: step; list-style: none; }
.step { padding: var(--sp-5); }
.step-num {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  margin-bottom: var(--sp-4);
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  font-weight: 700;
  color: var(--accent);
  background: var(--bg);
}

/* ---------------- Badges ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .2rem .7rem;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-dev { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.badge-demo { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.badge-live { color: var(--success); background: var(--success-soft); border-color: transparent; }
.badge-plain::before { display: none; }

.tag-list { display: flex; flex-wrap: wrap; gap: var(--sp-2); list-style: none; margin-top: var(--sp-3); }
.tag {
  padding: .15rem .6rem;
  border-radius: 6px;
  font-size: var(--fs-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  direction: ltr;
}

.check-list { list-style: none; display: grid; gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-5); }
.check-list li { display: flex; gap: .6rem; align-items: flex-start; font-size: var(--fs-sm); }
.check-list li::before {
  content: "";
  flex: none;
  width: 18px; height: 18px;
  margin-top: .3rem;
  border-radius: 50%;
  background: var(--accent-soft) center / 12px no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

/* ---------------- Service detail blocks ---------------- */
.service-block {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--sp-7);
  padding: var(--sp-7);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.service-block + .service-block { margin-top: var(--sp-5); }
.service-block h2 { font-size: var(--fs-xl); margin-bottom: var(--sp-3); }
.service-block .lead { color: var(--text-muted); }
.service-block h3 { font-size: var(--fs-md); margin: var(--sp-5) 0 var(--sp-2); }
.service-block h3:first-child { margin-top: 0; }
.service-meta { padding: var(--sp-5); border-radius: var(--radius); background: var(--bg-elevated); border: 1px solid var(--border); }
.service-meta p { color: var(--text-muted); font-size: var(--fs-sm); }

/* ---------------- Products / Portfolio cards ---------------- */
.item-card { padding: 0; overflow: hidden; }
.item-media {
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.item-media img { width: 100%; height: 100%; object-fit: cover; }
.item-body { padding: var(--sp-5) var(--sp-6) var(--sp-6); display: flex; flex-direction: column; flex: 1; }
.item-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.item-head h3 { margin: 0; }
.item-type { font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: var(--sp-3); }
.item-body dl { margin: var(--sp-2) 0 0; }
.item-body dt { font-size: var(--fs-xs); font-weight: 700; color: var(--text); margin-top: var(--sp-3); }
.item-body dd { margin: .2rem 0 0; font-size: var(--fs-sm); color: var(--text-muted); }
.item-actions { margin-top: auto; padding-top: var(--sp-5); }

.empty-state {
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
}
.empty-state .icon-tile { margin-inline: auto; }
.empty-state p { color: var(--text-muted); max-width: 520px; margin-inline: auto; }

/* ---------------- About ---------------- */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-7);
  align-items: start;
}
.prose { max-width: 720px; }
.prose p, .prose li { color: var(--text-muted); }
.prose h2 { font-size: var(--fs-xl); margin-top: var(--sp-7); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: var(--sp-5); }
.prose ul { padding-inline-start: 1.25rem; margin-bottom: var(--sp-4); }
.prose li { margin-bottom: var(--sp-2); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose strong { color: var(--text); }
.legal-meta { font-size: var(--fs-sm); color: var(--text-muted); }

.quote-card {
  padding: var(--sp-6);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--accent-soft), transparent 70%), var(--surface);
  border: 1px solid var(--border);
}
.quote-card h3 { color: var(--accent); font-size: var(--fs-sm); margin-bottom: var(--sp-2); }
.quote-card p { font-size: var(--fs-lg); color: var(--text); margin: 0; }
.quote-card + .quote-card { margin-top: var(--sp-4); }

.notice {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.notice svg { width: 20px; height: 20px; flex: none; margin-top: .25rem; color: var(--accent); }

/* ---------------- CTA ---------------- */
.cta {
  position: relative;
  overflow: hidden;
  padding: var(--sp-8) var(--sp-7);
  border-radius: 28px;
  background: #0b0b12;
  color: #f4f4f7;
  border: 1px solid #2a2440;
  isolation: isolate;
}
.cta::before {
  content: "";
  position: absolute;
  inset: auto -10% -60% 30%;
  height: 420px;
  background: radial-gradient(closest-side, rgba(124, 58, 237, .55), transparent 70%);
  z-index: -1;
}
.cta h2 { color: #fff; max-width: 620px; }
.cta p { color: #b9b7cc; max-width: 560px; margin-bottom: var(--sp-6); }
.cta .btn-ghost { color: #fff; border-color: #4a4566; }
.cta .btn-ghost:hover { background: rgba(255, 255, 255, .06); }

/* ---------------- Contact ---------------- */
.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: var(--sp-6);
  align-items: start;
}
.form-card { padding: var(--sp-7); }
.form-grid { display: grid; gap: var(--sp-5); }
.field { display: grid; gap: var(--sp-2); }
.field label { font-weight: 500; font-size: var(--fs-sm); }
.field .req { color: var(--danger); margin-inline-start: .2rem; }
.field .hint { font-size: var(--fs-xs); color: var(--text-muted); }
.input {
  width: 100%;
  min-height: 50px;
  padding: .75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.input::placeholder { color: var(--text-muted); opacity: .75; }
.input:focus { outline: none; border-color: var(--purple-500); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea.input { min-height: 150px; resize: vertical; line-height: 1.7; }
select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-start: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 1rem center;
  background-size: 16px;
}
.field.has-error .input { border-color: var(--danger); }
.field-error { font-size: var(--fs-xs); color: var(--danger); min-height: 1em; }
.field-error:empty { display: none; }
.hp-field { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-status {
  display: none;
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.form-status.is-visible { display: block; }
.form-status.is-success { background: var(--success-soft); color: var(--success); border: 1px solid currentColor; }
.form-status.is-error { background: var(--danger-soft); color: var(--danger); border: 1px solid currentColor; }
.form-status.is-info { background: var(--warning-soft); color: var(--warning); border: 1px solid currentColor; }
.form-consent { font-size: var(--fs-xs); color: var(--text-muted); margin: 0; }
.form-consent a { color: var(--accent); text-decoration: underline; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: none;
}
.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.contact-side { display: grid; gap: var(--sp-4); }
.contact-side .card { padding: var(--sp-5); }
.whatsapp-unavailable { font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------------- Footer ---------------- */
.site-footer {
  margin-top: var(--sp-9);
  padding-block: var(--sp-8) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: var(--fs-sm);
}
.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: var(--sp-6);
}
.footer-brand p { color: var(--text-muted); margin-top: var(--sp-4); max-width: 320px; }
.footer-col h2 { font-size: var(--fs-sm); margin-bottom: var(--sp-3); }
.footer-col ul { list-style: none; display: grid; gap: var(--sp-2); }
.footer-col a { color: var(--text-muted); transition: color .2s; }
.footer-col a:hover { color: var(--accent); }
.footer-col .muted { color: var(--text-muted); opacity: .7; }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-7);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

/* ---------------- 404 ---------------- */
.not-found { text-align: center; padding-block: var(--sp-9); }
.not-found .code { font-size: clamp(4rem, 12vw, 8rem); font-weight: 700; line-height: 1; color: var(--accent); direction: ltr; }

/* ---------------- Reveal (progressive enhancement) ---------------- */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
}
