/* === components/cad.css === */

/* Main container for a CAD entry */
.cad-entry {
    font-family: var(--cad-font-family) !important; /* Uses the new font variable */
    font-size: 18px;
    padding: 0px 10px;
    margin-top: 1rem;
    font-weight: var(--font-weight-light); /* 300, same as AHw. 350 was tried while CAD was still Source Serif 4, where 300 read thin; Noto Serif carries 300 with more colour and the two dictionaries now match. */
    hyphens: auto;
    text-align: justify;
}

/* Shown under a truncated CAD entry for anonymous visitors - see
   modules/api/render-external.xql. Deliberately quiet: it is a rights notice, not a
   call to action, and it must not compete with the entry text above it. No rule above
   it - the truncation is not a section break, and a line would read as one. Centred,
   with a max-width so it does not run the full column measure. */
.cad-preview-notice {
    margin: 1.25em auto 0;
    /* Side gutter. max-width alone leaves the text running into the edges once the
       column is narrower than 34em - on a small laptop it was almost touching the
       border. box-sizing is border-box globally (page/core/base.css), so this sits
       inside the max-width rather than widening the block. */
    padding: 0 1.5rem;
    max-width: 34em;
    text-align: center;
    text-align-last: center;
    hyphens: none;
    font-size: 0.85em;
    font-style: italic;
    color: var(--note-text-color, #6c757d);
}

/* The publisher's name links to them, but quietly: a rights credit should read as
   a sentence, not as navigation. The underline only appears on hover or keyboard
   focus. It is a transparent border rather than text-decoration so revealing it
   cannot shift the line. */
.cad-preview-notice a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.cad-preview-notice a:hover,
.cad-preview-notice a:focus-visible {
    color: var(--link-hover-color, #333);
    border-bottom-color: currentColor;
}

/* The headword/lemma line */
.cad-head { 
    margin-bottom: 0.5rem;
}

.cad-head .cad-lemma {
    font-weight: 700; /* Bold */
    color: var(--charcoal);
}

.cad-head .cad-pos {
    margin-left: 0.5em;
}

/* .small-caps now lives in page/dictionary/linguistic.css so AHw, CAD and the
   visual editor share one definition. Re-declaring it here would override that
   rule, because cad.css loads after page.css (which imports linguistic.css). */

/* The main body of the entry */
.cad-body {
    padding-left: 10px;
}

.cad-lexical-section {
    font-size: 0.9rem;
}

.cad-bilingual-section {
    font-size: 0.9rem;
}
/* Styling for each sense */
.cad-sense {
    /* Creates a hanging indent. Adjust values as needed. */
    text-indent: 1em;
    margin-bottom: 0.5rem;
}

.cad-sense-letter {
    font-weight: 400; /* Makes the letter bold */
}
.cad-sense-number {
    font-weight: 400; /* Bold */
    margin-right: 0.5em;
}

/* Styling for citations within a sense */

.cad-citation-note {
    font-size: 0.9rem;
}

.cad-citation .cad-quote {
    font-style: italic;
    color: var(--fern-green); /* Example color for Akkadian */
}

.cad-citation .cad-translation {
    margin-left: 0.5em;
    color: #555;
}

.cad-citation .cad-ref {
    margin-left: 0.5em;
    color: #777;
    font-size: 0.9rem;
}

/* Styling for the etymology section */
.cad-etymology {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    font-size: 0.9rem;
}

.cad-etymology .cad-etym-label {
    font-weight: 400;
    margin-right: 0.5em;
}

/* Error message styling */
.cad-error {
    color: var(--vermilion);
    padding: 20px;
}

/* Excluded entries and senses (strikethrough for non-selected fragments) */
.excluded-sub-entry {
    opacity: 0.5;
    text-decoration: line-through;
    color: #999;
}

.excluded-sense {
    opacity: 0.5;
    text-decoration: line-through;
    color: #999;
}

/* Ensure tooltip containers inside excluded elements inherit strikethrough */
.excluded-sub-entry .tooltip-container,
.excluded-sense .tooltip-container,
.excluded-sub-entry .tooltip-container *,
.excluded-sense .tooltip-container * {
    text-decoration: line-through;
    color: inherit;
}

/* Exclude the tooltip text itself from strikethrough */
.excluded-sub-entry .tooltip-text,
.excluded-sense .tooltip-text,
.excluded-sub-entry .tooltip-text *,
.excluded-sense .tooltip-text * {
    text-decoration: none;
    color: var(--tooltip-text-color);
    opacity: 1;
}


/* In components/cad.css */

.cad-lemma {
    font-weight: 700; /* This ensures it is bold (700 is the numeric value for bold) */
    font-style: normal !important; /* This FORCES it to be non-italic */
}

/* === CAD BIBLIOGRAPHY TOOLTIPS === */

/* CAD bibliography reference styling */
.cad-bibl-ref {
    cursor: pointer;
}

/* CAD-specific tooltip container */
.cad-tooltip-container {
    position: relative;
    cursor: pointer;
}

/* CAD tooltip text */
.cad-tooltip-text {
    visibility: hidden;
    background-color: var(--cad-tooltip-background);
    color: var(--cad-tooltip-text-color);
    text-align: left;
    border-radius: var(--tooltip-border-radius);
    border: var(--cad-tooltip-border);
    padding: 8px 12px;
    position: fixed;
    z-index: 9999;
    width: auto;
    min-width: 100px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: auto;
    font-style: var(--normal-font-style);
    font-weight: normal;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    white-space: normal;
    word-wrap: break-word;
}

/* CAD tooltip arrow */
.cad-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--cad-tooltip-background) transparent transparent transparent;
}

/* Show tooltip on click (when active class is added) */
.cad-tooltip-container.active .cad-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Copy icon for CAD tooltips */
.cad-tooltip-text .copy-icon {
    margin-left: 8px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: 0.8rem;
}

.cad-tooltip-text .copy-icon:hover {
    opacity: 1;
}

.cad-cross-ref-link,
.cad-source-ref {
    color: inherit;
    text-decoration: none;
    transition: var(--link-transition);
}

/* === CAD SOURCE REFERENCE LINKS === */



.cad-source-ref:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

.cad-external-link-icon {
    font-size: 0.8em;
    opacity: 0.6;
    display: inline-block;
    vertical-align: super;
}

.cad-source-id-text {
    display: inline-block;
}

/* ========== Page Reference ========== */

/* The reference row: form badge (plaintext / Raw Content), page reference, quality
   badge. They sit together as one centred group, each badge immediately beside the
   page reference rather than pinned to the column edges. */
.cad-page-ref {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9em;
    margin-bottom: 0.5rem;
}

/* An empty side zone is taken out of the flow: left in, it would still take a flex
   gap and nudge the group off centre. */
.cad-page-ref-left:empty,
.cad-page-ref-right:empty {
    display: none;
}

/* The badges were inline in a centred line and carried a left margin to separate
   them from the page number. In the zones they sit against the edge instead. */
.cad-page-ref-left > span,
.cad-page-ref-right > span {
    margin-left: 0;
}

/* A CAD/AHw lemma the LAD team deleted: its tab title is struck through
   (cad:render-tabbed-entries). The entry text stays as the dictionary printed it;
   where the passages went is said in the tooltip and in the search suggestions. */
/* Same look as a deleted row in the search suggestions (search.css). */
.external-dict-tabs .nav-link .lad-deleted-label {
    color: rgba(51, 51, 51, 0.6);
    text-decoration: line-through;
    text-decoration-color: #c00;
    text-decoration-thickness: 1px;
}


/* ========== Draft/Raw Content Styles ========== */

/* Badges - matching AHw pattern */
.cad-draft-badge,
.cad-raw-badge,
.cad-ref-badge {
    display: inline-block;
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    vertical-align: middle;
}

.cad-draft-badge {
    background-color: #ff4444;
    color: white;
}

.cad-review-badge {
    background-color: #ffaa00;
    color: white;
}

.cad-ready-badge {
    background-color: #00aa00;
    color: white;
}

.cad-published-badge {
    background-color: #0066cc;
    color: white;
}

.cad-status-badge {
    background-color: #5bc0de;
    color: white;
}

.cad-raw-badge {
    background-color: #888888;
    color: white;
    margin-left: 0;
    margin-right: 6px;
}

.cad-ref-badge {
    background-color: #5bc0de;
    color: white;
    margin-left: 8px;
}

/* Front-face raw content display */
.cad-raw-text {
    display: block;
}

/* Editor raw content reference box */
.cad-raw-reference {
    margin-top: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
}

.cad-raw-reference-header {
    padding: 8px 12px;
    background: #e9ecef;
    border-bottom: 1px solid #ddd;
    border-radius: 4px 4px 0 0;
}

.cad-raw-reference-label {
    font-weight: 600;
    font-size: 0.85em;
    color: #666;
    margin-right: 8px;
}

.cad-raw-reference-content {
    padding: 12px;
    line-height: 1.5;
    font-family: inherit;
    color: #333;
}

/* Akkadian transliteration in rawContent */
.cad-akkadian {
    font-style: italic;
}

/* Column break marker - matching AHw style */
.cad-col-break {
    display: inline-block;
    background-color: #e0e0e0;
    color: #555;
    font-size: 0.75em;
    font-style: normal;
    font-weight: 500;
    padding: 0.1em 0.4em;
    border-radius: 3px;
    vertical-align: middle;
    line-height: 1.2;
}

/* Lexical and discussion blocks */
.cad-lexical-block {
    font-size: 0.9em;
}

.cad-discussion-block {
    font-size: 0.9em;
}

/* Draft entry indicator */
.cad-draft-entry {
    padding-left: 8px;
}







