:root {
  --ink: #1d2430;
  --ink-soft: #57606e;
  --bg: #fbfaf8;
  --bg-alt: #f2efe9;
  --accent: #9a6b2f;
  --accent-dark: #7d5623;
  --line: #e4dfd6;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 640px; }
h1, h2, h3 { line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); margin: 0 0 1rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 .5rem; }
h3 { font-size: 1.1rem; margin: 0 0 .4rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--ink-soft); font-size: .95rem; }

.btn {
  display: inline-block; padding: .7rem 1.4rem; border-radius: 999px;
  background: var(--accent); color: #fff; text-decoration: none; font-weight: 600;
  border: 0; cursor: pointer; font-size: 1rem; transition: background .15s;
}
.btn:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.btn-ghost:hover { background: rgba(154,107,47,.08); }
.btn-sm { padding: .4rem 1rem; font-size: .9rem; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251,250,248,.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.brand span { color: var(--accent); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 1.4rem; }
.nav a { color: var(--ink); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--accent); }
.nav a.btn { color: #fff; }

/* Hero */
.hero { padding: clamp(4rem, 10vw, 7.5rem) 0; background:
  linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%); }
.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 34rem; }
.hero-actions { display: flex; gap: .8rem; margin-top: 1.6rem; flex-wrap: wrap; }

/* Sections */
.section { padding: clamp(3rem, 7vw, 5rem) 0; }
.section-alt { background: var(--bg-alt); }
.section-sub { color: var(--ink-soft); margin-bottom: 2rem; }

/* Cards */
.grid { display: grid; gap: 1.2rem; }
.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 1.6rem; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
}
.card p { color: var(--ink-soft); margin: 0; font-size: .95rem; }

/* Gallery */
.gallery { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 1.6rem; }
.proj {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.proj:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(29,36,48,.08); }
.proj img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.proj .proj-body { padding: 1rem 1.2rem 1.2rem; }
.proj .proj-cat { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.proj h3 { margin: .2rem 0 .3rem; }
.proj p { color: var(--ink-soft); font-size: .9rem; margin: 0; }

/* Form */
.form { display: grid; gap: 1rem; margin-top: 1.4rem; }
.form label { display: grid; gap: .35rem; font-weight: 600; font-size: .92rem; }
.form input, .form select, .form textarea {
  font: inherit; padding: .65rem .8rem; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink); font-weight: 400;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent;
}

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 2rem 0; color: var(--ink-soft); font-size: .9rem; }

/* Lightbox */
#lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(15,17,22,.92);
  display: flex; align-items: center; justify-content: center; padding: 2rem;
}
#lightbox[hidden] { display: none; }
#chat-panel[hidden], #chat-fab[hidden] { display: none; }
#lightbox figure { margin: 0; max-width: 100%; max-height: 100%; text-align: center; }
#lightbox img { max-width: 100%; max-height: 86dvh; border-radius: 8px; }
#lightbox figcaption { color: #cbd2dc; margin-top: .6rem; font-size: .9rem; }
#lightbox button {
  position: absolute; font-size: 2rem; color: #fff;
  background: none; border: 0; cursor: pointer;
}
#lb-close { top: 1rem; right: 1.2rem; }
.lb-nav { top: 50%; transform: translateY(-50%); font-size: 3rem !important; padding: 0 1rem; }
#lb-prev { left: .5rem; }
#lb-next { right: .5rem; }

/* Chat widget */
#chat-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  display: flex; align-items: center; gap: .55rem;
  padding: .6rem 1.1rem .6rem .6rem; border-radius: 999px; border: 0;
  background: var(--ink); color: #fff; font-weight: 600; font-size: .95rem;
  cursor: pointer; box-shadow: 0 6px 20px rgba(29,36,48,.25);
}
#chat-fab img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #2a3242; }
#chat-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 95;
  width: min(380px, calc(100vw - 40px)); height: min(560px, calc(100dvh - 40px));
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 16px 48px rgba(29,36,48,.22);
}
.chat-header {
  display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem;
  background: var(--ink); color: #fff;
}
.chat-header .chat-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #2a3242; }
.chat-header small { display: block; color: #b9c1cd; font-size: .75rem; }
.chat-header button { margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }
.chat-log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; }
.msg { max-width: 85%; padding: .6rem .85rem; border-radius: 14px; font-size: .93rem; white-space: pre-wrap; }
.msg.bot { background: var(--bg-alt); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.typing { color: var(--ink-soft); font-style: italic; }
.chat-form { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; font: inherit; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 999px; }
.chat-form button {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent);
  color: #fff; cursor: pointer; font-size: 1rem;
}

@media (max-width: 640px) {
  .nav a:not(.btn) { display: none; }
  .hero-actions .btn { flex: 1; text-align: center; }
}
