@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+Gujarati:wght@400;600;700&family=Noto+Serif+Devanagari:wght@400;600;700&family=IM+Fell+English:ital@0;1&family=Noto+Serif:wght@400;600;700&display=swap');

:root {
    --deed-navy:   #111111;
    --deed-gold:   #cccccc;
    --deed-brown:  #cccccc;
    --deed-cream:  #ffffff;
    --deed-bg:     #f0f0f0;
    --deed-light:  #ffffff;
    --deed-border: #cccccc;
    --deed-text:   #111111;
    --deed-muted:  #333333;
    --deed-burgundy: #7c2062;
}

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

body { background: var(--deed-bg); }

.deed-page {
    max-width: 880px;
    margin: 36px auto;
    padding: 0 20px 40px;
    font-family: 'Noto Serif', serif;
    color: var(--deed-text);
}

/* ══════════════════════════════════
   ACTION BAR
══════════════════════════════════ */
.action-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
.action-btn {
    padding: 9px 20px;
    border-radius: 8px;
    border: 1.5px solid var(--deed-navy);
    background: #fff;
    color: var(--deed-navy);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    font-family: 'Noto Serif', serif;
    line-height: 1;
    white-space: nowrap;
}
.action-btn:hover {
    background: var(--deed-navy);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}
.action-btn:active {
    transform: scale(0.97);
}
.action-btn.primary {
    background: var(--deed-navy);
    color: #fff;
}

/* Language toggle buttons */
.lang-toggle-group {
    display: flex;
    gap: 4px;
    background: var(--deed-light);
    border: 2px solid var(--deed-border);
    border-radius: 8px;
    padding: 3px;
}
.lang-btn {
    padding: 7px 18px;
    border-radius: 5px;
    border: none;
    background: transparent;
    color: var(--deed-navy);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Noto Serif', serif;
    transition: background .18s, color .18s;
    white-space: nowrap;
}
.lang-btn.active {
    background: var(--deed-navy);
    color: #fff;
    box-shadow: 0 2px 6px rgba(30,58,95,.25);
}

/* ══════════════════════════════════
   OWNER ACCORDION (multiple owners)
══════════════════════════════════ */
.owner-accordion {
    margin-bottom: 8px;
    border: none;
    border-radius: 5px;
    overflow: hidden;
}
.owner-accordion + .owner-accordion {
    margin-top: 10px;
}
.owner-accordion summary {
    list-style: none;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fbf7f8;
    font-weight: 700;
    font-size: 17px;
    color: #222;
    font-family: 'Noto Serif', serif;
    border-bottom: none;
    user-select: none;
}
.owner-accordion summary::-webkit-details-marker { display: none; }
.owner-accordion summary::after {
    content: '▾';
    font-size: 16px;
    color: #666;
    flex-shrink: 0;
    transition: transform .2s;
}
.owner-accordion[open] summary::after {
    transform: rotate(180deg);
}
.owner-accordion .accordion-body {
    padding: 20px 24px;
}
.owner-accordion summary .owner-accordion-title {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}
.owner-accordion summary .owner-section-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}
.owner-accordion summary .owner-section-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.owner-accordion summary .owner-section-photo.deed-photo-placeholder {
    background: #f0f0f0;
    border-color: rgba(0, 0, 0, 0.15);
}

/* ══════════════════════════════════
   OWNER DETAIL GRID
══════════════════════════════════ */
.deed-owner-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid var(--deed-border);
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0 0;
    font-size: 13.5px;
}
.deed-owner-grid .dg-row {
    display: contents;
}
.deed-owner-grid .dg-label,
.deed-owner-grid .dg-value {
    padding: 8px 12px;
    border-bottom: 1px solid var(--deed-border);
    display: flex;
    white-space: pre-line;
}
.deed-owner-grid .dg-label {
    align-items: center;
    background: var(--deed-light);
    font-weight: 700;
    color: var(--deed-navy);
    font-size: 12px;
    letter-spacing: .3px;
    border-right: 1px solid var(--deed-border);
}
.deed-owner-grid .dg-value {
    align-items: flex-start;
    background: var(--deed-cream);
    color: var(--deed-text);
    font-weight: 600;
    word-break: break-word;
}
.deed-owner-grid .dg-row:last-child .dg-label,
.deed-owner-grid .dg-row:last-child .dg-value {
    border-bottom: none;
}
/* Full-width row variant */
.deed-owner-grid .dg-label.full,
.deed-owner-grid .dg-value.full {
    grid-column: span 2;
}
.deed-owner-transaction {
    margin-top: 14px;
    font-size: 13.5px;
    line-height: 1.9;
    color: var(--deed-text);
    text-align: justify;
    padding: 12px 14px;
    background: var(--deed-light);
    border-left: 3px solid var(--deed-gold);
    border-radius: 0 4px 4px 0;
}
.deed-owner-transaction .field {
    display: inline;
    border-bottom: 1.5px solid var(--deed-navy);
    padding: 0 4px;
    font-weight: 700;
    color: var(--deed-navy);
}
.deed-owner-photo-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 16px 0;
}


/* ══════════════════════════════════
   DEED DOCUMENT SHELL
══════════════════════════════════ */
.deed-doc {
    background: #fbf7f8;
    border: none;
    border-radius: 0;
    padding: 40px 42px 48px;
    margin-bottom: 44px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    position: relative;
}

.deed-doc::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 2px solid #111;
    pointer-events: none;
    z-index: 10;
}

/* Corner brackets hidden for plain document look */
.deed-doc .corner { display: none; }

/* ══════════════════════════════════
   STAMP PAPER HEADER
══════════════════════════════════ */
.stamp-header {
    position: relative;
    border: 3px solid #b87ca8;
    background: #fdf5f9;
    padding: 18px 24px;
    margin: 0 0 40px 0; /* Kept inside the drawn border */
    text-align: center;
    color: #442a3f;
    font-family: 'Noto Serif Devanagari', 'Noto Serif', serif;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(184,124,168,0.2);
}
.stamp-bg-pattern {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    opacity: 0.15;
    background-image: repeating-linear-gradient(45deg, #a75c96 0, #a75c96 2px, transparent 2px, transparent 10px),
                      repeating-linear-gradient(-45deg, #a75c96 0, #a75c96 2px, transparent 2px, transparent 10px);
    z-index: 0;
}
.stamp-content {
    position: relative;
    z-index: 1;
    border: 1.5px dashed #b87ca8;
    padding: 24px 15px;
    background: rgba(253, 245, 249, 0.75);
}
.stamp-top-text {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 3px;
    color: #922b7a;
    margin-bottom: 20px;
}
.stamp-mid-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
}
.stamp-value-left, .stamp-value-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #922b7a;
}
.stamp-value-left { align-items: flex-start; }
.stamp-value-right { align-items: flex-end; }
.sv-num {
    font-size: clamp(16px, 5vw, 32px);
    font-weight: 700;
    margin: 4px 0;
}
.sv-text {
    font-size: 13.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.stamp-emblem img {
    height: 110px;
    opacity: 0.6;
    filter: sepia(1) hue-rotate(275deg) saturate(2) brightness(0.9);
}
.stamp-bot-text {
    margin-top: 20px;
    color: #922b7a;
}
.sbt-hi, .sbt-en { font-size: 20px; font-weight: 700; }
.sbt-main {
    display: block;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-top: 8px;
}

/* ══════════════════════════════════
   TITLE BLOCK
══════════════════════════════════ */
.deed-title-block {
    text-align: center;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid #888;
}
.deed-title {
    font-family: 'IM Fell English', serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #111;
    line-height: 1.2;
    margin-bottom: 6px;
}
.deed-title-tagline {
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #555;
    font-weight: 600;
}

/* ══════════════════════════════════
   SECTION SUBTITLE
══════════════════════════════════ */
.deed-subtitle {
    font-family: 'IM Fell English', serif;
    font-size: 15px;
    font-weight: 700;
    color: #222;
    margin: 28px 0 14px;
    text-align: center;
    letter-spacing: 1px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}
.deed-subtitle::before,
.deed-subtitle::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #aaa;
    opacity: .8;
}

/* ══════════════════════════════════
   OWNER HEADER: photo floated right
══════════════════════════════════ */
.deed-owner-header {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 4px;
}
.deed-photo-box {
    flex-shrink: 0;
    width: 100px;
    height: 120px;
    border: 1px solid #bbb;
    border-radius: 2px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f7f7f7;
    color: #777;
    font-size: 11px;
    text-align: center;
    gap: 4px;
}
.deed-photo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.deed-photo-caption {
    font-size: 10px;
    color: var(--deed-brown);
    font-style: italic;
    margin-top: 4px;
    display: block;
    text-align: center;
}

/* ══════════════════════════════════
   BODY TEXT
══════════════════════════════════ */
.deed-body {
    font-size: 14.5px;
    line-height: 2.15;
    color: var(--deed-text);
    text-align: justify;
    flex: 1;
}
.deed-body .field {
    display: inline;
    border-bottom: 1.5px solid #111;
    padding: 0 5px;
    font-weight: 700;
    color: #111;
    font-style: normal;
}

/* ══════════════════════════════════
   BOUNDARIES TABLE
══════════════════════════════════ */
.deed-boundaries {
    margin: 20px 0 4px;
    font-size: 13.5px;
    line-height: 1;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}
.deed-boundaries .boundary-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #ccc;
}
.deed-boundaries .boundary-row:last-child { border-bottom: none; }
.deed-boundaries .boundary-label {
    font-weight: 700;
    color: #111;
    background: #f5f5f5;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    padding: 10px 6px;
    flex-shrink: 0;
    border-right: 1px solid #ccc;
}
.deed-boundaries .boundary-value {
    padding: 10px 14px;
    flex: 1;
    color: #222;
    background: #fff;
    min-height: 38px;
    display: flex;
    align-items: center;
    font-size: 13.5px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* ══════════════════════════════════
   MEDIA ROW (photo + video)
══════════════════════════════════ */
.deed-media-row {
    display: flex;
    gap: 16px;
    margin: 24px 0 20px;
    align-items: stretch;
}
.deed-media-row.deed-media-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.deed-media-row.deed-media-grid + .deed-media-row.deed-media-grid {
    margin-top: 20px;
}
.deed-media-row.deed-media-grid .deed-media-box {
    flex: none;
    min-width: 0;
}
.deed-media-box {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    min-height: 140px;
}
.deed-media-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 130px;
}
.deed-media-content img,
.deed-media-content video,
.deed-media-content iframe {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
}
.deed-media-content iframe { border: 0; }
.deed-media-empty {
    color: #777;
    font-size: 12px;
    text-align: center;
    padding: 16px;
    font-style: italic;
}
.deed-media-label {
    font-size: 11.5px;
    font-weight: 700;
    color: #222;
    padding: 7px 10px;
    background: #f5f5f5;
    text-align: center;
    border-top: 1px solid #ccc;
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* Edge-to-Edge 16:9 Widescreen Deed Video Player */
.deed-video-section {
    width: 100%;
    margin: 14px 0;
}
.deed-video-box.deed-video-fullwidth {
    width: 100%;
    border: 1px solid #ccc;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}
.deed-video-player-wrap {
    width: 100%;
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    background: #000;
}
.deed-video-player-wrap iframe,
.deed-video-player-wrap video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}
.deed-video-box.deed-video-fullwidth .deed-media-label {
    background: #1e2a4a;
    color: #d4b85c;
    border-top: 1px solid rgba(212,184,92,0.3);
    font-size: 12px;
    letter-spacing: 0.8px;
}

/* ══════════════════════════════════
   MAP ROW
══════════════════════════════════ */
.deed-map-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 16px 0;
    font-size: 14px;
    padding: 10px 14px;
    background: #fafafa;
    border-left: 3px solid #b3b3b3;
    border-radius: 0 4px 4px 0;
}
.deed-map-label { font-weight: 700; color: #111; white-space: nowrap; }
.deed-map-value { color: #222; font-weight: 600; }
.deed-map-embed { margin: 0 0 16px; }

/* ══════════════════════════════════
   DISCLAIMER FOOTER
══════════════════════════════════ */
.deed-disclaimer {
    margin-top: 28px;
    padding-top: 14px;
    border-top: 1px solid #ccc;
    font-size: 12.5px;
    color: #555;
    text-align: center;
    font-style: italic;
    line-height: 1.6;
}

/* ══════════════════════════════════
   GUJARATI OVERRIDES
══════════════════════════════════ */
.deed-gujarati,
.deed-gujarati .deed-body,
.deed-gujarati .deed-subtitle,
.deed-gujarati .deed-boundaries,
.deed-gujarati .deed-map-row,
.deed-gujarati .deed-disclaimer {
    font-family: 'Noto Serif Gujarati', serif;
}
.deed-gujarati .deed-title {
    font-family: 'Noto Serif Gujarati', serif;
}
.deed-gujarati .deed-body {
    font-size: 14px;
    line-height: 2.25;
}

/* ══════════════════════════════════
   HINDI OVERRIDES
══════════════════════════════════ */
.deed-hindi,
.deed-hindi .deed-body,
.deed-hindi .deed-subtitle,
.deed-hindi .deed-boundaries,
.deed-hindi .deed-map-row,
.deed-hindi .deed-disclaimer {
    font-family: 'Noto Serif Devanagari', serif;
}
.deed-hindi .deed-title {
    font-family: 'Noto Serif Devanagari', serif;
}
.deed-hindi .deed-body {
    font-size: 14px;
    line-height: 2.25;
}

/* ══════════════════════════════════
   PRINT PAGINATION
══════════════════════════════════ */
@media print {
    body { background: #fff !important; }
    .action-bar { display: none !important; }
    .deed-page { 
        margin: 0 !important; 
        padding: 0 !important; 
        max-width: none !important; 
    }
    .deed-doc {
        border: none !important;
        border-image: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        /* Let it expand and split as needed */
        height: auto !important;
        page-break-after: auto;
    }
    /* Prevent cutting off individuals across physical pages */
    .owner-accordion, .deed-boundaries, .deed-media-row, .deed-map-row {
        page-break-inside: avoid;
    }
    .owner-accordion summary::after { display: none; }
}

/* ══════════════════════════════════
   MOBILE RESPONSIVE
══════════════════════════════════ */
@media (max-width: 640px) {
    .deed-doc { padding: 32px 20px; }
    .deed-title { font-size: 18px; letter-spacing: 1px; }
    .deed-body { font-size: 13px; line-height: 2; }

    .deed-owner-header { flex-direction: column; align-items: center; }
    .deed-photo-box { width: 90px; height: 108px; }

    .deed-media-row:not(.deed-media-grid) { flex-direction: column; }
    .deed-media-row.deed-media-grid { grid-template-columns: repeat(2, 1fr); }
    .deed-media-content img,
    .deed-media-content video,
    .deed-media-content iframe { height: 180px; }

    .action-bar { justify-content: center; }
    .stamp-header { padding: 12px; }
    .stamp-content { padding: 14px 8px; }
    .stamp-top-text { font-size: 18px; letter-spacing: 1px; }
    .stamp-mid-row { gap: 6px; }
    .stamp-emblem img { height: 70px; }
    .sv-text { font-size: 11px; }
    .sbt-hi, .sbt-en { font-size: 15px; }
    .sbt-main { font-size: 16px; }
    .deed-owner-grid {
        grid-template-columns: 42% 58%;
        font-size: 12.5px;
        border: 1.5px solid var(--deed-border);
        border-radius: 6px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(124, 32, 98, 0.05);
    }

    .deed-owner-grid .dg-label,
    .deed-owner-grid .dg-value {
        padding: 8px 10px;
        line-height: 1.35;
        word-break: break-word;
        overflow-wrap: anywhere;
        white-space: pre-line;
    }

    .deed-owner-grid .dg-label {
        border-right: 1px solid var(--deed-border);
        border-bottom: 1px solid var(--deed-border);
        font-size: 11.5px;
        letter-spacing: 0.2px;
        text-transform: none;
        color: var(--deed-burgundy);
        background: var(--deed-light);
        font-weight: 600;
        display: flex;
        align-items: center;
    }

    .deed-owner-grid .dg-value {
        border-bottom: 1px solid var(--deed-border);
        font-size: 12.5px;
        display: flex;
        align-items: flex-start;
        background: #ffffff;
    }

    .deed-owner-grid .dg-row:nth-child(even) .dg-value {
        background: #fdfbfd;
    }

    .deed-owner-grid .dg-row:last-child .dg-label,
    .deed-owner-grid .dg-row:last-child .dg-value {
        border-bottom: none;
    }

    .deed-boundaries {
        margin: 12px 0 4px;
        font-size: 12.5px;
    }

    .deed-boundaries .boundary-label {
        min-width: 32px;
        font-size: 12px;
        padding: 8px 6px;
    }

    .deed-boundaries .boundary-value {
        padding: 8px 10px;
        font-size: 12.5px;
        min-height: 34px;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

}

/* ══════════════════════════════════
   PRINT / PDF STYLES
══════════════════════════════════ */
@media print {
    @page { size: A4 portrait; margin: 8mm 10mm; }

    body * { visibility: hidden; }
    .deed-page, .deed-page * { visibility: visible; }

    body { background: #fff !important; margin: 0 !important; padding: 0 !important; }

    .action-bar { display: none !important; visibility: hidden !important; }

    .deed-page {
        position: static;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .deed-doc {
        box-shadow: none !important;
        border: 2px solid var(--deed-brown) !important;
        padding: 22px 28px !important;
        margin-bottom: 0 !important;
        width: 100% !important;
        page-break-after: always;
        break-after: page;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .deed-doc:last-child { page-break-after: avoid; break-after: avoid; }

    .deed-title         { font-size: 17px !important; }
    .deed-subtitle      { font-size: 12px !important; margin: 10px 0 6px !important; }
    .deed-body          { font-size: 10.5px !important; line-height: 1.85 !important; }
    .deed-gujarati .deed-body,
    .deed-hindi .deed-body { font-size: 10.5px !important; line-height: 1.95 !important; }
    .deed-boundaries    { font-size: 10px !important; margin: 8px 0 !important; }
    .deed-disclaimer    { font-size: 10px !important; margin-top: 12px !important; padding-top: 8px !important; }

    .deed-photo-box     { width: 72px !important; height: 88px !important; }

    .deed-media-row     { gap: 10px !important; margin: 10px 0 !important; }
    .deed-media-content img,
    .deed-media-content video,
    .deed-media-content iframe { height: 100px !important; }
    .deed-media-label   { font-size: 9px !important; padding: 4px !important; }

    .deed-map-row       { padding: 6px 10px !important; margin: 8px 0 !important; font-size: 10.5px !important; }

    .deed-body, .deed-boundaries, .deed-owner-header, .deed-media-row {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}
