/* Comments use the site's old liquid-glass material and MD3 field/control shapes. */
:root {
  --comment-error: #b3261e;
}

.comments-title {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 650;
  line-height: 1.4;
}

.comments-toggle,
.comments-form-head {
  display: none;
}

.comments-icon {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 11px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.comments-icon svg {
  display: block;
  width: 22px;
  height: 22px;
}

.comments-icon:hover {
  background: color-mix(in srgb, var(--theme-deep) 8%, transparent);
}

.comments-icon:active {
  background: color-mix(in srgb, var(--theme-deep) 12%, transparent);
}

.comments-icon:focus-visible {
  outline: 2px solid var(--theme-deep);
  outline-offset: 3px;
}

.comments-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 24px;
  align-items: start;
}

.comments-compose {
  position: sticky;
  top: 24px;
  min-width: 0;
}

.comments-view {
  min-width: 0;
}

.comments-list {
  display: grid;
  gap: 12px;
}

.comments-list:empty {
  display: none;
}

.comments-list-status {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: var(--text-sm);
}

.comments-list-status[hidden] {
  display: none;
}

.comment-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--glass-edge);
  border-radius: 16px;
}

.comment-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.comment-name {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.comment-header time,
.comment-ip,
.comment-reply-to {
  color: var(--muted);
  font-size: var(--text-xs);
}

.comment-ip,
.comment-reply-to {
  overflow-wrap: anywhere;
}

.comment-reply-button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 44px;
  margin-left: auto;
  padding: 0 16px;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  background: var(--glass-highlight), var(--glass-color);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.comment-reply-button:hover {
  background: var(--hover), var(--glass-highlight), var(--glass-color);
}

.comment-reply-button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.comment-body {
  margin: 10px 0 0;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-replies {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-left: 16px;
  border-left: 1px solid var(--theme-deep);
}

.comment-reply {
  min-width: 0;
  padding-top: 12px;
}

.comment-reply:first-child {
  padding-top: 0;
}

.comment-reply .comment-body {
  margin-top: 6px;
}

.comments-more {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: block;
  min-height: 44px;
  margin: 16px 0 0;
  padding: 0 20px;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

.comments-more:disabled {
  opacity: .5;
  cursor: default;
}

.comments-more:focus-visible {
  outline: 2px solid var(--theme-deep);
  outline-offset: 2px;
}

.comments-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--glass-edge);
  border-radius: 24px;
}

.comment-fields {
  display: grid;
  gap: 24px;
  min-width: 0;
  padding-top: 8px;
}

.comment-field {
  position: relative;
  min-width: 0;
}

.comment-field input,
.comment-field textarea {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 16px;
  border: 0;
  border-radius: 4px;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.6;
  caret-color: var(--theme-deep);
}

.comment-field textarea {
  min-height: 132px;
  padding-bottom: 28px;
  resize: none;
}

.comment-field input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.comment-field-outline {
  position: absolute;
  inset: -8px 0 0;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--muted);
  border-radius: 4px;
  pointer-events: none;
}

.comment-field-outline legend {
  padding: 0 4px;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}

.comment-field:focus-within .comment-field-outline {
  border: 2px solid var(--theme-deep);
  padding-inline: 11px;
}

.comment-field:focus-within .comment-field-outline legend {
  color: var(--theme-deep);
}

.comment-count {
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.comment-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.comment-ip-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--muted);
  font-size: var(--text-sm);
  cursor: pointer;
}

.comment-turnstile {
  flex: 0 1 200px;
  width: min(200px, 100%);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.comment-turnstile[data-size="invisible"] {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  overflow: hidden;
}

.comment-turnstile[hidden] {
  display: none;
}

.comment-turnstile iframe {
  max-width: 100%;
}

.comment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  min-width: 0;
}

.comment-submit {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.comment-submit:disabled {
  opacity: .5;
  cursor: default;
}

.comment-submit:focus-visible {
  outline: 2px solid var(--theme-deep);
  outline-offset: 3px;
}

.comment-form-status {
  flex: 1 1 220px;
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.comment-form-status.is-error {
  color: var(--comment-error);
}

.comment-reply-target {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  min-height: 44px;
  padding: 4px 4px 4px 14px;
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  color: var(--ink);
  font-size: var(--text-sm);
}

.comment-reply-target[hidden] {
  display: none;
}

.comment-reply-target span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.comment-reply-cancel {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.comment-reply-cancel svg {
  width: 16px;
  height: 16px;
}

.comment-reply-cancel:focus-visible {
  outline: 2px solid var(--theme-deep);
  outline-offset: 2px;
}

.comment-honeypot {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.comments-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.home-comments {
  width: 100%;
  max-width: 960px;
  margin-inline: auto;
  padding-block: 8px 56px;
}

.home-comments .comments-title {
  margin-bottom: 24px;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -.04em;
  text-align: center;
}

.comments-section {
  grid-column: 1;
  grid-row: 3;
  width: 100%;
  max-width: 800px;
  min-width: 0;
}

.comments-section[hidden] {
  display: none;
}

@media (max-width: 1200px) {
  .comments-section {
    grid-row: 5;
  }
}

@media (max-width: 860px) {
  .comments-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .comments-compose {
    position: static;
  }
}

@media (max-width: 767px) {
  .comments-toggle {
    display: inline-flex;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin-bottom: 16px;
    padding: 0 18px;
    border: 1px solid var(--glass-edge);
    border-radius: 999px;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .comments-toggle svg {
    display: block;
    width: 22px;
    height: 22px;
  }

  .comments-toggle[hidden] {
    display: none !important;
  }

  .comments-toggle:focus-visible {
    outline: 2px solid var(--theme-deep);
    outline-offset: 3px;
  }

  .comments-title {
    display: none;
  }

  .comments-form-head {
    display: flex;
    justify-content: flex-end;
    min-height: 44px;
    margin: -8px -8px 0 0;
  }

  .comments-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .comments-compose {
    position: static;
  }

  .comments-layout:not(.is-compose-open) .comments-compose {
    display: none;
  }

  .comments-form,
  .comments-toggle {
    transform-origin: top left;
  }
}

@media (max-width: 600px) {
  .comments-form {
    padding: 16px;
    border-radius: 20px;
  }

  .comment-card {
    padding: 16px;
  }

  .comment-replies {
    padding-left: 12px;
  }

  .comment-actions {
    align-items: stretch;
  }

  .comment-submit {
    width: 100%;
  }

  .comment-form-status {
    flex-basis: 100%;
  }
}

@media (prefers-contrast: more) {
  .comments-form,
  .comment-card,
  .comments-more,
  .comment-submit,
  .comment-reply-target,
  .comments-toggle {
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .comment-field-outline {
    border-color: currentColor;
  }
}

@media (forced-colors: active) {
  .comments-form,
  .comment-card,
  .comments-more,
  .comment-submit,
  .comment-reply-target,
  .comments-toggle,
  .comments-icon {
    background: Canvas;
    color: CanvasText;
    border-color: CanvasText;
  }

  .comment-field-outline {
    border-color: ButtonText;
  }

  .comment-field:focus-within .comment-field-outline {
    border-color: Highlight;
  }

  .comment-replies {
    border-left-color: CanvasText;
  }

  .comment-reply-button {
    color: LinkText;
  }

  .comment-form-status.is-error {
    color: CanvasText;
  }
}

@media (prefers-reduced-motion: reduce) {
  .comment-submit,
  .comments-more,
  .comment-reply-button,
  .comment-reply-cancel,
  .comment-field-outline {
    transition: none;
  }
}
