/* Tinyjob web — shared styles for the landing, Telegram guide and chat pages. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/bricolage.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/assets/atkinson-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/assets/atkinson-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper: #F5F7F4;
  --surface: #FFFFFF;
  --ink: #1E2A2F;
  --muted: #5D6A70;
  --rule: #D9DFDC;
  --thread: #C8253A;
  --gum: #24483F;
  --gum-hover: #1A3730;
  --gum-tint: #E4EDE9;
  --bubble-user: #24483F;
  --bubble-user-ink: #FFFFFF;
  --focus: #C8253A;
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  --text: "Atkinson Hyperlegible", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131B1E;
    --surface: #1B2529;
    --ink: #E8EDEA;
    --muted: #A2AFAB;
    --rule: #2F3C40;
    --thread: #F0566A;
    --gum: #7FC2AC;
    --gum-hover: #9AD3BF;
    --gum-tint: #22352F;
    --bubble-user: #2F5A4F;
    --bubble-user-ink: #F2F7F4;
    --focus: #F0566A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--text);
}

a { color: var(--gum); text-underline-offset: 3px; }
a:hover { color: var(--gum-hover); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Site header ─────────────────────────────────────────── */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 22px;
  padding-bottom: 22px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.45rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.wordmark:hover { color: var(--ink); }
.wordmark svg { width: 26px; height: 26px; flex: none; }

.site-nav { display: flex; gap: 20px; font-size: 0.98rem; }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--ink); text-decoration: underline; }

/* ── Buttons and fields ──────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 2px solid var(--gum);
  border-radius: 999px;
  background: var(--gum);
  color: var(--surface);
  font: 700 1rem/1 var(--text);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--gum-hover); border-color: var(--gum-hover); color: var(--surface); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.btn-quiet {
  background: transparent;
  color: var(--gum);
}
.btn-quiet:hover { background: var(--gum-tint); color: var(--gum-hover); }

.link-button {
  border: 0;
  padding: 0;
  background: none;
  color: var(--gum);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-button[disabled] { color: var(--muted); text-decoration: none; cursor: default; }

.field { display: grid; gap: 6px; }
.field label { font-weight: 700; font-size: 0.95rem; }
.field input {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: 2px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 1.05rem var(--text);
}
.field input:focus { border-color: var(--gum); outline: none; }
.field input:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--gum-tint); }

.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1 1 240px; }

.hint { color: var(--muted); font-size: 0.93rem; margin: 8px 0 0; }
.error { color: var(--thread); font-weight: 700; font-size: 0.95rem; margin: 8px 0 0; }
.error:empty, .hint:empty { display: none; }

/* ── Landing hero ────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
  padding-top: 40px;
  padding-bottom: 72px;
}

.hero h1 {
  font-size: clamp(2.3rem, 5.2vw, 3.9rem);
  font-weight: 800;
  max-width: 13ch;
}

.hero-lede {
  max-width: 34em;
  margin: 22px 0 30px;
  color: var(--muted);
  font-size: 1.12rem;
}

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

/* The example introduction: two people joined by a red thread. */
.introduction {
  position: relative;
  margin: 0;
  padding: 28px 0;
}
.introduction .thread {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.introduction .thread path {
  fill: none;
  stroke: var(--thread);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.introduction .knot { fill: var(--thread); }

@media (prefers-reduced-motion: no-preference) {
  .introduction .thread path {
    stroke-dashoffset: 1;
    animation: tie 1.6s 0.5s cubic-bezier(.6,.05,.3,1) forwards;
  }
  .introduction .knot { opacity: 0; animation: appear 0.3s 2s forwards; }
}
@keyframes tie { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: 1; } }

.person {
  position: relative;
  max-width: 330px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 18px;
  font-size: 0.98rem;
}
.person + .person { margin-top: 104px; margin-left: auto; }
.person .who {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}
.person p { margin: 0; }

.matched-note {
  position: relative;
  margin: 18px 0 0 auto;
  max-width: 330px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: right;
}

/* ── Landing: ways in ────────────────────────────────────── */

.ways {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  border-top: 1px solid var(--rule);
}
.way { padding-top: 44px; padding-bottom: 52px; }
.way + .way { padding-left: 48px; border-left: 1px solid var(--rule); }
.way:first-child { padding-right: 48px; }
.way h2 { font-size: 1.7rem; font-weight: 700; margin-bottom: 12px; }
.way > p { margin: 0 0 22px; max-width: 32em; color: var(--muted); }

.uses {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  padding-top: 52px;
  padding-bottom: 64px;
  border-top: 1px solid var(--rule);
}
.uses > div:first-child { padding-right: 48px; }
.uses > div + div { padding-left: 49px; }
.uses h2 { font-size: 1.35rem; font-weight: 700; margin-bottom: 10px; }
.uses ul { margin: 0; padding-left: 1.1em; color: var(--muted); }
.uses li + li { margin-top: 6px; }

.site-footer {
  border-top: 1px solid var(--rule);
  padding-top: 22px;
  padding-bottom: 40px;
  color: var(--muted);
  font-size: 0.92rem;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.site-footer a { color: var(--muted); }

/* ── Telegram guide ──────────────────────────────────────── */

.guide { max-width: 720px; padding-top: 24px; padding-bottom: 64px; }
.guide h1 { font-size: clamp(2rem, 4.5vw, 2.9rem); font-weight: 800; }
.guide .lede { color: var(--muted); font-size: 1.1rem; margin: 16px 0 36px; max-width: 34em; }

.steps { list-style: none; margin: 0 0 48px; padding: 0; counter-reset: step; }
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 30px 64px;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -4px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 2px solid var(--thread);
  border-radius: 50%;
  color: var(--thread);
  font: 800 1.1rem/1 var(--display);
}
.steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 40px;
  bottom: 4px;
  border-left: 2px solid var(--rule);
}
.steps h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 6px; }
.steps p { margin: 0 0 10px; color: var(--muted); }
.steps .btn { margin-top: 6px; }
.open-ways { margin: 0 0 12px; padding-left: 1.1em; color: var(--muted); }
.open-ways li { margin-bottom: 6px; }
.qr { margin: 18px 0 0; display: flex; width: max-content; flex-direction: column; align-items: center; gap: 8px; }
/* Always dark-on-white, whatever the theme, so phone cameras can read it. */
.qr img { display: block; width: 168px; height: 168px; padding: 10px; background: #FFFFFF; border: 1px solid var(--rule); border-radius: 12px; }
.qr figcaption { font-size: 0.9rem; color: var(--muted); }

.guide-section { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.guide-sub { color: var(--muted); margin: 0 0 12px; }

.command-list { margin: 0 0 40px; padding: 0; display: grid; gap: 0; }
.command-list div {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.command-list dt { font-weight: 700; }
.command-list dd { margin: 0; color: var(--muted); }

.aside {
  padding: 20px 22px;
  border-left: 4px solid var(--gum);
  background: var(--gum-tint);
  border-radius: 0 12px 12px 0;
}
.aside p { margin: 0; }

/* ── Chat app ────────────────────────────────────────────── */

.app-body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.app-body > .site-header { width: 100%; }

.signin {
  width: 100%;
  max-width: 460px;
  margin: 6vh auto 48px;
  padding: 0 24px;
}
.signin h1 { font-size: 2.1rem; font-weight: 800; margin-bottom: 10px; }
.signin > p { color: var(--muted); margin: 0 0 26px; }
.signin form { display: grid; gap: 14px; }
.signin .btn { width: 100%; }
.signin .alt { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 0.95rem; }

.chat {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  min-height: 0;
}
.chat-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.93rem;
  color: var(--muted);
}
.chat-bar .account-group { display: flex; align-items: center; gap: 16px; min-width: 0; }
.chat-bar .account { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wordmark-small { font-size: 1.15rem; gap: 8px; flex: none; }
.wordmark-small svg { width: 21px; height: 21px; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg { max-width: min(85%, 560px); }
.msg .bubble {
  padding: 12px 16px;
  border-radius: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.bot .bubble { background: var(--surface); border: 1px solid var(--rule); border-top-left-radius: 6px; }
.msg.user { align-self: flex-end; }
.msg.user .bubble { background: var(--bubble-user); color: var(--bubble-user-ink); border-top-right-radius: 6px; }
.msg .bubble a { color: inherit; }
.msg .bubble code { font-size: 0.92em; }

/* Menus under bot messages (laid out by kind in app.js renderButtons). */
.msg.has-menu { width: 100%; max-width: 620px; }
.msg.has-menu .bubble { max-width: min(100%, 560px); width: fit-content; }

.menu { margin-top: 10px; }
.menu.folded { display: none; }

.menu-home { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 18px 18px 20px;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.tile svg {
  width: 30px;
  height: 30px;
  margin-bottom: 6px;
  fill: none;
  stroke: var(--thread);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tile-title { font: 700 1.2rem/1.2 var(--display); letter-spacing: -0.01em; }
.tile-text { color: var(--muted); font-size: 0.95rem; line-height: 1.45; }
.tile:hover { border-color: var(--gum); box-shadow: inset 0 0 0 1px var(--gum); }

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
}
.option {
  display: grid;
  gap: 2px;
  padding: 13px 16px 14px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.option:nth-child(odd) { border-right: 1px solid var(--rule); }
.option-wide { grid-column: 1 / -1; border-right: 0 !important; }
.option:hover { background: var(--gum-tint); }
.option-title { font-weight: 700; }
.option-hint { color: var(--muted); font-size: 0.88rem; line-height: 1.35; }
.option-hint:empty { display: none; }
.option.is-destructive .option-title { color: var(--thread); }
.menu-grid .menu-nav { grid-column: 1 / -1; padding: 10px 16px 12px; margin: 0; }

.menu-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  min-height: 40px;
  padding: 6px 16px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 700 0.95rem/1.2 var(--text);
  cursor: pointer;
}
.pill:hover { border-color: var(--gum); color: var(--gum); }

.menu-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

.menu-nav { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 10px; }
.nav-link {
  border: 0;
  padding: 4px 0;
  background: none;
  color: var(--muted);
  font: 0.93rem var(--text);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 4px;
  cursor: pointer;
}
.nav-link:hover { color: var(--ink); text-decoration-color: currentColor; }
.unfold { margin-top: 6px; }

.menu button[disabled] { opacity: 0.5; cursor: progress; }
.is-destructive.choice, .is-destructive.pill { color: var(--thread); border-color: var(--thread); }

.menu-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 700 0.92rem var(--text);
  cursor: pointer;
}
.menu-button:hover { border-color: var(--gum); color: var(--gum); }
.choice {
  min-height: 42px;
  padding: 8px 16px;
  border: 2px solid var(--gum);
  border-radius: 999px;
  background: transparent;
  color: var(--gum);
  font: 700 0.97rem/1.2 var(--text);
  text-align: left;
  cursor: pointer;
}
.choice:hover { background: var(--gum-tint); }
.choice[disabled] { opacity: 0.5; cursor: not-allowed; }

.cmd {
  border: 0;
  padding: 0;
  background: none;
  color: var(--gum);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.msg.user .cmd { color: inherit; }

.working { color: var(--muted); font-size: 0.93rem; padding-left: 4px; }
.working[hidden] { display: none; }

.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--rule);
  background: var(--paper);
}
.composer textarea {
  flex: 1;
  min-height: 50px;
  max-height: 180px;
  padding: 13px 16px;
  border: 2px solid var(--rule);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  font: 1rem/1.4 var(--text);
  resize: none;
}
.composer textarea:focus { border-color: var(--gum); outline: none; }
.composer textarea:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--gum-tint); }

.empty-chat { margin: auto; text-align: center; color: var(--muted); max-width: 28em; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Checkboxes, tags, account page ──────────────────────── */

.check { display: flex; align-items: center; gap: 10px; font-size: 0.97rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--gum); flex: none; }

.optional { color: var(--muted); font-weight: 400; font-size: 0.88rem; margin-left: 4px; }

.tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 7px 10px;
  border: 2px solid var(--rule);
  border-radius: 12px;
  background: var(--surface);
  cursor: text;
}
.tag-input:focus-within { border-color: var(--gum); box-shadow: 0 0 0 3px var(--gum-tint); }
.tag-input .tags { display: contents; list-style: none; }
.tag-input input {
  flex: 1 1 160px;
  min-width: 0;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 1rem var(--text);
}
.tag-input input:focus { outline: none; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 4px 3px 12px;
  border-radius: 999px;
  background: var(--gum-tint);
  color: var(--gum-hover);
  font-weight: 700;
  font-size: 0.93rem;
}
.tag button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.tag button:hover { background: var(--surface); }

.account-page { max-width: 880px; padding-top: 16px; padding-bottom: 72px; }
.account-page h1 { font-size: clamp(2rem, 4.5vw, 2.7rem); font-weight: 800; }
.account-page .lede { color: var(--muted); margin: 8px 0 28px; }
.account-section {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: 32px;
  padding: 32px 0;
  border-top: 1px solid var(--rule);
}
.account-section > .hint { grid-column: 2; margin: 0; }
.section-intro h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 6px; }
.section-intro p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.account-section form { display: grid; gap: 18px; max-width: 520px; }
.form-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.status { margin: 0; color: var(--gum); font-weight: 700; font-size: 0.95rem; }
.status:empty { display: none; }

.chat-bar a.account {
  max-width: 34vw;
  color: var(--muted);
  text-decoration: none;
}
.chat-bar a.account:hover { color: var(--ink); text-decoration: underline; }

/* ── Small screens ───────────────────────────────────────── */

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 16px; padding-bottom: 48px; }
  .ways { grid-template-columns: 1fr; }
  .way:first-child { padding-right: 0; }
  .way + .way { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .uses { grid-template-columns: 1fr; gap: 32px; }
  .account-section { grid-template-columns: 1fr; gap: 18px; }
  .account-section > .hint { grid-column: 1; }
  .uses > div:first-child, .uses > div + div { padding-left: 0; padding-right: 0; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .site-nav { gap: 14px; font-size: 0.92rem; }
  .person + .person { margin-top: 64px; }
  .steps > li { padding-left: 56px; }
  .command-list div { grid-template-columns: 1fr; gap: 2px; }
  .messages, .chat-bar { padding-left: 16px; padding-right: 16px; }
  .composer { padding: 12px 16px 16px; }
  .msg { max-width: 92%; }
  .menu-home, .menu-grid { grid-template-columns: 1fr; }
  .option:nth-child(odd) { border-right: 0; }
  .chat-bar .account-group { gap: 12px; }
}
