/* INEGI page. Each project gets the layout that fits its shape. */

/* ---------- intro + register ---------- */
.intro { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: end; padding-block: clamp(56px, 9vw, 120px) clamp(48px, 7vw, 96px); }
.intro__where { font-family: var(--mono); font-size: 0.78rem; color: var(--blue-ink); font-variation-settings: "wdth" 90; margin-top: 12px; }
.intro__h { font-size: clamp(2.6rem, 1.8rem + 3.4vw, 5rem); }
.aerial { margin-top: 24px; max-width: 360px; }
.aerial img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: 45% 50%; border-radius: var(--radius); }
.intro__lede { margin-top: 20px; color: var(--ink-2); max-width: 62ch; font-size: 1.04rem; }
.intro__lede:first-of-type { margin-top: 28px; }

.register { border-top: 2px solid var(--ink); }
.register__title { font-weight: 600; font-size: 0.9rem; padding: 12px 0; border-bottom: 1px solid var(--line); }
.register ol { list-style: none; padding: 0; margin: 0; }
.register a {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name chip" "note chip";
  column-gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); text-decoration: none;
  transition: padding .3s var(--ease-out), background .3s var(--ease-out);
}
.register a > span:first-child { grid-area: name; font-weight: 700; font-variation-settings: "wdth" 112; }
.register__note { grid-area: note; color: var(--ink-3); font-size: 0.88rem; }
.register .chip { grid-area: chip; align-self: center; }
.register a:hover { padding-inline: 10px; background: var(--bg-2); }

@media (max-width: 900px) { .intro { grid-template-columns: 1fr; align-items: start; } }

/* ---------- scroll-spy rail ---------- */
.rail { position: fixed; left: 18px; top: 50%; transform: translateY(-50%); z-index: var(--z-sticky); display: flex; flex-direction: column; gap: 14px; opacity: 0; pointer-events: none; transition: opacity .4s var(--ease-out); }
.rail.is-on { opacity: 1; pointer-events: auto; }
.rail a { display: flex; align-items: center; gap: 10px; font-size: 0.72rem; color: var(--ink-3); text-decoration: none; font-family: var(--mono); font-variation-settings: "wdth" 85; }
.rail a::before { content: ""; width: 14px; height: 2px; background: currentColor; transition: width .35s var(--ease-out); }
.rail a { color: transparent; }
.rail a:not(.is-active)::before { background: var(--line); }
.rail:hover a { color: var(--ink-3); background: var(--bg); padding-right: 6px; }
.rail:hover a.is-active { color: var(--ink); }
.rail a.is-active::before { width: 28px; background: var(--blue); }
.rail.on-sea:hover a { color: var(--sea-ink); background: var(--sea); }
.rail.on-sea a:not(.is-active)::before { background: var(--sea-line); }
@media (max-width: 1360px) { .rail { display: none; } }

/* ---------- project shell ---------- */
.proj { padding-block: clamp(72px, 10vw, 140px); border-top: 1px solid var(--line); }
.proj__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 20px; }
.proj__h { font-size: var(--step-4); width: 100%; }
.proj__head--small .proj__h { font-size: var(--step-3); }
.proj__meta { color: var(--ink-2); font-size: 0.98rem; }
.proj__lede { margin-top: 28px; max-width: 68ch; font-size: clamp(1.08rem, 1rem + 0.35vw, 1.28rem); line-height: 1.55; }
.proj__lede-p { font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem); line-height: 1.55; max-width: 62ch; }

.did__h { font-size: 0.95rem; font-weight: 700; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); display: inline-block; }
.did__lead { margin-bottom: 12px; font-weight: 500; }
.did ul { list-style: none; display: grid; gap: 10px; }
.did li { position: relative; padding-left: 22px; color: var(--ink-2); }
.did li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 12px; height: 2px; background: var(--blue); }
.link { color: var(--blue-ink); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- AneurysmTool: interactive rig ---------- */
.rig { margin-top: clamp(40px, 6vw, 72px); display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.rig__stage { position: relative; border-radius: var(--radius); overflow: hidden; }
.rig__stage img { width: 100%; }
.hot {
  position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: var(--bg); color: var(--ink); font-family: var(--mono); font-size: 0.78rem; font-weight: 600;
  box-shadow: 0 0 0 2px var(--ink), 0 4px 14px oklch(0 0 0 / 0.25);
  transition: background .2s var(--ease-out), color .2s var(--ease-out), transform .3s var(--ease-out);
}
.hot::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--bg); opacity: 0; }
.hot:hover, .hot.is-active { background: var(--blue); color: #fff; box-shadow: 0 0 0 2px #fff, 0 4px 14px oklch(0 0 0 / 0.3); transform: translate(-50%, -50%) scale(1.12); }
.rig.is-live .hot:not(.is-active)::after { animation: ping 2.8s var(--ease-out) infinite; animation-delay: calc(var(--i, 0) * 0.35s); }
@keyframes ping { 0% { opacity: .9; transform: scale(.7); } 60%, 100% { opacity: 0; transform: scale(1.5); } }

.rig__legend { list-style: none; padding: 0; margin: 0; counter-reset: hot; display: grid; gap: 2px; }
.rig__legend li { counter-increment: hot; position: relative; padding: 11px 12px 11px 46px; border-radius: var(--radius); color: var(--ink-2); font-size: 0.93rem; line-height: 1.45; cursor: pointer; transition: background .25s var(--ease-out), color .25s var(--ease-out); }
.rig__legend li::before { content: counter(hot); position: absolute; left: 10px; top: 10px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 0.7rem; border: 1.5px solid var(--ink-3); color: var(--ink-2); }
.rig__legend b { color: var(--ink); font-weight: 700; }
.rig__legend li:hover { background: var(--bg-2); }
.rig__legend li.is-active { background: var(--blue-wash); color: var(--ink); }
.rig__legend li.is-active::before { background: var(--blue); border-color: var(--blue); color: #fff; }

.rig__cap { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.rig.markers-off .hot { opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(0.6); }
.rig .hot { transition: background .2s var(--ease-out), color .2s var(--ease-out), transform .3s var(--ease-out), opacity .3s var(--ease-out); }
@media (max-width: 900px) {
  .rig { grid-template-columns: 1fr; }
  .hot { width: 24px; height: 24px; font-size: 0.66rem; }
}

.aneu { margin-top: clamp(40px, 5vw, 64px); }
.aneu__mine { max-width: 75ch; color: var(--ink-2); }
.aneu__mine b { color: var(--ink); }
.aneu__grid { margin-top: 28px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
@media (max-width: 900px) { .aneu__grid { grid-template-columns: 1fr; } }
.aneu .carousel__slide { min-height: 100%; }
/* the results stay pinned while the page scrolls through the three states */
@media (min-width: 901px) {
  .pin { height: 165vh; }
  .pin__sticky { position: sticky; top: max(90px, calc(50vh - 280px)); }
}

/* validation read-out: set like an instrument printout, not a stat tile */
.readout { border-top: 2px solid var(--ink); padding: 14px 0 0; align-self: center; }
.readout__label { font-size: 0.9rem; color: var(--ink-2); }
.readout__rows { margin: 18px 0 0; display: grid; gap: 16px; }
.readout__rows div { display: grid; grid-template-columns: 1fr auto; row-gap: 6px; }
.readout__rows dt { color: var(--ink-2); font-size: 0.92rem; }
.readout__rows dd { margin: 0; font-family: var(--mono); font-size: 0.95rem; font-variation-settings: "wdth" 90; }
.readout__rows i { grid-column: 1 / -1; height: 6px; background: var(--bg-2); border-radius: 3px; position: relative; overflow: hidden; }
.readout__rows i::after { content: ""; position: absolute; inset: 0; width: var(--w); background: var(--ink); border-radius: 3px; transform-origin: left; }
.readout__rows div:first-child i::after { background: var(--blue); }
.readout__delta { margin-top: 18px; font-size: var(--step-2); font-weight: 800; font-variation-settings: "wdth" 115; }
.readout__delta .mono { font-size: 0.6em; color: var(--ink-3); margin-right: 6px; }

.papers { margin-top: clamp(40px, 5vw, 64px); max-width: 720px; }
.papers--stack { display: grid; gap: 16px; margin-top: 0; }

/* ---------- Marewind: sea band + scrollytelling ---------- */
.sea { background: var(--sea); color: var(--sea-ink); border-top: 0; }
.sea .proj__meta { color: var(--sea-ink-2); }
.sea .proj__lede { color: var(--sea-ink); }
.chip--sea { background: transparent; border-color: var(--sea-line); color: var(--sea-ink-2); }

.scrolly { margin-top: clamp(48px, 7vw, 96px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(32px, 6vw, 96px); }
.scrolly__media { order: 2; }
.scrolly__frame { position: sticky; top: calc(50vh - min(32vh, 300px)); height: min(64vh, 600px); }
.media { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; opacity: 0; visibility: hidden; transform: scale(0.98); filter: blur(6px); transition: opacity .6s var(--ease-out), transform .8s var(--ease-out), filter .6s var(--ease-out), visibility 0s .6s; }
.media.is-on { opacity: 1; visibility: visible; transform: none; filter: none; transition-delay: 0s; }
.media video, .media img { width: 100%; max-height: calc(100% - 64px); object-fit: cover; border-radius: var(--radius); }
.media img.media__tall { width: auto; max-width: 100%; align-self: center; object-fit: contain; }
.media .yt { width: 100%; }
.media .carousel { width: 100%; }
.media .carousel__track { align-items: center; }
.media .carousel__slide { align-self: center; }
.media .carousel img { max-height: 52vh; object-fit: contain; background: oklch(0.2 0.04 250); }
.carousel--sea figcaption { color: var(--sea-ink-2); }
.carousel--sea .carousel__btn { background: var(--sea-2); border-color: var(--sea-line); color: var(--sea-ink); }
.carousel--sea .carousel__dot { background: var(--sea-line); }
.carousel--sea .carousel__dot[aria-current="true"] { background: var(--sea-ink); }
.carousel--sea .carousel__count { color: var(--sea-ink-2); }
.media .yt img { max-height: none; height: 100%; border-radius: 0; }
.media__cap { margin-top: 12px; font-size: 0.85rem; color: var(--sea-ink-2); line-height: 1.45; }

.scrolly__steps { list-style: none; padding: 0; margin: 0; }
.step { min-height: 78vh; display: flex; flex-direction: column; justify-content: center; padding-block: 40px; opacity: .35; transition: opacity .5s var(--ease-out); }
.step:first-child { min-height: 64vh; justify-content: flex-start; padding-top: 12vh; }
.step:last-child { min-height: 70vh; }
.step.is-on { opacity: 1; }
.step__n { font-family: var(--mono); font-size: 0.74rem; color: oklch(0.78 0.09 250); font-variation-settings: "wdth" 90; margin-bottom: 14px; }
.step h3 { font-size: var(--step-2); font-variation-settings: "wdth" 110; margin-bottom: 16px; }
.step > p { color: var(--sea-ink-2); max-width: 54ch; }
.step__did { list-style: none; margin-top: 18px; display: grid; gap: 10px; }
.step__did li { position: relative; padding-left: 22px; color: var(--sea-ink); }
.step__did li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 12px; height: 2px; background: oklch(0.72 0.13 250); }
.step__credit { margin-top: 16px; font-size: 0.88rem; color: var(--sea-ink-2); }
.step__plain { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--sea-line); border-radius: var(--radius); color: var(--sea-ink); max-width: 54ch; }
.step__paper { margin-top: 22px; display: grid; gap: 6px; padding: 14px 16px; border-radius: var(--radius); background: var(--sea-2); text-decoration: none; font-weight: 600; max-width: 56ch; transition: background .25s var(--ease-out); }
.step__paper:hover { background: oklch(0.36 0.07 250); }
.step__paper .mono { font-weight: 400; color: var(--sea-ink-2); }
.step__media-inline { display: none; }

/* DAQ block diagram */
.daq { width: 100%; max-height: calc(100% - 64px); }
.daq text { fill: var(--sea-ink); font-family: var(--font); font-size: 12px; text-anchor: middle; }
.daq__box rect { fill: var(--sea-2); stroke: var(--sea-line); }
.daq__box--me rect { fill: oklch(0.45 0.13 255); stroke: oklch(0.7 0.13 255); }
.daq__wire { fill: none; stroke: oklch(0.72 0.13 250); stroke-width: 1.5; }
.daq__case { fill: none; stroke: var(--sea-ink-2); stroke-dasharray: 5 5; }
.daq__label { fill: var(--sea-ink-2) !important; font-size: 11px !important; text-anchor: end !important; }

@media (max-width: 900px) {
  .scrolly { grid-template-columns: 1fr; }
  .scrolly__media { order: 0; position: sticky; top: 60px; z-index: 1; background: var(--sea); padding-block: 12px; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .scrolly__frame { position: relative; top: 0; height: 34vh; }
  .media__cap { display: none; }
  .media video, .media img, .daq { max-height: 100%; }
  .step { min-height: auto; padding-block: 56px; opacity: 1; }
  .step:first-child { min-height: auto; padding-top: 32px; }
}

/* ---------- Mauser: architecture diagram ---------- */
.mauser { margin-top: clamp(40px, 6vw, 72px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.mauser .did { margin-top: 36px; }
.arch { position: sticky; top: 100px; }
.arch svg { width: 100%; overflow: visible; }
.arch text { font-family: var(--font); font-size: 13px; text-anchor: middle; fill: var(--ink-2); }
.arch text.b { font-weight: 700; fill: var(--ink); font-size: 15px; }
.arch__node circle, .arch__node rect { fill: var(--bg); stroke: var(--ink); stroke-width: 1.5; }
.arch__node--on rect { fill: var(--blue-wash); stroke: var(--blue); }
.arch__node--wake rect { transition: fill .4s var(--ease-out); }
.arch.is-awake .arch__node--wake rect { fill: oklch(0.95 0.05 155); stroke: var(--live); }
.arch__wire { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 5; }
.arch__pulses circle { fill: var(--blue); transform-box: fill-box; transform-origin: center; }
.arch__pulses circle.noise, .arch__key .k-noise { fill: var(--ink-3); }
.arch__key .k-ship { fill: var(--blue); }
.arch__key text { font-size: 11px !important; text-anchor: start !important; fill: var(--ink-3) !important; }
.arch__tag { font-family: var(--mono) !important; font-size: 11px !important; fill: var(--live) !important; }
.arch__spec { font-family: var(--mono) !important; font-size: 11px !important; fill: var(--ink-3) !important; }

.energy { margin-top: 36px; padding-top: 16px; border-top: 2px solid var(--ink); }
.energy__h { font-size: 0.9rem; color: var(--ink-2); margin-bottom: 16px; }
.energy__row { display: grid; grid-template-columns: 9.5rem 1fr; grid-template-areas: "lbl bar" "lbl val"; column-gap: 16px; row-gap: 4px; margin-bottom: 14px; align-items: center; }
.energy__row span { grid-area: lbl; font-size: 0.9rem; }
.energy__row i { grid-area: bar; height: 10px; border-radius: 5px; background: var(--bg-2); position: relative; overflow: hidden; }
.energy__row i::after { content: ""; position: absolute; inset: 0; width: var(--w); background: var(--ink-3); border-radius: 5px; transform-origin: left; }
.energy__row--me i::after { background: var(--blue); }
.energy__row b { grid-area: val; font-family: var(--mono); font-weight: 400; font-size: 0.74rem; color: var(--ink-2); font-variation-settings: "wdth" 90; }
.energy__row--me span { font-weight: 700; }
.energy__note { font-size: 0.9rem; color: var(--ink-2); }

.mauser__bottom { margin-top: clamp(56px, 7vw, 96px); display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }

@media (max-width: 900px) {
  .mauser, .mauser__bottom { grid-template-columns: 1fr; }
  .arch { position: static; }
}

/* ---------- PRR: full-bleed moment ---------- */
.bleed { margin-top: clamp(32px, 5vw, 56px); overflow: hidden; }
.bleed img { width: 100%; height: min(78vh, 760px); object-fit: cover; object-position: 50% 40%; }
.bleed figcaption { margin-top: 12px; }
.prr { margin-top: clamp(40px, 6vw, 72px); display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.prr__h { font-size: var(--step-2); font-variation-settings: "wdth" 112; margin-bottom: 18px; }
.prr__text > p { color: var(--ink-2); max-width: 62ch; }
.prr .did { margin-top: 32px; }
.prr__side { display: grid; gap: 20px; }
.prr__side img { border-radius: var(--radius); width: 100%; }
@media (max-width: 900px) { .prr { grid-template-columns: 1fr; } .bleed img { height: auto; aspect-ratio: 3 / 2; object-position: 50% 50%; } }

/* ---------- Other projects ---------- */
.tower { margin-top: clamp(40px, 6vw, 72px); display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 96px); align-items: start; padding: clamp(24px, 4vw, 48px); background: var(--bg-2); border-radius: 10px; }
.tower__fig { position: sticky; top: 90px; }
.tower__fig svg { width: 100%; max-height: 78vh; overflow: visible; }
.tower__h { font-size: var(--step-2); font-variation-settings: "wdth" 112; margin: 16px 0 14px; }
.tower__text > p { color: var(--ink-2); max-width: 60ch; }
.tower .did { margin-top: 28px; }
.tower__photo { margin-top: 28px; max-width: 280px; }
.tower__photo img { border-radius: var(--radius); }

.specs { margin: 24px 0 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.specs div { display: grid; grid-template-columns: 6.5rem 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.specs dt { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3); padding-top: 3px; font-variation-settings: "wdth" 90; }
.specs dd { margin: 0; font-size: 0.95rem; }

.tw__steel { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.tw__thin { stroke-width: 1; stroke: var(--ink-3); }
.tw__cable { fill: none; stroke: var(--blue); stroke-width: 1.5; stroke-dasharray: 3 4; }
.tw__dev rect, .tw__dev circle { fill: var(--blue); }
.tw__dev path { stroke: var(--blue); stroke-width: 2; fill: none; }
.tw__sat path:first-child { fill: var(--ink-3); }
.tw__sat path:last-child { stroke: var(--ink-3); stroke-width: 2; fill: none; }
.tw__signal { fill: none; stroke: var(--blue); stroke-width: 1; stroke-dasharray: 2 6; opacity: .55; }
.tw__arrow { fill: none; stroke: var(--live); stroke-width: 1.5; }
.tw__ground { stroke: var(--ink); stroke-width: 1.5; }
.tw__lead { stroke: var(--ink-3); stroke-width: 1; }
.tw__lbl { font-family: var(--mono); font-size: 10px; fill: var(--ink-2); text-anchor: middle; }
.tw__lbl--l { text-anchor: start; }
.tw__lbl--r { text-anchor: end; }
.tw__sway { transform-origin: 160px 500px; transform-box: view-box; }
@media (prefers-reduced-motion: no-preference) {
  .tower.is-live .tw__sway { animation: sway 5.5s ease-in-out infinite; }
  .tower.is-live .tw__signal { animation: dash 1.6s linear infinite; }
  .tower.is-live .tw__cable { animation: dash 1.2s linear infinite reverse; }
}
@keyframes sway { 0%, 100% { transform: rotate(-0.9deg); } 50% { transform: rotate(0.9deg); } }
@keyframes dash { to { stroke-dashoffset: -16; } }
@media (max-width: 900px) {
  .tower { grid-template-columns: 1fr; }
  .tower__fig { position: static; max-width: 300px; margin-inline: auto; }
}

.metro { margin-top: clamp(32px, 4vw, 48px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(24px, 4vw, 56px); align-items: center; }
.metro img { border-radius: var(--radius); width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.metro h3 { font-size: var(--step-2); font-variation-settings: "wdth" 112; margin-bottom: 12px; }
.metro p { color: var(--ink-2); max-width: 52ch; }
@media (max-width: 900px) { .metro { grid-template-columns: 1fr; } }

/* ---------- Developing now ---------- */
.now__grid { margin-top: clamp(32px, 4vw, 48px); display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: clamp(16px, 3vw, 32px); }
.now__item { padding: clamp(22px, 3vw, 32px); border: 1px dashed var(--ink-3); border-radius: 10px; }
.now__item h3 { font-size: var(--step-2); font-variation-settings: "wdth" 112; margin: 16px 0 10px; }
.now__item p { color: var(--ink-2); max-width: 52ch; }
