/* ─── FONTS ─── */
@font-face {
    font-family: 'Panic';
    src: url('panic.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* ─── RESET ─── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ─── VARIABLES ─── */
:root {
    --ink:        #111110;
    --paper:      #f0ede6;
    --paper-mid:  #c4c0b7;
    --dot:        #4a4740;
    --ff-d: 'Bebas Neue', Impact, 'Arial Narrow', sans-serif;
    --ff-m: 'Space Mono', 'Courier New', monospace;
}

html { scroll-behavior: smooth; cursor: url('mouse.png'), auto; }


body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--ff-m);
    font-size: 14px;
    line-height: 1.6;
}

/* ─── NAV ─────────────────────────────────────────────────────────── */
/*  mix-blend-mode: difference makes white text appear as the inverse  */
/*  of whatever background sits beneath it — dark on light, light on  */
/*  dark — so the nav stays legible everywhere without a bg fill.      */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 2.5rem;
    mix-blend-mode: hard-light;
    background-color: #494646;
    border-radius: 25px;

}

.nav-brand {
    font-family: 'Panic', var(--ff-d);
    font-size: 2.5rem;
    letter-spacing: 0.04em;
    color: #fff;
}

.logo {
    height: 75px;
    width: auto;
}

.zoom {
  transition: transform .2s; /* Animation */
}

.zoom:hover {
  transform: scale(1.5); /* (150% zoom - Note: if the zoom is too large, it will go outside of the viewport) */
}

.nav-links { display: flex; gap: 2.5rem; }

.nav-links a {
    font-family: var(--ff-m);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #fff;
    text-decoration: none;
}


.nav-links a:hover { text-decoration: underline; }

/* ─── HERO ─── */
.hero {
    position: relative;
    height: 100vh;
    height: 100svh;
    min-height: 480px;
    overflow: hidden;
    background-color: var(--paper-mid);
    background-image: url('background.png');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-title {
    position: relative;
    z-index: 10;
    width: clamp(280px, 65vw, 700px);
    height: auto;
    pointer-events: auto;
    user-select: none;
    cursor: default;
    will-change: transform;
    animation: hero-title-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both,
               hero-float 4s ease-in-out 1.1s infinite;
}

.figure-anchor {
    position: absolute;
    display: block;
}

.figure-anchor-left {
    bottom: -150px;
    left: 3%;
    width: 22vw;
    height: 70vh;
}

.figure-anchor-right {
    bottom: -75px;
    right: -1%;
    width: 22vw;
    height: 70vh;
}

.figure {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: bottom;
    color: #1b1916;
    display: block;
    pointer-events: auto;
    cursor: pointer;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.figure-left:hover,
.figure-right:hover {
    animation: rattle 0.3s ease-in-out 2 !important;
}

/* Film grain / noise overlay */
.hero-grain {
    position: absolute;
    inset: 0;
    z-index: 15;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-size: 300px 300px;
    opacity: 0.13;
    mix-blend-mode: multiply;
    pointer-events: none;
}


@keyframes bob {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%       { transform: translateX(-50%) translateY(8px); }
}

/* ─── SECTIONS ─── */
.section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 5.5rem 2.5rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.section-title {
    font-family: var(--ff-d);
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    letter-spacing: 0.06em;
    white-space: nowrap;
    line-height: 1;
}

.divider {
    flex: 1;
    height: 2px;
    background: var(--ink);
}

/* ─── PROJECT GRID ─── */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    border: 2px solid var(--ink);
}

.card {
    padding: 2rem 1.8rem;
    border: 1px solid var(--ink);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: background 0.15s, color 0.15s;
}

.card:hover {
    background: var(--ink);
    color: var(--paper);
}

.card-num {
    font-family: var(--ff-d);
    font-size: 3.5rem;
    line-height: 1;
    opacity: 0.11;
}

.card-title {
    font-family: var(--ff-d);
    font-size: 1.5rem;
    letter-spacing: 0.05em;
    line-height: 1.1;
}

.card-desc {
    font-size: 0.76rem;
    line-height: 1.8;
    opacity: 0.62;
    flex: 1;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    list-style: none;
}

.tags li {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1.5px solid currentColor;
    padding: 0.15rem 0.45rem;
}

.card-link {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: inherit;
    text-decoration: none;
    margin-top: auto;
    padding-top: 0.5rem;
}

.card-link:hover { text-decoration: underline; }

/* ─── CONTACT ─── */
.contact { border-top: 2px solid var(--ink); }

.contact-line {
    font-family: var(--ff-m);
    font-size: clamp(2.5rem, 7vw, 6rem);
    letter-spacing: 0.03em;
    line-height: 1;
    margin-bottom: 2.5rem;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.contact-link {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
}

.contact-link::before {
    content: '\2192';
    opacity: 0.3;
    transition: opacity 0.15s, transform 0.15s;
}

.contact-link:hover::before {
    opacity: 1;
    transform: translateX(4px);
}

/* ─── FOOTER ─── */
.footer {
    max-width: 1200px;
    margin: 0 auto;
    border-top: 1px solid var(--ink);
    padding: 1.2rem 2.5rem;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0.38;
}

/* ─── RESPONSIVE ─── */

/* Cleaner taps on mobile — no flash highlight, no 300ms delay */
a, button { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }

@media (max-width: 768px) {
    /* Nav */
    .nav          { padding: 0.6rem 1.5rem; }
    .logo         { height: 50px; }
    .nav-links    { gap: 1.5rem; }
    .nav-links a  { font-size: 0.9rem; letter-spacing: 0.12em; }

    /* Hero */
    .hero-title   { width: clamp(180px, 72vw, 500px); }
    .figure-anchor-left  { width: 32vw; height: 75vh; bottom: -30px; }
    .figure-anchor-right { width: 32vw; height: 75vh; bottom: -30px; }

    /* Content */
    .section      { padding: 3.5rem 1.5rem; }
    .grid         { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    /* Nav */
    .nav          { padding: 0.5rem 1rem; }
    .logo         { height: 36px; }
    .nav-links    { gap: 1rem; }
    .nav-links a  { font-size: 0.7rem; letter-spacing: 0.08em; }

    /* Hero */
    .hero-title   { width: clamp(160px, 82vw, 300px); }
    .figure-anchor-left  { width: 42vw; height: 72vh; bottom: -50px; left: 0; }
    .figure-anchor-right { width: 42vw; height: 72vh; bottom: -30px; right: 0; }

    /* Content */
    .section      { padding: 2.5rem 1rem; }
    .grid         { grid-template-columns: 1fr; }
    .card         { padding: 1.5rem 1.2rem; }
    .contact-line { font-size: 2rem; }
}

/* ─── ANIMATIONS ─── */

@keyframes rattle {
    0%   { transform: translate(0,    0) rotate(0deg);    }
    20%  { transform: translate(-4px, 0) rotate(-1.5deg); }
    40%  { transform: translate( 4px, 0) rotate( 1.5deg); }
    60%  { transform: translate(-3px, 0) rotate(-1deg);   }
    80%  { transform: translate( 3px, 0) rotate( 1deg);   }
    100% { transform: translate(0,    0) rotate(0deg);    }
}

/* Hero entrance keyframes */
@keyframes hero-title-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}
@keyframes fig-in {
    from { opacity: 0; transform: translateY(52px); }
    to   { opacity: 1; transform: none; }
}
@keyframes hero-float {
    0%, 100% { transform: translateY(0);    }
    50%       { transform: translateY(-15px); }
}
@keyframes figure-idle-left {
    0%, 100% { transform: translateY(0)    rotate(0deg);    }
    50%       { transform: translateY(-6px) rotate(-1deg); }
}
@keyframes figure-idle-right {
    0%, 100% { transform: translateY(0)    rotate(0deg);   }
    50%       { transform: translateY(-6px) rotate(1deg); }
}
/* Entrance on the wrapper — never re-triggered by hover */
.figure-anchor-left  { animation: fig-in 1s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both; }
.figure-anchor-right { animation: fig-in 1s cubic-bezier(0.16, 1, 0.3, 1) 0.18s both; }
/* Idle on the image — hover only replaces this, not the entrance */
.figure-left  { animation: figure-idle-left  3.5s ease-in-out 1.1s infinite; }
.figure-right { animation: figure-idle-right 3.5s ease-in-out 1.5s infinite; }

/* Section header — title slides up, divider grows from left */
.section-header .section-title {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.section-header .divider {
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 0.75s cubic-bezier(0.16, 1, 0.3, 1) 0.12s;
}
.section-header.in-view .section-title {
    opacity: 1;
    transform: none;
}
.section-header.in-view .divider {
    transform: scaleX(1);
}

/* Generic scroll reveal — fade + slide up */
.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.55s ease, transform 0.55s ease;
    transition-delay: var(--delay, 0ms);
}
.reveal.in-view {
    opacity: 1;
    transform: none;
}

/* Respect reduced-motion preference */
/* ─── CHATBOT ─── */
.chat-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.chat-widget.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.chat-bubble {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--paper);
    border: none;
    cursor: pointer;
    font-family: var(--ff-d);
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

.chat-bubble:hover { transform: scale(1.1); }

.chat-window {
    width: 300px;
    border: 2px solid var(--ink);
    background: var(--paper);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.97);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-window.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.chat-header {
    background: var(--ink);
    color: var(--paper);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-family: var(--ff-d);
    font-size: 1rem;
    letter-spacing: 0.08em;
}

.chat-close {
    background: none;
    border: none;
    color: var(--paper);
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    padding: 0;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.chat-close:hover { opacity: 1; }

.chat-messages {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 220px;
    overflow-y: auto;
    font-family: var(--ff-m);
    font-size: 0.72rem;
    line-height: 1.6;
}

.chat-msg {
    max-width: 82%;
    padding: 0.45rem 0.7rem;
    border: 1.5px solid var(--ink);
}

.chat-msg.bot  { align-self: flex-start; background: var(--paper); }
.chat-msg.user { align-self: flex-end; background: var(--ink); color: var(--paper); }
.chat-msg.typing { align-self: flex-start; opacity: 0.4; letter-spacing: 0.25em; }

.chat-input-row {
    display: flex;
    border-top: 2px solid var(--ink);
}

.chat-input {
    flex: 1;
    border: none;
    padding: 0.65rem 0.8rem;
    font-family: var(--ff-m);
    font-size: 0.72rem;
    background: var(--paper);
    color: var(--ink);
    outline: none;
}

.chat-send {
    border: none;
    border-left: 2px solid var(--ink);
    background: var(--ink);
    color: var(--paper);
    padding: 0 1rem;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s;
}

.chat-send:hover { background: #333; }

@media (prefers-reduced-motion: reduce) {
    .figure-anchor-left, .figure-anchor-right, .figure-left, .figure-right, .hero-title { animation: none !important; }
    .figure-left:hover, .figure-right:hover { animation: none !important; }
    .section-header .section-title { opacity: 1 !important; transform: none !important; transition: none !important; }
    .section-header .divider { transform: scaleX(1) !important; transition: none !important; }
    .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}
