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

/* Prevent font size inflation */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

/* Remove default margin in favour of better control in authored CSS */
body, h1, h2, h3, h4, p,
figure, blockquote, dl, dd {
  margin: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role='list'],
ol[role='list'] {
  list-style: none;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  line-height: 1.5;
}

/* Balance text wrapping on headings */
h1, h2,
h3, h4 {
  text-wrap: balance;
}

a {
  text-decoration-skip-ink: auto;
  color: currentColor;
}

/* Make images easier to work with */
img,
picture {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input, button,
textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
  min-height: 6em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: 5ex;
}

:root {
  --gbg: #ffffff; /*global background*/
  --bg: var(--gbg); /*background*/
  --gbl: #ffffff80; /*global background light*/
  --bl: var(--gbl); /*background light*/
  --gfg: #000000; /*global foreground*/
  --fg: var(--gfg); /*foreground*/
  --gfl: #00000080; /*global foreground light*/
  --fl: var(--gfl); /*foreground light*/
  --gprimary: #452faa; /*global primary*/
  --primary: var(--gprimary); /*primary*/
  --gprimaryl: #452faa80; /*global primary light*/
  --primaryl: var(--gprimaryl); /*primary light*/
  --gsecondary: #fea2db; /*global secondary*/
  --secondary: var(--gsecondary); /*secondary*/
  --gsecondaryl: #fea2db80; /*global secondary light*/
  --secondaryl: var(--gsecondaryl); /*secondary light*/
}

.dark {
  --bg: var(--gfg);
  --bl: var(--gfl);
  --fg: var(--gbg);
  --fl: var(--gbl);
}

:is(.light, .dark) {
  color: var(--fg);
}

@font-face {
  font-family: 'SourceSans';
  src: url('/font/SS3IVariable.ttf') format('truetype');
  font-weight: 200 900;
  font-style: italic;
  font-display: block;
}
@font-face {
  font-family: 'SourceSans';
  src: url('/font/SS3Variable.ttf') format('truetype');
  font-weight: 200 900;
  font-style: normal;
  font-display: block;
}

body {
  font-family: 'SourceSans';
  background: var(--bg);
  color: var(--fg);
}

.tripartite {
  display: grid;
  grid-template-columns: 0fr 1fr 0fr;
  position: relative;
}

.wide-right {
  display: grid;
  grid-template-columns: 12rem calc(40rem + calc(.6 * calc(100% - 70rem))) calc(18rem + calc(.4 * calc(100% - 70rem)));
  position: relative;
}

#left-sidebar, .tripartite #right-sidebar {
  width: 12rem;
  max-height: 100vh;
  overflow-y: scroll;
  scrollbar-width: none;
}

#left-sidebar, .wide-right #right-sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}

#left-sidebar {
  align-items: flex-end;
}

@media (min-width: 52rem) and (max-width: 70rem) {
  .wide-right {
    grid-template-columns: 12rem 40rem calc(100% - 52rem);
    #right-sidebar {
      grid-column: 2 / 3;
    }
    #left-sidebar {
      position: sticky;
      top:0;
    }
    #main-content {
      max-height: none;
      height: unset;
    }
  }
}  

@media (min-width: 52rem) and (max-width: 64rem) {
  .tripartite {
    grid-template-columns: 0fr 1fr;
    #right-sidebar {
      display: none;
    }
    #main-content {
      margin-right: calc(100vw - 52rem);
    }
  }
}

@media (min-width: 48rem) and (max-width: 52rem) {
  .tripartite {
    display: grid;
    grid-template-columns: 0fr 1fr;

    #right-sidebar {
      display: none;
    }
  }
  .wide-right {
    grid-template-columns: 12rem calc(100% - 12rem);
    #right-sidebar {
      grid-column: 2 / 3;
    }
    #main-content {
      max-height: none;
      height: unset;
    }
    #left-sidebar {
      position: sticky;
      top:0;
    }
  }
}

@media (min-width: 36rem) and (max-width: 48rem) {
  .tripartite {
    display: block;
    #left-sidebar, #right-sidebar {
      display: none
    }
    #main-content {
      margin-left: calc(100vw - 36rem);
    }
  }
  .wide-right {
    grid-template-columns: calc(100% - 36rem) 36rem;
    #left-sidebar {
      display: none
    }
    #main-content, #right-sidebar {
      grid-column: 2 / 3;
    }
    #main-content {
      max-height: none;
      height: unset;
    }
  }
}

@media (max-width: 36rem) {
  .tripartite {
    display: block;
    #left-sidebar, #right-sidebar {
      display: none
    }
  }
  .wide-right {
    display: block;
    #left-sidebar {
      display: none
    }
    #main-content {
      max-height: none;
      height: unset;
    }
  }
  #brains-ur-eat#brains-ur-eat {
    font-size: var(--fs-min);
  }
}

.sidebar-group {
  display:flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
}

#left-sidebar .sidebar-group {
  align-items: flex-end;
}

#right-sidebar .sidebar-group {
  align-items: flex-start;
}

#watched-threads button {
  position: relative;
}

#watched-threads button:hover {
  color: transparent;
}

#watched-threads button:hover::before {
  position: absolute;
  top: 0;
  right: 0;
  left: -3rem;
  text-align:right;
  overflow: visible;
  white-space: nowrap;
  color: var(--fg);
}

#watched-threads button.recent-activity:hover::before {
  content: 'sort by total activity';
}

#watched-threads button.ignore-thread:hover::before {
  left: 0;
  right: 3rem;
  text-align: left;
  content: 'click to ignore';
}

.new-thread:has(.ignore-thread:hover) .watch-thread {
  color: transparent;
}

#watched-threads button.watch-thread:hover::before {
  content: 'click to watch';
}

#watched-threads button.total-activity:hover::before {
  content: 'sort by recent activity'
}

.watched-thread, .new-thread {
  display: flex;
  width: 100%;
  justify-content: space-between;
}

.watch-thread {
  width: 90%;
  overflow: hidden;
  text-align: right;
}

#left-sidebar {
  position: relative;
  padding-right: 4px;
  overflow-y: hidden;
}

#left-sidebar::after {
  content: '';
  position: absolute;
  z-index: -3;
  left: 0;
  right:0;
  top:-50%;
  bottom:-50%;
  background: linear-gradient(0deg, var(--fg) 50%, transparent 50%);
  background-repeat: repeat-y;
  background-size: 4px 16px;
  background-position: 100% 0;
  animation: animate-up 128s infinite linear;
}

#left-sidebar::before {
  content: '';
  position: absolute;
  z-index: -3;
  left: 0;
  right: calc(100% - 4px);
  top: 0;
  bottom: var(--remaining);
  background: var(--accent);
}

@keyframes animate-up {
  0% {
    transform: translateY(25%);
  }

  99% {
    transform: translateY(-25%);
  }
}

#main-content {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: scroll;
  scrollbar-width: none;
}

button {
  background-color: transparent;
  border: none;
  color: var(--fg);
  padding: 0;
  cursor: pointer;
}

button:hover {
  font-weight: 700;
}

input {
  background-color: transparent;
  border: none;
}

form {
  display: flex;
  flex-direction: column;
}

.form-field {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.form-field > :is(input, textarea) {
  background-color: var(--fg);
  color: var(--bg);
  flex-grow: 1;
  max-width: 100%;
}

.form-submit > input {
  background-color: var(--fg);
  color: var(--bg);
}

.thread-link {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.volume-settings {
  accent-color: var(--primary);
}

.thread-tail {
  padding-bottom: 1rem;
}

.thread-tail:hover > div {
  transform: translateX(1rem);
}

.thread-tail:hover > div .time {
  transform: translateX(-1rem);
}

.thread-tail:hover {
  background: var(--accentl);
}

.thread-tail > div {
  transition-duration: .07s;
  transition-delay: 0s;
}

.thread-tail > div .time {
  transition-duration: .07s;
  transition-delay: 0s;
}

.catalog-thumb:hover::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index:-1;
  background: var(--accentl);
  transform: translateY(-0.5rem);
}

.catalog-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index:-1;
  transition-property: transform;
  transition-duration: .07s;
  transform: translateY(0rem);
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-template-rows: masonry;
}
.catalog::after {
  content: "looks best with mozilla firefox with masonry flag enabled in about:config!"
}

@supports (grid-template-rows: masonry) {
  .catalog::after {
    content: ""
  }
}

.catalog-thumb {
  padding-bottom: 1rem;
  transition-duration: .07s;
  position: relative;
}

.catalog-thumb:hover {
  transform: translateY(0.5rem);
}

:is(.catalog, .thread-tail) .topic {
  font-size: 2rem;
  word-break: break-word;
}

.catalog .tx {
  padding-bottom: 0;
}

.archived {
  opacity: 0.5;
}

.bump-limit {
  opacity: 0.75;
}

::selection {
  background: var(--primary);
}

.profile-head ::selection {
  background: var(--accent);
}

.banned {
  font-size: 8rem;
  line-height: 1;
}

#settings-pane {
  accent-color: var(--primary);
}

.thumb img {
  max-width: 12rem;
  max-height: 12rem;
}

:is(.tx, .profile-friend, .forum-post) .avatar.thumb img {
  max-width: 6rem;
  max-height: 6rem;
} 

.profile-friend {
  align-items: center;
}

.profile-head, .profile-friend {
  display: flex;
}

form:has(.form-submit:hover) {
  background: var(--primaryl);
}

.content-tuple {
  margin-bottom: 1rem
}

.friends {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  row-gap: 1rem;
  column-gap:1rem;
}

.bio {
  white-space: pre-wrap;
}

iframe {
  border: none;
}

#action-modal {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  z-index: 999 !important;
  inset: 0;
  backdrop-filter: brightness(50%);
}

#action-modal-content {
  max-width: 30rem;
  background: var(--gbg);
  padding: 1rem;
}

.actioning {
  outline: .25rem dashed #ff0000 !important;
  background: #00ffff !important;
  color: #000000 !important;
}

.reported.image-wrapper {
  filter: blur(2rem);
}

.reported.image-wrapper.thumb {
  filter: blur(.5rem);
}

.confirm-cancel {
  display: flex; 
  justify-content: space-between;
}

a.clickable {
  font-weight: 400;
}

a.you::after {
  content: " (you)";
}

form:has(.form-submit) {
  margin-bottom: 2rem;
}

.watch-toggle {
  align-self: flex-start;
}

.rooms {
  display: grid;
  grid-template-columns: 12rem calc(100% - 12rem);
}

.profile-room {
  width: 12rem;
}

.profile-room .profile {
  position: sticky;
  top: 0;
}

.profile-room .image-wrapper {
  float: none;
}

.roof {
  background: var(--accent);
  display: flex;
}

.roof .reply {
  margin-left: auto;
}

#brains-ur-eat {
  font-size: calc(var(--fs-min) + calc(var(--fs-pmax) * .5));
}

.forum-link {
  display: flex;
  cursor: pointer;
  background: var(--accent);
}

:not(.tx) .handle {
  color: var(--fl);
  font-size: .75em;
}

.forum-link .thread {
  width: 60%;
}

.forum-post .status {
  font-size: 0.75em;
}

.forum-post {
  margin-bottom: 1rem;
  :not(.avatar).image-wrapper {
    float: right;
  }
}

.forum-transmitter .nick {
  color: var(--fg);
} 

.forum-post.collapsed :is(.rooms) {
  display: none;
}

.forum-post .time {
  cursor: pointer;
}

#forum-notification-canvas {
  z-index: -1;
  position:fixed;
  top: 0;
  left: 0;
  filter: blur(2rem);
}

.new-post {
  display: none;
}

.wide-right:not(:has(.new-post)) .new-posts {
  visibility: hidden;
}

#action-modal form, form.forum-transmitter {
  margin-bottom: 0;
}

.pair {
  display: flex;
  width: 100%;
  justify-content: space-between;
}

.sidebar-group:hover .hidden-till-hover {
  visibility: visible;
}

.hidden-till-hover {
  color: var(--fl);
  margin-inline: auto;
  visibility: hidden;
  :hover {
    color: var(--fg);
    visibility: visible;
  }
}

/* was doing it this way & i'd prefer it, but i think attr() seems a bit buggy ngl */
/* #inbox-counter::before { */
/*   content: attr(data-ncount); */
/* } */
/**/
/* #inbox-counter[data-count="0"]::before { */
/*   content: ""; */
/* } */
/**/
/* #inbox-counter:is([data-count="0"],[data-count="1"])::after { */
/*   content: ""; */
/* } */
/**/
/* #inbox-counter::after { */
/*   content: "s"; */
/* } */
/**/
/* #inbox-counter[data-count="0"] { */
/*   color: transparent */
/* } */
/**/
#inbox-counter {
  width: 5.5rem;
  position: relative;
}

.sidebar-group:has(a[href="/inbox"]:hover) a[href="/inbox"] {
  animation: squiggly-anim 0.34s linear infinite;
}

a:hover {
  animation: squiggly-anim 0.34s linear infinite;
}

.forum-link:hover:not(:has(a:hover)) {
  animation: biggly-anim 0.34s 0.067s linear infinite;
}

@keyframes squiggly-anim {
  0% {
    filter: url("/svg/squiggly.svg#0-0");
  }
  25% {
    filter: url("/svg/squiggly.svg#0-1");
  }
  50% {
    filter: url("/svg/squiggly.svg#0-2");
  }
  75% {
    filter: url("/svg/squiggly.svg#0-3");
  }
  100% {
    filter: url("/svg/squiggly.svg#0-4");
  }
}

@keyframes biggly-anim {
  0% {
    filter: url("/svg/squiggly.svg#1-0");
  }
  25% {
    filter: url("/svg/squiggly.svg#1-1");
  }
  50% {
    filter: url("/svg/squiggly.svg#1-2");
  }
  75% {
    filter: url("/svg/squiggly.svg#1-3");
  }
  100% {
    filter: url("/svg/squiggly.svg#1-4");
  }
}

.notifications li:not(hr ~ li) {
  background: var(--primaryl);
  &:hover {
    background: var(--primary);
  }
}

/* to escape user agent, which we are not sure how big margin for ul might be, */ 
/* i just pick a big number to be safe */
.notifications hr {
  margin-inline: -20rem;
}

.notifications:not(:has(li)) {
  display: none;
}

.poke {
  flex-direction: row;
  input {
    color: var(--fg);
    margin: 0;
    padding: 0;
    &[type="submit"]:hover {
      font-weight: 700;
    }
  }
}

.poke span::after {
  content: "?";
}

.poke:has([type="submit"]:hover) span::after {
  content: "!";
  font-weight: 700;
}
