/* Guestbook page – builds on the tokens in style.css */

.gb-nav__right{
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.gb-lang{
  padding: 0.4rem 0.6rem;
}

.gb{
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 2rem;
}

.gb__title{
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

.gb__lead{
  margin: 0;
  max-width: 34rem;
  color: var(--ink-soft);
  line-height: 1.6;
  font-size: 0.98rem;
}

/* FORM */

.gb-form{
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 2rem;
}

.gb-form__row{
  display: flex;
  align-items: stretch;
  gap: 0.85rem;
}

.gb-field{
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.7rem 1.2rem;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.gb-field--name{
  flex: 1;
  min-width: 0;
}

.gb-field:focus-within{
  border-color: var(--muted);
}

.gb-field.is-invalid{
  border-color: var(--status-dnd);
}

.gb-field.is-invalid .gb-field__label{
  color: var(--status-dnd);
}

.gb-field.is-disabled{
  opacity: 0.5;
}

.gb-field__label{
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gb-field__input{
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0;
  outline: none;
  resize: none;
  width: 100%;
}

.gb-field__input::placeholder{
  color: var(--muted);
  font-weight: 400;
}

.gb-field__input--textarea{
  min-height: 5.5rem;
  line-height: 1.5;
  font-weight: 500;
}

.gb-hp{
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* checkbox */

.gb-check{
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  padding: 0 1.1rem;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s ease;
}

.gb-check:hover{
  border-color: var(--muted);
}

.gb-check__input{
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gb-check__box{
  position: relative;
  width: 18px;
  height: 18px;
  border: 1px solid var(--muted);
  border-radius: 4px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.gb-check__box::after{
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s ease;
}

.gb-check__input:checked + .gb-check__box{
  background: var(--ink);
  border-color: var(--ink);
}

.gb-check__input:checked + .gb-check__box::after{
  transform: rotate(45deg) scale(1);
}

.gb-check__input:focus-visible + .gb-check__box{
  outline: 2px solid var(--muted);
  outline-offset: 2px;
}

.gb-check__text{
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* buttons */

.gb-btn{
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.75rem 1.4rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease, transform 0.1s ease;
}

.gb-btn:hover{
  border-color: var(--muted);
  background: var(--surface-2);
}

.gb-btn:active{
  transform: scale(0.98);
}

.gb-btn:disabled{
  opacity: 0.55;
  cursor: default;
}

.gb-btn--primary{
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
  font-weight: 500;
}

.gb-btn--primary:hover{
  background: var(--ink);
  border-color: var(--ink);
  opacity: 0.88;
}

.gb-form__foot{
  display: flex;
  align-items: center;
  gap: 1rem;
}

.gb-counter{
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
  margin-left: auto;
}

.gb-counter.is-near{
  color: var(--status-idle);
}

.gb-status{
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  min-height: 1.1em;
  margin: 0;
}

.gb-status.is-error{
  color: var(--status-dnd);
}

.gb-status.is-success{
  color: var(--status-online);
}

.gb-hint{
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--muted);
}

.gb-hint a{
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* TOOLBAR */

.gb-list-wrap{
  margin-top: 3rem;
}

.gb-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 1.1rem;
}

.gb-toolbar__count{
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gb-sort{
  display: inline-flex;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px;
  background: var(--surface);
}

.gb-sort__btn{
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.gb-sort__btn:hover{
  color: var(--ink);
}

.gb-sort__btn.is-active{
  background: var(--ink);
  color: var(--bg);
}

/* ENTRIES */

.gb-list{
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.gb-entry{
  position: relative;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--surface);
  padding: 1.1rem 1.25rem;
  animation: gb-in 0.35s ease both;
  transition: border-color 0.2s ease;
}

.gb-entry:hover{
  border-color: color-mix(in srgb, var(--muted) 55%, var(--hairline));
}

.gb-entry.is-pinned{
  border-color: color-mix(in srgb, var(--status-idle) 45%, var(--hairline));
}

.gb-entry.is-mine::before{
  content: "";
  position: absolute;
  left: -1px;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 3px;
  background: var(--status-online);
}

@keyframes gb-in{
  from{ opacity: 0; transform: translateY(8px); }
  to{ opacity: 1; transform: none; }
}

.gb-entry__head{
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.gb-avatar{
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  background: var(--avatar, #555);
}

.gb-avatar--anon{
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--hairline);
}

.gb-avatar svg{
  width: 18px;
  height: 18px;
}

.gb-entry__who{
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.gb-entry__name{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.gb-entry__name--anon{
  color: var(--ink-soft);
  font-weight: 500;
}

.gb-entry__meta{
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.gb-badge{
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  color: var(--muted);
}

.gb-badge--you{
  color: var(--status-online);
  border-color: color-mix(in srgb, var(--status-online) 45%, transparent);
}

.gb-pin{
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  cursor: default;
}

.gb-pin svg{
  width: 16px;
  height: 16px;
}

.gb-entry__message{
  margin: 0.8rem 0 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.gb-reply{
  margin-top: 0.9rem;
  padding: 0.7rem 0.95rem;
  border-left: 2px solid var(--muted);
  background: var(--surface-2);
  border-radius: 0 10px 10px 0;
}

.gb-reply__who{
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.gb-reply__text{
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.gb-entry__actions{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.9rem;
}

.gb-act{
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.gb-act:hover{
  color: var(--ink);
  background: var(--surface-2);
}

.gb-act:focus-visible,
.gb-sort__btn:focus-visible,
.gb-btn:focus-visible{
  outline: 2px solid var(--muted);
  outline-offset: 2px;
}

.gb-act--danger:hover{
  color: var(--status-dnd);
}

.gb-act--spacer{
  margin-left: auto;
}

.gb-like svg{
  width: 16px;
  height: 16px;
  fill: transparent;
  stroke: currentColor;
  stroke-width: 2;
  transition: fill 0.2s ease, transform 0.2s ease;
}

.gb-like.is-liked{
  color: #ff5a7a;
  border-color: color-mix(in srgb, #ff5a7a 35%, transparent);
  background: color-mix(in srgb, #ff5a7a 10%, transparent);
}

.gb-like.is-liked svg{
  fill: currentColor;
}

.gb-like.is-pop svg{
  animation: gb-pop 0.35s ease;
}

@keyframes gb-pop{
  0%{ transform: scale(1); }
  40%{ transform: scale(1.45); }
  100%{ transform: scale(1); }
}

.gb-confirm{
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--status-dnd);
}

/* inline edit / reply */

.gb-edit{
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.gb-edit .gb-field{
  padding: 0.6rem 0.9rem;
}

.gb-edit__row{
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: stretch;
}

.gb-edit__foot{
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.gb-edit .gb-btn{
  padding: 0.55rem 1rem;
}

.gb-edit__error{
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--status-dnd);
  margin: 0;
}

/* states */

.gb-skeleton{
  height: 118px;
  border-radius: 14px;
  border: 1px solid var(--hairline);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 300% 100%;
  animation: gb-shimmer 1.4s linear infinite;
}

@keyframes gb-shimmer{
  from{ background-position: 100% 0; }
  to{ background-position: 0 0; }
}

.gb-empty{
  text-align: center;
  border: 1px dashed var(--hairline);
  border-radius: 14px;
  padding: 2.5rem 1.5rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.gb-empty .gb-btn{
  margin-top: 1rem;
}

.gb-more{
  display: flex;
  justify-content: center;
  margin-top: 1.4rem;
}

.gb-more[hidden]{
  display: none;
}

.gb-admin{
  margin: 2.5rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--status-idle);
}

.gb-admin[hidden]{
  display: none;
}

.gb-toast{
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 2rem);
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
}

.gb-toast.is-visible{
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 620px){

  .gb{
    padding: 2.5rem 1.25rem 1.5rem;
  }

  .gb-form__row{
    flex-direction: column;
  }

  .gb-check{
    padding: 0.8rem 1.1rem;
  }

  .gb-nav__right .legal-nav__back{
    display: none;
  }

  .gb-toolbar{
    flex-wrap: wrap;
  }

  .gb-entry{
    padding: 1rem;
  }

}

@media (prefers-reduced-motion: reduce){

  .gb-entry,
  .gb-skeleton,
  .gb-like.is-pop svg{
    animation: none;
  }

}
