/* site.css — shared styles for the AI Chat to HTML project site.
 * Audience: end users first, developers welcome. Calm, document-like,
 * with a single warm accent and a clear type hierarchy.
 */

:root {
  --ink: #14171a;
  --body: #3c4248;
  --muted: #6b7280;
  --line: #e6e8eb;
  --line-strong: #d2d6db;
  --bg: #fbfbf9;
  --panel: #ffffff;
  --accent: #b5512f;        /* warm clay — the one bold note */
  --accent-soft: #f7ece4;
  --accent-ink: #7d3318;
  --code-bg: #1d2530;
  --code-ink: #e7ecf3;
  --radius: 12px;
  --maxw: 1100px;

  --serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---- top bar ---- */
.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand {
  font-family: var(--sans);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand span { color: var(--accent); }
.nav { display: flex; gap: 22px; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.93rem;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---- type ---- */
h1, h2, h3 { color: var(--ink); line-height: 1.18; letter-spacing: -0.025em; }
h1 { font-family: var(--sans); font-size: 2.6rem; margin: 0 0 0.3em; font-weight: 800; }
h2 { font-size: 1.5rem; margin: 2.4em 0 0.5em; font-weight: 700; }
h3 { font-size: 1.1rem; margin: 1.8em 0 0.4em; font-weight: 700; }
p { margin: 0 0 1.1em; }
a { color: var(--accent-ink); }
.lead { font-size: 1.2rem; color: var(--muted); margin: 0 0 1.6em; }

main { padding: 56px 0 96px; }

.eyebrow {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.7em;
}

/* ---- buttons ---- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.6em 0 0; }
.btn {
  display: inline-block;
  padding: 11px 20px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost { background: var(--panel); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---- cards / steps ---- */
.cards { display: grid; gap: 14px; margin: 1.4em 0; }
@media (min-width: 620px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.card h3 { margin-top: 0; }
.card p { margin-bottom: 0; color: var(--muted); font-size: 0.95rem; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 1.4em 0; }
.steps > li {
  position: relative;
  padding: 0 0 1.6em 56px;
  border-left: 2px solid var(--line);
  margin-left: 18px;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: -19px;
  top: -2px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  border-radius: 50%;
}
.steps h3 { margin: 0.1em 0 0.3em; }
.steps p { margin-bottom: 0.5em; }

/* ---- code ---- */
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: #eef0ee;
  padding: 0.12em 0.4em;
  border-radius: 5px;
}
pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 16px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0 0 1.2em;
  font-size: 0.86rem;
  line-height: 1.55;
}
pre code { background: none; padding: 0; color: inherit; font-size: 1em; }

/* ---- table (reference) ---- */
table { border-collapse: collapse; width: 100%; margin: 0 0 1.4em; font-size: 0.94rem; }
th, td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
th { background: #f3f4f2; font-weight: 600; color: var(--ink); }

/* ---- demo frame on home ---- */
.demo {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.4em 0 0.6em;
}
.demo-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 14px;
  background: #f3f4f2;
  border-bottom: 1px solid var(--line);
}
.demo-bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--line-strong); }
.demo-cap { font-size: 0.8rem; color: var(--muted); text-align: center; margin: 0.4em 0 1.6em; }

/* ---- callout ---- */
.note {
  background: #faf3ee;
  border: 1px solid #eddccf;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 1.4em 0;
  font-size: 0.95rem;
}
.note strong { color: var(--accent-ink); }

/* ---- footer ---- */
.site-foot {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  padding: 28px 0;
}
.site-foot .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.site-foot a { color: var(--muted); }

@media (max-width: 560px) {
  h1 { font-size: 2rem; }
  .nav { gap: 14px; }
  .nav a { font-size: 0.85rem; }
  main { padding: 40px 0 64px; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---- embedded real-output frames ---- */
.demo-frame {
  width: 100%;
  min-width: 100%;
  border: 0;
  display: block;
  background: #fff;
}
.frame-wrap {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.4em 0 0.6em;
}
/* Let the demo frames use more width than the reading column so the embedded
   chat isn't pinched. Falls back to full width on smaller screens. */
.frame-wide {
  width: min(96vw, 1040px);
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
.frame-wrap .demo-bar { margin: 0; }

/* theme gallery */
.themes { display: grid; gap: 18px; margin: 1.4em 0; }
@media (min-width: 680px) { .themes { grid-template-columns: 1fr 1fr; } }
.theme-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}
.theme-card .frame-wrap { margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.theme-meta { padding: 14px 16px; }
.theme-meta h3 { margin: 0 0 0.2em; }
.theme-meta p { margin: 0 0 0.6em; color: var(--muted); font-size: 0.92rem; }
.theme-meta a { font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.theme-meta a:hover { text-decoration: underline; }

/* ---- simple-path callout: the three-line core, kept prominent ---- */
.simple-path {
  background: #fbf7f2;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 1.6em 0;
}
.simple-path h3 { margin: 0 0 0.5em; font-size: 1rem; }
.simple-path pre { margin: 0 0 0.6em; }
.simple-path p { margin: 0; font-size: 0.92rem; color: var(--muted); }
.simple-path .opt { color: var(--accent-ink); font-weight: 600; }


/* ---- layout refinements for expanded navigation and tools ---- */
.site-head .wrap {
  min-height: 60px;
  height: auto;
  gap: 18px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.nav {
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 8px;
  column-gap: 18px;
}
.wrap-wide { max-width: 1100px; }
button.btn {
  cursor: pointer;
  font-family: var(--sans);
}
button.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-small {
  padding: 8px 13px;
  font-size: 0.88rem;
  border-radius: 9px;
}

/* ---- online converter ---- */
.converter-grid {
  display: grid;
  gap: 18px;
  margin: 1.4em 0;
}
@media (min-width: 960px) {
  .converter-grid {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
    align-items: start;
  }
}
.converter-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px;
}
.converter-panel h2,
.converter-panel h3 { margin-top: 0; }
.converter-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 0.7em;
}
.converter-headline h2,
.converter-headline h3 { margin: 0; }
.converter-panel textarea,
.generated-output {
  width: 100%;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.45;
  background: #fff;
  color: var(--ink);
}
#sourceText { min-height: 420px; }
.generated-output { min-height: 260px; }
.converter-options {
  display: grid;
  gap: 12px;
  margin: 1em 0;
}
@media (min-width: 680px) {
  .converter-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.option-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}
.option-box legend,
.option-label {
  font-weight: 700;
  color: var(--accent-ink);
}
.option-box label {
  display: block;
  margin: 0.45em 0;
}
.option-box select {
  width: 100%;
  margin-top: 0.45em;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.option-box select:disabled {
  color: var(--muted);
  background: #f3f4f2;
}
.converter-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 1em 0;
}
.status-line {
  min-height: 1.4em;
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 0;
}
.preview-frame {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
}
.output-layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}
.css-output-wrap { display: none; }
.help-small { color: var(--muted); font-size: 0.9rem; }
@media (max-width: 720px) {
  .site-head .wrap {
    align-items: flex-start;
    flex-direction: column;
  }
  .nav { justify-content: flex-start; }
}


/* ---- dual-route site structure ---- */
.route-cards {
  display: grid;
  gap: 18px;
  margin: 1.6em 0 2em;
}
@media (min-width: 760px) {
  .route-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.route-cards-compact {
  margin-top: 1em;
}
.route-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.route-card-primary {
  border-color: #e5c5b5;
  background: #fff8f4;
}
.route-card h2,
.route-card h3 {
  margin-top: 0;
}
.route-card .eyebrow {
  margin-bottom: 0.55em;
}
.route-card p {
  color: var(--muted);
}
.route-meta {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent-ink) !important;
}

/* Keep the expanded navigation tidy. */
.site-head .wrap {
  min-height: 64px;
}
.nav {
  align-items: center;
}
@media (max-width: 820px) {
  .site-head .wrap {
    align-items: flex-start;
    flex-direction: column;
  }
  .nav {
    justify-content: flex-start;
  }
}


/* ---- online converter: options-first layout ---- */
.converter-options-panel {
  margin: 1.4em 0 18px;
}
.converter-options-panel h2 {
  margin-top: 0;
}
.converter-actions-end {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-bottom: 0;
}
.converter-grid-after-options {
  margin-top: 0;
}
@media (min-width: 960px) {
  .converter-grid-after-options {
    grid-template-columns: minmax(0, 1fr) minmax(420px, 0.95fr);
  }
}


/* ---- online converter: compact options toolbar ---- */
.compact-options-panel {
  padding: 18px 22px;
}

.compact-options-panel h2 {
  margin: 0 0 0.85rem;
}

.compact-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
}

.compact-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  align-items: end;
}

.control-group {
  display: grid;
  gap: 6px;
}

.control-label {
  color: var(--accent-ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.control-group select {
  min-width: 160px;
  padding: 9px 34px 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.control-group select:disabled {
  color: var(--muted);
  background: #f3f4f2;
}

.segmented-control {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
}

.segmented-control label {
  margin: 0;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: inline-block;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  border-right: 1px solid var(--line-strong);
}

.segmented-control label:last-child span {
  border-right: 0;
}

.segmented-control input:checked + span {
  background: var(--accent);
  color: #fff;
}

.compact-actions {
  display: grid;
  gap: 8px;
  min-width: 118px;
}

.compact-actions .btn {
  width: 100%;
  text-align: center;
}

.compact-options .help-small {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.2;
}

@media (max-width: 760px) {
  .compact-options {
    grid-template-columns: 1fr;
  }

  .compact-actions {
    display: flex;
    min-width: 0;
  }

  .compact-actions .btn {
    width: auto;
  }
}


/* ---- online converter: flatter toolbar options ---- */
.compact-options-panel {
  padding: 14px 18px;
}

.options-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
}

.options-toolbar h2 {
  margin: 0;
  white-space: nowrap;
  align-self: center;
}

.options-toolbar .compact-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: end;
}

.options-toolbar .control-group {
  display: grid;
  gap: 4px;
}

.options-toolbar .control-label {
  color: var(--accent-ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.options-toolbar .control-group select {
  min-width: 150px;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.options-toolbar .segmented-control span {
  padding: 8px 13px;
}

.options-toolbar .compact-actions {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.options-toolbar .compact-actions .btn {
  width: auto;
  padding: 9px 15px;
}

@media (max-width: 920px) {
  .options-toolbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .options-toolbar h2 {
    white-space: normal;
  }

  .options-toolbar .compact-actions {
    justify-content: flex-start;
  }
}


/* ---- online converter: reliable div preview ---- */
.preview-area {
  min-height: 520px;
  padding: 16px;
  overflow: auto;
}
.preview-area .ai-chat-page {
  margin: 0;
}
.preview-area .ai-chat-window,
.preview-area .ai-word-transcript {
  max-width: 100%;
}


/* ---- home output gallery ---- */
.output-gallery {
  display: grid;
  gap: 18px;
  margin: 1.4em 0 2em;
}

@media (min-width: 860px) {
  .output-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-card-large {
    grid-column: 1 / -1;
  }
}

.gallery-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.gallery-frame {
  height: 390px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.gallery-frame-small {
  height: 300px;
}

.gallery-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
}

.gallery-meta {
  padding: 16px 18px;
}

.gallery-meta h3 {
  margin-top: 0;
}

.gallery-meta p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.7em;
}

.gallery-meta a {
  font-weight: 700;
  text-decoration: none;
}

.gallery-meta a:hover {
  text-decoration: underline;
}


/* ---- online converter: hidden mode controls ---- */
.control-group[hidden],
button[hidden],
.css-output-wrap[hidden] {
  display: none !important;
}


/* ---- online converter: copy mode hint ---- */
.copy-mode-hint {
  margin: 0;
  max-width: 34rem;
}


/* ---- online converter: Word style controls ---- */
.word-style-group[hidden],
.control-group[hidden],
button[hidden] {
  display: none !important;
}


/* ---- online converter: Word copy/source clarity ---- */
.source-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.source-output-head label {
  margin: 0;
}

.preview-area .word-transcript {
  background: #ffffff;
}


/* ---- Word output copy/paste guidance ---- */
.word-paste-note {
  max-width: 48rem;
  margin: 0.35rem 0 0;
}


/* ---- online converter: bounded scrollable editor and preview ---- */
#sourceText {
  min-height: 520px;
  max-height: 70vh;
  overflow: auto;
  resize: vertical;
}

.preview-frame,
.preview-area {
  min-height: 520px;
  max-height: min(1040px, 80vh);
  overflow: auto;
}

.preview-area {
  overscroll-behavior: contain;
}

@media (max-width: 760px) {
  #sourceText,
  .preview-frame,
  .preview-area {
    min-height: 420px;
    max-height: 75vh;
  }
}


/* ---- online converter: generated table preview ---- */
.preview-area table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 0.9em;
  font-size: 0.92em;
}

.preview-area th,
.preview-area td {
  border: 1.5px solid #9aa3b2;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.preview-area th {
  background: rgba(0, 0, 0, 0.04);
  font-weight: 700;
}


/* ---- online converter: keep generated chat colours isolated inside preview ---- */
.preview-area .ai-chat-page .ai-chat-bubble h1,
.preview-area .ai-chat-page .ai-chat-bubble h2,
.preview-area .ai-chat-page .ai-chat-bubble h3,
.preview-area .ai-chat-page .ai-chat-bubble h4,
.preview-area .ai-chat-page .ai-chat-bubble h5,
.preview-area .ai-chat-page .ai-chat-bubble h6,
.preview-area .ai-chat-page .ai-chat-bubble th,
.preview-area .ai-chat-page .ai-chat-bubble td {
  color: inherit;
}


/* ---- online converter: keep generated Markdown element colours isolated inside preview ---- */
.preview-area .ai-chat-page .ai-chat-bubble p,
.preview-area .ai-chat-page .ai-chat-bubble h1,
.preview-area .ai-chat-page .ai-chat-bubble h2,
.preview-area .ai-chat-page .ai-chat-bubble h3,
.preview-area .ai-chat-page .ai-chat-bubble h4,
.preview-area .ai-chat-page .ai-chat-bubble h5,
.preview-area .ai-chat-page .ai-chat-bubble h6,
.preview-area .ai-chat-page .ai-chat-bubble strong,
.preview-area .ai-chat-page .ai-chat-bubble b,
.preview-area .ai-chat-page .ai-chat-bubble em,
.preview-area .ai-chat-page .ai-chat-bubble i,
.preview-area .ai-chat-page .ai-chat-bubble ul,
.preview-area .ai-chat-page .ai-chat-bubble ol,
.preview-area .ai-chat-page .ai-chat-bubble li,
.preview-area .ai-chat-page .ai-chat-bubble blockquote,
.preview-area .ai-chat-page .ai-chat-bubble table,
.preview-area .ai-chat-page .ai-chat-bubble thead,
.preview-area .ai-chat-page .ai-chat-bubble tbody,
.preview-area .ai-chat-page .ai-chat-bubble tr,
.preview-area .ai-chat-page .ai-chat-bubble th,
.preview-area .ai-chat-page .ai-chat-bubble td {
  color: inherit;
}


.download-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin: 1rem 0;
}
