:root {
  --green-900: #1d4d2a;
  --green-700: #2f6f3f;
  --green-100: #e8f3eb;
  --yellow-500: #f0c535;
  --yellow-100: #fff5cc;
  --white: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #d1d5db;
  --danger: #b91c1c;
  --radius: 12px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Aptos", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--green-100) 0%, #f9fafb 60%);
}

.site-header {
  background: linear-gradient(135deg, var(--green-900), var(--green-700));
  color: var(--white);
  padding: 18px 16px;
  border-bottom: 6px solid var(--yellow-500);
}

.header-content {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.75);
}

.brand {
  font-size: 1.4rem;
  font-weight: 700;
}

.brand small {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  opacity: 0.9;
}

.nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--white);
  background: rgba(255, 255, 255, 0.16);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
}

.container {
  max-width: 1100px;
  margin: 24px auto 40px;
  padding: 0 16px;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

h1,
h2,
h3 {
  margin-top: 0;
}

.subtitle {
  color: var(--muted);
}

.home-hero {
  background:
    radial-gradient(circle at top right, rgba(240, 197, 53, 0.28), transparent 45%),
    linear-gradient(140deg, #ffffff 0%, #eef8f0 65%, #fffdf2 100%);
  border: 1px solid #c7decf;
  text-align: center;
}

.home-hero h1,
.home-hero p {
  margin-left: auto;
  margin-right: auto;
}

.home-eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--yellow-100);
  color: #7a5a00;
  font-weight: 700;
  font-size: 0.85rem;
}

.home-lead {
  max-width: 780px;
  line-height: 1.65;
  font-size: 1.02rem;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.home-feature h2 {
  margin-bottom: 8px;
}

.home-feature p {
  margin-top: 0;
  line-height: 1.6;
}

.home-cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  justify-content: center;
  align-items: center;
}

a.home-cta {
  display: inline-block;
  text-decoration: none;
}

.home-final {
  border-left: 6px solid var(--yellow-500);
  text-align: center;
}

.home-final p {
  margin: 0;
  line-height: 1.65;
}

.video-wrap {
  position: relative;
  width: min(900px, 100%);
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}

.video-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-fallback {
  margin: 10px 0 0;
  text-align: center;
}

.ranking-list {
  margin: 0;
  padding-left: 18px;
}

.ranking-list li {
  margin-bottom: 8px;
  line-height: 1.45;
}

.tshirt-page {
  max-width: 1160px;
}

.tshirt-hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(300px, 1.1fr);
  gap: 24px;
  align-items: center;
  margin-bottom: 18px;
}

.tshirt-copy h1 {
  margin: 14px 0 12px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
}

.tshirt-copy p {
  line-height: 1.65;
  max-width: 620px;
}

.tshirt-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.tshirt-facts span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff5c7;
  color: #1f3f28;
  font-weight: 700;
}

.tshirt-gallery {
  display: grid;
  grid-template-columns: 1fr 0.82fr;
  gap: 10px;
  align-items: stretch;
}

.tshirt-gallery img {
  width: 100%;
  height: 100%;
  min-height: 280px;
  max-height: 520px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.shirt-item-row {
  display: grid;
  grid-template-columns: 130px minmax(120px, 1fr) minmax(150px, 1fr);
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbf7;
}

.shirt-summary {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf2;
  font-size: 1.1rem;
}

@media (max-width: 820px) {
  .tshirt-hero,
  .tshirt-gallery,
  .shirt-item-row {
    grid-template-columns: 1fr;
  }

  .tshirt-gallery img {
    min-height: 220px;
  }
}

form {
  display: grid;
  gap: 14px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

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

input,
select,
textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
}

textarea {
  resize: vertical;
  min-height: 86px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input[type="checkbox"] {
  width: auto;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.password-row button {
  min-width: 90px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}

.btn-primary {
  background: var(--green-700);
  color: var(--white);
}

.btn-secondary {
  background: var(--yellow-500);
  color: #111827;
}

.year-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fcfffd;
}

.year-card h4 {
  margin: 0 0 10px;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.suggestions-row {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.suggestion-chip {
  border: 1px solid var(--border);
  background: #f3f4f6;
  color: #111827;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
}

.warning {
  color: var(--danger);
  font-weight: 700;
}

.token-box {
  background: var(--yellow-100);
  border: 1px solid #e5b100;
  border-radius: 10px;
  padding: 12px;
}

.token-value {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 1rem;
  font-weight: 700;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.admin-table th,
.admin-table td {
  border: 1px solid var(--border);
  padding: 8px;
  vertical-align: top;
  text-align: left;
}

.admin-table th {
  background: #f3f4f6;
}

.admin-action-btn {
  margin-right: 6px;
  margin-bottom: 6px;
}

#change-log-list code {
  white-space: pre-wrap;
  word-break: break-word;
}

#timeline {
  scrollbar-width: thin;
}

.timeline-shell {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}

.view-toggle-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
}

.view-toggle-btn.active {
  background: var(--green-700);
  color: #ffffff;
}

.timeline-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--green-900);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: var(--shadow);
  padding: 0;
}

.timeline-nav-btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

#timeline {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
}

.timeline-year {
  border-top: 6px solid var(--green-700);
  padding: 12px 14px;
  border-radius: 10px;
  flex: 0 0 min(88vw, 520px);
  max-height: 78vh;
  overflow-y: auto;
  scroll-snap-align: start;
}

.timeline-year.alt-a {
  background: #ffffff;
}

.timeline-year.alt-b {
  background: #f2f8f3;
}

.timeline-year > h3 {
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #c8d8cc;
}

.timeline-year.current-year {
  border-top-color: var(--yellow-500);
  box-shadow: inset 0 0 0 2px rgba(240, 197, 53, 0.35);
}

.year-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--yellow-100);
  color: #7a5a00;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
}

#timeline-tree {
  display: grid;
  gap: 12px;
}

.tree-year {
  border-left: 6px solid var(--green-700);
  padding: 10px 12px;
  border-radius: 0 10px 10px 0;
  background: #ffffff;
}

.tree-year-head {
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.tree-branches {
  display: grid;
  gap: 8px;
}

.tree-branch {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: #f9fcfa;
}

.tree-branch-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.tree-subgroup {
  margin-left: 10px;
  border-left: 2px dashed #c7d5cc;
  padding-left: 8px;
  margin-bottom: 6px;
}

.tree-subgroup-title {
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.tree-people {
  margin: 0;
  padding-left: 18px;
}

.tree-people li {
  margin-bottom: 6px;
}

.branch-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-top: 8px;
  background: #ffffff;
}

.branch-color-branco {
  background: #fff8cc;
  border-color: #e8d36a;
}

.branch-color-reparto {
  background: #e8f7e8;
  border-color: #8dca93;
}

.branch-color-noviziato {
  background: #fff0da;
  border-color: #efb06a;
}

.branch-color-clan {
  background: #ffe4e4;
  border-color: #e49a9a;
}

.branch-color-comunita-capi {
  background: #f1e6ff;
  border-color: #b89adf;
}

.branch-block > h4 {
  margin-bottom: 8px;
}

.subgroup-block {
  border-top: 1px dashed #d1d5db;
  margin-top: 8px;
  padding-top: 8px;
}

.subgroup-title {
  font-weight: 700;
  margin-bottom: 6px;
  color: #1f2937;
}

.name-list {
  margin: 0;
  padding-left: 18px;
}

.name-list li {
  margin-bottom: 8px;
}

.person-item {
  padding-top: 2px;
}

.name-link {
  color: var(--green-900);
  font-weight: 700;
  text-decoration: underline;
}

.contact-icon-btn {
  border: 1px solid var(--border);
  background: #f3f4f6;
  color: #111827;
  border-radius: 999px;
  width: 20px;
  height: 20px;
  min-width: 20px;
  padding: 0;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}

.promise-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  width: 14px;
  height: 14px;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
  position: relative;
}

.promise-icon-img {
  width: 12px;
  height: 12px;
  object-fit: contain;
  display: block;
}

.promise-icon-fallback {
  display: none;
  font-size: 0.72rem;
  color: #5b3aa8;
}

.promise-icon-img[src=""],
.promise-icon-img:not([src]) {
  display: none;
}

.promise-icon-img[src=""] + .promise-icon-fallback,
.promise-icon-img:not([src]) + .promise-icon-fallback {
  display: inline;
}

.mini-link {
  font-size: 0.85rem;
  color: var(--green-700);
  text-decoration: underline;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-900);
  padding: 2px 8px;
  font-size: 0.8rem;
  margin-right: 6px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 1000;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(560px, 100%);
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 14px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  text-decoration: none;
  color: #111827;
  margin-bottom: 8px;
  background: #f9fafb;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.social-icon svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.social-facebook { background: #1877f2; }
.social-instagram { background: #e1306c; }
.social-tiktok { background: #111111; }
.social-x { background: #000000; }
.social-threads { background: #1f2937; }
.social-email { background: #065f46; }

@media (max-width: 700px) {
  .site-header {
    padding: 14px 12px;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand {
    font-size: 1.2rem;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 10px;
  }

  .nav-links {
    width: 100%;
    gap: 8px;
  }

  .nav-links a {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
    padding: 8px 10px;
  }

  .container {
    margin: 14px auto 24px;
    padding: 0 10px;
  }

  .card {
    padding: 12px;
    margin-bottom: 12px;
  }

  .grid.cols-2 {
    grid-template-columns: 1fr;
  }

  .home-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }

  .actions {
    flex-direction: column;
  }

  .actions button {
    width: 100%;
  }

  .timeline-year {
    padding: 10px;
    flex-basis: 92vw;
    max-height: 76vh;
  }

  .timeline-shell {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .timeline-nav-btn {
    width: 100%;
    border-radius: 10px;
  }

  .view-toggle-row .view-toggle-btn {
    flex: 1 1 calc(50% - 8px);
  }

  .branch-block,
  .year-card {
    padding: 8px;
  }

  .admin-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-topbar button {
    width: 100%;
  }

  .modal-head {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-head button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .nav-links a {
    flex: 1 1 100%;
  }

  h1 {
    font-size: 1.25rem;
  }

  h2 {
    font-size: 1.1rem;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }
}
