body {
    margin: 0;
    background: #000;
    color: #fff;
}

header {
    background: #000;
}

.devlog-article {
    width: 100%;
    background: #111;
}

/* ============================================================
   HERO
============================================================ */

.log-hero {
    min-height: 75vh;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 120px 10%;
    background: #111;
}

.log-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(
            90deg,
            rgba(0,0,0,0.92),
            rgba(0,0,0,0.55),
            rgba(0,0,0,0.88)
        ),
        url("images/hero-instance-system.png");
    background-size: cover;
    background-position: center;
    transform: scale(1.03);
    animation: instanceHeroZoom 20s ease-in-out infinite alternate;
    opacity: 0.78;
}

.log-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 48%, #111 100%);
}

@keyframes instanceHeroZoom {
    from { transform: scale(1.03); }
    to   { transform: scale(1.10); }
}

.log-hero-content {
    position: relative;
    z-index: 2;
    max-width: 1100px;
}

.log-label {
    margin-bottom: 25px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 5px;
    color: #777;
}

.log-hero h1 {
    margin: 0;
    font-size: clamp(48px, 7.5vw, 100px);
    line-height: 0.9;
    letter-spacing: -3px;
}

.log-hero p {
    max-width: 850px;
    margin-top: 35px;
    font-size: 23px;
    line-height: 1.45;
    color: #aaa;
    letter-spacing: 0.5px;
}

/* ============================================================
   SECTIONS
============================================================ */

.log-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 125px 40px;
}

.section-number {
    margin-bottom: 25px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 5px;
    color: #ff3b3b;
}

.log-section h2 {
    margin: 0 0 40px;
    font-size: clamp(36px, 5vw, 64px);
    line-height: 0.98;
    letter-spacing: -1px;
}

.log-section p {
    max-width: 900px;
    margin: 0 0 25px;
    font-size: 19px;
    line-height: 1.75;
    color: #999;
}

.log-section .lead {
    max-width: 950px;
    font-size: 24px;
    line-height: 1.5;
    color: #ccc;
}

.log-section strong {
    color: #fff;
}

/* ============================================================
   QUOTE
============================================================ */

.quote-block {
    position: relative;
    margin: 65px 0 35px;
    padding: 48px 50px;
    background: #0b0b0b;
    border: 1px solid #1b1b1b;
}

.quote-block::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ff3b3b;
}

.quote-block strong {
    display: block;
    max-width: 950px;
    font-size: 27px;
    line-height: 1.35;
}

.quote-small {
    margin-top: 50px;
    padding: 35px 40px;
}

.quote-small strong {
    font-size: 22px;
}

/* ============================================================
   DATA GRID
============================================================ */

.data-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    margin: 55px 0 25px;
}

.data-grid div {
    min-height: 85px;
    padding: 28px;
    background: #0b0b0b;
    border: 1px solid #181818;
}

.data-grid span {
    display: block;
    margin-bottom: 15px;
    font-size: 10px;
    letter-spacing: 2.5px;
    color: #555;
}

.data-grid strong {
    display: block;
    font-size: 15px;
    letter-spacing: 1px;
    color: #bbb;
}

/* ============================================================
   INSTANCE / ACTOR COMPARISON
============================================================ */

.comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    margin: 60px 0 35px;
}

.comparison-card {
    padding: 38px;
    background: #090909;
    border: 1px solid #202020;
}

.comparison-card.instance-card {
    border-top: 2px solid #ff3b3b;
}

.comparison-card.actor-card {
    border-top: 2px solid #555;
}

.card-kicker {
    color: #777;
    font-size: 10px;
    letter-spacing: 3px;
}

.comparison-card h3 {
    margin: 18px 0 25px;
    font-size: 25px;
}

.comparison-card ul {
    margin: 0;
    padding-left: 18px;
    color: #999;
    font-size: 15px;
    line-height: 2;
}

/* ============================================================
   SYSTEM MAP
============================================================ */

.system-map {
    margin: 65px 0 45px;
    padding: 45px;
    background: #080808;
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
}

.system-core {
    max-width: 620px;
    margin: 0 auto;
    padding: 30px;
    text-align: center;
    background: #0e0e0e;
    border: 1px solid #ff3b3b;
    box-shadow: 0 0 35px rgba(255,59,59,0.06);
}

.system-core span,
.system-node span {
    display: block;
    margin-bottom: 13px;
    color: #777;
    font-size: 10px;
    letter-spacing: 2.5px;
}

.system-core strong {
    display: block;
    font-size: 23px;
}

.system-core small,
.system-node small {
    display: block;
    margin-top: 10px;
    color: #777;
    font-size: 13px;
}

.system-branches {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 55px;
}

.system-branches::before {
    content: "";
    position: absolute;
    left: 12.5%;
    right: 12.5%;
    top: -28px;
    height: 1px;
    background: #444;
}

.system-node {
    position: relative;
    min-height: 115px;
    padding: 24px 15px;
    text-align: center;
    background: #0d0d0d;
    border: 1px solid #292929;
}

.system-node::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -28px;
    width: 1px;
    height: 28px;
    background: #444;
}

.system-node strong {
    font-size: 17px;
}

/* ============================================================
   FLOW LIST
============================================================ */

.flow-list {
    margin: 55px 0;
    border-top: 1px solid #222;
}

.flow-list > div {
    display: grid;
    grid-template-columns: 150px 1fr;
    align-items: center;
    gap: 30px;
    padding: 23px 0;
    border-bottom: 1px solid #222;
}

.flow-list span {
    color: #ff3b3b;
    font-size: 11px;
    letter-spacing: 2px;
}

.flow-list p {
    margin: 0;
    font-size: 17px;
}


/* ============================================================
   OWNERSHIP DIAGRAM
============================================================ */

.ownership-diagram {
    margin: 60px 0;
    padding: 50px 30px;
    background: #080808;
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
    text-align: center;
}

/* NODE */

.ownership-node {
    display: flex;
    width: 100%;
    max-width: 280px;
    min-height: 90px;
    margin: 0 auto;
    padding: 17px 20px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #101010;
    border: 1px solid #292929;
}

.ownership-node strong {
    color: #eee;
    font-size: 17px;
}

.ownership-node small {
    color: #777;
    font-size: 11px;
}

.ownership-nested-group {
    margin: 25px auto 0;
    padding: 25px 20px;
    border: 1px dashed #555;
}

.node-type {
    color: #888;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
}

/* NODE TYPES */

.root-node {
    border-color: #ff3b3b;
}

.root-node .node-type {
    color: #ff5555;
}

.container-node,
.slot-node {
    border-color: #454545;
}

.item-node {
    border-color: #a64b3c;
    background: #15100f;
}

.item-node .node-type {
    color: #ff5555;
}

.content-node {
    min-height: 75px;
    background: #0c0c0c;
    border: 1px dashed #555;
}

/* CONNECTORS */

.ownership-line {
    width: 1px;
    height: 30px;
    margin: 0 auto;
    background: #555;
}

/* PROPERTIES */

.ownership-properties {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin-top: 5px;
}

.ownership-properties span {
    padding: 5px 7px;
    color: #999;
    background: #1b1b1b;
    border: 1px solid #292929;
    font-size: 10px;
}

/* BRANCH */

.ownership-branch {
    max-width: 950px;
    margin: 0 auto;
}

.ownership-branch-line {
    width: 66.66%;
    height: 25px;
    margin: 0 auto;
    border-top: 1px solid #555;
    border-left: 1px solid #555;
    border-right: 1px solid #555;
}

.ownership-branch-items {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.ownership-branch-column {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.ownership-branch-column > .ownership-node {
    flex: 1;
}

.ownership-branch-column .ownership-line {
    height: 25px;
}


/* ============================================================
   NESTED OWNERSHIP BRANCH
============================================================ */

.ownership-subbranch {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 25px;
    padding-top: 25px;
}

.ownership-subbranch::before {
    content: "";
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 1px;
    background: #555;
}

.ownership-subbranch > .ownership-node {
    position: relative;
}

.ownership-subbranch > .ownership-node::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -26px;
    width: 1px;
    height: 25px;
    background: #555;
}

@media (max-width: 700px) {
    .ownership-subbranch {
        grid-template-columns: 1fr;
        gap: 20px;
        padding-top: 0;
        margin-top: 20px;
    }

    .ownership-subbranch::before {
        display: none;
    }

    .ownership-subbranch > .ownership-node::before {
        top: -21px;
        height: 20px;
    }
}

/* LEGEND */

.ownership-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
    color: #777;
    font-size: 11px;
}

.ownership-legend span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ownership-legend i {
    display: inline-block;
    width: 9px;
    height: 9px;
}

.legend-item {
    background: #a64b3c;
}

.legend-container {
    background: #555;
}

.legend-content {
    border: 1px dashed #999;
}

/* MOBILE */

@media (max-width: 700px) {
    .ownership-diagram {
        padding: 35px 12px;
    }

    .ownership-branch-items {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .ownership-branch-line {
        width: 1px;
        height: 25px;
        border: none;
        background: #555;
    }

    .ownership-branch-column {
        max-width: 100%;
    }

    .ownership-node {
        max-width: 100%;
    }

    .ownership-legend {
        flex-direction: column;
        align-items: center;
    }
}

/* ============================================================
   TRANSACTION FLOW
============================================================ */

.transaction-flow {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin: 65px 0;
    padding: 35px 22px;
    background: #080808;
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
}

.transaction-step {
    min-height: 125px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 18px;
    background: #0e0e0e;
    border: 1px solid #292929;
}

.transaction-step > span {
    margin-bottom: 15px;
    color: #ff3b3b;
    font-size: 11px;
    letter-spacing: 2px;
}

.transaction-step strong {
    font-size: 14px;
    letter-spacing: 1px;
}

.transaction-step small {
    margin-top: 9px;
    color: #777;
    font-size: 12px;
    line-height: 1.5;
}

.transaction-step.result {
    border-color: #ff3b3b;
}

.transaction-arrow {
    color: #555;
    font-size: 20px;
}

/* ============================================================
   ACTOR FACTORY
============================================================ */

.factory-flow {
    display: grid;
    grid-template-columns: 1fr 150px 1fr;
    align-items: center;
    gap: 20px;
    margin: 60px 0;
    padding: 45px;
    background: #080808;
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
}

.factory-instance,
.factory-actor {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 25px;
    text-align: center;
    background: #101010;
    border: 1px solid #333;
}

.factory-instance {
    border-color: #ff3b3b;
}

.factory-instance span,
.factory-actor span {
    color: #777;
    font-size: 10px;
    letter-spacing: 3px;
}

.factory-instance strong,
.factory-actor strong {
    margin-top: 13px;
    font-size: 25px;
}

.factory-instance small,
.factory-actor small {
    margin-top: 10px;
    color: #777;
    font-size: 12px;
}

.factory-arrow {
    text-align: center;
}

.factory-arrow span {
    display: block;
    margin-bottom: 10px;
    color: #777;
    font-size: 9px;
    letter-spacing: 2px;
}

.factory-arrow b {
    color: #ff3b3b;
    font-size: 30px;
    font-weight: 400;
}

/* ============================================================
   DEFINITIONS
============================================================ */

.definition-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    margin: 55px 0;
}

.definition-card {
    padding: 35px;
    background: #090909;
    border: 1px solid #202020;
}

.definition-card span {
    color: #ff3b3b;
    font-size: 10px;
    letter-spacing: 3px;
}

.definition-card h3 {
    margin: 18px 0;
    font-size: 23px;
}

.definition-card p {
    margin: 0;
    font-size: 15px;
}

/* ============================================================
   PERSISTENCE
============================================================ */

.persistence-flow {
    display: grid;
    grid-template-columns: 1fr 160px 1fr;
    align-items: center;
    gap: 20px;
    margin: 60px 0;
    padding: 45px 30px;
    background: #080808;
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
}

.persistence-column {
    min-height: 145px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 22px;
    text-align: center;
    background: #101010;
    border: 1px solid #333;
}

.persistence-column.database {
    border-color: #ff3b3b;
}

.persistence-column span {
    color: #777;
    font-size: 10px;
    letter-spacing: 3px;
}

.persistence-column strong {
    margin-top: 13px;
    font-size: 22px;
}

.persistence-column small {
    margin-top: 10px;
    color: #777;
    font-size: 12px;
}

.persistence-connector {
    text-align: center;
}

.persistence-connector span {
    display: block;
    margin-bottom: 10px;
    color: #777;
    font-size: 9px;
    letter-spacing: 2px;
}

.persistence-connector b {
    color: #ff3b3b;
    font-size: 30px;
    font-weight: 400;
}

/* ============================================================
   LIFECYCLE
============================================================ */

.lifecycle {
    margin: 60px 0;
    border-top: 1px solid #222;
}

.lifecycle-row {
    display: grid;
    grid-template-columns: 55px 1fr 230px;
    align-items: center;
    gap: 25px;
    padding: 25px 5px;
    border-bottom: 1px solid #222;
}

.lifecycle-index {
    color: #ff3b3b;
    font-family: monospace;
    font-size: 15px;
}

.lifecycle-row strong {
    font-size: 14px;
    letter-spacing: 2px;
}

.lifecycle-row p {
    margin: 8px 0 0;
    font-size: 15px;
}

.lifecycle-owner {
    color: #666;
    font-size: 10px;
    letter-spacing: 1.5px;
    text-align: right;
}

/* ============================================================
   COMPOSITE VEHICLE
============================================================ */

.vehicle-structure {
    margin: 60px 0;
    padding: 40px;
    background: #080808;
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
}

.vehicle-root {
    max-width: 420px;
    margin: 0 auto 30px;
    padding: 25px;
    text-align: center;
    background: #101010;
    border: 1px solid #ff3b3b;
}

.vehicle-root span {
    display: block;
    margin-bottom: 12px;
    color: #777;
    font-size: 10px;
    letter-spacing: 2px;
}

.vehicle-root strong {
    font-size: 23px;
}

.vehicle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.vehicle-grid div {
    display: flex;
    min-height: 80px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: #101010;
    border: 1px solid #292929;
}

.vehicle-grid strong {
    font-size: 15px;
}

.vehicle-grid small {
    color: #777;
    font-size: 11px;
}

/* ============================================================
   FINAL
============================================================ */

.log-final {
    padding: 120px 10%;
    background: #080808;
    border-top: 1px solid #222;
}

.log-final h2 {
    max-width: 1200px;
    margin: 0 auto 45px;
    font-size: clamp(38px, 5vw, 64px);
    letter-spacing: -1px;
}

.log-final > p {
    max-width: 900px;
    margin: 0 auto 25px;
    color: #999;
    font-size: 19px;
    line-height: 1.75;
}

.final-statement {
    max-width: 1200px;
    margin: 70px auto 0;
    padding: 50px;
    background: #0d0d0d;
    border: 1px solid #252525;
    border-left: 2px solid #ff3b3b;
}

.final-statement span {
    display: block;
    margin-bottom: 22px;
    color: #ff3b3b;
    font-size: 11px;
    letter-spacing: 4px;
}

.final-statement strong {
    font-size: clamp(24px, 4vw, 42px);
    line-height: 1.25;
    letter-spacing: 1px;
}

.disclaimer {
    max-width: 1120px;
    margin: 0 auto 80px;
    padding: 30px 40px;
    background: #090909;
    border-left: 2px solid #ff3b3b;
}

.disclaimer-label {
    margin-bottom: 12px;
    color: #ff3b3b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 4px;
}

.disclaimer p {
    margin: 0;
    color: #777;
    font-size: 14px;
    line-height: 1.65;
}

/* ============================================================
   BACK TO TOP
============================================================ */

.back-to-top {
    position: fixed;
    right: 35px;
    bottom: 35px;
    z-index: 100;
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    border: 1px solid #333;
    background: #111;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, border-color 0.2s, visibility 0.2s;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    border-color: #ff3b3b;
}

/* ============================================================
   MOBILE
============================================================ */

@media (max-width: 900px) {
    .system-branches {
        grid-template-columns: repeat(2, 1fr);
    }

    .system-branches::before {
        display: none;
    }

    .system-node::before {
        display: none;
    }

    .transaction-flow {
        grid-template-columns: 1fr 1fr;
    }

    .transaction-arrow {
        display: none;
    }
}

@media (max-width: 700px) {
    .log-hero {
        min-height: 70vh;
        padding: 90px 7%;
    }

    .log-hero::before {
        background-position: 58% center;
    }

    .log-label {
        margin-bottom: 20px;
        font-size: 9px;
        letter-spacing: 2.5px;
    }

    .log-hero h1 {
        font-size: clamp(38px, 11vw, 54px);
        line-height: 0.94;
        letter-spacing: -1.5px;
    }

    .log-hero p {
        margin-top: 28px;
        font-size: 17px;
        line-height: 1.5;
    }

    .log-section {
        padding: 70px 7%;
    }

    .log-section h2 {
        margin-bottom: 30px;
        font-size: clamp(31px, 8.5vw, 42px);
        line-height: 1;
    }

    .log-section .lead {
        font-size: 19px;
        line-height: 1.5;
    }

    .log-section p {
        font-size: 16px;
        line-height: 1.7;
    }

    .quote-block {
        margin-top: 45px;
        padding: 30px 25px;
    }

    .quote-block strong {
        font-size: 21px;
        line-height: 1.4;
    }

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

    .data-grid div {
        padding: 22px;
    }

    .comparison,
    .definition-grid {
        grid-template-columns: 1fr;
    }

    .comparison-card,
    .definition-card {
        padding: 28px;
    }

    .system-map {
        padding: 30px 15px;
    }

    .system-core {
        padding: 25px 15px;
    }

    .system-core strong {
        font-size: 18px;
    }

    .system-branches {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 25px;
    }

    .system-node {
        min-height: 100px;
        padding: 18px 10px;
    }

    .system-node strong {
        font-size: 15px;
    }

    .flow-list > div {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 20px 0;
    }

    .flow-list p {
        font-size: 15px;
    }

    .ownership-diagram {
        padding: 30px 12px;
    }

    .ownership-group,
    .ownership-grandchildren {
        grid-template-columns: 1fr;
        padding-left: 0;
    }

    .ownership-root {
        min-width: 0;
        width: 70%;
    }

    .transaction-flow {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 20px 12px;
    }

    .transaction-step {
        min-height: 115px;
        padding: 15px 12px;
    }

    .transaction-step strong {
        font-size: 12px;
    }

    .factory-flow,
    .persistence-flow {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 28px 18px;
    }

    .factory-arrow b,
    .persistence-connector b {
        display: inline-block;
        transform: rotate(90deg);
    }

    .factory-arrow span,
    .persistence-connector span {
        margin-bottom: 4px;
    }

    .lifecycle-row {
        grid-template-columns: 35px 1fr;
        gap: 12px;
        padding: 20px 0;
    }

    .lifecycle-owner {
        grid-column: 2;
        text-align: left;
        font-size: 9px;
    }

    .lifecycle-row p {
        font-size: 14px;
    }

    .vehicle-structure {
        padding: 25px 12px;
    }

    .vehicle-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .vehicle-grid div {
        min-height: 75px;
    }

    .log-final {
        padding: 80px 7%;
    }

    .log-final h2 {
        font-size: 38px;
    }

    .log-final > p {
        font-size: 16px;
        line-height: 1.7;
    }

    .final-statement {
        margin-top: 45px;
        padding: 30px 22px;
    }

    .final-statement strong {
        font-size: 24px;
    }

    .disclaimer {
        margin: 0 7% 60px;
        padding: 25px;
    }

    .back-to-top {
        right: 18px;
        bottom: 18px;
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 420px) {
    .data-grid,
    .system-branches,
    .transaction-flow,
    .vehicle-grid {
        grid-template-columns: 1fr;
    }

    .log-hero h1 {
        font-size: 39px;
    }

    .quote-block strong {
        font-size: 19px;
    }
}
