﻿:root {
  color-scheme: light;
  --page: #eef2f5;
  --nav: #526b7d;
  --nav-dark: #465d6e;
  --surface: #ffffff;
  --surface-muted: #f6f8fa;
  --text: #34424f;
  --text-strong: #24313c;
  --muted: #8a98a5;
  --border: #dde5eb;
  --primary: #d96b63;
  --primary-dark: #b94f48;
  --accent: #5f7f95;
  --success: #3aa66e;
  --danger: #c75656;
  --shadow: 0 2px 8px rgba(36, 49, 60, 0.08);
  --shadow-hover: 0 12px 28px rgba(36, 49, 60, 0.12);
  --radius: 0.18rem;
}

* {
  box-sizing: border-box;
}

[hidden],
.add-link-panel:not(.is-open) {
  display: none !important;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.65)),
    repeating-linear-gradient(90deg, rgba(82, 107, 125, 0.035) 0 1px, transparent 1px 90px),
    var(--page);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 4.2rem;
  padding: 0 2rem;
  background: linear-gradient(180deg, var(--nav), var(--nav-dark));
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 0 rgba(36, 49, 60, 0.08);
}

.top-nav a,
.top-nav .nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 4.2rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  padding: 0 1.15rem;
  text-decoration: none;
  text-transform: uppercase;
  transform: none;
}

.top-nav a:hover,
.top-nav a:focus-visible,
.top-nav .nav-link:hover,
.top-nav .nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  color: #ffffff;
  transform: none;
}

button,
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  border: 1px solid #d8e0e6;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--primary-dark);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  gap: 0.4rem;
  padding: 0.62rem 0.85rem;
  text-decoration: none;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

button:hover,
.primary-link:hover {
  border-color: #f0c1bd;
  background: #fff8f7;
  box-shadow: var(--shadow);
  color: var(--primary);
  transform: translateY(-1px);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text-strong);
  padding: 0.76rem 0.82rem;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  border-color: #9eb4c3;
  box-shadow: 0 0 0 3px rgba(95, 127, 149, 0.14);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #a6b1ba;
}

label {
  color: var(--text-strong);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

code {
  border-radius: 0.2rem;
  background: #eef3f6;
  color: var(--accent);
  font-size: 0.82em;
  padding: 0.12rem 0.32rem;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1360px;
  margin: 0 auto;
  padding: 2.2rem 0.65rem 0.65rem;
}

.hero h1 {
  margin: 0.35rem 0 0.5rem;
  color: var(--text-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 6vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.hero p {
  max-width: 42rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.eyebrow {
  margin: 0;
  color: var(--primary) !important;
  font-size: 0.75rem !important;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(6.2rem, 1fr));
  gap: 0.85rem;
}

.stats div {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0.9rem;
  text-align: center;
}

.stats span {
  display: block;
  color: var(--text-strong);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  line-height: 1;
}

.stats small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 0.75rem;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 0.65rem 3rem;
}

.content-grid {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 0.75rem;
}

.sidebar {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  position: sticky;
  top: 5.2rem;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1.15rem;
}

.link-panel {
  grid-column: 1 / -1;
}

.panel-heading {
  margin-bottom: 1rem;
}

.panel-heading h2 {
  margin: 0 0 0.38rem;
  color: var(--text-strong);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.25;
  text-transform: uppercase;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.split-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.compact-form,
.link-form {
  display: grid;
  gap: 0.78rem;
}

.help-text {
  margin: -0.25rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
}

.directory-list {
  display: grid;
  gap: 0.55rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.directory-item {
  display: grid;
  gap: 0.4rem;
}

.directory-item.is-nested {
  margin-left: calc(0.85rem * var(--directory-depth, 1));
}

.directory-button {
  justify-content: flex-start;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  box-shadow: none;
  color: var(--accent);
  padding-inline: 0;
  text-align: left;
}

.directory-button.is-subdirectory,
.directory-tile.is-subdirectory h3,
#current-directory-name.is-subdirectory,
.subdirectory-option {
  font-style: italic;
}

.directory-button:hover {
  background: transparent;
  box-shadow: none;
  color: var(--primary);
  transform: none;
}

.directory-button[aria-pressed="true"] {
  color: var(--text-strong);
}

.directory-item.is-drop-target {
  border-radius: var(--radius);
  background: #fff8f7;
  outline: 2px dashed var(--primary);
}

.directory-item.is-drop-target .directory-button {
  color: var(--primary);
}

.inline-actions,
.link-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
}

.ghost-button,
.danger-button {
  background: #f7f9fb;
  box-shadow: none;
  color: var(--accent);
}

.danger-button {
  color: var(--danger);
}

.danger-button:hover {
  border-color: #efc8c8;
  background: #fff4f4;
  color: #a54040;
}

.icon-button {
  width: 2.45rem;
  min-width: 2.45rem;
  min-height: 2.35rem;
  padding: 0;
}

.action-icon,
.action-icon svg {
  display: block;
  width: 1.05rem;
  height: 1.05rem;
}

.action-icon svg {
  fill: currentColor;
}

.search-field {
  display: grid;
  gap: 0.35rem;
  min-width: min(100%, 18rem);
}

.search-field span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-message {
  min-height: 1.35rem;
  margin: 0 0 0.75rem;
  color: var(--success);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.status-message[data-type="error"] {
  color: var(--danger);
}

.empty-state {
  border: 1px dashed #cfd9e1;
  background: var(--surface-muted);
  color: var(--muted);
  margin: 0;
  padding: 1.2rem;
  text-align: center;
}

.link-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1.05rem;
}

.directory-tile,
.link-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition:
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.directory-tile:hover,
.link-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.directory-tile {
  padding: 1rem;
}

.directory-tile::before,
.link-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.22rem;
  background: var(--primary);
  content: "";
}

.directory-tile-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.95rem;
  padding-left: 0.2rem;
}

.directory-tile-header h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
}

.directory-tile-header p {
  margin: 0.28rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.directory-tile-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: #edf3f7;
  color: var(--accent);
  font-weight: 900;
}

.directory-tile-links {
  display: grid;
  gap: 0.85rem;
}

.link-card {
  padding: 0.95rem;
  cursor: grab;
}

.link-card.is-dragging {
  cursor: grabbing;
  opacity: 0.55;
}

.link-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.8rem;
}

.link-card h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 1rem;
  font-weight: 900;
}

.link-count {
  margin: 0.28rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .content-grid,
  .sidebar {
    grid-column: 1;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  .top-nav {
    overflow-x: auto;
    padding-inline: 0.5rem;
  }

  .hero,
  .split-heading,
  .link-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .hero {
    padding-top: 2rem;
  }

  .stats,
  .content-grid,
  .input-row {
    grid-template-columns: 1fr;
  }

  .app-shell {
    padding-inline: 0.85rem;
  }
}
