/* ==========================================================================
   Dharma Design System (Reusable)
   Version: 1.0.0
   Scope: Registration pages + Result pages + PDF attachment pages
   ========================================================================== */

:root {
  /* Brand palette */
  --ds-primary: #5e4536;
  --ds-primary-strong: #3d2e24;
  --ds-primary-light: #a85e2a;
  --ds-red: #b03a2e;
  --ds-gold: #c9a84c;
  --ds-gold-light: #f0d080;

  /* Neutrals */
  --ds-bg: #faf8f5;
  --ds-surface: #ffffff;
  --ds-surface-soft: #fdfaf4;
  --ds-border: #e8e0d0;
  --ds-text: #5f4739;
  --ds-text-muted: #666666;
  --ds-text-light: #999999;

  /* Typography */
  --ds-font-family:
    "Noto Sans SC",
    "Microsoft YaHei",
    "微软雅黑",
    "PingFang SC",
    Arial,
    sans-serif;
  --ds-font-size-body: 15px;
  --ds-line-height-body: 1.65;
  --ds-font-size-title: clamp(22px, 4.5vw, 36px);
  --ds-font-size-card-title: 22px;
  --ds-font-size-section-title: 19px;

  /* Spacing / radius / shadow */
  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-5: 20px;
  --ds-space-6: 24px;
  --ds-space-7: 32px;
  --ds-space-8: 40px;

  --ds-radius-sm: 6px;
  --ds-radius-md: 8px;
  --ds-radius-lg: 12px;

  --ds-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
  --ds-shadow-md: 0 4px 18px rgba(94, 69, 54, 0.13);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

body.ds-body {
  margin: 0;
  font-family: var(--ds-font-family);
  font-size: var(--ds-font-size-body);
  line-height: var(--ds-line-height-body);
  color: var(--ds-text);
  background: var(--ds-bg);
}

a {
  color: var(--ds-primary-light);
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.ds-main-wrap {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--ds-space-8) 60px;
}

.ds-main-wrap--compact {
  padding-bottom: 0;
}

.ds-hero {
  display: flex;
  flex-direction: column;
}

/* Keep original large hero on desktop only */
@media (min-width: 992px) {
  .ds-hero {
    min-height: auto;
  }
}

/* --------------------------------------------------------------------------
   Banner
   -------------------------------------------------------------------------- */

.ds-banner {
  position: relative;
  width: 100%;
  height: clamp(220px, 36vw, 480px);
  min-height: 240px;
  overflow: hidden;
  background-color: #3a1a0a;
}

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

.ds-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
      rgba(0, 0, 0, 0.55) 0%,
      rgba(0, 0, 0, 0.1) 50%,
      transparent 100%);
}

/* Banner style matching Lianghuang index */
.ds-banner-frame {
  position: relative;
  width: 100%;
  background: #2a1810;
}

.ds-banner-photo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
}

@media (max-width: 991.98px) {
  .ds-banner {
    height: auto;
    aspect-ratio: 21 / 9;
    min-height: 200px;
    max-height: 48vh;
  }
}

@media (max-width: 991.98px) and (orientation: portrait) {
  .ds-banner {
    aspect-ratio: 4 / 3;
    max-height: 56vh;
    min-height: clamp(160px, 52vw, 320px);
  }

  .ds-banner-img {
    object-position: center top;
  }
}

/* --------------------------------------------------------------------------
   Header / title / language toggle
   -------------------------------------------------------------------------- */

.ds-lang-toggle {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 40px;
  background: #faf7f2;
}

.ds-lang-toggle button {
  border: 1.5px solid #DBC082;
  background: transparent;
  color: #DBC082;
  border-radius: var(--ds-radius-sm);
  padding: 7px 22px;
  font-size: var(--ds-font-size-body);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.ds-lang-toggle button:hover,
.ds-lang-toggle button.ds-active {
  background: #DBC082;
  color: #5C4A2A;
}

.ds-page-title {
  text-align: center;
  padding: 16px 16px 12px;
  margin-bottom: 22px;
}

.ds-page-title--spaced {
  margin-bottom: 28px;
}

.ds-page-title .ds-temple-name {
  color: var(--ds-primary-strong);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 4px;
  margin: 0 0 10px;
}

.ds-page-title h1 {
  margin: 0 0 8px;
  font-size: var(--ds-font-size-title);
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--ds-primary);
}

.ds-page-subtitle {
  color: var(--ds-text-muted);
  font-size: 17px;
}

.ds-page-subtitle--large {
  margin-top: 24px;
  margin-bottom: 32px;
  font-size: 20px;
  font-weight: 400;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Card / blocks
   -------------------------------------------------------------------------- */

.ds-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 32px 36px;
  margin-bottom: var(--ds-space-6);
  box-shadow: var(--ds-shadow-sm);
}

.ds-card--soft-info {
  background: var(--ds-surface-soft);
  border-color: #e8dfc8;
}

.ds-card--soft-info .ds-card-title {
  margin-bottom: 14px;
}

.ds-card--soft-info .ds-event-info {
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 0;
}

.ds-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 28px;
  padding-bottom: 18px;
  border-bottom: 2px solid #f0ece4;
  color: var(--ds-primary-strong);
  font-size: var(--ds-font-size-card-title);
  font-weight: 700;
}

.ds-optional-tag {
  font-size: 15px;
  color: #bbbbbb;
  font-weight: 400;
}

.ds-event-info {
  background: var(--ds-surface-soft);
  border: 1px solid #e8dfc8;
  border-radius: var(--ds-radius-md);
  padding: 16px 20px;
  margin-bottom: 22px;
  font-size: 15px;
  line-height: 2;
  color: #555555;
}

.ds-event-info p {
  margin: 0;
}

.ds-event-contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
}

.ds-event-contact-row span {
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Form fields
   -------------------------------------------------------------------------- */

.ds-label {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 500;
}

.ds-label.ds-required::after {
  content: " *";
  color: #dc3545;
}

.ds-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 6px;
}

.ds-radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 15px;
}

.ds-radio-option input {
  width: 17px;
  height: 17px;
  accent-color: var(--ds-primary);
}

/* --------------------------------------------------------------------------
   Package cards
   -------------------------------------------------------------------------- */

.ds-package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.ds-package-card {
  position: relative;
  text-align: center;
  user-select: none;
  cursor: pointer;
  background: #fff;
  border: 2px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 20px 16px;
  transition: all 0.2s;
}

.ds-package-card:hover {
  border-color: var(--ds-gold);
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.2);
}

.ds-package-card.ds-active {
  border-color: var(--ds-primary);
  background: linear-gradient(135deg, #fff8f8, #ffffff);
  box-shadow: var(--ds-shadow-md);
}

.ds-package-check {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ds-primary);
  color: #fff;
  font-size: 12px;
}

.ds-package-card.ds-active .ds-package-check {
  display: flex;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.ds-btn-primary {
  border: none;
  border-radius: var(--ds-radius-md);
  padding: 14px 56px;
  background: #875d25;
  color: #fff;
  text-decoration: none;
  font-size: 17px;
  letter-spacing: 3px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.ds-btn-primary:hover {
  background: #875d25;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(94, 69, 54, 0.35);
}

.ds-btn-primary--compact {
  padding: 12px 34px;
  letter-spacing: normal;
}

.ds-required-mark {
  color: #dc3545;
}

/* --------------------------------------------------------------------------
   Table system
   -------------------------------------------------------------------------- */

.ds-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 15px;
}

.ds-table th,
.ds-table td {
  border: 1px solid var(--ds-border);
  padding: 9px 8px;
  vertical-align: middle;
}

.ds-table thead th {
  background: #fdf8f0;
  color: var(--ds-primary);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.ds-table .ds-col-num {
  width: 36px;
  text-align: center;
  color: #bbbbbb;
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   Notices
   -------------------------------------------------------------------------- */

.ds-notice {
  margin-bottom: 20px;
  padding: 14px 18px;
  border: 1px solid #f0c070;
  border-left: 4px solid var(--ds-gold);
  border-radius: 0 var(--ds-radius-md) var(--ds-radius-md) 0;
  background: #fff8ed;
  color: #7a4f10;
  font-size: 14px;
  line-height: 1.9;
}

/* --------------------------------------------------------------------------
   Xiaodao form module
   -------------------------------------------------------------------------- */

.dh-card-block {
  margin-bottom: 24px;
}

.dh-offering-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 16px;
  background: #f8f5f0;
  border-left: 4px solid var(--ds-gold);
  border-radius: 6px;
}

.dh-offering-head .dh-offering-title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ds-primary);
}

.dh-offering-head .dh-offering-hint {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  color: #a07030;
}

.dh-form-control {
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  font-size: 15px;
  padding: 8px 10px;
}

.dh-form-control:focus {
  border-color: var(--ds-gold);
  box-shadow: 0 0 0 0.2rem rgba(201, 168, 76, 0.2);
}

.dh-date-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dh-remove-btn {
  border: 1px solid var(--ds-red);
  color: var(--ds-red);
  background: transparent;
  border-radius: 6px;
  padding: 4px 10px;
  transition: all 0.2s ease;
}

.dh-remove-btn:hover {
  background: var(--ds-red);
  color: #fff;
}

.dh-autofilled-field {
  background: #f8f4ea;
}

.entry-add-btn {
  margin-top: 12px;
  font-size: 15px;
}

.dh-submit-wrap {
  text-align: center;
  padding-top: 10px;
}

.dh-memorial-table .dh-col-index {
  width: 44px;
}

.dh-memorial-table .dh-col-action,
.dh-lamp-table .dh-col-action,
.dh-food-table .dh-col-action {
  width: 72px;
  white-space: nowrap;
}

.dh-lamp-table .dh-col-qty,
.dh-food-table .dh-col-qty {
  width: 120px;
}

.dh-card-block .table-responsive {
  margin-bottom: 14px;
}

.dh-card-block .ds-notice {
  margin-top: 12px;
  margin-bottom: 8px;
}

.dh-card-block .ds-notice+.ds-notice {
  margin-top: 0;
}

.dh-card-block .entry-add-btn {
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Payment result module
   -------------------------------------------------------------------------- */

.dh-result-wrap {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px 60px;
}

.dh-result-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 36px 40px;
  box-shadow: var(--ds-shadow-sm);
}

.dh-result-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.dh-result-icon--success {
  background: linear-gradient(135deg, var(--ds-gold-light) 0%, var(--ds-gold) 100%);
  box-shadow: 0 6px 24px rgba(201, 168, 76, 0.25);
}

.dh-result-icon--failed {
  background: linear-gradient(135deg, #e8a09a 0%, var(--ds-red) 100%);
  box-shadow: 0 6px 24px rgba(176, 58, 46, 0.2);
}

.dh-result-icon i {
  font-size: 34px;
  color: #fff;
}

.dh-result-title {
  margin-bottom: 6px;
  font-size: 24px;
  font-weight: 700;
}

.dh-result-title--success {
  color: var(--ds-primary);
}

.dh-result-title--failed {
  color: var(--ds-red);
}

.dh-result-greeting {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.8;
}

.dh-result-text {
  line-height: 1.8;
  margin-bottom: 18px;
}

.dh-result-text--lg {
  margin-bottom: 20px;
}

.dh-result-accent {
  color: var(--ds-primary);
}

.dh-ref-card {
  background: var(--ds-surface-soft);
  border-left: 4px solid var(--ds-gold);
  border-radius: 0 var(--ds-radius-md) var(--ds-radius-md) 0;
  padding: 12px 14px;
}

.dh-ref-label {
  font-size: 13px;
  color: var(--ds-text-muted);
}

.dh-ref-number {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
  color: var(--ds-primary);
  letter-spacing: 2px;
}

.dh-divider {
  border: none;
  border-top: 1px solid var(--ds-border);
  margin: 24px 0;
}

.dh-blessing {
  background: var(--ds-surface-soft);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  padding: 20px 18px;
  text-align: center;
}

.dh-blessing-zh {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--ds-primary);
  font-weight: 600;
  line-height: 1.9;
}

.dh-blessing-en {
  margin: 0;
  font-size: 14px;
  color: var(--ds-text-muted);
  font-style: italic;
  line-height: 1.8;
}

.dh-help-title {
  margin-bottom: 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ds-primary-strong);
}

.dh-help-box {
  background: var(--ds-surface-soft);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  padding: 18px 20px;
}

.dh-help-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--ds-text-muted);
  line-height: 1.7;
  font-size: 14px;
}

.dh-help-item:last-child {
  margin-bottom: 0;
}

.dh-help-item i {
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--ds-gold);
  font-size: 16px;
}

/* --------------------------------------------------------------------------
   Language toggle visibility helpers
   -------------------------------------------------------------------------- */

[data-lang-en] {
  display: none;
}

body.lang-en [data-lang-zh] {
  display: none !important;
}

body.lang-en [data-lang-en] {
  display: block;
}

body.lang-en .inline-lang[data-lang-en] {
  display: inline;
}

.dh-hidden-en [data-lang-en] {
  display: none;
}

body.lang-en .dh-hidden-en [data-lang-zh] {
  display: none;
}

body.lang-en .dh-hidden-en [data-lang-en] {
  display: inline;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.ds-site-footer {
  background: #3a2a14;
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.9rem;
  line-height: 1.75;
  padding: 2.5rem 0 2rem;
}

.ds-site-footer a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
}

.ds-site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.ds-site-footer-main {
  margin-bottom: 2rem;
}

.ds-site-footer-org {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
  margin: 0 0 0.35rem;
}

.ds-site-footer-org-en {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  margin: 0;
}

.ds-site-footer-address {
  font-style: normal;
  font-size: 0.88rem;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.84);
  margin: 0;
}

.ds-site-footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
}

.ds-site-footer-copyright {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
}

/* --------------------------------------------------------------------------
   PDF attachment module (optional)
   Add class `ds-attachment` on <body>
   -------------------------------------------------------------------------- */

body.ds-body.ds-attachment {
  width: 210mm;
  margin: 0 auto;
  padding: 18mm 20mm 20mm;
  background: #fff;
  color: #333;
  font-size: 14px;
  line-height: 1.7;
}

body.ds-body.ds-attachment .ds-table {
  font-size: 13px;
  table-layout: fixed;
}

body.ds-body.ds-attachment .ds-table th,
body.ds-body.ds-attachment .ds-table td {
  padding: 8px 10px;
  border-color: #ccc;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: break-word;
}

body.ds-body.ds-attachment .ds-table thead th {
  background: #fff;
  color: #333;
  white-space: normal;
}

body.ds-body.ds-attachment .ds-table .ds-col-num {
  width: 28px;
  text-align: center;
  color: #333;
}

.ds-attachment-header {
  text-align: right;
  padding-bottom: 16px;
  border-bottom: 1px solid #ccc;
  margin-bottom: 24px;
}

.ds-attachment-header img {
  width: 200px;
  max-width: 200px;
  height: auto;
}

.ds-attachment-title {
  text-align: center;
  margin-bottom: 22px;
}

.ds-attachment-title h1 {
  margin: 0 0 4px;
  font-size: 24px;
  letter-spacing: 6px;
}

.ds-attachment-subtitle {
  font-size: 14px;
  letter-spacing: 1px;
}

.ds-attachment-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 32px;
  margin-bottom: 24px;
}

.ds-attachment-info-item {
  display: flex;
  font-size: 14px;
  line-height: 1.8;
}

.ds-attachment-info-label {
  min-width: 150px;
  white-space: nowrap;
}

.ds-attachment-info-value {
  font-weight: 600;
}

.ds-attachment-section {
  margin-bottom: 22px;
}

.ds-attachment-section-title {
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 700;
}

@page {
  size: A4;
  margin: 18mm 20mm 20mm;
}

@media print {
  body.ds-body.ds-attachment {
    width: auto;
    padding: 0;
  }

  .ds-attachment-header,
  .ds-attachment-title,
  .ds-attachment-info-grid,
  .ds-attachment-section {
    page-break-inside: avoid;
  }

  .ds-attachment-section-title {
    page-break-after: avoid;
  }

  thead {
    display: table-header-group;
  }

  tr {
    page-break-inside: avoid;
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .ds-main-wrap {
    padding: 20px 20px 50px;
  }

  .dh-result-wrap {
    padding: 0 20px 50px;
  }

  .ds-site-footer {
    padding: 28px 20px;
  }
}

@media (max-width: 576px) {
  .ds-main-wrap {
    padding: 14px 12px 40px;
  }

  .dh-date-group {
    grid-template-columns: 1fr;
  }

  .ds-card {
    padding: 18px 14px;
  }

  .ds-package-grid {
    grid-template-columns: 1fr;
  }

  .ds-lang-toggle {
    padding: 12px 16px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .dh-result-wrap {
    padding: 0 12px 40px;
  }

  .dh-result-card {
    padding: 26px 18px;
  }

  .dh-result-icon {
    width: 64px;
    height: 64px;
  }

  .dh-result-icon i {
    font-size: 28px;
  }

  .dh-ref-number {
    font-size: 18px;
  }

  .ds-table {
    font-size: 13px;
  }

  .ds-table th,
  .ds-table td {
    padding: 6px;
  }

  .ds-site-footer {
    padding: 24px 16px;
  }
}