:root {
    --ink: #0F1B2D;
    --ink-2: #16233A;
    --ink-3: #1E2E48;
    --paper: #EDEFF3;
    --paper-dim: #A9B3C7;
    --line: #2C3C58;
    --amber: #E8A33D;
    --green: #5FB88A;
    --coral: #D9645A;
    --gitlab: #e96900;
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

::selection {
    background: var(--amber);
    color: var(--ink);
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.01em;
}

p {
    margin: 0 0 1em 0;
    color: var(--paper-dim);
    max-width: 62ch;
}

code,
.mono {
    font-family: var(--font-mono);
}

button {
    font-family: var(--font-body);
}

/* ---------- link style ---------- */
.doc-link {
    color: var(--amber);
    text-decoration: underline;
    text-decoration-color: rgba(232, 163, 61, .4);
    text-underline-offset: 3px;
    font-family: var(--font-mono);
    font-size: .92em;
    transition: text-decoration-color .2s ease;
}

.doc-link:hover {
    text-decoration-color: var(--amber);
}

/* ---------- fake gitlab-style button ---------- */
.gl-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--gitlab);
    color: #fff;
    padding: .42rem 1rem;
    border-radius: 4px;
    font-size: .82rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .25) inset;
    cursor: default;
    user-select: none;
    vertical-align: middle;
}

.gl-btn .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .7);
}

/* ---------- mock checkbox ---------- */
.mock-checkbox {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    font-size: .85rem;
    color: var(--paper);
    margin-top: .6rem;
    padding: .55rem .8rem;
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: 5px;
}

.mock-checkbox .box {
    width: 1rem;
    height: 1rem;
    border-radius: 3px;
    background: var(--gitlab);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
    color: #fff;
    flex-shrink: 0;
}

/* ---------- app shell ---------- */
.app {
    display: flex;
    height: 100vh;
}

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--amber);
    z-index: 50;
    transition: width .5s ease;
    width: 0%;
}

.rail-nav {
    width: 230px;
    flex-shrink: 0;
    height: 100vh;
    padding: 2.2rem 1.4rem;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
}

.rail-nav .brand {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 2.2rem;
    line-height: 1.3;
}

.rail-nav .brand span {
    color: var(--amber);
}

.rail-track {
    position: relative;
    flex: 1;
    padding-left: 1.4rem;
}

.rail-track::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--line);
}

.rail-item {
    position: relative;
    display: block;
    width: 100%;
    text-align: left;
    padding: .6rem 0;
    font-size: .86rem;
    color: var(--paper-dim);
    background: none;
    border: none;
    transition: color .25s ease;
}

.rail-item::before {
    content: '';
    position: absolute;
    left: -1.4rem;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--ink);
    border: 2px solid var(--line);
    transition: all .3s ease;
}

.rail-item.active {
    color: var(--paper);
    font-weight: 600;
}

.rail-item.active::before {
    border-color: var(--amber);
    background: var(--amber);
    box-shadow: 0 0 0 4px rgba(232, 163, 61, .18);
}

.rail-item:hover {
    color: var(--paper);
}

.rail-item[disabled] {
    opacity: .35;
    cursor: not-allowed;
}

.main {
    flex: 1;
    min-width: 0;
    height: 100vh;
    position: relative;
}

.panel {
    display: none;
    height: 100%;
    flex-direction: column;
}

.panel.active {
    display: flex;
}

.panel-inner {
    flex: 1;
    overflow-y: auto;
    padding: 5.5rem 6vw 3rem 6vw;
}

.hero-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 7vw;
    max-width: 900px;
}

.eyebrow-plain {
    font-size: .8rem;
    color: var(--amber);
    font-family: var(--font-mono);
    margin-bottom: 1rem;
}

.hero-inner h1 {
    font-size: clamp(2rem, 4.2vw, 3.4rem);
    max-width: 16ch;
    margin-bottom: 1.1rem;
}

.hero-inner .lede {
    font-size: 1.1rem;
    max-width: 56ch;
    color: var(--paper-dim);
}

.begin-btn {
    margin-top: 2.4rem;
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    background: var(--amber);
    color: var(--ink);
    border: none;
    padding: .9rem 1.7rem;
    border-radius: 999px;
    font-size: .96rem;
    font-weight: 600;
    width: fit-content;
    box-shadow: 0 10px 26px -10px rgba(232, 163, 61, .55);
    transition: transform .25s ease, box-shadow .25s ease;
}

.begin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px -12px rgba(232, 163, 61, .7);
}

.begin-btn svg {
    transition: transform .3s ease;
}

.begin-btn:hover svg {
    transform: translateX(4px);
}

.part-head {
    margin-bottom: 2.8rem;
    max-width: 900px;
}

.part-num {
    font-family: var(--font-mono);
    color: var(--amber);
    font-size: .85rem;
    margin-bottom: .6rem;
    display: block;
}

.part-head h2 {
    font-size: clamp(1.55rem, 2.8vw, 2.2rem);
    margin-bottom: .8rem;
    max-width: 22ch;
}

.part-head p {
    font-size: 1.02rem;
}

.subflow {
    margin-top: 3.2rem;
    padding-top: 2.4rem;
    border-top: 1px dashed var(--line);
    max-width: 900px;
}

.subflow:first-of-type {
    border-top: none;
    padding-top: 0;
}

.subflow h3 {
    font-size: 1.2rem;
    margin-bottom: .4rem;
    color: var(--paper);
}

.subflow .sub-desc {
    font-size: .96rem;
    margin-bottom: 1.4rem;
}

.local-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-family: var(--font-mono);
    font-size: .74rem;
    color: var(--green);
    border: 1px solid rgba(95, 184, 138, .4);
    background: rgba(95, 184, 138, .08);
    padding: .25rem .6rem;
    border-radius: 999px;
    margin-bottom: .9rem;
}

/* reveal-on-scroll */
.reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .55s ease, transform .55s ease;
}

.reveal.in {
    opacity: 1;
    transform: none;
}

/* ---------- step list ---------- */
.steps {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 1.1rem;
    max-width: 900px;
}

.step {
    position: relative;
    padding: 1.2rem 0 1.2rem 3rem;
    border-left: 2px solid var(--line);
    margin-left: .6rem;
}

.step:last-child {
    border-color: transparent;
}

.step::before {
    content: attr(data-n);
    position: absolute;
    left: -1.05rem;
    top: 1.1rem;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    background: var(--ink-2);
    border: 2px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: .85rem;
    color: var(--paper-dim);
    transition: all .4s ease;
}

.step.in::before {
    border-color: var(--amber);
    color: var(--amber);
    background: var(--ink-3);
}

.step h4 {
    font-size: 1rem;
    margin-bottom: .35rem;
    color: var(--paper);
}

.step p {
    font-size: .94rem;
    margin-bottom: .4rem;
}

/* ---------- notes (importante / regla de oro / tip) ---------- */
.note {
    border-radius: 6px;
    padding: .85rem 1rem;
    margin-top: .7rem;
    border: 1px solid;
    max-width: 640px;
}

.note.danger {
    border-color: rgba(217, 100, 90, .4);
    background: rgba(217, 100, 90, .08);
}

.note.warning {
    border-color: rgba(232, 163, 61, .4);
    background: rgba(232, 163, 61, .08);
}

.note.tip {
    border-color: rgba(95, 184, 138, .4);
    background: rgba(95, 184, 138, .08);
}

.note-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .35rem;
    font-family: var(--font-mono);
    font-size: .76rem;
    font-weight: 600;
}

.note.danger .note-head {
    color: var(--coral);
}

.note.warning .note-head {
    color: var(--amber);
}

.note.tip .note-head {
    color: var(--green);
}

.note-icon {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    border: 1px solid currentColor;
    flex-shrink: 0;
}

.note-body {
    margin: 0;
    font-size: .87rem;
    color: var(--paper);
}

/* ---------- terminal ---------- */
.terminal {
    background: #0A1220;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin: 1rem 0;
    overflow: hidden;
    box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .6);
    max-width: 640px;
}

.terminal .bar {
    display: flex;
    gap: .4rem;
    padding: .6rem .8rem;
    background: var(--ink-2);
    border-bottom: 1px solid var(--line);
}

.terminal .dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #3a4a68;
}

.terminal .body {
    padding: 1rem 1.1rem;
    font-family: var(--font-mono);
    font-size: .86rem;
    min-height: 2.4em;
}

.terminal .line {
    display: flex;
    gap: .5rem;
    color: #D6DCE8;
    min-height: 1.5em;
    margin-bottom: .15rem;
}

.terminal .prompt {
    color: var(--green);
    flex-shrink: 0;
}

.terminal .txt::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 1.1em;
    background: var(--amber);
    margin-left: 2px;
    vertical-align: -2px;
    animation: blink 1s steps(1) infinite;
}

.terminal .line.done .txt::after {
    display: none;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* ---------- tables ---------- */
.tbl-wrap {
    margin: 1rem 0 1.5rem 0;
    overflow-x: auto;
    max-width: 900px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
    min-width: 420px;
}

th,
td {
    text-align: left;
    padding: .7rem .9rem;
    border-bottom: 1px solid var(--line);
}

th {
    font-family: var(--font-mono);
    font-size: .76rem;
    color: var(--amber);
    font-weight: 600;
}

td {
    color: var(--paper-dim);
}

td code,
td .mono {
    color: var(--paper);
}

tr:last-child td {
    border-bottom: none;
}

/* ---------- checklist ---------- */
.checklist {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    margin: 1.1rem 0;
    max-width: 640px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    font-size: .92rem;
    color: var(--paper-dim);
    opacity: 0;
    transform: translateX(-8px);
    transition: all .4s ease;
}

.check-item.in {
    opacity: 1;
    transform: none;
}

.check-item .box {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 3px;
    border: 2px solid var(--line);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .35s ease;
}

.check-item.checked .box {
    background: var(--green);
    border-color: var(--green);
}

.check-item.checked .box::after {
    content: '✓';
    font-size: .72rem;
    color: var(--ink);
    font-weight: 700;
}

.check-item.checked {
    color: var(--paper);
}

.check-item.static {
    opacity: 1;
    transform: none;
}

/* ---------- key visual (SSH) ---------- */
.key-pair {
    display: flex;
    gap: 1.1rem;
    margin: 1.4rem 0;
    flex-wrap: wrap;
    max-width: 640px;
}

.key-card {
    flex: 1;
    min-width: 210px;
    padding: 1.1rem 1.2rem;
    border-radius: 6px;
    background: var(--ink-2);
    border: 1px solid var(--line);
}

.key-card.priv {
    border-color: rgba(217, 100, 90, .4);
}

.key-card.pub {
    border-color: rgba(95, 184, 138, .4);
}

.key-card .kicker {
    font-family: var(--font-mono);
    font-size: .76rem;
    margin-bottom: .5rem;
}

.key-card.priv .kicker {
    color: var(--coral);
}

.key-card.pub .kicker {
    color: var(--green);
}

.key-card .file {
    font-family: var(--font-mono);
    font-size: .9rem;
    color: var(--paper);
    margin-bottom: .4rem;
}

.key-card .desc {
    font-size: .83rem;
    color: var(--paper-dim);
    margin: 0;
}

/* ---------- 2FA visual ---------- */
.tfa-visual {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin: 1.4rem 0;
    flex-wrap: wrap;
}

.qr-box {
    width: 110px;
    height: 110px;
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--ink-2);
    border: 1px solid var(--line);
    position: relative;
    overflow: hidden;
}

.qr-box svg {
    width: 100%;
    height: 100%;
}

.qr-scan-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--amber);
    top: 0;
    box-shadow: 0 0 8px var(--amber);
    opacity: 0;
}

.tfa-visual.in .qr-scan-line {
    animation: scan 1.8s ease-in-out infinite;
    opacity: 1;
}

@keyframes scan {
    0% {
        top: 2%;
    }

    50% {
        top: 94%;
    }

    100% {
        top: 2%;
    }
}

.code-display {
    display: flex;
    gap: .4rem;
}

.code-digit {
    width: 1.9rem;
    height: 2.4rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 1.05rem;
    background: var(--ink-2);
    color: var(--paper-dim);
    transition: all .4s ease;
}

.code-digit.on {
    color: var(--green);
    border-color: var(--green);
}

/* ---------- diagrams ---------- */
.diagram {
    margin: 1.6rem 0;
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.3rem;
    max-width: 900px;
}

.diagram svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

.dline {
    fill: none;
    stroke-linecap: round;
    animation: drawline 1.3s ease forwards;
}

@keyframes drawline {
    from {
        stroke-dashoffset: var(--len, 500);
    }

    to {
        stroke-dashoffset: 0;
    }
}

.dnode {
    opacity: 0;
    transform: scale(.3);
    transform-origin: center;
    animation: popnode .45s ease forwards;
}

@keyframes popnode {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.dlabel {
    font-family: var(--font-mono);
    font-size: 11px;
    fill: var(--paper-dim);
    opacity: 0;
    animation: fadein .5s ease forwards;
}

@keyframes fadein {
    to {
        opacity: 1;
    }
}

.dbox {
    opacity: 0;
    animation: fadein .6s ease forwards;
}

.dbox-title {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    fill: var(--paper);
}

/* ---------- best practices ---------- */
.practices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .85rem;
    margin-top: 1.5rem;
    max-width: 900px;
}

.practice {
    display: flex;
    gap: .7rem;
    padding: .95rem 1.05rem;
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: .89rem;
    color: var(--paper-dim);
    opacity: 0;
    transform: translateY(10px);
    transition: all .5s ease;
}

.practice.in {
    opacity: 1;
    transform: none;
}

.practice .num {
    font-family: var(--font-mono);
    color: var(--amber);
    flex-shrink: 0;
    font-size: .83rem;
}

/* ---------- file cards (archivos esenciales del repositorio) ---------- */
.file-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .9rem;
    margin-top: 1.6rem;
    max-width: 900px;
}

.file-card {
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 1.15rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all .5s ease;
}

.file-card.in {
    opacity: 1;
    transform: none;
}

.file-card .fhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    flex-wrap: wrap;
}

.file-card .fname {
    font-family: var(--font-mono);
    color: var(--paper);
    font-size: .98rem;
}

.file-tag {
    font-family: var(--font-mono);
    font-size: .66rem;
    padding: .18rem .55rem;
    border-radius: 999px;
    border: 1px solid;
    white-space: nowrap;
}

.file-tag.oblig {
    color: var(--amber);
    border-color: rgba(232, 163, 61, .5);
}

.file-tag.reco {
    color: var(--green);
    border-color: rgba(95, 184, 138, .5);
}

.file-tag.opc {
    color: var(--paper-dim);
    border-color: var(--line);
}

.file-card .fdesc {
    font-size: .87rem;
    color: var(--paper-dim);
    margin: 0;
}

.file-card .frule {
    font-size: .83rem;
    color: var(--paper);
    margin: 0;
    padding-top: .4rem;
    border-top: 1px dashed var(--line);
}

.file-card .frule b {
    color: var(--amber);
    font-weight: 600;
}

/* ---------- section end / continue ---------- */
.section-end {
    max-width: 900px;
    margin-top: 3.4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.section-end .end-label {
    font-family: var(--font-mono);
    font-size: .78rem;
    color: var(--paper-dim);
}

.continue-btn {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    background: transparent;
    color: var(--paper);
    border: 1px solid var(--paper-dim);
    padding: .75rem 1.4rem;
    border-radius: 999px;
    font-size: .9rem;
    font-weight: 600;
    transition: border-color .25s ease, background .25s ease, transform .25s ease;
}

.continue-btn:hover {
    border-color: var(--amber);
    background: rgba(232, 163, 61, .08);
    transform: translateX(3px);
}

.continue-btn svg {
    transition: transform .3s ease;
}

.continue-btn:hover svg {
    transform: translateX(4px);
}

.finish-box {
    max-width: 640px;
}

.finish-box h3 {
    font-size: 1.3rem;
    margin-bottom: .6rem;
}

footer.doc-footer {
    padding-top: 2.5rem;
    text-align: left;
    color: var(--paper-dim);
    font-size: .8rem;
    max-width: 900px;
}

.mobile-nav {
    display: none;
}

@media (max-width:880px) {
    body {
        overflow: auto;
    }

    .app {
        flex-direction: column;
        height: auto;
    }

    .rail-nav {
        display: none;
    }

    .mobile-nav {
        display: flex;
        position: sticky;
        top: 0;
        z-index: 20;
        background: rgba(15, 27, 45, .94);
        backdrop-filter: blur(8px);
        overflow-x: auto;
        gap: 1rem;
        padding: .85rem 1.1rem;
        border-bottom: 1px solid var(--line);
    }

    .mobile-nav button {
        white-space: nowrap;
        font-size: .8rem;
        color: var(--paper-dim);
        background: none;
        border: none;
        flex-shrink: 0;
    }

    .mobile-nav button.active {
        color: var(--amber);
    }

    .main {
        height: auto;
    }

    .panel {
        height: auto;
    }

    .panel-inner {
        overflow-y: visible;
        padding: 2.4rem 6vw 3rem 6vw;
        height: auto;
    }

    .hero-inner {
        padding: 4rem 6vw 2rem 6vw;
    }

    .practices {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 3px;
}