/* ==========================================================================
   Jon's Wisdom Log (/sanctuary/wisdom)
   ========================================================================== */

/* Full-bleed: the hero runs edge to edge under the top bar. */
.screen-wisdom .main {
  padding: var(--topbar-h) 0 0;
  background: var(--surface-lowest);
}
.screen-wisdom .wisdom {
  position: relative;
  overflow: hidden;
  background-image: radial-gradient(rgb(52 52 64 / 0.25) 1px, transparent 1px);
  background-size: 4px 4px;
}
.screen-wisdom .wisdom__crt {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.4;
  background:
    linear-gradient(rgb(18 16 16 / 0) 50%, rgb(0 0 0 / 0.25) 50%),
    linear-gradient(90deg, rgb(255 0 0 / 0.06), rgb(0 255 0 / 0.02), rgb(0 0 255 / 0.06));
  background-size: 100% 3px, 3px 100%;
}

/* ---- Hero -------------------------------------------------------------- */
.screen-wisdom .wisdom-hero {
  position: relative;
  height: 400px;
  display: flex;
  align-items: flex-end;
  padding: 2rem 3rem;
  overflow: hidden;
  border-bottom: 8px solid #000;
}
.screen-wisdom .wisdom-hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.25);
  opacity: 0.5;
}
.screen-wisdom .wisdom-hero__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg) 0%, transparent 65%);
}
.screen-wisdom .wisdom-hero__copy { position: relative; z-index: 20; max-width: 56rem; }
.screen-wisdom .wisdom-hero__chip {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.25rem 1rem;
  background: var(--orange);
  color: #000;
  font: italic 700 1rem/1.5 var(--font-head);
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.screen-wisdom .wisdom-hero__title {
  margin-bottom: 1rem;
  color: var(--cyan);
  font-size: clamp(2.75rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1;
  text-shadow: 2px 2px 0 #000;
}
.screen-wisdom .wisdom-hero__status {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--peach);
  font: 700 0.875rem var(--font-head);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.screen-wisdom .wisdom-hero__status span { width: 3rem; height: 4px; flex-shrink: 0; background: var(--cyan); }

.screen-wisdom .wisdom-cozy {
  position: absolute;
  top: 3rem;
  right: 3rem;
  z-index: 20;
  padding: 1rem;
  background: var(--surface-low);
  border: 4px solid var(--cyan);
  box-shadow: var(--shadow-cyan-soft);
}
.screen-wisdom .wisdom-cozy__label { margin-bottom: 0.5rem; color: var(--cyan); font: 700 0.75rem var(--font-head); }
.screen-wisdom .wisdom-cozy .seg > i { width: 1rem; height: 1.5rem; background: var(--surface-highest); box-shadow: none; }
.screen-wisdom .wisdom-cozy .seg > i.on { background: var(--cyan); }
/* The last lit block glows orange: the warmth frontier. */
.screen-wisdom .wisdom-cozy .seg > i.on:not(:has(+ i.on)) { background: var(--orange); }

/* ---- Grid -------------------------------------------------------------- */
.screen-wisdom .wisdom-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 2rem;
  max-width: 80rem;
  margin: 0 auto;
  padding: 3rem;
}

/* ACTIVE_SAGE_FEED terminal window */
.screen-wisdom .sage {
  grid-column: span 8;
  min-width: 0;
  background: var(--surface-container);
  border: 4px solid var(--on-surface-variant);
  box-shadow: 4px 4px 0 #000, inset 2px 2px 0 rgb(255 255 255 / 0.1);
}
.screen-wisdom .sage__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: var(--on-surface-variant);
  color: var(--bg);
}
.screen-wisdom .sage__title { display: flex; align-items: center; gap: 0.5rem; font-size: 1rem; font-weight: 700; }
.screen-wisdom .sage__title .ms { font-size: 1.125rem; }
.screen-wisdom .sage__search {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex: 0 1 16rem;
  min-width: 0;
  padding: 0.25rem 0.5rem;
  background: var(--bg);
  border: 2px solid var(--cyan);
  color: var(--cyan);
}
.screen-wisdom .sage__search:focus-within { outline: 3px solid var(--cyan-bright); outline-offset: 2px; }
.screen-wisdom .sage__search .ms { font-size: 1rem; }
.screen-wisdom .sage__search input {
  width: 100%;
  min-width: 0;
  padding: 0.25rem 0;
  background: transparent;
  border: 0;
  color: var(--on-surface);
  font: 700 0.75rem var(--font-head);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.screen-wisdom .sage__search input::placeholder { color: var(--outline); }
.screen-wisdom .sage__search input:focus { outline: none; }
.screen-wisdom .sage__win { display: flex; gap: 0.5rem; flex-shrink: 0; }
.screen-wisdom .sage__win i { width: 1rem; height: 1rem; border: 2px solid var(--bg); }
.screen-wisdom .sage__win i:last-child { background: var(--bg); }

.screen-wisdom .sage__body { padding: 2rem; color: var(--cyan); font-family: var(--font-head); line-height: 1.625; }
.screen-wisdom .sage-feed__meta {
  margin-bottom: 1.25rem;
  color: var(--outline);
  font: 700 0.6875rem var(--font-head);
  letter-spacing: 0.15em;
}
.screen-wisdom .sage-feed__list { display: grid; gap: 1.5rem; margin: 0; padding: 0; list-style: none; }
.screen-wisdom .sage-entry { display: flex; gap: 1rem; }
.screen-wisdom .sage-entry__time { flex: 0 0 4.25rem; color: var(--peach); font-weight: 700; }
.screen-wisdom .sage-entry__text { font-size: 1.25rem; text-shadow: 2px 2px 0 #000; }
.screen-wisdom .sage-entry--alt { opacity: 0.8; }
.screen-wisdom .sage-entry--alt .sage-entry__text { font-style: italic; }
.screen-wisdom .sage-entry.is-fresh { animation: wisdom-fresh 2s steps(10); }
.screen-wisdom .sage-entry mark { padding: 0 0.1em; background: var(--peach); color: var(--peach-ink); text-shadow: none; }
.screen-wisdom .sage-feed__empty { color: var(--peach); font-weight: 700; }

.screen-wisdom .totd {
  margin: 3rem 0 0;
  padding: 1.5rem;
  background: var(--surface-lowest);
  border-left: 4px solid var(--peach);
}
.screen-wisdom .totd__label {
  margin-bottom: 0.5rem;
  color: var(--peach);
  font: 700 0.75rem var(--font-head);
  letter-spacing: 0.1em;
  text-decoration: underline;
  text-transform: uppercase;
}
.screen-wisdom .totd__quote { margin: 0; }
.screen-wisdom .totd__quote p { color: var(--on-surface); font: 700 1.5rem/1.35 var(--font-head); }

/* Side widgets */
.screen-wisdom .wisdom-side { grid-column: span 4; display: flex; flex-direction: column; gap: 2rem; }
.screen-wisdom .bio {
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  background: var(--surface-high);
  border: 4px solid var(--peach);
  box-shadow: 4px 4px 0 #000, inset 2px 2px 0 rgb(255 255 255 / 0.1);
}
.screen-wisdom .bio__mark { position: absolute; top: -1rem; right: -1rem; width: auto; font-size: 8rem; opacity: 0.1; }
.screen-wisdom .bio__title { position: relative; margin-bottom: 1rem; color: var(--peach); font-size: 1.25rem; font-style: italic; font-weight: 700; }
.screen-wisdom .bio__copy { position: relative; margin-bottom: 1.5rem; color: var(--on-surface-variant); font-size: 0.875rem; line-height: 1.3; }
.screen-wisdom .bio__stats { display: grid; gap: 1rem; margin: 0; }
.screen-wisdom .bio__stats > div {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--outline-variant);
}
.screen-wisdom .bio__stats dt { color: var(--cyan); font: 700 0.75rem var(--font-head); text-transform: uppercase; }
.screen-wisdom .bio__stats dd { margin: 0; font: 700 1.125rem var(--font-head); }

.screen-wisdom .wisdom-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.screen-wisdom .wisdom-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0.5rem;
  border: 0;
  box-shadow: 4px 4px 0 #000, inset 2px 2px 0 rgb(255 255 255 / 0.1);
  font: 700 0.625rem var(--font-head);
  letter-spacing: 0.05em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}
.screen-wisdom .wisdom-action:active { transform: translateY(4px); box-shadow: none; }
.screen-wisdom .wisdom-action--cyan { background: var(--cyan); color: var(--on-cyan); }
.screen-wisdom .wisdom-action--cyan:hover { background: var(--orange); color: #000; }
.screen-wisdom .wisdom-action--ghost { background: var(--surface-highest); color: var(--cyan); box-shadow: inset 0 0 0 2px var(--cyan), 4px 4px 0 #000; }
.screen-wisdom .wisdom-action--ghost:hover { background: var(--cyan); color: var(--on-cyan); }
.screen-wisdom .wisdom-action[disabled] { cursor: not-allowed; opacity: 0.5; }
.screen-wisdom .wisdom-action.htmx-request { filter: brightness(0.8); }

/* Signal frequency */
.screen-wisdom .signal {
  grid-column: span 4;
  padding: 1.5rem;
  background: var(--surface-lowest);
  border: 4px solid var(--violet);
  box-shadow: 4px 4px 0 #000, inset 2px 2px 0 rgb(255 255 255 / 0.1);
}
.screen-wisdom .signal__head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; color: var(--violet); }
.screen-wisdom .signal__head h2 { font-size: 1rem; font-weight: 700; }
.screen-wisdom .signal__bars {
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 0.5rem;
  background: var(--bg);
}
.screen-wisdom .signal__bars i {
  width: 4px;
  height: var(--h, 1rem);
  background: var(--violet);
  animation: wisdom-signal 1.1s steps(4) infinite alternate;
  animation-delay: var(--d, 0s);
}
.screen-wisdom .signal__bars i:nth-child(1) { --h: 1rem;    --d: -0.2s; }
.screen-wisdom .signal__bars i:nth-child(2) { --h: 2rem;    --d: -0.7s; }
.screen-wisdom .signal__bars i:nth-child(3) { --h: 3rem;    --d: -0.4s; }
.screen-wisdom .signal__bars i:nth-child(4) { --h: 1.5rem;  --d: -0.9s; }
.screen-wisdom .signal__bars i:nth-child(5) { --h: 2.5rem;  --d: -0.1s; }
.screen-wisdom .signal__bars i:nth-child(6) { --h: 0.5rem;  --d: -0.6s; }
.screen-wisdom .signal__bars i:nth-child(7) { --h: 3.5rem;  --d: -0.3s; }

/* Next drop */
.screen-wisdom .drop {
  grid-column: span 8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  background: var(--surface-container);
  border-top: 8px solid var(--peach);
  box-shadow: 4px 4px 0 #000, inset 2px 2px 0 rgb(255 255 255 / 0.1);
}
.screen-wisdom .drop__title { color: var(--peach); font-size: 1.5rem; font-weight: 700; line-height: 1.25; text-shadow: 2px 2px 0 #000; }
.screen-wisdom .drop__sub { color: var(--on-surface-variant); font: 0.75rem var(--font-head); letter-spacing: -0.02em; text-transform: uppercase; }
.screen-wisdom .drop__alert { flex-shrink: 0; padding: 1rem 2rem; box-shadow: 6px 6px 0 #000; font-size: 1.0625rem; }
.screen-wisdom .drop__alert:active { transform: translateY(6px); box-shadow: none; }

/* ---- Footer strip ------------------------------------------------------ */
.screen-wisdom .wisdom-foot {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding: 1rem;
  background: #000;
  border-top: 4px solid var(--cyan);
  font: 700 0.625rem var(--font-head);
  text-transform: uppercase;
}
.screen-wisdom .wisdom-foot ul { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; margin: 0; padding: 0; list-style: none; }
.screen-wisdom .wisdom-foot__item { display: flex; align-items: center; gap: 0.5rem; color: var(--cyan); }
.screen-wisdom .wisdom-foot__item--peach { color: var(--peach); }
.screen-wisdom .wisdom-foot__dot { width: 0.75rem; height: 0.75rem; background: currentColor; }
.screen-wisdom .wisdom-foot p { color: var(--on-surface-variant); letter-spacing: 0.2em; opacity: 0.5; }

/* ---- Motion -------------------------------------------------------------- */
@keyframes wisdom-signal { to { transform: scaleY(0.25); } }
@keyframes wisdom-fresh { from { background: rgb(0 220 229 / 0.3); box-shadow: 0 0 0 6px rgb(0 220 229 / 0.3); } }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 1100px) {
  .screen-wisdom .sage,
  .screen-wisdom .wisdom-side,
  .screen-wisdom .signal,
  .screen-wisdom .drop { grid-column: 1 / -1; }
  .screen-wisdom .wisdom-side { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
}
@media (max-width: 720px) {
  .screen-wisdom .wisdom-hero { height: auto; min-height: 360px; padding: 7rem 1rem 1.5rem; }
  .screen-wisdom .wisdom-cozy { top: 1rem; right: 1rem; padding: 0.75rem; }
  .screen-wisdom .wisdom-grid { gap: 1.5rem; padding: 1.5rem 1rem; }
  .screen-wisdom .wisdom-side { grid-template-columns: 1fr; gap: 1.5rem; }
  .screen-wisdom .sage__bar { flex-wrap: wrap; }
  .screen-wisdom .sage__search { order: 3; flex-basis: 100%; }
  .screen-wisdom .sage__body { padding: 1.25rem; }
  .screen-wisdom .sage-entry { flex-direction: column; gap: 0.25rem; }
  .screen-wisdom .sage-entry__time { flex-basis: auto; }
  .screen-wisdom .sage-entry__text { font-size: 1.0625rem; }
  .screen-wisdom .totd { margin-top: 2rem; }
  .screen-wisdom .totd__quote p { font-size: 1.125rem; }
  .screen-wisdom .drop { flex-direction: column; align-items: flex-start; padding: 1.5rem; }
  .screen-wisdom .drop__title { font-size: 1.25rem; }
  .screen-wisdom .drop__alert,
  .screen-wisdom #wisdom-alert { width: 100%; }
}
