:root {
    --ink: #171717;
    --muted: #5b5b5b;
    --soft: #f7f7f5;
    --paper: #ffffff;
    --line: #e6e6e2;
    --field: #f1f1ee;
    --dark: #111816;
    --green: #146a43;
    --green-dark: #0f5134;
    --blue: #315d80;
    --amber: #9a6224;
    --shadow: 0 16px 42px rgba(17, 17, 17, 0.08);
    --radius: 8px;
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --display: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
    --ink: #f0f0ee;
    --muted: #a8a8a6;
    --soft: #1a1a18;
    --paper: #262624;
    --line: #3a3a38;
    --field: #323230;
    --dark: #0d0d0c;
    --shadow: 0 16px 42px rgba(0, 0, 0, 0.4);
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--paper);
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea {
    font: inherit;
}

.container,
.hero-grid {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
}

.navbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(230, 230, 226, 0.8);
    backdrop-filter: blur(16px);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

:root[data-theme="dark"] .navbar {
    background: rgba(38, 38, 36, 0.88);
    border-bottom-color: rgba(58, 58, 56, 0.8);
}

.navbar.scrolled {
    box-shadow: 0 10px 28px rgba(17, 17, 17, 0.08);
}

:root[data-theme="dark"] .navbar.scrolled {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

.nav-container {
    width: min(1120px, calc(100% - 40px));
    height: 68px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav-logo {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--ink);
    font-weight: 700;
    letter-spacing: 0;
}

.logo-mark {
    font-weight: 800;
    letter-spacing: 0.02em;
}

.logo-name {
    font-size: 0.88rem;
    color: var(--muted);
    white-space: nowrap;
}

.secret-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--amber);
    opacity: 0.38;
    box-shadow: 0 0 0 0 rgba(154, 98, 36, 0.35);
    animation: clue 5s ease-in-out infinite;
}

@keyframes clue {
    0%, 85%, 100% { box-shadow: 0 0 0 0 rgba(154, 98, 36, 0); }
    90% { box-shadow: 0 0 0 8px rgba(154, 98, 36, 0.12); }
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 22px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-link {
    color: var(--muted);
    font-size: 0.94rem;
    font-weight: 600;
}

.nav-link:hover,
.nav-link:focus {
    color: var(--ink);
}

.nav-lang,
.nav-theme {
    display: inline-flex;
    gap: 6px;
    padding: 3px;
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.lang-toggle,
.theme-toggle {
    border: 0;
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.78rem;
    transition: color 0.2s ease, background 0.2s ease;
}

.lang-toggle {
    padding: 6px 10px;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 0.9rem;
}

.lang-toggle.active,
.theme-toggle.active {
    color: var(--paper);
    background: var(--ink);
}

.hamburger {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    cursor: pointer;
}

.bar {
    display: block;
    width: 18px;
    height: 2px;
    margin: 4px auto;
    background: var(--ink);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.hero {
    padding: 120px 0 64px;
    background:
        linear-gradient(90deg, rgba(230, 230, 226, 0.42) 1px, transparent 1px),
        linear-gradient(rgba(230, 230, 226, 0.42) 1px, transparent 1px),
        var(--soft);
    background-size: 56px 56px;
    border-bottom: 1px solid var(--line);
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
    align-items: center;
    gap: 56px;
}

.eyebrow,
.section-kicker {
    margin: 0 0 16px;
    color: var(--green-dark);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-family: var(--display);
    max-width: 760px;
    margin-bottom: 24px;
    font-size: clamp(2.1rem, 4.2vw, 3.5rem);
    line-height: 1.08;
    letter-spacing: 0;
    font-weight: 650;
}

h2 {
    font-family: var(--display);
    margin-bottom: 16px;
    font-size: clamp(1.55rem, 2.8vw, 2.3rem);
    line-height: 1.16;
    letter-spacing: 0;
    font-weight: 620;
}

h3 {
    margin-bottom: 8px;
    font-size: 1.04rem;
    line-height: 1.3;
    font-weight: 650;
}

p {
    color: var(--muted);
    margin-bottom: 0;
}

.hero-description {
    max-width: 620px;
    margin-bottom: 24px;
    font-size: 1rem;
    line-height: 1.62;
}

.hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}

.hero-tags span,
.case-meta span {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.8);
    color: var(--muted);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: 600;
}

.hero-actions,
.contact-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 11px 15px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.btn:hover,
.btn:focus {
    transform: translateY(-1px);
}

.btn-primary {
    color: var(--paper);
    background: var(--green);
}

.btn-primary:hover {
    background: var(--green-dark);
}

.btn-secondary {
    color: var(--ink);
    background: var(--paper);
    border-color: var(--line);
}

.system-visual {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 16px;
    border: 1px solid rgba(23, 23, 23, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.visual-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
}

.visual-toolbar span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--line);
}

.visual-toolbar span:nth-child(1) { background: #d56442; }
.visual-toolbar span:nth-child(2) { background: #d89b35; }
.visual-toolbar span:nth-child(3) { background: #3f9f70; }
.visual-toolbar strong {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.8rem;
}

.schema-frame {
    position: relative;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    overflow: hidden;
}

.schema-image {
    display: block;
    width: 100%;
    height: auto;
}

.visual-console {
    display: grid;
    gap: 8px;
    padding: 14px;
    border-radius: 8px;
    background: var(--dark);
}

.visual-console p {
    margin: 0;
    color: #dce4de;
    font-size: 0.86rem;
    font-weight: 600;
}

.visual-console span {
    color: #8ca99b;
    margin-right: 12px;
}

section {
    padding: 72px 0;
}

.intro {
    background: var(--paper);
}

.intro-grid,
.contact-grid {
    display: grid;
    grid-template-columns: 0.95fr 1.05fr;
    gap: 48px;
    align-items: start;
}

.intro-copy {
    padding-top: 8px;
}

.intro-copy p {
    font-size: 0.98rem;
    line-height: 1.68;
    max-width: 620px;
}

.intro-copy p + p {
    margin-top: 14px;
}

.work,
.contact {
    background: var(--soft);
    border-block: 1px solid var(--line);
}

.section-head {
    max-width: 820px;
    margin-bottom: 32px;
}

.section-head p {
    max-width: 680px;
    margin-top: 8px;
    line-height: 1.6;
}

.section-head.compact {
    max-width: 760px;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    grid-auto-flow: dense;
}

.tile.span-3 { grid-column: span 3; }
.tile.span-4 { grid-column: span 4; }
.tile.span-5 { grid-column: span 5; }
.tile.span-7 { grid-column: span 7; }
.tile.span-8 { grid-column: span 8; }
.tile.span-12 { grid-column: span 12; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.case-card {
    min-height: 216px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: 0 4px 14px rgba(17, 17, 17, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.case-card:nth-child(1) { animation-delay: 0s; }
.case-card:nth-child(2) { animation-delay: 0.1s; }
.case-card:nth-child(3) { animation-delay: 0.2s; }
.case-card:nth-child(4) { animation-delay: 0.3s; }
.case-card:nth-child(5) { animation-delay: 0.4s; }

@media (prefers-reduced-motion: reduce) {
    .case-card {
        animation: none;
        opacity: 1;
    }
}

.case-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(17, 17, 17, 0.12);
    border-color: var(--green);
}

.case-card.span-12 {
    min-height: 152px;
}

.case-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 16px;
}

.case-meta span {
    padding: 5px 9px;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.case-card p,
.capability p,
.experience-row p {
    margin-bottom: 0;
    line-height: 1.58;
    font-size: 0.95rem;
}

.approach {
    background: var(--paper);
}

.capability-grid {
    gap: 16px;
}

.capability {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--paper), var(--soft));
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.capability:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(17, 17, 17, 0.08);
}

.capability i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    background: #e5efe7;
    color: var(--green-dark);
    transition: transform 0.2s ease;
}

:root[data-theme="dark"] .capability i {
    background: rgba(20, 106, 67, 0.2);
}

.capability:hover i {
    transform: scale(1.08);
}

.experience {
    background: var(--paper);
}

.experience-list {
    display: grid;
    border-top: 1px solid var(--line);
}

.experience-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 24px;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
    transition: background 0.2s ease;
}

.experience-row > span {
    color: var(--green-dark);
    font-weight: 700;
    font-size: 0.9rem;
}

.experience-row:hover > span {
    color: var(--green);
}

.credibility {
    display: inline-flex;
    margin-top: 20px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--soft);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.contact-panel {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow);
}

.contact-line {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-weight: 700;
}

.contact-line i {
    color: var(--green);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

.contact-actions {
    margin-top: 18px;
}

.btn.copied {
    animation: slideUp 0.2s ease;
}

.footer {
    padding: 24px 0;
    color: #b8c1ba;
    background: var(--dark);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    font-size: 0.85rem;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 22, 0.62);
    backdrop-filter: blur(6px);
}

.modal-card {
    position: relative;
    width: min(520px, 100%);
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--soft);
    cursor: pointer;
}

.modal-link {
    width: 100%;
    margin-top: 10px;
}

.manual-page {
    background:
        linear-gradient(90deg, rgba(230, 230, 226, 0.42) 1px, transparent 1px),
        linear-gradient(rgba(230, 230, 226, 0.42) 1px, transparent 1px),
        var(--soft);
    background-size: 42px 42px;
}

.manual-shell {
    width: min(980px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 80px;
}

.manual-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 34px;
}

.manual-controls {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 34px;
    color: var(--muted);
    font-weight: 800;
}

.manual-nav .back-link {
    margin-bottom: 0;
}

.manual-hero {
    padding: 44px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.manual-hero h1 {
    max-width: 780px;
    font-size: clamp(2.2rem, 4.6vw, 4rem);
}

.manual-hero p:last-child {
    max-width: 760px;
    margin-bottom: 0;
    font-size: 1rem;
}

.manual-checklist {
    gap: 12px;
    margin: 18px 0;
}

.manual-checklist div {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
}

.manual-checklist strong,
.manual-checklist span {
    display: block;
}

.manual-checklist strong {
    margin-bottom: 6px;
}

.manual-checklist span {
    color: var(--muted);
    font-size: 0.9rem;
}

.manual-section {
    margin-top: 18px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
}

.manual-step {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 16px;
    align-items: start;
}

.manual-step > span {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    color: var(--paper);
    background: var(--dark);
    font-weight: 800;
}

.manual-step h2 {
    margin-bottom: 8px;
    font-size: 1.55rem;
}

.terminal-block {
    position: relative;
    margin-top: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: #0f1714;
}

.terminal-block pre {
    margin: 0;
    padding: 48px 18px 18px;
    overflow-x: auto;
}

.terminal-block code {
    color: #d9e4dd;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.9rem;
    line-height: 1.65;
    white-space: pre;
}

.copy-code {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 7px;
    color: #d9e4dd;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 800;
}

.manual-note {
    margin-top: 16px;
    padding: 14px 16px;
    border-left: 4px solid var(--blue);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--field);
    color: var(--ink);
}

.manual-note.accent {
    border-left-color: var(--amber);
}

.manual-note p {
    margin: 4px 0 0;
}

@media (max-width: 920px) {
    .hero-grid,
    .intro-grid,
    .contact-grid {
        grid-template-columns: 1fr;
    }

    .system-visual {
        min-height: 0;
    }

    .manual-checklist {
        grid-template-columns: 1fr 1fr;
    }

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

    .bento-grid .tile {
        grid-column: auto;
    }

    .bento-grid .tile.span-12 {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .container,
    .hero-grid,
    .nav-container,
    .manual-shell {
        width: min(100% - 28px, 1120px);
    }

    .hamburger {
        display: block;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    .nav-menu {
        position: fixed;
        top: 68px;
        left: 14px;
        right: 14px;
        display: grid;
        gap: 0;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--paper);
        box-shadow: var(--shadow);
        transform: translateY(-14px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .logo-name {
        font-size: 0.82rem;
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .nav-menu li {
        padding: 10px;
    }

    .nav-lang {
        width: fit-content;
    }

    .hero {
        padding-top: 100px;
    }

    .hero-actions .btn,
    .contact-actions .btn {
        width: 100%;
    }

    .manual-checklist {
        grid-template-columns: 1fr;
    }

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

    .bento-grid .tile,
    .bento-grid .tile.span-12 {
        grid-column: auto;
    }

    .case-card,
    .case-card.span-12 {
        min-height: auto;
    }

    .experience-row,
    .manual-step {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .manual-hero,
    .manual-section {
        padding: 20px;
    }

    .footer-inner {
        display: grid;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2.05rem;
    }

    .system-visual {
        padding: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        scroll-behavior: auto !important;
        transition: none !important;
    }
}

@media print {
    @page {
        margin: 12mm;
    }

    .navbar,
    .system-visual,
    .hero-actions,
    .contact-actions,
    .footer,
    .modal,
    .back-link,
    .copy-code {
        display: none !important;
    }

    body,
    .hero,
    .work,
    .contact,
    .manual-page {
        color: #111;
        background: white !important;
    }

    .hero,
    section,
    .manual-shell {
        padding: 16px 0 !important;
    }

    .container,
    .hero-grid,
    .manual-shell {
        width: 100%;
    }

    h1 {
        font-size: 32px;
        line-height: 1.1;
    }

    h2 {
        font-size: 22px;
    }

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

    .bento-grid .tile,
    .bento-grid .tile.span-12 {
        grid-column: auto;
    }

    .case-card,
    .capability,
    .experience-row,
    .manual-section {
        break-inside: avoid;
        box-shadow: none !important;
    }
}
