/* web/assets/site.css
   Jehuty's front door, wearing the African Heritage Foundation's house dress.
   Every colour, the type, the gradient and the textures below are taken from
   the mothership's own style sheet (design/mothership/index.css.txt), so this
   door and africanheritagefoundation.org read as one building.
   The house is dark. There is no light setting. */

/* ------------------------------------------------------------------ tokens */

:root {
  --house-header-height: 92px;
  --house-bar-background: 0 0% 0%;

  --background: 148 46% 8%;
  --foreground: 35 30% 85%;

  --card: 145 41% 11%;
  --card-foreground: 40 40% 92%;

  --primary: 42 90% 50%;
  --primary-foreground: 148 46% 8%;

  --secondary: 122 52% 33%;
  --secondary-foreground: 35 30% 85%;

  --destructive: 0 69% 47%;
  --destructive-foreground: 35 30% 85%;

  --muted: 140 20% 15%;
  --muted-foreground: 82 10% 61%;

  --accent: 42 90% 50%;
  --accent-foreground: 148 46% 8%;

  --border: 38 85% 38%;
  --border-alpha: 0.2;
  --input: 140 20% 20%;
  --ring: 42 90% 50%;

  --radius: 0.375rem;

  --ahf-gold: 42 90% 50%;
  --ahf-green: 160 100% 21%;
  --ahf-red: 349 75% 44%;
  --ahf-warm-light: 35 30% 85%;
  --ahf-body-text: 80 10% 64%;
  --ahf-parchment: 40 50% 90%;
  --ahf-footer-bg: 150 46% 5%;
  --ahf-heading-warm: 35 35% 65%;
  --ahf-teal: 180 35% 16%;
  --ahf-royal-purple: 268 45% 16%;

  /* A warning that stays legible on the house's red end. */
  --warn: 6 85% 72%;

  --line: hsl(var(--border) / var(--border-alpha));
  --measure: 68ch;
}

/* -------------------------------------------------------------------- base */

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

/* The HTML hidden attribute outranks every display rule below it.
   talk.js shows and hides the door, the room, and several buttons with it. */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--house-header-height) + 0.75rem);
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Exo 2', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: hsl(var(--foreground));
  background-color: hsl(0 60% 9%);
  background-image: linear-gradient(
    140deg,
    hsl(0 78% 20%) 0%,
    hsl(0 72% 12%) 25%,
    hsl(0 0% 3%) 37%,
    hsl(0 0% 2%) 50%,
    hsl(0 0% 3%) 63%,
    hsl(150 70% 10%) 75%,
    hsl(155 78% 16%) 100%
  );
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Exo 2', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.6em;
}

p { margin: 0 0 1.15rem; }
p:last-child { margin-bottom: 0; }

a {
  color: hsl(var(--primary));
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover { color: hsl(46 95% 68%); }

:focus-visible {
  outline: 2px solid hsl(var(--ring) / 0.85);
  outline-offset: 2px;
  border-radius: 2px;
}

img { max-width: 100%; height: auto; }

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

/* ---------------------------------------------------- house textures */

.circuit-bg {
  background-image:
    linear-gradient(hsl(38 85% 38% / 0.03) 1px, transparent 1px),
    linear-gradient(90deg, hsl(38 85% 38% / 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.circuit-bg-hero {
  background-image:
    linear-gradient(hsl(38 85% 38% / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, hsl(38 85% 38% / 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

.gold-divider {
  height: 1px;
  border: 0;
  margin: 2.5rem 0;
  background: linear-gradient(90deg, transparent 0%, hsl(38 85% 38% / 0.3) 50%, transparent 100%);
}

.gold-divider-short {
  height: 1px;
  width: 30%;
  border: 0;
  margin: 2rem auto;
  background: linear-gradient(90deg, transparent 0%, hsl(38 85% 38% / 0.25) 50%, transparent 100%);
}

.ahf-gold-title {
  background-image: linear-gradient(
    180deg,
    hsl(46 95% 78%) 0%,
    hsl(42 92% 58%) 42%,
    hsl(36 88% 42%) 72%,
    hsl(44 90% 66%) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 hsl(28 60% 18% / 0.85))
          drop-shadow(0 0 18px hsl(42 90% 50% / 0.28));
  letter-spacing: 0.01em;
}

/* --------------------------------------------------------------- house bar */

.bar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--house-header-height);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2rem);
  background: hsl(var(--house-bar-background));
  border-bottom: 1px solid var(--line);
}

.bar .mark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  flex: 0 0 auto;
}
.bar .mark img { width: 46px; height: 46px; display: block; }
.bar .mark .house-name {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: hsl(var(--ahf-heading-warm));
  line-height: 1.25;
  max-width: 10ch;
}

.bar .name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: hsl(var(--primary));
  flex: 0 0 auto;
}

.bar nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-left: auto;
}

.bar nav a {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: hsl(var(--foreground) / 0.8);
  white-space: nowrap;
}
.bar nav a:hover { color: hsl(var(--primary)); }

.bar .spacer { margin-left: auto; }

.remaining {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

/* ----------------------------------------------------------------- buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border) / 0.45);
  background: hsl(var(--muted) / 0.7);
  color: hsl(var(--foreground));
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.button:hover {
  border-color: hsl(var(--primary) / 0.7);
  color: hsl(var(--primary));
}
.button:disabled { opacity: 0.5; cursor: not-allowed; }

.button.primary {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.button.primary:hover {
  background: hsl(46 95% 60%);
  border-color: hsl(46 95% 60%);
  color: hsl(var(--primary-foreground));
}

.button.contribute {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 0.6rem 1.1rem;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
}
.button.contribute:hover {
  background: hsl(46 95% 60%);
  color: hsl(var(--primary-foreground));
}

.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 0.95rem;
  color: hsl(var(--primary));
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link:hover { color: hsl(46 95% 68%); }

.quiet {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: hsl(var(--foreground) / 0.75);
  text-decoration: none;
}
.quiet:hover { color: hsl(var(--primary)); }

/* ------------------------------------------------------- the welcome page */

.welcome main {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem) 4rem;
}

.hero {
  text-align: center;
  padding: clamp(2.5rem, 7vw, 4.5rem) clamp(1rem, 4vw, 2rem) clamp(2rem, 5vw, 3.5rem);
  background-image:
    linear-gradient(hsl(38 85% 38% / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, hsl(38 85% 38% / 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

.hero-inner {
  max-width: 44rem;
  margin: 0 auto;
}

.hero .seal {
  width: 360px;
  max-width: min(76vw, 360px);
  height: auto;
  margin: 0 auto 1.5rem;
  display: block;
  filter: drop-shadow(0 10px 40px hsl(268 45% 16% / 0.75));
}

.hero h1 {
  font-size: clamp(3rem, 11vw, 5.5rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  margin: 0 0 0.25rem;
}

.say {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: hsl(var(--ahf-heading-warm));
  margin: 0 0 0.9rem;
}

.companion {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: hsl(var(--primary) / 0.9);
  margin: 0 0 1.4rem;
}

.lede {
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  color: hsl(var(--foreground) / 0.92);
  max-width: 36rem;
  margin: 0 auto 2rem;
}

.house {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0 0 1.5rem;
}
.house a { color: hsl(var(--ahf-heading-warm)); text-decoration: none; }
.house a:hover { color: hsl(var(--primary)); }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin: 0;
}

.welcome section {
  background: hsl(var(--card) / 0.72);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 2);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  margin-top: 1.75rem;
}

.welcome section h2 {
  font-size: clamp(1.4rem, 3.4vw, 1.9rem);
  color: hsl(var(--primary));
  margin: 0 0 1.2rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid hsl(var(--primary) / 0.2);
}

.welcome section p { color: hsl(var(--foreground) / 0.88); max-width: var(--measure); }

.welcome section ol {
  margin: 0 0 1.25rem;
  padding-left: 1.3rem;
  color: hsl(var(--foreground) / 0.88);
  max-width: var(--measure);
}
.welcome section li { margin-bottom: 0.6rem; }

.begin { margin-top: 1.75rem; }

.site-foot {
  text-align: center;
  padding: clamp(2.5rem, 6vw, 4rem) 1.5rem 3rem;
  background: hsl(var(--ahf-footer-bg) / 0.75);
  border-top: 1px solid var(--line);
}

.site-foot .ahf-seal {
  width: 93px;
  height: 93px;
  display: block;
  margin: 0 auto 1rem;
}

.site-foot .creed {
  margin: 0 auto 1.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: hsl(var(--ahf-heading-warm));
}

.site-foot .foot-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1.5rem;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
}
.site-foot .foot-links a {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: hsl(var(--foreground) / 0.8);
}
.site-foot .foot-links a:hover { color: hsl(var(--primary)); }

.site-foot p {
  font-size: 0.92rem;
  color: hsl(var(--ahf-body-text));
  max-width: 40rem;
  margin: 0 auto 0.9rem;
}

.site-foot .motto {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: hsl(var(--primary) / 0.9);
  margin-bottom: 0;
}

/* ---------------------------------------------------------- the talk page */

body.talk {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* --- the door --- */

.auth {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(1.5rem, 5vw, 3rem) 1.25rem 3rem;
}

.auth h1 {
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  text-align: center;
  color: hsl(var(--primary));
  margin-bottom: 0.6rem;
}

#auth-lede {
  text-align: center;
  color: hsl(var(--foreground) / 0.85);
  max-width: 30rem;
  margin: 0 auto 2rem;
}

.auth form {
  width: 100%;
  max-width: 26rem;
  background: hsl(var(--card) / 0.8);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 2);
  padding: clamp(1.25rem, 4vw, 2rem);
}

.field { margin-bottom: 1.1rem; }

.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: hsl(var(--ahf-heading-warm));
  margin-bottom: 0.45rem;
}

.field .opt {
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: none;
  color: hsl(var(--muted-foreground));
}

input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.7rem 0.85rem;
  color: hsl(var(--foreground));
  background: hsl(var(--input) / 0.75);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
input:focus {
  outline: none;
  border-color: hsl(var(--ring) / 0.8);
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.18);
}

.auth .button.primary { width: 100%; padding: 0.85rem 1.3rem; }

.msg {
  font-size: 0.92rem;
  color: hsl(var(--foreground) / 0.85);
  margin: 0 0 1rem;
  min-height: 1.2em;
}
.msg.error { color: hsl(var(--warn)); }
.msg:empty { margin: 0; min-height: 0; }

.switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1.5rem;
  max-width: 26rem;
  margin: 1.5rem auto 0;
}

/* --- the room --- */

.room {
  flex: 1;
  display: grid;
  grid-template-columns: 17rem 1fr;
  min-height: 0;
}

.threads {
  border-right: 1px solid var(--line);
  background: hsl(0 0% 0% / 0.35);
  padding: 1.25rem 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.threads > .button { width: 100%; }

.threads ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.threads li.empty {
  font-size: 0.88rem;
  color: hsl(var(--muted-foreground));
  padding: 0.5rem 0.2rem;
}

.threads li button {
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.92rem;
  color: hsl(var(--foreground) / 0.85);
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.threads li button:hover { background: hsl(var(--muted) / 0.6); }
.threads li button[aria-current="true"] {
  color: hsl(var(--primary));
  border-left-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.08);
}

.conversation {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.log {
  flex: 1;
  overflow-y: auto;
  padding: clamp(1.25rem, 4vw, 2.25rem) clamp(1rem, 4vw, 2.25rem);
  scroll-behavior: smooth;
}

.log > * { max-width: 48rem; margin-left: auto; margin-right: auto; }

.welcome-note {
  color: hsl(var(--foreground) / 0.8);
  text-align: center;
  padding: clamp(2rem, 8vh, 4rem) 0;
  font-size: 1.05rem;
}

/* --- a turn --- */

.turn { margin-bottom: 1.75rem; }

.turn.person .body {
  background: hsl(var(--card) / 0.85);
  border: 1px solid var(--line);
  border-left: 2px solid hsl(var(--primary) / 0.55);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  white-space: pre-wrap;
  color: hsl(var(--foreground));
}

.turn.jehuty .body { color: hsl(var(--foreground) / 0.92); }

.turn.jehuty .body h2,
.turn.jehuty .body h3 {
  color: hsl(var(--primary));
  font-size: 1.15rem;
  margin: 1.6rem 0 0.7rem;
}

.turn .body ul,
.turn .body ol { margin: 0 0 1.15rem; padding-left: 1.3rem; }
.turn .body li { margin-bottom: 0.4rem; }

.turn .body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: hsl(0 0% 0% / 0.45);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

.turn .body pre {
  background: hsl(0 0% 0% / 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  margin: 0 0 1.15rem;
}
.turn .body pre code { background: none; border: 0; padding: 0; }

.turn .body blockquote {
  margin: 1.4rem 0;
  padding: 0.85rem 1.25rem;
  border-left: 3px solid hsl(var(--primary) / 0.6);
  background: hsl(var(--card) / 0.5);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: hsl(var(--foreground) / 0.85);
}

.turn.pending .body::after {
  content: '';
  display: inline-block;
  width: 0.55rem;
  height: 1.05rem;
  margin-left: 0.15rem;
  vertical-align: text-bottom;
  background: hsl(var(--primary));
  animation: scribe 1.1s steps(1) infinite;
}

@keyframes scribe {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.15; }
}

.turn.notice .body {
  background: hsl(var(--primary) / 0.08);
  border: 1px solid hsl(var(--primary) / 0.35);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  color: hsl(var(--foreground));
}

.check {
  margin-top: 1.1rem;
  padding: 0.9rem 1.15rem;
  border: 1px solid hsl(var(--primary) / 0.3);
  border-radius: var(--radius);
  background: hsl(var(--card) / 0.6);
  font-size: 0.95rem;
}
.check p { margin-bottom: 0.5rem; }
.check strong { color: hsl(var(--primary)); }

.error { color: hsl(var(--warn)); }
.turn.error {
  color: hsl(var(--warn));
  border-left: 2px solid hsl(var(--warn) / 0.6);
  padding-left: 0.9rem;
}

/* --- the composer --- */

.composer {
  border-top: 1px solid var(--line);
  background: hsl(0 0% 0% / 0.5);
  padding: 1rem clamp(1rem, 4vw, 2.25rem) 1.1rem;
}

.composer-inner { max-width: 48rem; margin: 0 auto; }

textarea#msg {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 3.6rem;
  padding: 0.75rem 0.9rem;
  color: hsl(var(--foreground));
  background: hsl(var(--input) / 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
textarea#msg:focus {
  outline: none;
  border-color: hsl(var(--ring) / 0.8);
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.18);
}
textarea#msg::placeholder { color: hsl(var(--muted-foreground)); }

.composer-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.7rem;
}

.caveat {
  flex: 1;
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.45;
  color: hsl(var(--muted-foreground));
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 860px) {
  .bar { gap: 0.75rem; padding: 0 1rem; }
  .bar nav { gap: 1rem; }
  .bar nav a.wide { display: none; }
  .bar .mark .house-name { display: none; }
}

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

  .threads {
    position: fixed;
    top: var(--house-header-height);
    left: 0;
    bottom: 0;
    width: min(80vw, 19rem);
    z-index: 30;
    background: hsl(150 46% 5%);
    border-right: 1px solid var(--line);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
  }
  .threads.open { transform: translateX(0); box-shadow: 0 0 40px hsl(0 0% 0% / 0.6); }
}

@media (max-width: 600px) {
  body { font-size: 1rem; }
  .bar { gap: 0.5rem; }
  .bar nav { gap: 0.6rem; }
  .bar .name { font-size: 1rem; }
  .remaining { display: none; }
  .hero .seal { max-width: 68vw; }
  .actions { gap: 1rem; }
  .button { font-size: 0.72rem; padding: 0.65rem 1rem; }
}

@media (max-height: 500px) {
  .bar { height: 56px; }
  .threads { top: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .log { scroll-behavior: auto; }
  .threads { transition: none; }
  .turn.pending .body::after { animation: none; opacity: 0.8; }
}
