/* The AI assistant (chat.js), 5 Dec 2026: the button and the panel, in the page's colours turned round like the cookie
   card (--ink the ground, --paper the letters), sharp corners, cut in at 45 degrees. */

/* The button. A computer: top right, one gap under the clock, its right edge on the margin. */
.chat-open { position: fixed; z-index: 1; margin: 0; padding: 14px 16px; border: 0; border-radius: 0;
  right: max(var(--pad), env(safe-area-inset-right)); top: calc(max(var(--pad), env(safe-area-inset-top)) + .75 * var(--small) + var(--gap));
  background: var(--ink); color: var(--paper); font: 400 var(--small)/1 'Unbounded', sans-serif; letter-spacing: .06em;
  text-transform: uppercase; white-space: nowrap; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
  opacity: 0; transition: opacity .4s;
  /* dark letters on light while the page is dark: the small capitals' hairline then (style.css .meta .legal) */
  -webkit-text-stroke: calc((1 - var(--hair)) * .035em) currentColor; }
.chat-open span { display: block; text-box: trim-both cap alphabetic; }
.chat-open.on { opacity: 1; }
.chat-open.on:focus-visible { opacity: .75; outline: none; }
@media (hover: hover) { .chat-open.on:hover { opacity: .75; } }
/* a window taller than wide (a tablet upright): KRA runs the whole width under the clock, so bottom left, one gap over the hint */
@media (min-width: 601px) and (orientation: portrait) {
  .chat-open { right: auto; top: auto; left: max(var(--pad), env(safe-area-inset-left));
    bottom: calc(max(var(--pad), env(safe-area-inset-bottom)) + .75 * var(--small) + var(--gap)); }
}
/* a phone: on the left margin one gap under the networks, in one line (the user, 5 Dec 2026: "na mobu gumb ai asistent
   treba dodat ispod facebook x instagram", "i da ide u jedan red", "sva slova"; it stood beside the big K's foot in two
   lines for an hour). Its top is the first term of style.css --ktop, the line one gap under the networks. On a short
   phone that is the big K's top too: the button then stands in the K's cut top left corner, clear of its ink. */
@media (max-width: 600px) {
  .chat-open { right: auto; left: max(var(--pad), env(safe-area-inset-left)); padding: 12px;
    top: calc(var(--pad) + 4 * var(--gap) + .785 * var(--col) + .75 * var(--small) + .75 * clamp(20px, 6.2vw, 35px) + .75 * var(--small));
    -webkit-text-stroke-width: calc((1 - var(--hair)) * .03em); }
}

/* The lens travels through the open panel too, in difference as everywhere (the panel is under it: z-index 3, the flip's
   copy 4, the lens 5); over the panel's buttons and its field it shrinks away, as over any link (home.js) */
.mouse:not(.idle) .chat textarea { cursor: text; }

/* The panel. A computer: from the button's place down the right margin, cut in from its top right corner. */
.chat { position: fixed; z-index: 3; display: flex; flex-direction: column; margin: 0;
  right: max(var(--pad), env(safe-area-inset-right)); top: calc(max(var(--pad), env(safe-area-inset-top)) + .75 * var(--small) + var(--gap));
  width: min(440px, calc(100vw - 2 * var(--pad)));
  height: min(640px, calc(100vh - 2 * var(--pad) - .75 * var(--small) - var(--gap)));
  background: var(--ink); color: var(--paper); font-family: 'Unbounded', sans-serif; font-weight: 300;
  -webkit-user-select: text; user-select: text;
  visibility: hidden; clip-path: polygon(100% 0, 100% 0, 100% 0);
  transition: clip-path .5s cubic-bezier(.7, 0, .3, 1), visibility 0s .5s; }
.chat.open { visibility: visible; clip-path: polygon(100% 0, calc(100% - 2400px) 0, 100% 2400px);
  transition: clip-path .5s cubic-bezier(.7, 0, .3, 1), visibility 0s; }
/* the panel on the page's own ground since the late evening of 5 Dec 2026 (the user: black on the black page, white on
   the white one): its own --ink and --paper, the page's swapped, also in the flip's copy; a faint edge shows where it ends */
.chat { --ink: #0A0A0A; --paper: #F5F5F5; --hair: 1; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--paper) 14%, var(--ink)); }
.inv .chat, .flip-layer.inv .chat { --ink: #F5F5F5; --paper: #0A0A0A; --hair: 0; }
.flip-layer:not(.inv) .chat { --ink: #0A0A0A; --paper: #F5F5F5; --hair: 1; }
.chat p { margin: 0; }
/* the head: the name, under it the note, the X beside them; a line under it */
.chat-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 8px 8px 16px 22px; box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--paper) 14%, var(--ink)); }
.chat-top { flex: 1; min-width: 0; padding-top: 16px; }
.chat-title { min-height: 1em; font: 800 17px/1 'Archivo Expanded', sans-serif; letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap; -webkit-text-stroke: calc((1 - var(--hair)) * .006em) currentColor; }
.chat button, .chat-button { border: 0; border-radius: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: opacity .15s; }
.chat-close { width: 44px; height: 44px; padding: 14px; background: transparent; color: inherit; }
.chat-close svg { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }

.chat-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 20px 22px 18px;
  scrollbar-width: thin; scrollbar-color: var(--paper) transparent; }
.chat-msg { max-width: 94%; font-size: 12.5px; line-height: 1.6; letter-spacing: .01em; white-space: pre-wrap; overflow-wrap: anywhere;
  -webkit-text-stroke: calc((1 - var(--hair)) * .035em) currentColor; }
/* the visitor's words: a block in the page's own colours */
.chat-msg.me { align-self: flex-end; padding: 10px 12px; background: var(--paper); color: var(--ink);
  -webkit-text-stroke-width: calc(var(--hair) * .03em); }
.chat-wait { font-weight: 400; letter-spacing: .2em; }
/* a shade off the panel (#131313 on the dark one), with an edge a little lighter still */
.chat-msg.chat-hello { padding: 14px 16px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--paper) 10%, var(--ink)); }
/* the suggested questions: outlines in rows over the field, until the first question */
.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 22px 16px; }
.chat .chat-chip { padding: 10px 12px; background: transparent; color: inherit; box-shadow: inset 0 0 0 1px currentColor;
  font: 300 11.5px/1.4 'Unbounded', sans-serif; letter-spacing: .01em; text-align: left;
  -webkit-text-stroke: calc((1 - var(--hair)) * .035em) currentColor; }
/* the enquiry the assistant put together, and its two buttons */
.chat-mail { align-self: stretch; padding: 14px; box-shadow: inset 0 0 0 1px currentColor; font-size: 12px; line-height: 1.6; letter-spacing: .01em;
  -webkit-text-stroke: calc((1 - var(--hair)) * .035em) currentColor; }
.chat-mail-subject { font-weight: 400; margin-bottom: 8px !important; }
.chat-mail-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 14px !important; }
.chat-mail-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-button, .chat .chat-send { display: inline-block; padding: 15px 16px; background: var(--paper); color: var(--ink); text-decoration: none;
  font: 400 11px/1 'Unbounded', sans-serif; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  -webkit-text-stroke: calc(var(--hair) * .03em) currentColor; }
.chat .chat-button-line { background: transparent; color: inherit; box-shadow: inset 0 0 0 1px currentColor;
  -webkit-text-stroke-width: calc((1 - var(--hair)) * .035em); }

/* Cloudflare Turnstile's widget (chat.js prove): nothing to see unless Cloudflare asks for a click */
/* no room at all until Cloudflare asks for a click; then as far over the field's line as under the questions */
.chat-check { height: 0; padding: 0 22px; overflow: hidden; line-height: 0; }
.chat-check.on { height: auto; padding-bottom: 16px; }
.chat-form { display: flex; align-items: flex-end; gap: 10px; padding: 14px 22px 18px; box-shadow: inset 0 1px 0 color-mix(in srgb, var(--paper) 14%, var(--ink)); }
.chat-field { flex: 1; min-width: 0; height: 44px; min-height: 44px; margin: 0; padding: 12px 0; border: 0; border-radius: 0; outline: none; resize: none;
  background: transparent; color: inherit; box-shadow: inset 0 -1px 0 currentColor; -webkit-appearance: none; appearance: none;
  font: 300 13px/20px 'Unbounded', sans-serif; letter-spacing: .01em; scrollbar-width: none; }
.chat-field::placeholder { color: inherit; opacity: .55; }
.chat-field:focus-visible { box-shadow: inset 0 -2px 0 currentColor; }
.chat .chat-send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; }
.chat-send svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.chat .chat-send:disabled { opacity: .4; cursor: default; }
.chat-note { padding: 0; margin-top: 12px !important; font-size: 9px; line-height: 1.6; letter-spacing: .02em; font-weight: 400;
  -webkit-text-stroke: calc((1 - var(--hair)) * .035em) currentColor; }
.chat-note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.chat :is(button, a):focus-visible { opacity: .75; outline: none; }
@media (hover: hover) { .chat :is(button, .chat-button):not(:disabled):hover { opacity: .75; } .chat-note a:hover { text-decoration: none; } }

/* a phone: the whole screen (what the keyboard leaves of it: chat.js --vh, --vt), cut in from the bottom left, where the button is */
@media (max-width: 600px) {
  .chat { left: 0; right: auto; top: 0; width: 100%; height: var(--vh, 100dvh); transform: translateY(var(--vt, 0px));
    clip-path: polygon(0 100%, 0 100%, 0 100%); }
  .chat.open { clip-path: polygon(0 100%, 0 calc(100% - 2400px), 2400px 100%); }
  .chat-head { padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left)); }
  .chat-title { font-size: 15px; }
  .chat-log { padding: 16px max(20px, env(safe-area-inset-right)) 16px max(20px, env(safe-area-inset-left)); }
  .chat-chips { padding: 0 max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left)); }
  .chat-check { padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left)); }
  .chat-form { padding: 12px max(20px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
  /* 16 px: under that iOS zooms the page in when the field is touched */
  .chat-field { font-size: 16px; }
  html.chat-on .lens { display: none; }
}
@media (prefers-reduced-motion: reduce) { .chat, .chat.open, .chat-open { transition: none; } }
