/* Copyright © 2026 Olaf Kolkman */
/* SPDX-License-Identifier: GPL-3.0-or-later */

@import url('https://fonts.googleapis.com/css2?family=Asset&family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --base: #1e1e2e;
  --mantle: #181825;
  --crust: #11111b;
  --surface-0: #313244;
  --surface-1: #45475a;
  --surface-2: #585b70;
  --text: #cdd6f4;
  --subtext: #a6adc8;
  --muted: #7f849c;
  --mauve: #cba6f7;
  --lavender: #b4befe;
  --blue: #89b4fa;
  --teal: #94e2d5;
  --peach: #fab387;
  --red: #f38ba8;
  --border: rgba(205, 214, 244, 0.12);
  --shadow: 0 18px 50px rgba(17, 17, 27, 0.28);
}

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

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(145deg, rgba(203, 166, 247, 0.06), transparent 36%),
    var(--base);
  color: var(--text);
  font-family: 'DM Sans', 'Avenir Next', sans-serif;
  line-height: 1.5;
}

body::selection {
  background: var(--mauve);
  color: var(--crust);
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  position: relative;
  z-index: 20;
  padding: 56px 0 48px;
  background:
    linear-gradient(115deg, rgba(203, 166, 247, 0.18), transparent 45%),
    var(--mantle);
  border-bottom: 1px solid var(--border);
}

.site-header::after {
  position: absolute;
  right: 12%;
  bottom: -52px;
  width: 180px;
  height: 100px;
  border-top: 1px solid rgba(180, 190, 254, 0.28);
  border-radius: 50%;
  content: '';
  transform: rotate(-12deg);
}

.site-header h1,
.link-item h2 {
  font-family: 'Space Grotesk', 'Avenir Next', sans-serif;
  letter-spacing: 0;
}

.site-header h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1;
}

.site-logo {
  display: block;
  width: min(260px, 70vw);
  height: 150px;
  margin-bottom: 12px;
  object-fit: contain;
  object-position: left center;
}

.site-header .site-logo + h1,
.feed-link {
  font-family: 'Asset', 'Space Grotesk', sans-serif;
}

.site-header p {
  max-width: 34rem;
  margin: 14px 0 0;
  color: var(--subtext);
  font-size: 1.05rem;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  position: relative;
}

.menu-toggle {
  min-width: 0;
  padding: 10px 13px;
  border-color: var(--surface-2);
  background: var(--surface-0);
  color: var(--text);
}

.menu-toggle::before {
  content: '\2630';
  margin-right: 7px;
  font-size: 1.1em;
}

.auth-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  min-width: 190px;
  gap: 4px;
  padding: 8px;
  background: var(--surface-0);
  border: 1px solid var(--surface-1);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.auth-menu a,
.auth-menu button {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  text-decoration: none;
}

.auth-menu a:hover,
.auth-menu button:hover {
  background: var(--surface-1);
  color: var(--lavender);
}

.auth-menu .hidden {
  display: none;
}

.auth-session {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}

.auth-session .user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-button {
  min-width: 0;
  border-color: rgba(243, 139, 168, 0.45);
  background: transparent;
  color: var(--red);
}

.logout-button:hover {
  border-color: var(--red);
  background: rgba(243, 139, 168, 0.12);
  color: var(--red);
}

main.container {
  position: relative;
  z-index: 1;
  padding-top: 28px;
  padding-bottom: 64px;
}

.site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 24px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: underline;
}

.site-footer a:hover,
.site-footer a:focus-visible,
.site-footer a:active {
  color: var(--lavender);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 0 24px;
  padding: 16px;
  background: rgba(24, 24, 37, 0.72);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.toolbar label,
.settings-panel label {
  display: grid;
  gap: 7px;
  color: var(--subtext);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 9px !important;
  text-transform: none !important;
}

.checkbox-label input {
  width: auto;
  min-width: 0;
}

.toolbar label {
  flex: 1 1 220px;
}

select,
input,
textarea,
button {
  max-width: 100%;
  min-width: 180px;
  padding: 11px 13px;
  border: 1px solid var(--surface-1);
  border-radius: 8px;
  background: var(--surface-0);
  color: var(--text);
  font: inherit;
}

select:focus,
input:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid var(--lavender);
  outline-offset: 2px;
  border-color: var(--lavender);
}

::placeholder {
  color: var(--muted);
}

.settings-panel form {
  display: grid;
  gap: 16px;
  max-width: 560px;
}

.settings-panel textarea {
  min-height: 110px;
  resize: vertical;
}

.readonly-value {
  display: block;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--mantle);
  color: var(--lavender);
  font-weight: 600;
}

.profile-avatar-preview {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border: 2px solid var(--mauve);
  border-radius: 50%;
}

button {
  width: fit-content;
  border-color: var(--mauve);
  background: var(--mauve);
  color: var(--crust);
  cursor: pointer;
  font-weight: 700;
  transition: filter 160ms ease, transform 160ms ease;
}

button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

.status {
  min-height: 1.25em;
  margin: 0;
  color: var(--teal);
}

.hidden {
  display: none;
}

.auth-notice {
  margin: 0 0 20px;
  color: var(--subtext);
}

.auth-notice a,
.link-item a {
  color: var(--lavender);
}

.auth-notice a:hover,
.link-item a:hover {
  color: var(--mauve);
}

.plugin-list,
.feed {
  display: grid;
  gap: 14px;
}

.plugin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.plugin-row:last-child {
  border-bottom: 0;
}

.plugin-row button {
  min-width: 0;
  padding: 8px 12px;
  background: var(--surface-1);
  border-color: var(--surface-2);
  color: var(--text);
}

.user-admin-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--subtext);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.user-admin-toggle input {
  width: auto;
  min-width: 0;
}

.danger-button {
  border-color: rgba(243, 139, 168, 0.45) !important;
  background: transparent !important;
  color: var(--red) !important;
}

.edit-button {
  min-width: 0;
  margin-top: 14px;
  padding: 8px 12px;
  background: var(--surface-1);
  border-color: var(--surface-2);
  color: var(--text);
}

.edit-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.edit-tags {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.edit-tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.edit-tag-options label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--subtext);
  font-size: 0.85rem;
}

.edit-tag-options input {
  width: auto;
  min-width: 0;
}

.edit-tag-status {
  min-height: 1.25em;
  margin: 0;
  color: var(--red);
  font-size: 0.82rem;
}

.feed {
  padding-bottom: 40px;
}

.link-item {
  padding: 22px;
  background: rgba(49, 50, 68, 0.84);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.about-content {
  display: grid;
  gap: 14px;
}

.link-item h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1.25;
}

.link-header {
  display: inline-flex;
  align-items: center;
  float: right;
  gap: 12px;
  margin: 0 0 12px 18px;
}

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 2px solid rgba(203, 166, 247, 0.5);
  border-radius: 50%;
  background: var(--surface-1);
  color: var(--mauve);
  font-weight: 700;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.user-name {
  color: var(--lavender);
  font-weight: 700;
}

.link-item a {
  text-decoration: none;
  overflow-wrap: anywhere;
}

.link-item::after {
  display: table;
  clear: both;
  content: '';
}

.comment,
.profile-summary p {
  margin: 12px 0 0;
  color: var(--subtext);
  line-height: 1.65;
}

.meta {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.entry-tags {
  margin-top: 12px;
  color: var(--mauve);
  font-size: 0.85rem;
  font-weight: 600;
}

@media (max-width: 600px) {
  .container {
    padding: 0 14px;
  }

  .site-header {
    padding: 38px 0 34px;
  }

  .site-header h1 {
    font-size: 2.35rem;
  }

  .site-logo {
    width: min(220px, 68vw);
    height: 48px;
  }

  .header-row {
    align-items: center;
    gap: 12px;
  }

  .header-actions {
    align-items: flex-end;
  }

  .auth-session {
    align-items: flex-start;
  }

  .menu-toggle {
    padding: 8px 11px;
    font-size: 0.9rem;
  }

  .logout-button {
    font-size: 0.9rem;
  }

  main.container {
    padding-top: 18px;
  }

  .site-footer {
    padding: 0 14px 18px;
  }

  .toolbar {
    gap: 12px;
    padding: 14px;
  }

  .toolbar label,
  select,
  input,
  textarea,
  .settings-panel button {
    width: 100%;
    min-width: 0;
  }

  .link-item {
    padding: 16px;
    border-radius: 10px;
  }

  .link-header {
    margin-left: 14px;
  }

  .plugin-row {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
  }

  .plugin-row button {
    align-self: flex-start;
  }
}
