/*
 * Copyright 2021 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@import url('https://fonts.googleapis.com/css2?family=Montserrat&display-swap');

:root {
    --base-fontsize: 1.0rem;
    --header-scale: 1.125;
    --line-height: 1.618;

    /* Dark Theme (Default) */
    --main-bg: #000;
    --text-color: #bfbfbf;
    --link-color: #9fc6e0;
    --header-color: #bfbfbf;
    --wikilink-color: deepskyblue;
    --wikilink-visited-color: deepskyblue;
    --wikilink-hover-color: hotpink;
    --accent-bg: #2B2B2B;
    --border: #666;
    --node-bg: #191919;
    --subnode-bg: #303030;
    --subnode-text-color: #cfcfcf;
    --pulled-pushed-bg: #101010;
    --info-box-bg: #A5550D; /* A warm, caramel/flan-like color */
    --info-box-text-color: #cfcfcf;
    --intro-footer-bg: #811707;
    --intro-footer-text-color: #cfcfcf;
    --button-bg: #2d2d2d;
    --button-text-color: #ddd;
    --button-border-color: #999;
    --logo-filter: invert(1);
    --tab-active-bg: #ffffff20;
    --overlay-bg: rgba(0, 0, 0, 0.95);
    --separator-border: #ddd;
    --blockquote-border: #bfbfbf;
    --agora-protocol-text: #ffffff80;
    --agora-protocol-bg: black;
    --dismiss-button-color: white;
}

[data-theme="light"] {
    --main-bg: #e9e9e9;
    --text-color: #000000;
    --link-color: #377ba8;
    --header-color: #377ba8;
    --wikilink-color: #1e53a6;
    --wikilink-visited-color: #1e53a6;
    --wikilink-hover-color: hotpink; /* Or something else */
    --accent-bg: #F5F7FF;
    --border: #D8DAE1;
    --node-bg: #f0f0f0;
    --subnode-bg: #f8f8f8;
    --subnode-text-color: #000;
    --pulled-pushed-bg: #fdfdfd;
    --info-box-bg: #ffedb1;
    --info-box-text-color: #000;
    --intro-footer-bg: #ffe17e;
    --intro-footer-text-color: #000;
    --button-bg: #ddd;
    --button-text-color: #000;
    --button-border-color: #999;
    --logo-filter: none;
    --tab-active-bg: rgba(255, 255, 255, 1);
    --overlay-bg: rgba(238, 238, 238, 0.9);
    --separator-border: #222;
    --blockquote-border: #000; /* Or a shade of grey */
    --agora-protocol-text: #00000080;
    --agora-protocol-bg: #ffffff;
    --dismiss-button-color: black;
}


html {
    font-family: 'Noto Sans', sans-serif;
    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
}

body {
    background: var(--main-bg);
    color: var(--text-color);
    width: 100%;
    font-size: var(--base-fontsize);
    margin: 0;
}

.content, .async-content {
    max-width: 80em;
    margin-left: auto;
    margin-right: auto;
    flex-direction: column;
    display: flex;
    justify-content: center;
    gap: 10px;
}

pre {
    white-space: pre-line;
}

a {
    color: var(--link-color);
}

.navigation > a {
  display: flex;
}

.navigation > a > span {
    flex-grow: 1;
    flex-shrink: 0;
    padding: 2px;
}

nav {
    font-family: sans-serif;
    max-width: 100%;
    position: sticky;
    top: 0;
    z-index: 4;
    background-color: var(--main-bg);
    padding: 0.25em;
    padding-bottom: 0px;
}

.navbar-item {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-direction: row;
}

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

button {
    border: 1px solid var(--button-border-color);
    border-radius: 4px;
    background: var(--button-bg);
    color: var(--button-text-color);
    text-transform: capitalize;
    padding: 3px 6px 3px 6px;
    white-space: nowrap;
}

ul {
    line-height: 1.7em;
    padding-right: 0.34em;
    padding-left: 2em;
}

li {
    padding: 0.17em;
}

.subnode-content > ul {
    filter: brightness(100%);
    display: inline-block;
    padding-right: 10px;
    padding-top: 5px;
    padding-bottom: 5px;
}

.subnode-content > ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.subnode-content > ul {
    filter: brightness(100%);
    display: inline-block;
    padding-right: 1em;
    padding-top: 5px;
    padding-bottom: 2em;
    background-color: var(--agora-protocol-bg);
    position: relative;
}

.subnode-content > ul::after {
    content: '(Agora Protocol inferred.)';
    position: absolute;
    bottom: 5px;
    font-size: smaller;
    font-style: italic;
    color: var(--agora-protocol-text);
}

li img {
    vertical-align: top;
}

hr {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.20), rgba(0, 0, 0, 0.1));
}

iframe {
    margin-top: 2px;
    margin-bottom: 2px;
    border-color: gray;
    border-style: dashed;
    border-width: 1px;
    height: 53em;
    width: 99.5%;
}

.mastodon-embed > iframe {
    height: auto;
    width: auto;
}

details .mastodon, .twitter {
    display: inline;
    max-width: 100%;
    vertical-align: top;
}

details[open] > :not(summary) {
    animation: slide-down 0.3s ease;
}
  
@keyframes slide-down {
    from { 
      opacity: 0;
      transform: translateY(-10px);
    }
    to { 
      opacity: 1;
      transform: translateY(0);
    }
}

@media screen and (max-width: 48em) {
    iframe {
        max-height: 35em;
    }
}

.container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
}

.column {
    background-color: #f0f0f0;
    padding: 20px;
    border: 1px solid #ccc;
}

@media (min-width: 48em) {
    .container {
        flex-direction: row;
    }

    .column {
        flex: 1;
    }
}

.navigation .logo {
    vertical-align: middle;
    max-width: 32px;
    max-height: 32px;
    margin-bottom: 4px;
}

.logo {
    filter: var(--logo-filter);
}

.spinner {
    animation: heartbeat 1s infinite;
}

.spinner2 {
    transform: translateZ(1px);
    animation: flipping 10s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

@keyframes heartbeat {
  0% { transform: scale(0.95); }
  5% { transform: scale(1.1); }
  39% { transform: scale(0.85); }
  45% { transform: scale(1); }
  60% { transform: scale(0.95); }
  100% { transform: scale(0.9); }
}

@keyframes flipping {
  0%, 100% { animation-timing-function: cubic-bezier(0.5, 0, 1, 0.5); }
  0% { transform: rotateY(0deg); }
  50% { transform: rotateY(1800deg); animation-timing-function: cubic-bezier(0, 0.5, 0.5, 1); }
  100% { transform: rotateY(3600deg); }
}

.content {
    line-height: var(--line-height);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--header-color);
    line-height: 1.1;
}

h1 { font-size: calc(var(--base-fontsize) * var(--header-scale) * var(--header-scale) * var(--header-scale) * var(--header-scale) * var(--header-scale)); margin-block-start: 10px; }
h2 { font-size: calc(var(--base-fontsize) * var(--header-scale) * var(--header-scale) * var(--header-scale)); margin-top: calc(var(--line-height) * 0.8rem); }
h3 { font-size: calc(var(--base-fontsize) * var(--header-scale)); margin-top: calc(var(--line-height) * 0.8rem); }
h4 { font-size: calc(var(--base-fontsize)); margin-top: calc(var(--line-height) * 0.8rem); }
h5 { font-size: calc(var(--base-fontsize) / var(--header-scale)); margin-top: calc(var(--line-height) * 0.8rem); }
h6 { font-size: calc(var(--base-fontsize) / var(--header-scale) / var(--header-scale)); }

li > p {
    margin-block-start: 0;
    margin-block-end: 0;
}

.content blockquote {
    padding-left: 0.5em;
    margin-left: 1em;
    border-left: 2px solid var(--blockquote-border);
    font-style: italic;
}

summary::-webkit-scrollbar {
    display: none;
}

summary, #footer {
    gap: 5px;
    vertical-align: middle;
    align-items: center;
    overflow-x: scroll;
    white-space: nowrap;
    justify-content: space-between;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.navigation::-webkit-scrollbar {
    display: none;
}

.navigation {
    width: 100%;
    box-sizing: border-box;
    display: flex;
}

.navigation-content {
    display: flex;
    gap: 5px;
    align-items: center;
    white-space: nowrap;
    justify-content: space-between;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
    flex-grow: 1;
    min-width: 0;
}

.navigation-content::-webkit-scrollbar {
    display: none;
}

.navigation, .intro {
    overflow-x: scroll;
    -ms-overflow-style: none;
    scrollbar-width: none;
    display: flex;
}

.webnav::-webkit-scrollbar {
    display: none;
}

.webnav{
    vertical-align: middle;
    align-items: center;
    overflow-x: scroll;
    white-space: nowrap;
    justify-content: space-between;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.topline-node {
    vertical-align: middle;
    overflow-y: auto;
}

.topline-node-wrapper {
    display: flex;
    align-items: center;
}

input[type="text"] {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

button, input {
    font-size: 0.9em;
}

.topline-agora {
    display: flex;
    justify-content: space-between;
    vertical-align: middle;
    overflow-y: auto;
    width: auto;
    margin-top: 10px;
    margin-right: 10px;
    margin-left: 10px;
}

.topline-query {
    flex: auto;
    display: inline;
    vertical-align: middle;
    margin-right: 4px;
}

.topline-cli {
    flex: auto;
    vertical-align: middle;
    width: 100%;
    margin-right: 4px;
}

#mini-cli {
    width: 100%;
    padding: 4px;
}

.cli-header {
    margin-right: 10px;
}

button {
    margin-right: 4px;
}

.web, .stoa {
    display: block;
    overflow-y: auto;
    width: auto;
}

summary {
    line-height: 1.7;
}

.separator {
    margin-top: 15px;
    margin-bottom: 15px;
    font-family: 'Montserrat', sans-serif;
}

.user {
    font-weight: bold;
}

.node, .web, .stoa, .search, .genai {
    border-color: gray;
    background: var(--node-bg);
    border-width: 0px;
    border-style: dotted;
    padding: 10px;
    overflow-x: hidden;
}

.context {
    border-color: gray;
    border-style: dotted;
    border-width: 0px;
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 10px;
}

.context-all {
    position: relative;
    height: 800px;
    border-color: gray;
    border-style: solid;
    border-width: 1px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.image-embed {
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
    max-height: 600px;
}

.subnode, .not-found {
    background: var(--subnode-bg);
    color: var(--subnode-text-color);
    padding: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
    overflow-x: auto;
}

.info-box {
    background: var(--info-box-bg);
    filter: brightness(100%);
    padding: 7px;
    font-style: italic;
    color: var(--info-box-text-color);
    border: 1px dashed var(--border);
}

.intro, #footer {
    background: var(--intro-footer-bg);
    padding: 7px;
    font-style: italic;
    color: var(--intro-footer-text-color);
}

.info-box, .intro {
    line-height: var(--line-height);
    text-align: left;
    padding: 7px;
    position: relative;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    opacity: 1;
    visibility: visible;
}

.dismiss-button {
    position: absolute;
    right: 10px;
    cursor: pointer;
    font-weight: bold;
    color: var(--dismiss-button-color);
}

.info-box::before {
  content: '➼';
  width: 1em;
  margin-right: 0.3em;
  flex-shrink: 0;
  transition: 0.3s;
}

.hidden {
    opacity: 0;
    visibility: hidden;
}

.intro {
    line-height: var(--line-height);
}

.intro::before {
  content: '➼';
  width: 1em;
  margin-right: 0.3em;
  flex-shrink: 0;
  transition: 0.3s;
}

.pulled-subnode, .pushed-subnode, .stoa-public {
    background: var(--pulled-pushed-bg);
    color: var(--subnode-text-color);
    padding: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.pulled-search-embed {
    overflow-x: hidden;
}


.node-header, .context-header, .stoa-header, .ctzn-header {
    justify-content: space-between;
    text-align: left;
    padding-bottom: 2px;
}

.header-with-button {
    display: flex;
}

details > summary {
    cursor: pointer;
}

.with-spacing {
    margin-top: 10px;
}

.node-name {
    text-transform: capitalize;
}

.subnode-header, .links-header, .search-header, .subnode-id {
    width: 100%;
    padding-bottom: 2px;
}

.subnode-header {
    border-bottom: 1px solid #ccc;
}

.subnode-footer, .node-footer {
    font-size: smaller;
    font-weight: bolder;
    width: 100%;
    display: flex;
    padding-top: 6px;
    border-top: 1px solid #ccc;
    text-align: left;
}

.subnode-contrib {
    text-align: right;
    text-decoration: none;
    max-width: 19%;
    margin-left: auto;
}

.footer-links, .footer-id {
    text-align: right;
    margin-left: auto;
    text-decoration: none;
    font-weight: normal;
}

.agora-actions, .internet-actions {
    text-decoration: none;
    margin-left: auto;
    display: block;
}

.subnode-id {
    max-width: 81%;
}

.subnode-id a {
    text-decoration: none;
}

.search {
    overflow: auto;
    gap: 10px;
}

.flex {
    display: flex;
}

.inline-flex {
    display: inline-flex;
    justify-content: space-between;
    width: 97%;
}

.inline-flex > div {
    flex: auto;
}

.subnodes {
    width: 100%;
}

.annotations, .delta {
    width: 100%;
    display: flex;
    background: var(--pulled-pushed-bg);
    color: var(--subnode-text-color);
    padding: 0.5em;
    margin-bottom: 10px;
    gap: 10px;
}

.delta-nodes {
    float: left;
    width: 50%;
}

.delta-annotations {
    background: var(--pulled-pushed-bg);
    float: left;
    width: 50%;
}

.backlinks, .forwardlinks {
    width: 50%;
    overflow: auto;
}

.pushlinks, .pulllinks {
    width: 33%;
    overflow: auto;
}

.backlinks-header, .pushlinks-header, .pulllinks-header, .forwardlinks-header {
    font-style: italic;
}

#agoragraph {
    height: 90%;
    width: 100%;
    position: absolute;
}

.links {
    overflow: auto;
    padding: 10px;
    margin: 10px;
    gap: 10px;
    max-height: 400px;
    width: 50%;
}

.search-header {
    text-align: left;
    margin-bottom: 1em;
    margin-left: 0.2em;
}

.wikilink-marker {
    font-weight: lighter;
    color: grey;
}

.wikilink:link {
    color: var(--wikilink-color);
}

.wikilink:visited {
    color: var(--wikilink-visited-color);
}

.wikilink:hover {
    color: var(--wikilink-hover-color);
}

.no-wikilinks .wikilink {
    color: inherit;
    text-decoration: none;
    pointer-events: none;
}

#hypothesis-frame {
    display: none;
    position: fixed;
    top: 10%; 
    right: 10px;
    width: 380px;
    height: 80%;
    z-index: 1000;
    background-color: transparent;
    border: none;
    flex-direction: column;
}

#hypothesis-frame.visible {
    display: flex;
}

#hypothesis-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #333;
    padding: 2px 8px;
    border: 1px solid #444;
    border-radius: 5px 5px 0 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

#hypothesis-drag-handle {
    cursor: move;
    font-size: 0.9em;
    font-family: sans-serif;
    color: #ccc;
    flex-grow: 1;
    text-align: center;
}

#hypothesis-client-container {
    flex-grow: 1;
    position: relative;
}

#hypothesis-close-btn {
    cursor: pointer;
    color: #fff;
    background-color: #555;
    border: 1px solid #777;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 18px;
    font-family: sans-serif;
    font-weight: bold;
}

.microblog_timeline {
    background: var(--pulled-pushed-bg);
    color: var(--subnode-text-color);
}

table {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
    margin: 10px 0;
}

td,
th {
    border: 1px solid var(--border);
    padding: .5rem;
    word-wrap: break-word;
    white-space: pre-wrap;
    text-align: left;
}

th {
    background: var(--accent-bg);
    font-weight: bold;
}

tr:nth-child(even) {
    background: var(--accent-bg);
}

table caption {
    font-weight: bold;
    margin-bottom: .5rem;
}

.burger {
    font-size: 1.5em;
    cursor: pointer;
}

.content, .async-content {
    position: relative;
}

body.overlay-open {
    overflow: hidden;
}

.overlay {
    height: 100%;
    width: 100%;
    top: 0;
    position: fixed;
    background-color: rgba(20, 20, 20, 0);
    overflow-x: hidden;
    z-index: 3;
    left: -120%; 
    transition: left 0.4s ease-in-out, background-color 0.4s ease-in-out;
}

.overlay.active {
    left: 0;
    background-color: var(--overlay-bg);
}

#toast-container {
    position: fixed;
    bottom: 10px;
    right: 50px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    z-index: 1000;
}

.toast {
    background-color: #1f2937;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.4s, transform 0.4s ease-in-out;
}

.toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.ai-provider-tab, .wiki-provider-tab, .web-provider-tab {
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
}

.ai-provider-tab.active, .wiki-provider-tab.active, .web-provider-tab.active {
    font-weight: bold;
    background-color: var(--tab-active-bg);
    text-decoration: none;
}

.links-flex {
    display: flex;
    flex-direction: row;
}

.overlay-content {
    padding: 20px;
}

.theme-toggle-text {
    cursor: pointer;
}

.context-flex {
    display: flex;
    flex-direction: row;
}

.links {
    width: 50%;
}

.graph-container {
    width: 50%;
    height: 400px;
    position: relative;
}

#graph {
    width: 100%;
    height: 100%;
}

#graph-toggle-labels {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 10;
    padding: 3px 6px;
}

