/*
Theme Name: ASEG Ingeniería
Theme URI: https://asegingenieria.cl
Author: ASEG Ingeniería
Description: Tema de bloques para el portafolio de Alex Seguel, proyectista civil-estructural. Concepto "Del plano a la obra": grilla de plano, cotas, niveles, cajetín y visor 3D interactivo. 100% editable con Gutenberg.
Version: 1.1.0
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: aseg
*/

:root {
	--aseg-negro: #111111;
	--aseg-grafito: #2B2B2B;
	--aseg-acero: #4B5059;
	--aseg-gris: #EDEDED;
	--aseg-ambar: #F2A900;
	--aseg-linea: #E2E2E2;
	--aseg-mono: 'JetBrains Mono', ui-monospace, monospace;
	--aseg-display: Montserrat, system-ui, sans-serif;
	--aseg-ease: cubic-bezier(.2, .7, .2, 1);
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { -webkit-font-smoothing: antialiased; }
.wp-site-blocks > * { margin-block-start: 0; }
.wp-site-blocks > main { margin-block-start: 0; }
::selection { background: var(--aseg-ambar); color: var(--aseg-negro); }
:focus-visible { outline: 2px solid var(--aseg-ambar); outline-offset: 3px; }

/* ---------- Fondos ---------- */
.aseg-dark,
.aseg-grafito {
	color: #fff;
	background-color: var(--aseg-negro);
	background-image:
		linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
	background-size: 48px 48px;
}
.aseg-grafito { background-color: var(--aseg-grafito); background-image: none; }
.aseg-plano {
	background-color: var(--aseg-gris);
	background-image:
		linear-gradient(rgba(17,17,17,.06) 1px, transparent 1px),
		linear-gradient(90deg, rgba(17,17,17,.06) 1px, transparent 1px);
	background-size: 32px 32px;
}
.aseg-dark a:not(.wp-block-button__link),
.aseg-grafito a:not(.wp-block-button__link) { color: #fff; }
.aseg-dark .is-style-outline > .wp-block-button__link,
.aseg-grafito .is-style-outline > .wp-block-button__link { color: #fff; border-color: #fff; }
.is-style-outline > .wp-block-button__link { background: transparent; border: 1.5px solid currentColor; color: var(--aseg-negro); }
.is-style-outline > .wp-block-button__link:hover { background: var(--aseg-ambar); border-color: var(--aseg-ambar); color: var(--aseg-negro); }

/* ---------- Secciones ---------- */
.aseg-section { padding-block: clamp(72px, 9vw, 128px); position: relative; }
.aseg-section--tight { padding-block: clamp(40px, 5vw, 64px); }
.aseg-kicker {
	font-family: var(--aseg-mono);
	font-size: 0.8125rem;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--aseg-acero);
	margin: 0;
	display: flex;
	align-items: center;
	gap: 12px;
}
.aseg-kicker::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.aseg-dark .aseg-kicker, .aseg-grafito .aseg-kicker { color: var(--aseg-ambar); }
.aseg-lead { font-size: clamp(1.0625rem, 1.4vw, 1.25rem); line-height: 1.65; max-width: 640px; }
.aseg-dark .aseg-lead, .aseg-grafito .aseg-lead { color: #D4D4D4; }
.aseg-muted { color: var(--aseg-acero); }
.aseg-dark .aseg-muted, .aseg-grafito .aseg-muted { color: #A3A3A3; }
.aseg-meta { font-family: var(--aseg-mono); font-size: 0.75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--aseg-acero); margin: 0; }
.aseg-dark .aseg-meta, .aseg-grafito .aseg-meta { color: #A3A3A3; }

/* Título con línea de cota debajo */
.aseg-cota-title { position: relative; padding-bottom: 22px; }
.aseg-cota-title::after {
	content: "";
	position: absolute; left: 0; bottom: 0;
	width: min(220px, 60%); height: 9px;
	border-left: 1px solid currentColor; border-right: 1px solid currentColor;
	background: linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat;
	opacity: .5;
}

/* ---------- Cabecera ---------- */
.aseg-header-wrap { position: sticky; top: 0; z-index: 50; }
.admin-bar .aseg-header-wrap { top: var(--wp-admin--admin-bar--height, 32px); }
@media (max-width: 600px) { .admin-bar .aseg-header-wrap { top: 0; } }
.aseg-main .wp-block-post-content > .alignfull { margin-block-start: 0; margin-block-end: 0; }
.aseg-header {
	background: rgba(17,17,17,.92);
	backdrop-filter: saturate(140%) blur(10px);
	-webkit-backdrop-filter: saturate(140%) blur(10px);
	color: #fff;
	border-bottom: 1px solid rgba(255,255,255,.08);
	transition: background .3s var(--aseg-ease);
}
.aseg-scrolled .aseg-header { background: rgba(17,17,17,.98); }
.aseg-header__row { padding-block: 14px; gap: 24px; }
.aseg-brand { display: flex; align-items: center; gap: 12px; }
.aseg-brand a { display: inline-flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.aseg-brand svg { width: 34px; height: 34px; flex: none; }
.aseg-brand__name { font-family: var(--aseg-display); font-weight: 700; font-size: 17px; letter-spacing: .2em; }
.aseg-brand__name small { font-weight: 500; font-size: 11px; letter-spacing: .32em; margin-left: 4px; }
.aseg-header .wp-block-navigation a { text-decoration: none; color: #fff; }
.aseg-header .wp-block-navigation-item__content { position: relative; padding-block: 6px; }
.aseg-header .wp-block-navigation-item__content::after {
	content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
	background: var(--aseg-ambar); transform: scaleX(0); transform-origin: left;
	transition: transform .35s var(--aseg-ease);
}
.aseg-header .wp-block-navigation-item__content:hover::after,
.aseg-header .current-menu-item > .wp-block-navigation-item__content::after { transform: scaleX(1); }
.aseg-header .wp-block-navigation__responsive-container.is-menu-open { background: var(--aseg-negro); color: #fff; }
.aseg-header .wp-block-navigation__responsive-container.is-menu-open a { font-family: var(--aseg-display); font-size: 1.5rem; font-weight: 700; }
.aseg-header .wp-block-button__link { padding: .7rem 1.25rem; }
@media (max-width: 600px) { .aseg-header .wp-block-buttons { display: none; } }

/* ---------- Portada (hero) ---------- */
.aseg-hero { min-height: min(92vh, 900px); display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.aseg-hero h1 { margin-block: 18px 22px; font-size: clamp(2.3rem, 4.3vw, 4.25rem); overflow-wrap: normal; word-break: normal; hyphens: manual; }
.aseg-hero--interior { min-height: 0; }
.aseg-hero--interior h1 { max-width: 20ch; }
.aseg-hero__cols { align-items: center !important; gap: clamp(24px, 4vw, 64px); }
.aseg-hero .aseg-visor { margin: 0; }
.aseg-hero__foot { font-family: var(--aseg-mono); font-size: .75rem; color: #8F8F8F; letter-spacing: .08em; text-transform: uppercase; margin-top: 28px; }

/* Cursor CAD (solo en zonas de plano) */
.aseg-cad { position: fixed; left: 0; top: 0; width: 0; height: 0; pointer-events: none; opacity: 0; transition: opacity .2s; z-index: 40; overflow: hidden; }
.aseg-cad.is-on { opacity: 1; }
.aseg-cad-on .aseg-dark:not(.aseg-footer), .aseg-cad-on .aseg-dark:not(.aseg-footer) *:not(a):not(button):not(.aseg-visor):not(.aseg-visor *),
.aseg-cad-on .aseg-plano, .aseg-cad-on .aseg-plano *:not(a):not(button),
.aseg-cad-on .aseg-ph, .aseg-cad-on .aseg-ph * { cursor: none; }
.aseg-cad__h, .aseg-cad__v { position: absolute; background: rgba(242,169,0,.4); }
.aseg-cad__h { left: 0; right: 0; top: 0; height: 1px; }
.aseg-cad__v { top: 0; bottom: 0; left: 0; width: 1px; }
.aseg-cad__box { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border: 1px solid var(--aseg-ambar); }
.aseg-cad__lbl { position: absolute; left: 0; top: 0; font-family: var(--aseg-mono); font-size: 11px; color: var(--aseg-ambar); white-space: pre; letter-spacing: .06em; background: rgba(17,17,17,.75); padding: 2px 6px; }
.aseg-plano ~ .aseg-cad .aseg-cad__lbl { color: var(--aseg-negro); }

/* ---------- Cifras con cota ---------- */
.aseg-stats { gap: 0 !important; border-top: 1px solid var(--aseg-linea); border-bottom: 1px solid var(--aseg-linea); }
.aseg-stat { padding: 36px 28px; border-left: 1px solid var(--aseg-linea); position: relative; }
.aseg-stat:first-child { border-left: 0; }
.aseg-stat__num { font-family: var(--aseg-display); font-weight: 800; font-size: clamp(2.75rem, 5vw, 4rem); line-height: 1; margin: 0 0 14px; letter-spacing: -.02em; }
.aseg-stat__label { margin: 0; color: var(--aseg-acero); font-size: .9375rem; max-width: 22ch; }
.aseg-stat::before {
	content: ""; position: absolute; left: 28px; top: 18px; height: 7px;
	width: 0; border-left: 1px solid var(--aseg-ambar); border-right: 1px solid var(--aseg-ambar);
	background: linear-gradient(var(--aseg-ambar), var(--aseg-ambar)) center / 100% 1px no-repeat;
	transition: width 1s var(--aseg-ease) .2s;
}
.aseg-stat.is-in::before, .aseg-stat:not(.aseg-r)::before { width: 56px; }

/* ---------- Tarjetas ---------- */
.aseg-cards { gap: 24px; }
.aseg-card {
	position: relative; border: 1px solid var(--aseg-linea); background: #fff;
	display: flex; flex-direction: column; gap: 0 !important;
	transition: transform .45s var(--aseg-ease), box-shadow .45s var(--aseg-ease), border-color .3s;
}
.aseg-card:hover { transform: translateY(-6px); box-shadow: 0 24px 48px -28px rgba(17,17,17,.45); border-color: var(--aseg-negro); }
.aseg-card__body { padding: 26px 26px 28px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.aseg-card__body > * { margin: 0 !important; }
.aseg-card h3 { font-size: 1.3rem; }
.aseg-card__link { margin-top: auto !important; padding-top: 8px; font-weight: 700; }
.aseg-card__link a { text-decoration: none; }
.aseg-card__link a::after { content: ""; position: absolute; inset: 0; }
.aseg-card__link a:focus-visible { outline: none; }
.aseg-card:focus-within { outline: 2px solid var(--aseg-ambar); outline-offset: 3px; }
.aseg-card--dark { background: var(--aseg-negro); border-color: #3A3A3A; color: #fff; }
.aseg-card--dark:hover { border-color: var(--aseg-ambar); }
.aseg-card--dark .aseg-card__link a { color: var(--aseg-ambar); }
.aseg-card--dark p:not(.aseg-meta):not(.aseg-card__link) { color: #D4D4D4; }

/* Marcador de imagen tipo plano */
.aseg-ph {
	position: relative; min-height: 220px; margin: 0 !important;
	display: flex; align-items: flex-end; padding: 16px !important;
	background-color: #1A1A1A;
	background-image:
		linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
		linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
	background-size: 24px 24px;
	border-bottom: 2px solid var(--aseg-ambar);
	overflow: hidden;
}
.aseg-ph::before { content: ""; position: absolute; inset: 12% 20% 14%; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 140'%3E%3Cg fill='none' stroke='%23F2A900' stroke-opacity='.45' stroke-width='1'%3E%3Cpath d='M100 10 L170 130 H30 Z'/%3E%3Cpath d='M100 62 L131 130 L100 112 L69 130 Z'/%3E%3Cpath d='M20 134 H180' stroke-dasharray='4 4'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat; }
.aseg-ph p { position: relative; z-index: 1; margin: 0; font-family: var(--aseg-mono); font-size: .75rem; color: #A3A3A3; letter-spacing: .06em; }
.aseg-ph--grande { min-height: clamp(260px, 42vw, 520px); }
.aseg-ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Ciclo ---------- */
.aseg-pasos { gap: 20px; }
.aseg-paso { background: #fff; padding: 32px !important; border-top: 3px solid var(--aseg-negro); }
.aseg-paso:last-child { border-top-color: var(--aseg-ambar); }
.aseg-paso > * { margin: 0 !important; }
.aseg-paso > * + * { margin-top: 12px !important; }
.aseg-paso .aseg-meta { font-size: .8125rem; }

/* ---------- Empresas ---------- */
.aseg-empresas { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 44px; font-family: var(--aseg-display); font-weight: 700; font-size: clamp(1.05rem, 1.8vw, 1.35rem); color: var(--aseg-acero); margin: 0; }
.aseg-empresas span { white-space: nowrap; transition: color .3s; }
.aseg-empresas span:hover { color: var(--aseg-negro); }

/* ---------- Trayectoria por niveles ---------- */
.aseg-niveles { position: relative; gap: 0 !important; }
.aseg-niveles::before { content: ""; position: absolute; left: 150px; top: 0; bottom: 0; width: 1px; background: var(--aseg-linea); }
.aseg-nivel {
	display: grid !important; grid-template-columns: 150px 1fr; column-gap: 40px;
	padding: 34px 0; border-bottom: 1px solid var(--aseg-linea); position: relative; margin: 0 !important;
}
.aseg-nivel > * { grid-column: 2; margin: 0 !important; }
.aseg-nivel > * + * { margin-top: 8px !important; }
.aseg-nivel > .aseg-nivel__cota { grid-column: 1; grid-row: 1 / span 4; margin: 0 !important; font-family: var(--aseg-mono); font-size: .8125rem; color: var(--aseg-acero); letter-spacing: .06em; padding-top: 4px; }
.aseg-nivel > .aseg-nivel__cota strong { display: block; font-family: var(--aseg-display); color: var(--aseg-negro); font-size: 1.6rem; letter-spacing: -.01em; margin-bottom: 4px; }
.aseg-nivel::after { content: ""; position: absolute; left: 146px; top: 42px; width: 9px; height: 9px; background: #fff; border: 2px solid var(--aseg-negro); transform: rotate(45deg); }
.aseg-nivel--actual::after { background: var(--aseg-ambar); border-color: var(--aseg-ambar); }
.aseg-nivel--actual { background: linear-gradient(90deg, transparent 150px, rgba(242,169,0,.08) 150px); }
.aseg-nivel h3 { font-size: 1.35rem; }
@media (max-width: 700px) {
	.aseg-niveles::before { left: 6px; }
	.aseg-nivel { grid-template-columns: 1fr; padding-left: 32px; }
	.aseg-nivel > *, .aseg-nivel > .aseg-nivel__cota { grid-column: 1; grid-row: auto; }
	.aseg-nivel::after { left: 2px; }
	.aseg-nivel--actual { background: rgba(242,169,0,.08); }
}

/* ---------- Cajetín (ficha de proyecto) ---------- */
.aseg-cajetin { border: 2px solid var(--aseg-negro); gap: 0 !important; background: #fff; }
.aseg-cajetin > * { padding: 16px 18px !important; border-right: 1px solid var(--aseg-negro); border-bottom: 1px solid var(--aseg-negro); margin: 0 !important; }
.aseg-cajetin > * > p { margin: 0; }
.aseg-cajetin .aseg-meta { font-size: .6875rem; margin-bottom: 6px; }
.aseg-cajetin__valor { font-weight: 600; font-size: .9375rem; }
.aseg-cajetin__firma { background: var(--aseg-negro); color: #fff; grid-column-end: -1; }
.aseg-cajetin__firma .aseg-meta { color: #A3A3A3; }

/* ---------- Herramientas (software) ---------- */
.aseg-tools { gap: 20px; }
.aseg-tool { border: 1px solid var(--aseg-linea); padding: 28px !important; background: #fff; }
.aseg-tool > * { margin: 0 !important; }
.aseg-tool > * + * { margin-top: 10px !important; }

/* ---------- Visor 3D ---------- */
.aseg-visor { position: relative; margin: 0; height: var(--aseg-visor-h, 520px); background: transparent; }
.aseg-visor__stage { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; cursor: grab; touch-action: pan-y; }
.aseg-visor__stage.is-dragging, .aseg-visor__stage:active { cursor: grabbing; }
.aseg-visor__stage canvas { display: block; width: 100% !important; height: 100% !important; }
.aseg-visor--modelo, .aseg-visor--embed { background: #1A1A1A; border: 1px solid #3A3A3A; }
.aseg-visor__hint { position: absolute; right: 12px; bottom: 10px; margin: 0; font-family: var(--aseg-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #A3A3A3; pointer-events: none; }
.aseg-visor__hint::before { content: "\21BB  "; color: var(--aseg-ambar); }
.aseg-visor__caption { position: absolute; left: 12px; bottom: 10px; font-family: var(--aseg-mono); font-size: 11px; color: #A3A3A3; letter-spacing: .06em; }
.aseg-visor-box { border: 1px solid #3A3A3A; }
@media (max-width: 781px) { .aseg-hero .aseg-visor { height: min(var(--aseg-visor-h, 520px), 360px); } }

/* Vista del bloque en el editor */
.aseg-visor-editor { display: flex; align-items: center; justify-content: center; background: #1A1A1A; color: #fff; border: 1px dashed #F2A900;
	background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 24px 24px; }
.aseg-visor-editor__inner { display: flex; flex-direction: column; gap: 8px; text-align: center; padding: 24px; max-width: 420px; }
.aseg-visor-editor__kicker { font-family: var(--aseg-mono); font-size: 12px; color: #F2A900; letter-spacing: .16em; }

/* ---------- Pie ---------- */
.aseg-footer { font-size: .9375rem; border-top: 1px solid rgba(255,255,255,.12); background-color: #0B0B0B !important; }
.aseg-footer a { text-decoration: none; }
.aseg-footer a:hover { color: var(--aseg-ambar) !important; }
.aseg-footer__bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 24px; font-size: .8125rem; color: #8F8F8F; }
.aseg-footer__cols { gap: 40px; }
.aseg-footer h4 { font-family: var(--aseg-mono); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: #8F8F8F; font-weight: 500; }

/* ---------- Aparición al hacer scroll ---------- */
.aseg-js .aseg-r { opacity: 0; transform: translateY(22px); transition: opacity .8s var(--aseg-ease) var(--aseg-delay, 0ms), transform .8s var(--aseg-ease) var(--aseg-delay, 0ms); }
.aseg-js .aseg-r.is-in { opacity: 1; transform: none; }
.aseg-js .aseg-card.aseg-r.is-in:hover { transform: translateY(-6px); }

/* ---------- Pantalla de carga ---------- */
#aseg-loader { display: none; }
.aseg-loading #aseg-loader {
	display: flex; position: fixed; inset: 0; z-index: 9999; background: var(--aseg-negro);
	flex-direction: column; align-items: center; justify-content: center; gap: 18px;
	transition: opacity .6s var(--aseg-ease), visibility .6s;
}
.aseg-loaded #aseg-loader { opacity: 0; visibility: hidden; }
#aseg-loader polygon, #aseg-loader line { fill: transparent; stroke: #fff; stroke-width: 1.6; stroke-dasharray: 400; stroke-dashoffset: 400; animation: aseg-draw 1s var(--aseg-ease) forwards, aseg-fill .4s ease .95s forwards; }
#aseg-loader .aseg-loader__b { animation-delay: .25s, 1.05s; }
#aseg-loader line { stroke: var(--aseg-ambar); stroke-width: 3; animation: aseg-draw .8s var(--aseg-ease) .45s forwards; }
.aseg-loader__txt { font-family: var(--aseg-mono); font-size: 12px; letter-spacing: .3em; color: #A3A3A3; opacity: 0; animation: aseg-fade .5s ease .7s forwards; }
@keyframes aseg-draw { to { stroke-dashoffset: 0; } }
@keyframes aseg-fill { to { fill: #fff; } }
@keyframes aseg-fade { to { opacity: 1; } }

/* ---------- Varios ---------- */
.aseg-cta h2 { max-width: 18ch; }
.aseg-list-check { list-style: none; padding-left: 0; }
.aseg-list-check li { padding-left: 26px; position: relative; margin-bottom: 8px; }
.aseg-list-check li::before { content: ""; position: absolute; left: 0; top: .6em; width: 12px; height: 1px; background: var(--aseg-ambar); box-shadow: 0 -4px 0 0 transparent; }
.aseg-list-check li::after { content: ""; position: absolute; left: 10px; top: calc(.6em - 3px); width: 1px; height: 7px; background: var(--aseg-ambar); }
.aseg-nav-proyecto { border-top: 1px solid var(--aseg-linea); }

@media (max-width: 781px) {
	.aseg-stat { border-left: 0; border-top: 1px solid var(--aseg-linea); }
	.aseg-stat:first-child { border-top: 0; }
}
