@import './matrix-font.css';

.home-signal-monitor {
  display: none;
}

.home-signal-viewport {
  touch-action: none;
  user-select: none;
  position: absolute;
  z-index: 2;
  inset: auto 0 0 auto;
  width: var(--signal-expanded-width);
  height: 160px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1000ms linear;
}
.home-signal-scroll {
  position: relative;
  z-index: 1;
  opacity: 1;
  transition: opacity 1000ms linear;
}
.home-signal-monitor[data-preview] .home-signal-viewport {
  opacity: 1;
  pointer-events: auto;
  cursor: default;
}
.home-signal-monitor[data-preview] .home-signal-scroll {
  opacity: 0;
}

.home-signal-message {
  cursor: text;
  user-select: text;
  display: block;
  text-align: center;
  flex: 0 0 auto;
  width: 100%;
  margin-block: auto;
  white-space: pre-wrap;
  color: #8cf3a7;
  font:
    14px/1.6 'Courier New',
    monospace;
  text-shadow: 0 0 6px rgba(96, 255, 128, 0.3);
  overflow-wrap: anywhere;
  transition:
    color 180ms ease,
    text-shadow 180ms ease;
}
.home-signal-monitor[data-near]:not([data-preview]) .home-signal-message {
  color: #d2ffe0;
  text-shadow: 0 0 8px #60ff8060;
}
.key-button-lock {
  transition:
    color 180ms ease 120ms,
    filter 180ms ease 120ms;
}
.home-signal-monitor[data-near] .key-button-lock {
  color: #d2ffe0;
  filter: drop-shadow(0 0 4px #60ff80);
}
.home-signal-enter::after {
  content: '';
  position: absolute;
  right: 0;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: linear-gradient(transparent, #c9ffda, transparent);
  box-shadow: 0 0 5px #60ff80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease 240ms;
}
.home-signal-monitor[data-near] .home-signal-enter::after,
.home-signal-monitor:focus-within .home-signal-enter::after {
  opacity: 1;
}

.home-signal-scroll {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 116px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #4aa96b rgba(0, 16, 6, 0.8);
}
.home-signal-enter {
  position: absolute;
  right: 4px;
  bottom: 3px;
  z-index: 3;
  flex: 0 0 auto;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  color: #a0efb5;
  font:
    12px/1.4 'Courier New',
    monospace;
  cursor: pointer;
  text-shadow: 0 0 6px rgba(96, 255, 128, 0.35);
}
.home-signal-enter:is(:hover, :focus-visible) {
  color: #d5ffe0;
}
.home-signal-enter:focus-visible {
  outline: 1px solid rgba(140, 243, 167, 0.5);
  outline-offset: 2px;
}
.home-signal-monitor[data-preview] .home-signal-enter {
  visibility: hidden;
}
.home-signal-scroll:focus-visible {
  outline: 1px solid #79d99b;
  outline-offset: 4px;
}
.home-signal-scroll::-webkit-scrollbar {
  width: 5px;
}
.home-signal-scroll::-webkit-scrollbar-track {
  background: rgba(0, 16, 6, 0.8);
}
.home-signal-scroll::-webkit-scrollbar-thumb {
  background: #4aa96b;
  border-radius: 1px;
}
.home-signal-scroll::-webkit-scrollbar-thumb:hover {
  background: #8cf3a7;
}

@media (min-width: 1440px) {
  .home-signal-monitor {
    --signal-expanded-width: min(180px, calc((100vw - 850px) / 2 - 3rem));
    position: fixed;
    z-index: 4;
    right: 2rem;
    bottom: 4.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    box-sizing: border-box;
    width: var(--signal-rest-width, max-content);
    height: var(--signal-rest-height, auto);
    transition:
      width 1000ms ease,
      height 1000ms ease;
    max-width: var(--signal-expanded-width);
    overflow: hidden;
    min-height: 40px;
    max-height: 160px;
    padding: 6px 12px 38px;
    background:
      repeating-linear-gradient(0deg, transparent 0 3px, rgba(0, 0, 0, 0.12) 3px 4px),
      linear-gradient(90deg, rgba(0, 12, 5, 0.42), rgba(0, 12, 5, 0.2));
    box-shadow: inset 0 0 24px 6px rgba(0, 0, 0, 0.2);
    color: #8bbc9a;
    font:
      12px/1.6 'Courier New',
      monospace;
    isolation: isolate;
  }
  .home-signal-monitor[data-expanded] {
    width: var(--signal-expanded-width);
    height: 160px;
  }
  .home-signal-monitor::before,
  .home-signal-monitor::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
    background:
      linear-gradient(#9bf5b8, #9bf5b8) left top / 18px 2px no-repeat,
      linear-gradient(#9bf5b8, #9bf5b8) left top / 2px 18px no-repeat,
      linear-gradient(#9bf5b8, #9bf5b8) right bottom / 18px 2px no-repeat,
      linear-gradient(#9bf5b8, #9bf5b8) right bottom / 2px 18px no-repeat;
    opacity: 0.7;
    filter: drop-shadow(0 0 3px rgba(96, 255, 160, 0.2));
    transition:
      opacity 180ms ease,
      filter 180ms ease;
  }
  .home-signal-monitor::after {
    transform: scaleX(-1);
  }
  .home-signal-monitor:is(:hover, :focus-within)::before,
  .home-signal-monitor:is(:hover, :focus-within)::after {
    opacity: 0.9;
    filter: drop-shadow(0 0 4px rgba(96, 255, 160, 0.3));
  }
  .home-signal-code {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: -1;
    opacity: 0.16;
    mask-image: linear-gradient(#000, transparent 85%);
    pointer-events: none;
  }
  .home-signal-code span {
    position: absolute;
    left: calc(8% + var(--signal-column) * 16%);
    top: -60px;
    width: 1ch;
    overflow-wrap: anywhere;
    font:
      15px/1.3 'Matrix Code NFI',
      monospace;
    color: #64ff94;
    animation: home-transmission-flow 12s linear infinite;
    animation-delay: calc(var(--signal-column) * -2s);
  }
}

@keyframes home-transmission-flow {
  to {
    transform: translateY(340px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-signal-monitor,
  .home-signal-viewport,
  .home-signal-scroll {
    transition: none;
  }
  .home-signal-monitor::before,
  .home-signal-monitor::after {
    transition: none;
  }
  .home-signal-code span {
    animation: none;
    top: 0;
  }
}

body.page-home {
  --matrix-green: rgba(96, 255, 128, 0.92);
  --matrix-green-soft: rgba(96, 255, 128, 0.65);
  --matrix-border: rgba(96, 255, 128, 0.24);
  --chrome-bg: rgba(0, 6, 0, 0.74);
  --chrome-border: rgba(96, 255, 128, 0.24);
  --chrome-link: rgba(176, 255, 192, 0.95);
  --chrome-link-hover: rgba(210, 255, 220, 0.98);
  --chrome-active: rgba(96, 255, 128, 0.9);
  --chrome-text-muted: rgba(148, 216, 160, 0.74);
}

#matrix-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

body.page-home::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.22) 3px,
    rgba(0, 0, 0, 0.22) 4px
  );
  opacity: 0.28;
}

body.page-home::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(
      circle at var(--matrix-mx, 50%) var(--matrix-my, 50%),
      rgba(96, 255, 128, 0.12),
      transparent 45%
    ),
    radial-gradient(ellipse 85% 80% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.42) 100%);
}

body.page-home main {
  position: relative;
  z-index: 4;
  background: rgba(0, 8, 0, 0.62);
  border: 1px solid var(--matrix-border);
  border-radius: 10px;
  padding: 2rem 2rem 0.8rem;
  margin-top: calc(3em + 56px);
  margin-bottom: 1.4rem;
  box-shadow:
    0 0 18px rgba(96, 255, 128, 0.15),
    inset 0 0 30px rgba(18, 70, 30, 0.26);
  backdrop-filter: blur(2px);
}

body.page-home main > :not(.home-mirror-surface) {
  position: relative;
  z-index: 1;
}

.home-mirror-surface {
  position: absolute;
  top: 0;
  right: 0;
  width: min(260px, 36%);
  height: 225px;
  border: 0;
  border-top-right-radius: inherit;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.home-mirror-surface:focus-visible {
  outline: 1px solid var(--matrix-green);
  outline-offset: -3px;
}

.home-mirror {
  display: block;
  width: 100%;
  height: 100%;
  border-top-right-radius: inherit;
  pointer-events: none;
  mask-image: linear-gradient(225deg, #000 12%, rgba(0, 0, 0, 0.9) 38%, transparent 76%);
}

@media (max-width: 720px) {
  .home-mirror-surface {
    width: 32%;
    height: 150px;
    opacity: 0.8;
  }
}

@property --home-signal-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

body.page-home main::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 2px;
  pointer-events: none;
  background: conic-gradient(
    from var(--home-signal-angle),
    transparent 0deg 310deg,
    rgba(60, 255, 120, 0.15) 325deg,
    rgba(100, 255, 155, 0.85) 350deg,
    rgba(210, 255, 225, 0.95) 357deg,
    transparent 360deg
  );
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: home-border-signal 6s linear infinite;
}

@keyframes home-border-signal {
  0% {
    --home-signal-angle: 0deg;
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  45% {
    opacity: 1;
  }
  50% {
    --home-signal-angle: 360deg;
    opacity: 0;
  }
  100% {
    --home-signal-angle: 360deg;
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.page-home main::before {
    display: none;
    animation: none;
  }
}

body.page-home h1 {
  overflow-wrap: anywhere;
  color: var(--matrix-green);
  letter-spacing: 0.04em;
  text-shadow:
    0 0 14px rgba(96, 255, 128, 0.35),
    0 0 30px rgba(96, 255, 128, 0.12);
  font-size: clamp(2rem, 5vw, 3rem);
}

/* Film-title treatment for the configured homepage wordmark. */
body.page-home .home-wordmark {
  position: relative;
  font-family: 'Times New Roman', 'Noto Serif CJK SC', 'Songti SC', 'SimSun', serif;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-shadow:
    0 0 6px rgba(145, 255, 181, 0.24),
    0 0 20px rgba(55, 205, 115, 0.12);
}
@media (min-width: 721px) {
  body.page-home .home-wordmark {
    font-size: clamp(2rem, 5vw, 3.75rem);
  }
}
@supports (background-clip: text) {
  body.page-home .home-wordmark {
    background: linear-gradient(
      180deg,
      #edfff3,
      #cbffdd 43%,
      transparent 43%,
      transparent 44.3%,
      #dcffe8 44.3%,
      #89e4ad
    );
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

@media (forced-colors: active) {
  body.page-home .home-wordmark {
    background: none;
    color: CanvasText;
    -webkit-text-fill-color: currentColor;
    text-shadow: none;
  }
}

.home-terminal-intro {
  margin-bottom: 0.65rem;
  font-size: clamp(0.68rem, 1.7vw, 1.02rem);
  --startup-color: var(--matrix-green-soft);
  --startup-cursor-color: var(--matrix-green);
}
body.page-home p,
body.page-home main li {
  color: rgba(220, 255, 228, 0.88);
  text-shadow: 0 0 10px rgba(96, 255, 128, 0.08);
}

body.page-home ul {
  list-style: none;
  padding-left: 0;
  margin-left: 0;
}

body.page-home main li {
  position: relative;
  padding-left: 1.1rem;
}

body.page-home main li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--matrix-green-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

body.page-home a {
  color: var(--matrix-green);
  text-decoration-color: rgba(96, 255, 128, 0.5);
  text-underline-offset: 2px;
}

body.page-home a:hover {
  color: rgba(172, 255, 188, 0.98);
}

body.page-home code {
  background: rgba(16, 54, 24, 0.7);
  color: rgba(182, 255, 195, 0.95);
  border: 1px solid rgba(96, 255, 128, 0.2);
}

body.page-home .home-hero-copy {
  max-width: 62ch;
  margin-top: 1.2rem;
  margin-bottom: 1.1rem;
  color: #a7c5ad;
  font-family: 'Atkinson', sans-serif;
  font-size: clamp(1rem, 1.3vw, 1.075rem);
  font-weight: 400;
  line-height: 1.8;
  text-shadow: none;
  text-wrap: pretty;
}

.home-section-title {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #83b98f;
  margin: 1.2rem 0 0.65rem;
}

.home-latest-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.home-latest-count {
  font:
    400 0.75rem/1.4 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  color: #76a782;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}
.home-latest {
  border-top: 1px solid rgba(96, 255, 128, 0.2);
  padding-top: 0.9rem;
}

.home-post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.home-post-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(96, 255, 128, 0.12);
}

.home-post-list li:last-child {
  border-bottom: none;
}

body.page-home .home-post-list .home-post-record {
  padding: 0.55rem 0 0.55rem 1.1rem;
  transition: background-color 180ms ease;
}

body.page-home .home-post-record:is(:hover, :focus-within) {
  background: linear-gradient(90deg, rgba(96, 255, 128, 0.09), transparent);
}
body.page-home .home-post-record:is(:hover, :focus-within)::before {
  color: #c9ffda;
  text-shadow:
    0 0 5px #60ff80,
    0 0 12px #60ff8060;
}
body.page-home .home-post-record::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, #60ff8040 35%, #ceffdb 80%, transparent);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  body.page-home .home-post-record:is(:hover, :focus-within)::after {
    animation: home-row-signal 650ms ease-out 1;
  }
}
@keyframes home-row-signal {
  0% {
    transform: scaleX(0);
    opacity: 0;
  }
  18% {
    opacity: 0.9;
  }
  75% {
    transform: scaleX(1);
    opacity: 0.7;
  }
  100% {
    transform: scaleX(1);
    opacity: 0;
  }
}
body.page-home .home-post-title {
  text-decoration: none;
}
body.page-home .home-post-title:is(:hover, :focus-visible) {
  color: #c9ffda;
  text-shadow: 0 0 8px #60ff8060;
}

.home-white-rabbit {
  position: relative;
  display: inline-block;
  width: 0;
  height: 0;
  --rabbit-width: 22px;
  --rabbit-height: 28px;
  --rabbit-gap: 0.25rem;
  color: rgba(205, 255, 219, 0.9);
  opacity: 0;
  pointer-events: none;
  user-select: none;
}
.home-white-rabbit [data-white-rabbit] {
  position: absolute;
  left: var(--rabbit-gap);
  bottom: -0.2rem;
}
:is(.home-post-record, .home-archive-command):focus-within .home-white-rabbit {
  opacity: 1;
}
@media (hover: hover) and (pointer: fine) {
  :is(.home-post-record, .home-archive-command):hover .home-white-rabbit {
    opacity: 1;
  }
}
@media (max-width: 720px) {
  .home-white-rabbit {
    --rabbit-width: 13px;
    --rabbit-height: 19px;
    --rabbit-gap: 0.1rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .home-signal-message,
  .key-button-lock,
  .home-signal-enter::after {
    transition: none;
  }
}
body.page-home .home-archive-command {
  --archive-rabbit-width: 22px;
  position: relative;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  min-height: 44px;
  border-radius: 10px;
  padding: 0.25rem 0.4rem 0.25rem calc(var(--archive-rabbit-width) + 2.1rem);
  text-decoration: none;
  color: #b6f6c5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: none;
}

.home-archive-command .home-white-rabbit {
  position: absolute;
  left: 0.35rem;
  top: 50%;
}

.home-archive-command .home-white-rabbit [data-white-rabbit] {
  left: 0;
  top: calc(var(--rabbit-height) / -2);
  bottom: auto;
}

.home-archive-row {
  margin: 1.1rem 0 0;
  text-align: end;
}

.home-archive-arrow {
  display: inline-block;
  margin-left: 0.5em;
}

.home-archive-command::before {
  content: '>';
  position: absolute;
  left: calc(var(--archive-rabbit-width) + 0.8rem);
  color: var(--matrix-green-soft);
}
body.page-home .home-archive-command:is(:hover, :focus-visible) {
  background: radial-gradient(
    ellipse at center,
    rgba(96, 255, 128, 0.1),
    rgba(96, 255, 128, 0.035) 48%,
    transparent 78%
  );
  text-shadow: 0 0 8px #60ff8060;
}
.home-archive-command:is(:hover, :focus-visible)::before {
  color: #c9ffda;
  text-shadow: 0 0 6px #60ff80;
}
@media (max-width: 720px) {
  body.page-home .home-archive-command {
    --archive-rabbit-width: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-section-title::after {
    animation: none;
  }
  body.page-home .home-post-record {
    transition: none;
  }
}
.home-post-title {
  font-weight: 700;
}

.home-terminal-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 0.15rem;
  color: var(--matrix-green-soft);
  font:
    0.75rem/1.5 'Courier New',
    Courier,
    monospace;
  letter-spacing: normal;
}
.home-pirate-signal {
  white-space: nowrap;
  font-family: 'Matrix Code NFI', 'Courier New', monospace;
  color: #91edb2;
  letter-spacing: 0.12em;
  text-shadow: 0 0 5px rgba(96, 255, 160, 0.32);
}
.home-signal-prompt {
  font-family: 'Courier New', monospace;
}
.home-terminal-status .home-trace-text {
  margin-left: auto;
  overflow-wrap: anywhere;
  min-width: 0;
  text-align: right;
  font-size: 0.875rem;
  color: #b9fbd1;
  text-shadow: 0 0 6px rgba(112, 255, 165, 0.28);
}
.home-trace-label,
.home-trace-result {
  display: inline-block;
  white-space: nowrap;
}
.home-trace-decode {
  display: inline-block;
  position: relative;
  vertical-align: bottom;
  white-space: pre;
  font-size: 12px;
  font-weight: 600;
  color: #ddffea;
  text-shadow:
    0 0 5px rgba(175, 255, 206, 0.5),
    0 0 12px rgba(96, 255, 150, 0.25);
}
.home-post-meta {
  font-size: 0.82rem;
  color: rgba(178, 246, 192, 0.8);
}

/* Keep the 720px reading width, but include desktop padding and borders in the viewport cap. */
@media (min-width: 721px) {
  body.page-home main {
    max-width: calc(100% - 4rem - 2px);
  }
}

@media (max-width: 720px) {
  body.page-home main {
    padding: 1.25rem 1rem 0.75rem;
    margin-top: calc(1em + 56px);
    margin-bottom: 1rem;
  }
}

body.page-home header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
