:root {
  --bg-color: #fdfbf7;
  --text-main: #1e1e1e;
  --text-muted: #757470;
  --border-color: #e6e4df;
  --btn-color: #283618;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #161614;
    --text-main: #e3e1dc;
    --text-muted: #8c8a85;
    --border-color: #2d2d2a;
  }
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family:
    ui-monospace,
    SFMono-Regular,
    Roboto Mono,
    monospace;
  line-height: 1.6;
  margin: 0;
  padding: 2rem;
}

hr,
.border {
  border: 0;
  border-top: 1px solid var(--border-color);
}

.main-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1rem;
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
}

.logo {
  font-weight: bold;
  text-decoration: none;
  color: var(--text-main);
  font-size: 1.1rem;
}

.main-nav nav {
  display: flex;
  gap: 1.5rem;
}

.nav-icons {
  display: flex;
  gap: 1.2rem;
  align-items: center;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition:
    color 0.15s ease,
    transform 0.1s ease;
  padding: 0.25rem;
}

.nav-link:hover {
  color: var(--text-main);
  width: 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(35%) grayscale(30%) contrast(105%);

  transition:
    filter 0.4s ease,
    transform 0.4s ease;
  height: 100%;
  object-fit: cover;
  filter: sepia(35%) grayscale(30%) contrast(105%);

  transition:
    filter 0.4s ease,
    transform 0.4s ease;
}

.nav-link.active {
  color: var(--text-main);
  transform: scale(1.05);
}

.lang-selector {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-lang {
  flex: 1;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 500;
  background-color: var(--bg-secondary, #f3f4f6);
  color: var(--text-main, #1f2937);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-lang:hover {
  background-color: var(--bg-hover, #e5e7eb);
}

.btn-lang.active {
  background-color: var(--accent-color, #e5e7eb);
  font-weight: 600;
  border-color: var(--accent-color, #3f3630);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-export {
  flex: 1;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 500;
  background-color: var(--bg-secondary, #f3f4f6);
  color: var(--text-main, #1f2937);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-export:hover {
  background-color: var(--bg-hover, #e5e7eb);
}

.btn-export.active {
  background-color: var(--accent-color, #e5e7eb);
  font-weight: 600;
  border-color: var(--accent-color, #3f3630);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-add-person {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--btn-color);
  color: #fdfbf7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(40, 54, 24, 0.2);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition:
    transform 0.2s ease,
    background-color 0.2s ease;
  z-index: 999;
}

.btn-add-person:hover {
  background-color: #1f2a13;
  transform: scale(1.04);
}

.btn-add-person:active {
  transform: scale(0.96);
}

.add-person-plus {
  font-weight: 300;
  font-size: 24px;
  line-height: 1;
}

.lineage-form-container {
  max-width: 680px;
  margin: 0 auto;
  background: var(--bg-color);
  color: var(--text-color);
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  padding: 20px;
}

.form-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0 0 5px 0;
  text-transform: uppercase;
  letter-spacing: -0.5px;
}

.form-header .subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 30px 0;
}

.form-section {
  border: 1px solid var(--border-color);
  padding: 20px;
  margin-bottom: 25px;
  background: var(--input-bg);
}

.form-section legend {
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
  padding: 0 10px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
}

.form-group {
  margin-bottom: 15px;
}

.form-row {
  display: flex;
  gap: 15px;
}

.form-row .form-group {
  flex: 1;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 5px;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: var(--text-color);
  font-family: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
  transition: background-color 0.2s;
}

input[type="text"]:focus,
textarea :focus {
  outline: none;
  background-color: #f5f5f5;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #b3b3b3;
  font-size: 0.85rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 20px;
  margin-top: 30px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.95rem;
}

.btn-link:hover {
  color: var(--text-color);
}

.btn-primary {
  background: var(--btn-color);
  color: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 12px 24px;
  font-weight: bold;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background-color: #1f2a13;
}

@media (max-width: 480px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

.form-identity-layout {
  display: table;
  width: 100%;
  margin-bottom: 15px;
}

.photo-upload-container {
  display: table-cell;
  width: 150px;
  vertical-align: top;
  padding-right: 20px;
}

.identity-fields {
  display: table-cell;
  vertical-align: top;
  width: calc(100% - 150px);
}

.photo-box {
  display: block;
  width: 130px;
  height: 160px;
  border: 1px solid var(--border-color);
  background: #f5f2eb;
  position: relative;
  overflow: hidden;
  box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.05);
}

#photo-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(35%) grayscale(30%) contrast(105%);

  transition:
    filter 0.4s ease,
    transform 0.4s ease;
}

.photo-box:hover #photo-preview {
  filter: sepia(0%) grayscale(0%) contrast(100%);
  transform: scale(1.03);
}

.photo-placeholder-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
}

.photo-placeholder-content .icon {
  display: block;
  text-align: center;
  font-size: 2rem;
  margin-bottom: 5px;
  opacity: 0.5;
}

.photo-placeholder-content .text {
  display: block;
  font-size: 0.75rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.2;
  color: var(--text-muted);
}

.parents-row {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px dotted #e0e0e0;
}

input[list]::placeholder {
  font-style: italic;
  color: #cccccc;
}

.dates-row {
  margin-top: 15px;
}

select#p-sex {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  width: 100%;
  height: 42px;
  padding: 0 35px 0 12px;

  background-color: var(--bg-color);
  color: #000000;
  font-family: inherit;
  font-size: 15px;
  border: 2px solid var(--border-color);
  border-radius: 0px;

  cursor: pointer;
  transition: background-color 0.1s ease;
}

select#p-sex:focus {
  outline: none;
  background-color: #f5f5f5;
}

select#p-sex:invalid,
select#p-sex option[value=""] {
  color: #888888;
}

select#p-sex option {
  background-color: #ffffff;
  color: #000000;
  font-family: inherit;
  padding: 10px;
}

.search-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background-color: var(--bg-color);
}

.search-bar {
  display: flex;
  width: 100%;
  margin-bottom: 30px;
}

.search-bar input[type="text"] {
  flex: 1;
  height: 50px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: #000000;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: 0;
  outline: none;
}

.search-bar input[type="text"]::placeholder {
  color: #888888;
}

.search-bar input[type="text"]:focus {
  background-color: #f9f9f9;
}

.search-bar button {
  width: 60px;
  height: 50px;
  background-color: var(--btn-color);
  color: #ffffff;
  border: 1px solid var(--btn-color);
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color 0.1s ease,
    color 0.1s ease;
}

.search-bar button svg {
  width: 20px;
  height: 20px;
}

.search-bar button:hover {
  background-color: #1f2a13;
}

.people-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 30px;
}

@media (min-width: 600px) {
  .people-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.person-card {
  position: relative;
  display: flex;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  transition:
    transform 0.1s ease,
    box-shadow 0.1s ease;
}

.person-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0px var(--btn-color);
}

.person-avatar {
  width: 60px;
  height: 60px;
  border: 2px solid #000000;
  background-color: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 16px;
  overflow: hidden;
}

.avatar-placeholder {
  font-size: 18px;
  font-weight: 700;
  color: #000000;
  text-transform: uppercase;
}

.person-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.person-name {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.person-meta {
  margin: 0 0 4px 0;
  font-size: 13px;
  color: #555555;
  font-weight: 500;
}

.person-occu {
  margin: 0;
  font-size: 13px;
  color: #888888;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.card-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.load-more-container {
  display: flex;
  justify-content: center;
}

.btn-brutal {
  height: 46px;
  padding: 0 24px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  background-color: var(--bg-color);
  color: #000000;
  border: 2px solid var(--btn-color);
  border-radius: 0;
  cursor: pointer;
  transition:
    background-color 0.1s ease,
    color 0.1s ease;
}

.btn-brutal:hover {
  background-color: var(--btn-color);
  color: #ffffff;
}

.btn-brutal:active {
  background-color: #222222;
  color: #ffffff;
}

.view-container {
  max-width: 750px;
  margin: 0 auto;
  padding: 20px;
  background-color: var(--bg-color);
}

.nav-back-zone {
  margin-bottom: 25px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #000000;
  text-decoration: none;
  text-transform: uppercase;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.1s ease;
}

.btn-back svg {
  width: 16px;
  height: 16px;
}

.btn-back:hover {
  border-color: #000000;
}

.person-profile {
  border: 2px solid var(--border-color);
  padding: 30px;
  background-color: var(--bg-color);
}

.profile-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-bottom: 2px solid #000000;
  padding-bottom: 25px;
  margin-bottom: 25px;
}

@media (min-width: 550px) {
  .profile-header {
    flex-direction: row;
    align-items: flex-start;
  }
}

.profile-photo-wrapper {
  width: 140px;
  height: 140px;
  border: 2px solid #000000;
  flex-shrink: 0;
  background-color: #f0f0f0;
}

.profile-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(35%) grayscale(30%) contrast(105%);

  transition:
    filter 0.4s ease,
    transform 0.4s ease;
}

.profile-photo:hover {
  filter: sepia(0%) grayscale(0%) contrast(100%);
  transform: scale(1.03);
}

.profile-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.profile-full-name {
  margin: 0 0 6px 0;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.profile-years {
  font-size: 20px;
  font-weight: 700;
  color: #000000;
  margin-bottom: 12px;
}

.profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge,
.badge-occu {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border: 1px solid #000000;
  text-transform: uppercase;
}

.badge {
  background-color: #000000;
  color: #ffffff;
}

.badge-occu {
  background-color: #ffffff;
  color: #000000;
}

.profile-section {
  margin-bottom: 25px;
}

.section-title {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555555;
  border-bottom: 1px dashed #000000;
  padding-bottom: 4px;
}

.bio-text,
.interests-text {
  font-size: 16px;
  line-height: 1.6;
  color: #000000;
  font-weight: 500;
  text-align: justify;
}

.brutal-quote {
  margin: 0;
  padding: 16px;
  background-color: #ffffff;
  border-left: 4px solid #000000;
  font-size: 16px;
  font-style: italic;
  font-weight: 600;
  line-height: 1.5;
}

.profile-footer {
  margin-top: 35px;
  padding-top: 20px;
  border-top: 2px solid #000000;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 550px) {
  .meta-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.meta-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #888888;
}

.meta-value {
  font-size: 14px;
  font-weight: 600;
  color: #000000;
}

.link-brutal {
  color: #000000;
  text-decoration: none;
  border-bottom: 1px solid #000000;
  display: inline-block;
  width: fit-content;
}

.link-brutal:hover {
  background-color: #000000;
  color: #ffffff;
}

.code-style {
  font-family: monospace;
  font-size: 13px;
  background-color: #f5f5f5;
  padding: 2px 4px;
  width: fit-content;
}

.person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.icon-pencil {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  padding: 12px 18px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #111111;
  background-color: #ffffff;
  border: 2px solid #111111;
  box-shadow: 4px 4px 0px #111111;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;

  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-info {
  background-color: #ffffff;
  border-color: #111111;
}

.toast-error {
  background-color: #ff4d4d;
  color: #ffffff;
  border-color: #111111;
  box-shadow: 4px 4px 0px #111111;
}

.toast-close {
  font-weight: bold;
  opacity: 0.7;
  margin-left: 8px;
}
.toast-close:hover {
  opacity: 1;
}

.about-container {
  max-width: 680px;
  margin: 40px auto;
  padding: 0 16px;
  font-family: "Courier New", Courier, monospace;
  color: #111111;
}

.about-card {
  background-color: #fdfbf7;
  border: 2px solid #111111;
  box-shadow: 4px 4px 0px #111111;
  padding: 24px 32px;
  border-radius: 4px;
}

.about-header {
  margin-bottom: 20px;
}

.about-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  text-transform: uppercase;
}

.about-subtitle {
  font-size: 14px;
  opacity: 0.8;
  margin: 0;
}

.about-divider {
  border: none;
  border-top: 2px solid #111111;
  margin: 20px 0;
}

.about-section {
  margin-bottom: 24px;
  line-height: 1.6;
  font-size: 15px;
}

.about-section h2 {
  font-size: 18px;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 12px;
  border-bottom: 1px solid #111111;
  padding-bottom: 4px;
}

.about-section ul {
  padding-left: 20px;
  margin: 8px 0;
}

.about-section li {
  margin-bottom: 8px;
}

.warning-box {
  background-color: #fff4e5;
  border: 2px dashed #111111;
  padding: 16px;
  margin: 24px 0;
}

.warning-box h2 {
  border-bottom-color: #111111;
}

.highlight-box {
  background-color: #ffffff;
  border: 1px solid #111111;
  padding: 16px;
}

.gitlab-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background-color: #fdfbf7;
  color: #111111;
  text-decoration: none;
  font-weight: bold;
  padding: 10px 16px;
  border: 2px solid #111111;
  box-shadow: 3px 3px 0px #111111;
  border-radius: 4px;
  margin-top: 8px;
  transition:
    transform 0.1s,
    box-shadow 0.1s;
}

.gitlab-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0px #111111;
}

.gitlab-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0px #111111;
}

.welcome-card {
  max-width: 600px;
  margin: 40px auto;
  padding: 24px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  background-color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  font-family: inherit;
}

.welcome-header {
  text-align: center;
  gap: 12px;
  margin-bottom: 12px;
}

.welcome-icon {
  font-size: 2rem;
}

.welcome-intro {
  font-size: 1.05rem;
  line-height: 1.5;
  color: #333333;
  margin-bottom: 20px;
}

.privacy-warning-box {
  display: flex;
  gap: 12px;
  background-color: #fefce8;
  border: 1px solid #fef08a;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 24px;
}

.warning-icon {
  font-size: 1.3rem;
}

.warning-text {
  font-size: 0.92rem;
  line-height: 1.45;
  color: #713f12;
}

.welcome-actions {
  gap: 12px;
  text-align: center;
}

.btn-secondary {
  background-color: #f5f5f5;
  color: #333333;
  border: 1px solid #ccc;
}

.btn {
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-size: 0.95rem;
  transition: background-color 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #1b5e20;
}

.person-page-actions {
  text-align: center;
  margin-top: 10px;
}

#print-area {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }

  #print-area,
  #print-area * {
    visibility: visible;
  }

  #print-area {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }

  @page {
    size: A4 portrait;
    margin: 15mm 15mm 15mm 20mm;
  }

  .pdf-page {
    break-after: page;
    page-break-after: always;
    height: 100vh;
    box-sizing: border-box;
    display: flex;
    padding: 10px;
    flex-direction: column;
    justify-content: space-between;
  }

  .pdf-cover {
    text-align: center;
    justify-content: center;
  }

  .cover-title {
    font-size: 36pt;
    margin-bottom: 10px;
  }

  .cover-person {
    font-size: 22pt;
    color: #2e7d32;
    margin-bottom: 40px;
  }

  .tree-icon {
    font-size: 72pt;
  }

  .person-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #2e7d32;
    padding-bottom: 12px;
  }

  .person-photo {
    width: 90px;
    height: 110px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ccc;
  }

  .photo-placeholder {
    width: 90px;
    height: 110px;
    background: #f0f0f0;
    border: 1px dashed #aaa;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20pt;
  }

  .page-badge {
    font-size: 9pt;
    color: #666;
    text-transform: uppercase;
  }

  .relation-tag {
    font-weight: bold;
    color: #2e7d32;
    margin-top: 4px;
  }

  .person-details {
    flex-grow: 1;
    margin-top: 15px;
  }

  .detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background-color: #f9f9f9;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
  }

  .detail-item {
    font-size: 10pt;
    line-height: 1.4;
  }

  .quotes-section blockquote {
    font-style: italic;
    background: #f5f5f5;
    border-left: 3px solid #2e7d32;
    margin: 8px 0;
    padding: 8px 12px;
    font-size: 10pt;
  }

  .bio-section h3,
  .quotes-section h3 {
    font-size: 11pt;
    margin-bottom: 6px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
  }

  .bio-section p {
    font-size: 10pt;
    line-height: 1.5;
    text-align: justify;
  }

  .pdf-footer {
    border-top: 1px solid #ccc;
    display: flex;
    justify-content: space-between;
    font-size: 8pt;
    color: #777;
    padding-top: 6px;
  }
}
