*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

#root,
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

:root {
  --gray:        #665f55;
  --green:       #1a5c38;
  --red:         #aa0000;
  --green-light: #f0f7f3;
  --green-mid:   #2e7d52;
  --text:        #1a1a1a;
  --muted:       #555;
  --border:      #d0ddd6;
  --bg:          #f8faf9;
  --white:       #ffffff;
  --beige:       #c6ba9c;
  --offwhite:    #efe7d3;
  --error:       #c0392b;
  --error-bg:    #fdf0ee;
  --radius:      6px;
  --shadow:      0 1px 4px rgba(0,0,0,0.08);
}

body {
  font-family: "Roboto Slab", Georgia, "Times New Roman", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--green-mid); }
a:hover { color: var(--green); }

ol {
  list-style: decimal;
  margin-left: 1.5rem;
  list-style-position: outside;
}
ul {
  margin-left: 1.5rem;
  list-style-position: outside;
}

h1 {
  font-size: 2rem;
  font-weight: normal;
  line-height: 1.1;
  margin-bottom: 0.5rem;
  color: var(--green);
}

h2 {
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1.1;
  color: var(--gray);
  margin-top: 1.5rem;
  border-bottom: 1px solid var(--gray);
}

/* ── Header ── */
.site-header-container {
  background:  var(--gray) url("/harl-bg.png") repeat;
  border-bottom: 3px solid var(--gray);
}
.site-header {
  margin: 0 auto;
  max-width: 760px;
  padding: 0;
  display: grid;
  grid-template-columns: 130px 1fr;
  grid-template-areas: "owl title" "owl disclaimer";
  column-gap: 20px;
  row-gap: 10px;
  align-items: end;
}

.header-owl {
  grid-area: owl;
  overflow: visible;
}
.header-owl img {
  width: 100%;
  height: auto;
  display: block;
  transform: scale(1.2);
  transform-origin: top left;
}

.header-title {
  grid-area: title;
  color: var(--white);
  font-size: 2rem;
  line-height: 1.1;
}
.disclaimer {
  grid-area: disclaimer;
  color: var(--offwhite);
  padding: 0 10px 10px 0px;
}
.disclaimer strong { font-weight: bold; }

/* ── Main ── */
.main {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
  flex: 1;
}

/* ── Form ── */
.ruling-form { display: flex; flex-direction: column; gap: 0.75rem; }
.conversation + .ruling-form { margin-top: 1.75rem; }

.form-label {
  font-size: 1rem;
  font-weight: bold;
  color: var(--green);
}

.form-textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  background: var(--white);
  transition: border-color 0.15s;
}
.form-textarea:focus {
  outline: none;
  border-color: var(--green-mid);
}
.form-textarea:disabled { background: #f0f0f0; }

.submit-btn {
  align-self: flex-start;
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1.5rem;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.submit-btn:hover:not(:disabled) { background: var(--green-mid); }
.submit-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Examples ── */
.examples { margin-top: 1.75rem; }
.examples-label { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; }
.example-list { display: flex; flex-direction: column; gap: 0.4rem; }
.example-btn {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.85rem;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--green-mid);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.example-btn:hover { background: var(--green-light); border-color: var(--green-mid); }

/* ── Error ── */
.error-box {
  margin-top: 1.5rem;
  background: var(--error-bg);
  border: 1px solid #e8b4b0;
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  color: var(--error);
  font-size: 0.95rem;
}

/* ── Result ── */
.conversation { display: flex; flex-direction: column; }

.question-block {
  margin-top: 1.75rem;
  background: var(--green-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  align-self: flex-end;
  max-width: 90%;
}
.question-text { margin: 0; font-size: 0.95rem; color: var(--text); white-space: pre-wrap; }

.result-box {
  margin-top: 1.75rem;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.ruling-text p { margin-bottom: 0.75rem; font-size: 1rem; }
.ruling-text p:last-child { margin-bottom: 0; }

/* ── Thinking indicator (bouncing dots) ── */
.streaming-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0;
}
.streaming-indicator .dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--green-mid, #4a9);
  animation: thinking-bounce 1.2s ease-in-out infinite both;
}
.streaming-indicator .dot:nth-child(2) { animation-delay: 0.15s; }
.streaming-indicator .dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes thinking-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-0.4rem); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .streaming-indicator .dot {
    animation: thinking-pulse 1.2s ease-in-out infinite both;
  }
  @keyframes thinking-pulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
  }
}

.sources { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.sources-heading { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.5rem; }
.source-group { margin-top: 1rem; }
.source-group:first-of-type { margin-top: 0.25rem; }
.source-group-heading { font-size: 0.8rem; font-weight: 600; color: var(--text); margin-bottom: 0.4rem; }
.sources-list { list-style: none; display: flex; flex-direction: column; gap: 0.3rem; }
.source-item { font-size: 0.875rem; }
.source-link {
  display: inline;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.source-link:hover .law-title,
.source-link:hover .law-number { text-decoration: underline; }
.law-number { font-weight: bold; color: var(--green); }
.law-title { color: var(--text); }
.source-doc { color: var(--muted); font-style: italic; }

/* ── Source passage modal ── */
.source-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 1000;
}
.source-modal {
  position: relative;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 1.75rem 1.75rem 1.5rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.source-modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.85rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.source-modal-close:hover { color: var(--green); }
.source-modal-title { font-size: 1.05rem; margin: 0 1.5rem 0.25rem 0; }
.source-modal-doc { font-size: 0.8rem; font-style: italic; color: var(--muted); margin-bottom: 1rem; }
.source-modal-body { font-size: 0.95rem; line-height: 1.55; }
.source-modal-body p { margin-bottom: 0.75rem; }

/* ── Defined terms & definition popover ── */
.definition-term {
  border-bottom: 1px dotted var(--green-mid, #4a9);
  cursor: help;
}
.definition-term:hover { background: rgba(0, 128, 96, 0.08); }
.definition-popover {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1100;
  max-width: min(320px, calc(100vw - 16px));
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
  padding: 0.7rem 0.85rem;
  font-size: 0.85rem;
  line-height: 1.45;
}
.definition-popover-term { display: block; font-weight: bold; color: var(--green); margin-bottom: 0.2rem; }
.definition-popover-text { color: var(--text); }

.new-question-btn {
  margin-top: 1.25rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.new-question-btn:hover { border-color: var(--green-mid); color: var(--green); }

/* ── Password page ── */
.password-box {
  max-width: 420px;
  margin: 2.5rem auto;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.password-box h2 {
  font-size: 1.2rem;
  color: var(--green);
  border-bottom: none;
  margin-top: 0;
  margin-bottom: 0.75rem;
}
.password-box p {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.form-input {
  height: auto;
  padding: 0.6rem 0.75rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.public-sources {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
  margin-top: 3rem;
}

/* ── Footer ── */
.site-footer {
  position: relative;
  overflow: hidden;
  background-color: #221d15;
  margin-top: 1rem;
  padding: 1.25rem 1.5rem;
  text-align: center;
  border-top: 3px solid var(--gray);
  color: var(--offwhite);
}




.site-footer > * {
  position: relative;
  z-index: 1;
}

.promotion {
  max-width: 760px;
  margin: 0 auto;
  font-size: 1.25rem;
  text-align: center;
}
.promotion p {
  margin-bottom: 1rem;
}
.promotion a {
  color: var(--white);
}
.promotion a:hover {
  color: var(--beige);
  text-decoration: underline;
}
.rsvp {
  color: var(--red);
  text-align: center;
}

/* ── Responsive ── */
@media (max-width: 550px) {
  .main { padding: 1.25rem 1rem; }
}
@media (max-width: 550px) {
  .site-header {
    column-gap: 0px;
    row-gap:0;
  }
  .header-title {
    font-size: 1.25rem;
    font-weight: 700;
  }
  .disclaimer {
    font-size: 0.85rem;
  }
}

@media (max-width: 550px) {
  .header-owl img {
    transform: scale(1);
  }
}
@media (max-width: 550px) {
  .header-title {
    align-self: center;
  }
}


