/** fetch tool styles */
.fetch-result {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.fetch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-1);
}

.status-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

.status-badge.success {
  background-color: #d1fae5;
  color: #065f46;
}

.status-badge.redirect {
  background-color: #dbeafe;
  color: #1e40af;
}

.status-badge.client-error {
  background-color: #fef3c7;
  color: #92400e;
}

.status-badge.server-error {
  background-color: #fee2e2;
  color: #b91c1c;
}

.response-time {
  font-size: var(--font-size-6);
  color: var(--slate-500);
}

.fetch-section {
  margin-top: var(--space-2);
}

.fetch-section h4 {
  margin-bottom: var(--space-1);
  font-size: var(--font-size-5);
}

.fetch-headers, .fetch-body {
  font-size: var(--font-size-6);
  background-color: var(--slate-50);
  padding: var(--space-2);
  border-radius: 4px;
  max-height: 200px;
  overflow: auto;
}

.fetch-error {
  color: var(--red);
}

.fetch-error h4 {
  margin-bottom: var(--space-1);
  font-size: var(--font-size-5);
}

.fetch-error pre {
  font-size: var(--font-size-6);
  background-color: var(--red-light);
  padding: var(--space-2);
  border-radius: 4px;
}

/** townie 2025 css */

/* ia-writer-mono-latin-400-normal */
@font-face {
  font-family: 'iA Writer Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(https://cdn.jsdelivr.net/fontsource/fonts/ia-writer-mono@latest/latin-400-normal.woff2) format('woff2'), url(https://cdn.jsdelivr.net/fontsource/fonts/ia-writer-mono@latest/latin-400-normal.woff) format('woff');
}

/* ia-writer-quattro-latin-400-normal */
@font-face {
  font-family: 'iA Writer Quattro';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(https://cdn.jsdelivr.net/fontsource/fonts/ia-writer-quattro@latest/latin-400-normal.woff2) format('woff2'), url(https://cdn.jsdelivr.net/fontsource/fonts/ia-writer-quattro@latest/latin-400-normal.woff) format('woff');
}

/* ia-writer-quattro-latin-700-normal */
@font-face {
  font-family: 'iA Writer Quattro';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(https://cdn.jsdelivr.net/fontsource/fonts/ia-writer-quattro@latest/latin-700-normal.woff2) format('woff2'), url(https://cdn.jsdelivr.net/fontsource/fonts/ia-writer-quattro@latest/latin-700-normal.woff) format('woff');
}

/* ia-writer-quattro-latin-400-italic */
@font-face {
  font-family: 'iA Writer Quattro';
  font-style: italic;
  font-display: swap;
  font-weight: 400;
  src: url(https://cdn.jsdelivr.net/fontsource/fonts/ia-writer-quattro@latest/latin-400-italic.woff2) format('woff2'), url(https://cdn.jsdelivr.net/fontsource/fonts/ia-writer-quattro@latest/latin-400-italic.woff) format('woff');
}

/* ia-writer-quattro-latin-700-italic */
@font-face {
  font-family: 'iA Writer Quattro';
  font-style: italic;
  font-display: swap;
  font-weight: 700;
  src: url(https://cdn.jsdelivr.net/fontsource/fonts/ia-writer-quattro@latest/latin-700-italic.woff2) format('woff2'), url(https://cdn.jsdelivr.net/fontsource/fonts/ia-writer-quattro@latest/latin-700-italic.woff) format('woff');
}

/** vars */
:root {
  /* typography */
  --sans-serif: "iA Writer Quattro", system-ui, sans-serif;
  --monospace: "iA Writer Mono", Menlo, monospace;
  --border-radius: 12px;

  --font-size-1: 32px;
  --font-size-2: 24px;
  --font-size-3: 20px;
  --font-size-4: 16px;
  --font-size-5: 14px;
  --font-size-6: 12px;

  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 32px;
  --space-5: 64px;
  --space-6: 128px;
  --space-7: 256px;
  --space-8: 512px;

  --container: 896px;

  /* colors */
  --slate-50: rgb(248, 250, 252);
  --slate-100: rgb(241, 245, 249);
  --slate-200: rgb(226, 232, 240);
  --slate-300: rgb(203, 213, 225);
  --slate-400: rgb(148, 163, 184);
  --slate-500: rgb(100, 116, 139);
  --slate-600: rgb(71, 85, 105);
  --slate-700: rgb(51, 65, 85);
  --slate-800: rgb(30, 41, 59);
  --slate-900: rgb(15, 23, 42);
  --slate-950: rgb(2, 6, 23);

  --sky-50: rgb(240, 249, 255);
  --sky-100: rgb(224, 242, 254);
  --sky-200: rgb(186, 230, 253);
  --sky-300: rgb(125, 211, 252);
  --sky-400: rgb(56, 189, 248);
  --sky-500: rgb(14, 165, 233);
  --sky-600: rgb(2, 132, 199);
  --sky-700: rgb(3, 105, 161);
  --sky-800: rgb(7, 89, 133);
  --sky-900: rgb(12, 74, 110);
  --sky-950: rgb(8, 47, 73);

  --fuchsia-50: rgb(253, 244, 255);
  --fuchsia-100: rgb(250, 232, 255);
  --fuchsia-200: rgb(245, 208, 254);
  --fuchsia-300: rgb(240, 171, 252);
  --fuchsia-400: rgb(232, 121, 249);
  --fuchsia-500: rgb(217, 70, 239);
  --fuchsia-600: rgb(192, 38, 211);
  --fuchsia-700: rgb(162, 28, 175);
  --fuchsia-800: rgb(134, 25, 143);
  --fuchsia-900: rgb(112, 26, 117);
  --fuchsia-950: rgb(74, 4, 78);

  --amber-50: rgb(255, 251, 235);
  --amber-100: rgb(254, 243, 199);
  --amber-200: rgb(253, 230, 138);
  --amber-300: rgb(252, 211, 77);
  --amber-400: rgb(251, 191, 36);
  --amber-500: rgb(245, 158, 11);
  --amber-600: rgb(217, 119, 6);
  --amber-700: rgb(180, 83, 9);
  --amber-800: rgb(146, 64, 14);
  --amber-900: rgb(120, 53, 15);
  --amber-950: rgb(69, 26, 3);

  --red-light: #fdd;
  --red: #f00;
  --red-dark: #300;

  /* color aliases */
  --text: black;                    /* body foreground color */
  --background: white;              /* body background color */
  --primary: var(--sky-500);        /* primary brand color for links, buttons, etc. */
  --primary-hover: var(--sky-600);  /* primary brand color for links, buttons, etc. */
  --secondary: var(--fuchsia-500);  /* secondary brand color for alternative styling */
  --accent: var(--amber-500);       /* contrast color for emphasizing UI */
  --highlight: var(--sky-100);      /* background color for highlighting text */
  --muted: var(--slate-200);        /* faint color for backgrounds, borders, and accents that do not require high contrast with the background color */
  --border: var(--slate-200);
  --error-text: var(--red);
  --error-bg: var(--red-light);
}

.dark {
  --text: var(--slate-50);          /* body foreground color */
  --background: var(--slate-900);   /* body background color */
  --primary: var(--sky-500);        /* primary brand color for links, buttons, etc. */
  --primary-hover: var(--sky-400);  /* primary brand color for links, buttons, etc. */
  --secondary: var(--fuchsia-500);  /* secondary brand color for alternative styling */
  --accent: var(--amber-500);       /* contrast color for emphasizing UI */
  --highlight: var(--sky-900);      /* background color for highlighting text */
  --muted: var(--slate-800);        /* faint color for backgrounds, borders, and accents that do not require high contrast with the background color */
  --border: var(--slate-900);
  --error-bg: var(--red-dark);
}

/** reset */
* { box-sizing: border-box }
body {
  margin: 0;
  font-family: var(--sans-serif);
  color: var(--text);
  background-color: var(--background);
  transition-property: background-color;
  transition-duration: 400ms;
  transition-timing-function: linear;
}

a {
  color: var(--primary);
}
a:hover, a:focus {
  color: var(--primary-hover);
}


h1, h2, h3, h4, h5, h6 {
  margin: 0;
  padding: 0;
}
p, ol, ul, blockquote, pre {
  margin-top: var(--space-1);
  margin-bottom: var(--space-1);
}

button {
  appearance: none;
  background: none;
  border: 0;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
}

.label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 14px;
  font-weight: 700;
  margin-top: var(--space-1);
  margin-bottom: var(--space-1);
}

input[type=text],
input[type=url],
input[type=password] {
  display: block;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
  padding: var(--space-1) var(--space-2);
  color: var(--text);
  background-color: var(--muted);
  border: 1px solid transparent;
}
input[type=text]:focus,
input[type=url]:focus,
input[type=password]:focus {
  background-color: var(--highlight);
  outline: none;
  border-color: var(--primary);
}
select {
  display: block;
  height: 32px;
  font-family: var(--monospace);
  font-size: var(--font-size-6);
  padding: var(--space-1) var(--space-1);
  color: var(--text);
  background-color: var(--muted);
  border: 1px solid transparent;
  cursor: pointer;
}
select:hover,
select:focus {
  background-color: var(--highlight);
}
select:focus {
  outline: none;
  border-color: var(--primary);
}

pre, code {
  font-family: var(--monospace);
}
pre {
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  white-space: pre-wrap;
}

hr {
  margin: 0;
  max-width: 256px;
  border: 0;
  border-bottom: 1px solid var(--muted);
}

/** typography */
.h1 { font-size: var(--font-size-1) }
.h2 { font-size: var(--font-size-2) }
.h3 { font-size: var(--font-size-3) }
.h4 { font-size: var(--font-size-4) }
.h5 { font-size: var(--font-size-5) }
.h6 { font-size: var(--font-size-6) }

.bold { font-weight: 700 }
.regular { font-weight: 400 }
.italic { font-style: italic }
.mono { font-family: "iA Writer Mono", Menlo, monospace }

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/** layout */
.header {
  position: sticky;
  top: 0;
  height: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-left: var(--space-3);
  padding-right: var(--space-3);
  background-color: var(--background);
}

.footer {
  padding: var(--space-2) 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-6);
  background-color: var(--background);
}

.section {
  margin-top: var(--space-5);
  margin-bottom: var(--space-5);
}
.section-grid {
  display: grid;
  gap: var(--space-3);
}
@media screen and (min-width: 768px) {
  .section-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
  }
}

.log-in-container {
  line-height: 1.5;
  max-width: 1024px;
  margin: 0 auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - var(--space-6));
}
.log-in-columns {
  display: grid;
  gap: var(--space-4);
}
@media screen and (min-width: 40em) {
  .log-in-columns {
    grid-template-columns: 1fr 1fr;
  }
}
.log-in-list {
  padding-left: 0;
}
.log-in-list li {
  margin-top: var(--space-2);
  margin-bottom: var(--space-2);
}

/** projects list */
.container {
  max-width: 1024px;
  padding: var(--space-3);
  margin: 0 auto;
}
.container.small {
  max-width: 512px;
}
.projects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.projects-list {
  display: grid;
  gap: var(--space-3);
  padding-top: var(--space-4);
  padding-bottom: var(--space-5);
}
@media screen and (min-width: 768px) {
  .projects-list {
    grid-template-columns: 1fr 1fr;
  }
}

/** NEW single-column chat layout */
.single-column-container {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--space-5));
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--space-3);
  padding-right: var(--space-3);
}
.single-sticky-header {
  position: sticky;
  top: var(--space-5);
  background-color: var(--background);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.single-chat-input {
  position: sticky;
  bottom: 0;
}
.inline-preview {
  width: 100%;
  max-width: 512px;
  max-height: 50vh;
}
.url-bar {
  padding-left: var(--space-2);
  background-color: var(--muted);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
/** END single-column chat layout */

.spacer { margin: auto }

/** decoration */
.header a {
  color: inherit;
  text-decoration: none;
}
.block-link {
  min-width: 0;
  max-width: 100%;
  display: block;
  text-decoration: none;
  color: inherit;
}
.text-link:hover {
  color: var(--primary);
  text-decoration: underline;
}
.rounded { border-radius: var(--border-radius) }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) }
.shadow { box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) }
.white-fade-up { box-shadow: 0 -8px 48px 4px rgba(255, 255, 255, 0.9875) }
.border { border: 1px solid var(--slate-100) }

/** components */
.icon-button {
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--background);
  background-color: var(--primary);
}
.icon-button:hover {
  background-color: var(--primary-hover);
}
.icon-button:disabled {
  opacity: 0.2;
}
.icon-button.large svg {
  width: 32px;
  height: 32px;
}
.dark-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
}
.dark-button:hover,
.dark-button:focus {
  background-color: var(--highlight);
}
.townie-link {
  margin-left: var(--space-3);
}

.button {
  display: inline-flex;
  align-items: center;
  font-weight: 400;
  min-height: 32px;
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
  min-width: 0;
  flex-shrink: 0;
}
.button.small {
  font-size: 12px;
  padding: 4px 6px;
}
.button.primary {
  color: var(--background);
  background-color: var(--primary);
}
.button:hover,
.button:focus {
  color: var(--sky-600);
  background-color: var(--sky-100);
}
.button:hover.primary,
.button:focus.primary {
  color: var(--background);
  background-color: var(--primary-hover);
}

.form {
  display: grid;
  gap: var(--space-3);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/** messages */
.messages-list {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  scroll-behavior: smooth;
  line-height: 1.625;
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}
.messages-list::after {
  content: "";
  display: block;
  height: 1px;
  visibility: hidden;
}

.user-message {
  color: var(--primary);
  max-width: 80%;
  margin-left: auto;
}

.details {
  font-size: var(--font-size-6);
  background-color: var(--muted);
}
.summary {
  font-size: var(--font-size-6);
  font-family: var(--monospace);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-2);
  cursor: pointer;
  background-color: var(--muted);
  user-select: none;
}
.summary:hover {
  background-color: var(--highlight);
}
.details[open] .summary {
  background-color: var(--highlight);
}
.details-body {
  padding: var(--space-2);
  max-height: 50vh;
  overflow: auto;
}

.timestamp {
  font-family: var(--monspace);
  font-size: var(--font-size-6);
  text-align: right;
}

.error-box {
  font-size: var(--font-size-5);
  font-family: var(--monospace);
  padding: var(--space-2);
  color: var(--error-text);
  background-color: var(--error-bg);
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.2em;
  margin-right: 1em;
  background-color: var(--text);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/** InputBox */
.textarea {
  display: block;
  width: 100%;
  height: 60px; /* account for borders */
  color: inherit;
  background-color: transparent;
  font-family: inherit;
  font-size: 14px;
  padding: 8px 12px;
  line-height: 1.5;
  border: 0;
  outline: none;
  resize: none;
}
textarea::placeholder {
  color: inherit !important;
  opacity: 0.5;
}
.input-box { /* wrapper around textarea */
  width: 100%;
  background-color: var(--muted);
  border: 1px solid transparent;
  padding: var(--space-1);
}
.input-box:focus-within {
  background-color: var(--highlight);
}
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/** PreviewBox */
.preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  flex-grow: 1;
  gap: var(--space-2);
}
@media screen and (min-width: 768px) {
  .preview {
    gap: var(--space-3);
  }
}

.preview-header {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.preview-iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  flex-grow: 0;
  object-fit: contain;
  border: 0;
  zoom: 0.5;
  background-color: white;
}

.preview-footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

input[type=url].url-input {
  font-family: var(--monospace);
  font-size: var(--font-size-6);
  height: 32px;
  border: 0;
  border-radius: 0;
  background-color: var(--muted);
}
input[type=text].url-input:focus {
  background-color: var(--highlight);
  outline: none;
}

.lockup {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.lockup-username {
  font-size: var(--font-size-5);
}
.lockup-name {
  font-size: var(--font-size-4);
  font-weight: 700;
}

/** ValCard */
.card {
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  display: flex;
  gap: var(--space-2);
  align-items: center;
  overflow: hidden;
}
.card:hover {
  background-color: var(--highlight);
}
.card-image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border--top-left-radius: var(--border-radius);
  border--bottom-left-radius: var(--border-radius);
  flex-shrink: 0;
}
.card-body {
  flex: 1 1 auto;
}
.project-name {
  font-weight: 700;
}
.username,
.project-description {
  font-size: var(--font-size-6);
}

.avatar {
  border-radius: 99999px;
  object-fit: cover;
}

.image-placeholder,
.image-thumbnail {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
}
.image-placeholder {
  background-color: var(--muted);
}

.privacy {
  display: inline-block;
  font-size: var(--font-size-6);
  font-weight: 400;
  margin-left: 0.5em;
}

.image-row {
  display: flex;
  gap: var(--space-1);
}
.input-image {
  position: relative;
  border: 1px solid var(--muted);
  border-radius: 6px;
}
.remove-image-button {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background-color: var(--red);
  cursor: pointer;
  opacity: 0;
}
.input-image:hover .remove-image-button {
  opacity: 1;
}

.image-drop-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.image-drop-inner {
  padding: var(--space-2);
  background-color: var(--background);
}

.transition, .input-box, .icon-button, .button, .remove-image-button {
  transition-property: color, background-color, border-color, opacity;
  transition-duration: 200ms;
  transition-timing-function: ease-in-out;
}

.debug, .debug * {
  outline: 1px solid rgba(0, 128, 255, 0.2);
}
.bg-debug-1 { background-color: var(--sky-100) }
.bg-debug-2 { background-color: var(--fuchsia-100) }
.bg-debug-3 { background-color: var(--amber-100) }


@media screen and (max-width: 40em) {
  .mobile-hide { display: none }
}
