/* MindBento — special.fish aesthetic */

:root {
  --times: 'Times New Roman', Times, serif;
  --courier: Courier, 'Courier New', monospace;
  --text-color: #000;
  --bg-color: #d0d0d0;
  --link-color: #004de5;
  --nav-bg: #e6e6e6;
  --cream: rgb(255, 252, 239);
}

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

html {
  font-family: var(--courier);
  font-size: 15px;
  background-color: var(--bg-color);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: none;
}

body { margin: 0; padding: 0; }

a {
  color: var(--link-color);
  word-break: break-word;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img { max-width: 100%; display: block; }

/* === Nav === */
nav.topbar {
  background-color: var(--nav-bg);
  padding: 4px 8px 6px 8px;
  display: flex;
  margin: 0;
  border-bottom: 1px solid #dadada;
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-left {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 4px;
  margin-right: 8px;
}

.nav-right {
  display: flex;
  gap: 14px;
  margin-left: auto;
}

.nav-cta {
  background: #66ff66;
  padding: 0 6px;
  border: 1px solid #44cc44;
  color: #000 !important;
  line-height: inherit;
}

nav a {
  color: var(--text-color);
  text-decoration: none;
}

.nav-left a {
  white-space: nowrap;
}

nav a:hover {
  text-decoration: underline;
}

.nav-left a:not(.nav-brand):not(.nav-mode):last-child {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.nav-brand {
  font-weight: normal;
}

.nav-sep {
  color: #666;
  margin: 0 4px;
  white-space: nowrap;
}

.nav-dot {
  color: #999;
  margin: 0 4px;
}

.nav-mode {
  color: #999;
  text-decoration: none;
}

.nav-mode.active {
  color: #000;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 535px) {
  nav.topbar {
    flex-flow: column nowrap;
    gap: 10px;
    font-size: 18px;
    padding: 10px;
  }
  .nav-right {
    margin-left: initial;
  }
}

/* === Main === */
main {
  position: relative;
  padding: 0;
}

/* === Grid === */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1px;
  background-color: var(--bg-color);
}

/* === Plot (cell) base === */
.plot {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  position: relative;
  background-color: #fff;
  display: flex;
}

a.plot {
  text-decoration: none;
  color: #000;
  cursor: pointer;
}

a.plot:hover {
  text-decoration: none;
  color: #000;
  background-color: #f0f0f0;
}

a.plot.bento:hover,
a.plot.attachment:hover {
  background-color: unset;
  opacity: 0.85;
}

a.plot.link-preview:hover {
  background-color: #f5f5f5;
}

.plot a:hover {
  text-decoration: none;
}

/* === Plot: Text === */
.plot.text {
  background-color: #fff;
}

.plot.text .text-content {
  padding: 10px;
  overflow: hidden;
}

.plot.text .text-title {
  font-family: var(--courier);
  font-weight: bold;
  font-size: 15px;
  line-height: 20px;
  margin-bottom: 6px;
  color: #000;
}

pre.text-body {
  font-family: var(--courier);
  font-size: 13px;
  line-height: 18px;
  color: #000;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}


/* === Plot: PDF card === */
.plot.pdf-card {
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.plot.pdf-card .pdf-icon {
  font-family: var(--courier);
  font-size: 32px;
  font-weight: bold;
  color: #d32f2f;
  background: #fce4ec;
  border: 2px solid #d32f2f;
  border-radius: 6px;
  padding: 8px 18px;
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.plot.pdf-card .pdf-info {
  padding: 0 10px;
  font-family: var(--courier);
  font-size: 13px;
  line-height: 18px;
}

.plot.pdf-card .pdf-title {
  font-weight: bold;
  margin-bottom: 4px;
}

.plot.pdf-card .pdf-domain {
  color: #888;
  font-size: 12px;
}

.plot.pdf-card:hover {
  background-color: #f5f5f5;
}


/* === Source tag (same on ALL card types) === */
.plot-source {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 1;
}

.source-tag {
  font-family: var(--courier);
  font-size: 11px;
  color: #fff;
  padding: 3px 6px;
  opacity: 0.85;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* === Plot: Image / attachment === */
.plot.attachment img,
.plot.attachment video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* === Plot: Link preview (og:image + title) === */
.plot.link-preview {
  flex-direction: column;
  justify-content: center;
  background: #fff;
}

.plot.link-preview .link-preview-img {
  overflow: hidden;
  padding: 15px 15px 0;
}

.plot.link-preview .link-preview-img img {
  width: 100%;
  display: block;
  border: 1px solid #e6e6e6;
}

.plot.link-preview .link-preview-info {
  padding: 4px 10px;
  font-family: var(--courier);
  font-size: 14px;
  line-height: 19px;
  text-align: center;
}

.plot.link-preview .link-preview-title {
  font-weight: bold;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 2px;
}

.plot.link-preview .link-preview-url {
  color: var(--link-color);
  text-decoration: underline;
  font-size: 11px;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* === Plot: Link === */
.plot.link {
  background-color: #fff;
}

.plot.link .link-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  gap: 10px;
  height: 100%;
}

.plot.link .link-thumbnail {
  width: 150px;
  height: 150px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #e6e6e6;
}

.plot.link .link-url {
  font-family: var(--courier);
  font-size: 16px;
  color: blue !important;
  word-break: break-word;
  text-align: center;
  line-height: 1.3;
  text-decoration: underline;
}

/* === Plot: Bento (full color bg, name centered) === */
a.plot.bento {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.plot.bento .bento-name {
  font-family: var(--courier);
  font-size: 18px;
  font-weight: bold;
  color: #fff;
  text-align: center;
  padding: 0 10px;
}

.plot.bento .bento-meta {
  font-family: var(--courier);
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}

/* === Plot: Channel === */
.plot.channel {
  background-color: #f8f8f8;
}

a.plot.channel {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.plot.channel .channel-emoji {
  font-size: 32px;
  line-height: 1;
}

.plot.channel .channel-title {
  font-family: var(--courier);
  font-size: 18px;
  font-weight: bold;
  color: #000;
  text-align: center;
  padding: 0 10px;
}

.plot.channel .channel-meta {
  font-family: var(--courier);
  font-size: 14px;
  color: #666;
}

.plot.channel .channel-lock {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  opacity: 0.4;
}

/* === Caption pills (overlaid on images) === */
.plot-caption {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  line-height: 19px;
  display: flex;
  gap: 4px;
  align-items: flex-end;
}

.plot-caption span {
  font-family: var(--courier);
  font-size: 11px;
  color: #000;
  background: #fff;
  padding: 3px 6px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.plot-caption-top,
.plot-label-top {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  line-height: 19px;
  z-index: 1;
}

.plot-caption-top span,
.plot-label-top span {
  font-family: var(--courier);
  font-size: 11px;
  color: #000;
  background: rgba(255,255,255,0.85);
  padding: 3px 6px;
  border: 1px solid rgba(0,0,0,0.3);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.plot-badge-corner {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 1;
  font-family: var(--courier);
  font-size: 11px;
  font-weight: bold;
  color: #d32f2f;
  background: rgba(255,255,255,0.9);
  padding: 3px 6px;
  border: 1px solid #d32f2f;
}

/* === Intro box (fixed bottom-left) === */
.intro-box {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 460px;
  height: 220px;
  background: #1a1a1a;
  color: #c0c0c0;
  border: 1px solid #333;
  padding: 16px 20px;
  font-family: var(--courier);
  font-size: 13px;
  z-index: 100;
  line-height: 1.5;
  overflow: hidden;
}

.intro-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  color: #bbb;
  font-size: 18px;
  cursor: pointer;
  font-family: var(--courier);
  line-height: 1;
}

.intro-close:hover {
  color: #fff;
}

.intro-inner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.intro-art {
  display: none;
}

.intro-text {
  min-width: 0;
}

.intro-brand {
  color: #fff;
  font-weight: bold;
}

.intro-dim {
  color: #fff;
}

.intro-green {
  color: #66ff66;
}

.intro-gap {
  height: 4px;
}

.intro-prompt-line {
  color: #fff;
}

.intro-cycle-word {
  color: #fff;
  font-weight: bold;
}

.intro-cta {
  position: absolute;
  bottom: 14px;
  right: 16px;
  font-family: var(--courier);
  font-size: 12px;
  font-weight: bold;
  color: #000;
  background: #66ff66;
  color: #000;
  padding: 4px 12px;
  text-decoration: none;
}

.intro-cta:hover {
  background: #66ff66;
  color: #000;
  text-decoration: none;
}

.intro-cursor {
  color: #4CAF50;
  animation: blink-cursor 0.8s steps(1) infinite;
}

@keyframes blink-cursor {
  50% { opacity: 0; }
}

.intro-actions a:hover {
  border-color: #9c9c9c;
}

/* === Options (fixed bottom-right) === */
.grid-options {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 0;
  background: #eaeaea;
  border: 1px solid #676767;
  font-family: var(--courier);
  font-size: 16px;
  z-index: 100;
}

.grid-option {
  padding: 8px 10px;
  cursor: pointer;
  text-decoration: none;
  color: #000;
}

.grid-option:first-child {
  border-right: 1px solid #676767;
}

.grid-option:hover {
  text-decoration: none;
  background: #ddd;
}

.grid-option.active {
  font-weight: bold;
}

/* === Reading view (item detail) === */
.reading {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.reading-wrap {
  background: #fff;
  min-height: 100dvh;
}

.reading h1 {
  font-family: var(--courier);
  font-size: 19px;
  font-weight: bold;
  line-height: 1.3;
  margin-bottom: 6px;
}

.reading-meta-table {
  font-family: var(--courier);
  font-size: 13px;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.reading-meta-table td {
  padding: 6px 0;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

.reading-meta-table .meta-key {
  color: #999;
  width: 120px;
  padding-right: 24px;
}

.reading-meta-table .meta-value {
  color: #333;
}

pre.reading-body {
  font-family: var(--courier);
  font-size: 16px;
  line-height: 24px;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}

.reading-body th { background: #f9f9f9; font-weight: bold; }


/* PDF in reading view — embedded viewer */
.reading-pdf {
  background: #fff;
  padding: 20px;
}

.reading-pdf embed {
  width: 100%;
  height: 80vh;
  max-height: 700px;
  border: 1px solid #dadada;
}

/* Image in reading view — full width, outside narrow container */
.reading-image {
  text-align: center;
  background: #fff;
  padding: 20px 0;
}

.reading-image img {
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  display: inline-block;
}

/* Bookmark in reading view */
.bookmark-preview {
  border: 1px solid #e6e6e6;
  overflow: hidden;
  margin-bottom: 20px;
}

.bookmark-preview img {
  width: 100%;
  aspect-ratio: 1.91;
  object-fit: cover;
}

.reading-title-link {
  color: var(--link-color);
  text-decoration: underline;
}

.bookmark-link {
  display: block;
  font-family: var(--courier);
  font-size: 13px;
  color: var(--link-color);
  text-decoration: underline;
  margin-bottom: 10px;
  word-break: break-all;
}

.bookmark-open {
  display: inline-block;
  margin-top: 16px;
  color: var(--link-color);
  font-size: 14px;
}

/* Divider */
hr {
  border: 0;
  border-bottom: 1px solid #dadada;
  margin: 20px 0;
}

.reading-channels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1px;
  background-color: var(--bg-color);
  margin-top: 16px;
}

.back-link {
  display: block;
  padding: 16px 0;
  color: #666;
  font-family: var(--courier);
  font-size: 14px;
}

/* === Bento profile page === */
.private-profile {
  text-align: center;
  padding: 80px 20px;
  font-family: var(--courier);
  color: #999;
}

.private-profile .private-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.private-profile h1 {
  color: #333;
  font-size: 20px;
  margin-bottom: 8px;
}

.start-options {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 32px;
}

.start-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 28px;
  background: #fff;
  border: 1px solid #dadada;
  text-decoration: none;
  color: #000;
  font-family: var(--courier);
}

.start-option:hover {
  border-color: #999;
  text-decoration: none;
}

.start-emoji {
  font-size: 32px;
  margin-bottom: 8px;
}

.start-label {
  font-weight: bold;
  font-size: 14px;
}

.start-detail {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

.bento-header {
  background: #fff;
  padding: 20px;
  display: flex;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid #dadada;
}

.bento-header-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  font-family: var(--courier);
  flex-shrink: 0;
}

.bento-header-info h1 {
  font-family: var(--courier);
  font-size: 22px;
  font-weight: bold;
}

.bento-header-info p {
  font-family: var(--courier);
  font-size: 15px;
  color: #666;
  margin-top: 2px;
}

.bento-header-meta {
  font-family: var(--courier);
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

.view-tabs {
  font-family: var(--courier);
  font-size: 14px;
  padding: 8px 8px 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border-bottom: 1px solid #dadada;
}

.view-tab {
  color: #999;
  text-decoration: none;
}

.view-tab.active {
  color: #000;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.view-dot {
  color: #999;
  margin: 0 4px;
}

/* === Channel page header === */
.channel-header {
  background: #fff;
  padding: 20px;
  border-bottom: 1px solid #dadada;
}

.channel-header h1 {
  font-family: var(--courier);
  font-size: 22px;
  font-weight: bold;
}

.channel-header p {
  font-family: var(--courier);
  font-size: 15px;
  color: #666;
  margin-top: 4px;
}

.channel-header-meta {
  font-family: var(--courier);
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

/* === Keys page === */
.keys-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 40px 16px;
  background: #fff;
  min-height: 100dvh;
}

.keys-page h1 {
  font-family: var(--courier);
  font-size: 24px;
  margin-bottom: 16px;
}

.keys-form {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.keys-form input {
  flex: 1;
  padding: 8px;
  border: 1px solid gray;
  font-family: var(--courier);
  font-size: 16px;
  min-width: 0;
}

.keys-form button {
  padding: 4px 12px;
  font-family: var(--courier);
  font-size: 15px;
  background: #f7f7f7;
  border: 1px solid #c0c0c0;
  border-radius: 4px;
  cursor: pointer;
}

.keys-form button:hover {
  border-color: #9c9c9c;
}

.keys-list {
  list-style: none;
}

.keys-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #e6e6e6;
  font-family: var(--courier);
  font-size: 16px;
}

.keys-item-remove {
  font-family: var(--courier);
  font-size: 13px;
  color: #999;
  cursor: pointer;
  background: none;
  border: none;
}

.keys-note {
  font-family: var(--courier);
  font-size: 12px;
  color: #999;
  margin-top: 16px;
  line-height: 1.5;
}

/* Flash */
.flash {
  padding: 8px;
  max-width: 489px;
  margin: 20px auto;
  font-family: var(--courier);
}

.flash-info { background-color: #e8ffe8; }
.flash-error { background-color: yellow; }

/* Empty state */
.empty {
  background: #fff;
  padding: 48px 20px;
  text-align: center;
  color: #666;
  font-family: var(--courier);
  font-size: 17px;
}

/* Load more */
.load-more {
  display: block;
  background: #fff;
  padding: 12px;
  text-align: center;
  font-family: var(--courier);
  font-size: 13px;
  color: #666;
  text-decoration: none;
}

.load-more:hover {
  text-decoration: underline;
}

/* Footer */
footer {
  background: #fff;
  border-top: 1px solid #c5c5c5;
  padding: 10px;
  color: #5a5a5a;
  font-family: var(--courier);
}

footer a {
  text-decoration: none;
  color: #5a5a5a;
}

footer a:hover {
  text-decoration: underline;
}

/* === Responsive === */
@media (max-width: 600px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .intro-box {
    bottom: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    height: auto;
    font-size: 12px;
  }
  .intro-art {
    display: none;
  }
  .grid-options {
    display: none;
  }
}

/* === Live Badge === */
.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #22c55e;
  padding: 6px 10px;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* plot-wrap: transparent grid child so plots lay out normally */
.plot-wrap {
  display: contents;
}

/* new items fade + scale in */
.plot-enter > * {
  animation: plot-enter 1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes plot-enter {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* edited items get a brief highlight flash */
.plot-update > * {
  animation: plot-update 0.8s ease both;
}

@keyframes plot-update {
  0% { box-shadow: 0 0 0 2px #22c55e; }
  100% { box-shadow: 0 0 0 2px transparent; }
}
