:root {
    --bg: #070707;
    --panel: #0e0e0e;
    --panel-2: #141414;
    --rule: #1c1c1c;
    --rule-2: #2a2a2a;
    --rule-3: #3a3a3a;
    --text: #ecece6;
    --dim: #7a7a72;
    --dimmer: #4c4c47;
    --accent: #c6ff5e;
    --cream: #f0e6d3;
    --emph: #e8b466;
    --warn: #ffb03a;
    --err: #ff5e5e;
}

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

html,
body {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 13.5px;
    line-height: 1.55;
    min-height: 100vh;
    background-image:
        linear-gradient(var(--rule) 1px, transparent 1px),
        linear-gradient(90deg, var(--rule) 1px, transparent 1px);
    background-size: 72px 72px;
    background-position: -1px -1px;
}

/* faint vignette */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(80% 60% at 50% 20%, transparent 40%, rgba(0, 0, 0, .5) 100%);
}

a { color: inherit; }
::selection { background: var(--accent); color: #0a0a0a; }

/* inline emphasis: color change only — same typeface as parent */
.serif { color: var(--emph); }

/* =========== TOP BAR =========== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: clamp(12px, 2vw, 28px);
    padding: 12px clamp(16px, 3vw, 36px);
    border-bottom: 1px solid var(--rule);
    background: rgba(7, 7, 7, .85);
    backdrop-filter: blur(8px);
    font-size: 11px;
    letter-spacing: .08em;
    align-items: center;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
}
@keyframes pulse { 50% { opacity: .35; } }
.topbar nav {
    display: flex;
    gap: 18px;
    color: var(--dim);
    justify-self: start;
    margin-left: 8px;
}
.topbar nav a { text-decoration: none; transition: color .2s; }
.topbar nav a:hover { color: var(--text); }
.topbar nav a::before { content: "/ "; color: var(--dimmer); }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--rule-2);
    border-radius: 999px;
    color: var(--dim);
    font-size: 10.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.chip .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}
.lang-toggle {
    background: transparent;
    border: 1px solid var(--rule-2);
    color: var(--text);
    font-family: inherit;
    font-size: 11px;
    letter-spacing: .2em;
    padding: 6px 12px;
    cursor: pointer;
    transition: all .2s;
}
.lang-toggle:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 780px) {
    .topbar nav { display: none; }
    .chip { display: none; }
}

/* =========== LAYOUT WRAP =========== */
.wrap {
    position: relative;
    z-index: 2;
    padding: 0 clamp(16px, 3vw, 36px);
}

/* =========== HERO =========== */
.hero {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: clamp(24px, 4vw, 56px);
    padding: clamp(56px, 12vh, 140px) 0 clamp(48px, 8vh, 96px);
    align-items: stretch;
}
@media (max-width: 980px) { .hero { grid-template-columns: 1fr; } }

.kicker {
    font-size: 11px;
    letter-spacing: .24em;
    color: var(--accent);
    margin-bottom: 24px;
}
.kicker::before { content: "[ "; color: var(--dimmer); }
.kicker::after { content: " ]"; color: var(--dimmer); }

h1.hero-title {
    font-family: "JetBrains Mono", monospace;
    font-size: clamp(34px, 6vw, 78px);
    font-weight: 500;
    line-height: 1.03;
    letter-spacing: -.035em;
    text-transform: uppercase;
    margin: 0 0 28px;
}
.cursor {
    display: inline-block;
    width: .55ch;
    height: .9em;
    background: var(--accent);
    vertical-align: -.08em;
    margin-left: .1em;
    animation: blink 1.1s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.brand-logo-jf {
    animation: pulse 1.8s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
    .cursor, .brand-logo-jf { animation: none; }
}

p.lede {
    max-width: 52ch;
    font-size: 15px;
    color: var(--dim);
    margin: 0 0 36px;
    line-height: 1.7;
}
p.lede em {
    font-style: normal;
    color: var(--text);
    border-bottom: 1px dashed var(--accent);
    padding-bottom: 1px;
}

.cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    font-family: inherit;
    font-size: 12px;
    letter-spacing: .14em;
    text-decoration: none;
    text-transform: uppercase;
    border: 1px solid var(--rule-2);
    color: var(--text);
    background: var(--panel);
    transition: all .22s ease;
    cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: #0a0a0a; border-color: var(--accent); }
.btn.primary:hover { background: transparent; color: var(--accent); }
.btn .k {
    color: var(--dimmer);
    padding-left: 10px;
    margin-left: 2px;
    border-left: 1px solid currentColor;
    font-size: 10px;
}
.btn.primary .k { color: rgba(0, 0, 0, .35); border-color: rgba(0, 0, 0, .3); }

/* side panel */
.logbox {
    border: 1px solid var(--rule-2);
    background: var(--panel);
    padding: 22px 24px 18px;
    position: relative;
    font-size: 12px;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.logbox::before {
    content: "~/status.log";
    position: absolute;
    top: -10px;
    left: 18px;
    background: var(--bg);
    padding: 0 8px;
    font-size: 10px;
    letter-spacing: .2em;
    color: var(--dim);
    text-transform: uppercase;
}
.logline {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 12px;
    padding: 4px 0;
    color: var(--dim);
    border-bottom: 1px dotted var(--rule);
}
.logline:last-child { border-bottom: none; }
.logline .t { color: var(--dimmer); font-size: 11px; }
.logline .l { font-weight: 600; font-size: 11px; }
.logline .l.ok { color: var(--accent); }
.logline .l.inf { color: var(--dim); }
.logline .l.note { color: var(--cream); }
.logline .m { color: var(--text); font-size: 12px; }
.logbox .spacer { flex: 1; }
.logbox .foot {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--rule-2);
    color: var(--dimmer);
    font-size: 10.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
}

/* reveal */
.reveal > * {
    opacity: 0;
    transform: translateY(12px);
    animation: rise .85s cubic-bezier(.2, .7, .1, 1) forwards;
}
.reveal > *:nth-child(1) { animation-delay: .04s; }
.reveal > *:nth-child(2) { animation-delay: .18s; }
.reveal > *:nth-child(3) { animation-delay: .32s; }
.reveal > *:nth-child(4) { animation-delay: .44s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* =========== PULL QUOTE =========== */
.pullquote {
    margin: clamp(40px, 8vh, 96px) 0 clamp(40px, 8vh, 96px);
    padding: clamp(32px, 5vw, 64px) clamp(24px, 5vw, 72px);
    border-top: 1px solid var(--rule-2);
    border-bottom: 1px solid var(--rule-2);
    text-align: center;
}
.pullquote .q {
    font-family: "Fraunces", serif;
    font-style: italic;
    font-variation-settings: "opsz" 144, "SOFT" 20;
    font-weight: 300;
    color: var(--cream);
    font-size: clamp(22px, 3.4vw, 42px);
    line-height: 1.2;
    letter-spacing: -.015em;
    max-width: 32ch;
    margin: 0 auto;
}
.pullquote .q .dash { color: var(--accent); font-style: normal; font-family: inherit; }

/* =========== ABOUT =========== */
.about {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: clamp(24px, 4vw, 56px);
    align-items: start;
    padding: clamp(24px, 4vw, 40px) 0;
}
@media (max-width: 780px) { .about { grid-template-columns: 1fr; } }

.portrait {
    width: clamp(180px, 22vw, 280px);
    aspect-ratio: 1 / 1;
    border: 1px solid var(--rule-2);
    padding: 12px;
    background: var(--panel);
    position: relative;
}
.portrait .img {
    width: 100%;
    height: 100%;
    background: linear-gradient(150deg, #222 0%, #0c0c0c 60%, #1a1a1a 100%);
    filter: grayscale(1) contrast(1.03);
    position: relative;
    overflow: hidden;
}
.portrait .img::before {
    content: "JF";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: "Fraunces", serif;
    font-style: italic;
    font-size: 64px;
    color: #2a2a2a;
    letter-spacing: -.04em;
}
.portrait .img[data-has-image="1"]::before { display: none; }
.portrait .cap {
    position: absolute;
    bottom: -10px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    background: var(--bg);
    padding: 0 6px;
    font-size: 10px;
    letter-spacing: .2em;
    color: var(--dim);
    text-transform: uppercase;
}
.portrait .cap span:last-child { color: var(--accent); }

.about-copy h2 {
    font-family: "JetBrains Mono", monospace;
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 500;
    margin: 0 0 18px;
    line-height: 1.1;
    letter-spacing: -.02em;
    text-transform: uppercase;
}
.about-copy p {
    margin: 0 0 14px;
    color: var(--dim);
    max-width: 62ch;
    font-size: 14.5px;
    line-height: 1.7;
}
.about-copy p strong { color: var(--text); font-weight: 500; }
.about-copy ul.tags {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.about-copy ul.tags li {
    font-size: 11px;
    letter-spacing: .12em;
    color: var(--dim);
    padding: 4px 10px;
    border: 1px solid var(--rule-2);
    border-radius: 2px;
    text-transform: uppercase;
}

/* =========== SECTION TITLES =========== */
.section { padding: clamp(48px, 8vw, 96px) 0; }
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid var(--rule-2);
    padding-bottom: 16px;
    margin-bottom: clamp(28px, 4vw, 48px);
    gap: 24px;
    flex-wrap: wrap;
}
.section-head h2 {
    font-family: "JetBrains Mono", monospace;
    font-size: clamp(20px, 2.6vw, 28px);
    font-weight: 500;
    letter-spacing: -.02em;
    margin: 0;
    text-transform: uppercase;
}
.section-head .index {
    font-size: 11px;
    letter-spacing: .22em;
    color: var(--dim);
    text-transform: uppercase;
}

/* =========== SERVICES =========== */
.service {
    display: grid;
    grid-template-columns: 72px 1.1fr 2fr auto;
    gap: clamp(14px, 3vw, 36px);
    padding: clamp(20px, 3vw, 32px) 0;
    border-bottom: 1px solid var(--rule-2);
    align-items: start;
}
.service:last-child { border-bottom: none; }
@media (max-width: 800px) {
    .service { grid-template-columns: 1fr; gap: 8px; }
    .service .tag { justify-self: start; }
}
.service .n { font-size: 12px; letter-spacing: .18em; color: var(--dimmer); }
.service h3 {
    margin: 0;
    font-family: "JetBrains Mono", monospace;
    font-size: clamp(18px, 2.2vw, 26px);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -.02em;
    text-transform: uppercase;
}
.service p {
    margin: 0;
    font-size: 14.5px;
    color: var(--dim);
    max-width: 60ch;
    line-height: 1.65;
}
.service .tag {
    font-size: 11px;
    letter-spacing: .14em;
    color: var(--dim);
    padding: 4px 10px;
    border: 1px solid var(--rule-2);
    border-radius: 2px;
    text-transform: uppercase;
    height: fit-content;
}

/* =========== CASE STUDIES =========== */
.case {
    border: 1px solid var(--rule-2);
    background: var(--panel);
    padding: clamp(22px, 3vw, 36px);
    margin-bottom: clamp(18px, 2vw, 28px);
    display: grid;
    grid-template-columns: 1.1fr 1.3fr;
    gap: clamp(24px, 3vw, 44px);
    position: relative;
}
@media (max-width: 900px) { .case { grid-template-columns: 1fr; } }
.case::before {
    content: attr(data-n);
    position: absolute;
    top: -10px;
    left: 22px;
    background: var(--bg);
    padding: 0 8px;
    font-size: 10px;
    letter-spacing: .2em;
    color: var(--dim);
    text-transform: uppercase;
}
.case h3 {
    font-family: "JetBrains Mono", monospace;
    font-weight: 500;
    font-size: clamp(18px, 2.4vw, 26px);
    letter-spacing: -.02em;
    margin: 0 0 14px;
    line-height: 1.12;
    text-transform: uppercase;
}
.case p { margin: 0 0 12px; color: var(--dim); font-size: 14.5px; line-height: 1.65; }
.case ul.stack {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.case ul.stack li {
    font-size: 11px;
    letter-spacing: .1em;
    color: var(--dim);
    padding: 4px 9px;
    border: 1px solid var(--rule-2);
    text-transform: uppercase;
}
.case ul.stack li a { color: inherit; text-decoration: none; transition: color .2s; }
.case ul.stack li a:hover { color: var(--accent); }
.case ul.stack li.priv { color: var(--dimmer); border-style: dashed; }
.case ul.stack li.pub { color: var(--accent); border-color: var(--accent); }
.case .diagram {
    background: var(--panel-2);
    border: 1px solid var(--rule);
    padding: 18px 14px;
    font-size: 11.5px;
    color: var(--text);
    overflow-x: auto;
    position: relative;
}
.case .diagram::before {
    content: "architecture.txt";
    position: absolute;
    top: -9px;
    left: 14px;
    background: var(--panel);
    padding: 0 8px;
    font-size: 10px;
    letter-spacing: .2em;
    color: var(--dim);
    text-transform: uppercase;
}
.case .diagram pre { margin: 0; font-family: inherit; line-height: 1.4; white-space: pre; }
.case .diagram .acc { color: var(--accent); }
.case .diagram .dim { color: var(--dim); }

/* =========== STACK =========== */
.stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1px;
    background: var(--rule-2);
    border: 1px solid var(--rule-2);
}
.stack-col { background: var(--bg); padding: 22px 20px; }
.stack-col h4 {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    letter-spacing: .22em;
    color: var(--accent);
    margin: 0 0 12px;
    text-transform: uppercase;
    font-weight: 500;
}
.stack-col ul { list-style: none; padding: 0; margin: 0; }
.stack-col li {
    position: relative;
    padding: 5px 0 5px 20px;
    color: var(--dim);
    font-size: 13.5px;
    line-height: 1.5;
}
.stack-col li::before {
    content: "▸";
    position: absolute;
    left: 0;
    top: 6px;
    color: var(--dimmer);
    font-size: 10px;
}
.stack-col li strong { color: var(--text); font-weight: 500; }

/* =========== CONTACT =========== */
.contact {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: clamp(28px, 5vw, 72px);
    align-items: start;
}
@media (max-width: 900px) { .contact { grid-template-columns: 1fr; } }
.contact-intro h2 {
    font-family: "JetBrains Mono", monospace;
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 500;
    line-height: 1.05;
    margin: 0 0 18px;
    letter-spacing: -.03em;
    text-transform: uppercase;
}
.contact-intro p {
    color: var(--dim);
    max-width: 48ch;
    font-size: 14.5px;
    line-height: 1.7;
    margin: 0 0 28px;
}
.contact-intro .socials {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid var(--rule-2);
    padding-top: 18px;
}
.contact-intro .socials a {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    text-decoration: none;
    color: var(--text);
    border-bottom: 1px solid var(--rule);
    transition: padding-left .3s ease, color .2s ease;
}
.contact-intro .socials a:hover { padding-left: 8px; color: var(--accent); }
.contact-intro .socials a .k {
    font-size: 11px;
    letter-spacing: .2em;
    color: var(--dim);
    text-transform: uppercase;
}
.contact-intro .socials a .v { font-size: 14px; }
.contact-intro .socials a .arrow { color: var(--dim); transition: transform .25s ease; }
.contact-intro .socials a:hover .arrow { transform: translateX(4px); color: var(--accent); }

form.contact-form {
    background: var(--panel);
    border: 1px solid var(--rule-2);
    padding: clamp(22px, 3vw, 36px);
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}
form.contact-form::before {
    content: "./new-message.sh";
    position: absolute;
    top: -10px;
    left: 20px;
    background: var(--bg);
    padding: 0 8px;
    font-size: 10px;
    letter-spacing: .2em;
    color: var(--dim);
    text-transform: uppercase;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
    font-size: 11px;
    letter-spacing: .22em;
    color: var(--dim);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}
.field label::before { content: "→"; color: var(--accent); }
.field input,
.field textarea {
    background: var(--bg);
    border: 1px solid var(--rule-2);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    padding: 12px 14px;
    outline: none;
    resize: vertical;
    transition: border-color .2s ease;
}
.field input:focus,
.field textarea:focus { border-color: var(--accent); }
.field textarea { min-height: 140px; line-height: 1.6; }
form.contact-form .submit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
form.contact-form .hint {
    font-size: 11px;
    color: var(--dimmer);
    letter-spacing: .1em;
    text-transform: uppercase;
}
form.contact-form.sent .sent-msg { display: flex; }
.sent-msg {
    display: none;
    align-items: center;
    gap: 10px;
    color: var(--accent);
    font-size: 12px;
    letter-spacing: .2em;
    text-transform: uppercase;
    padding: 10px 14px;
    border: 1px dashed var(--accent);
}
.sent-msg::before { content: "●"; }

/* =========== FOOTER =========== */
.bottombar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    padding: 8px 18px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 24px;
    background: rgba(7, 7, 7, .9);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--rule);
    font-size: 11px;
    letter-spacing: .1em;
    color: var(--dim);
}
.bottombar .ticker {
    overflow: hidden;
    white-space: nowrap;
    mask-image: linear-gradient(90deg, transparent, black 5%, black 95%, transparent);
}
.bottombar .ticker-track { display: inline-block; animation: roll 52s linear infinite; }
@keyframes roll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.bottombar .ticker .acc { color: var(--accent); }
.bottombar .ticker .warm { color: var(--cream); }
@media (max-width: 640px) { .bottombar { display: none; } }

footer.pagefoot {
    padding: 48px clamp(16px, 3vw, 36px) 72px;
    border-top: 1px solid var(--rule-2);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    color: var(--dimmer);
    font-size: 11px;
    letter-spacing: .16em;
    text-transform: uppercase;
    align-items: baseline;
}
footer.pagefoot .brand-foot { color: var(--text); font-weight: 500; }
@media (max-width: 780px) { footer.pagefoot { grid-template-columns: 1fr; } }
