|
| 1 | +/** |
| 2 | + * Dialog Component |
| 3 | + * |
| 4 | + * A modal dialog triggered by user action, requiring an interstitial step. |
| 5 | + * Dialog Container (.dialog-modal__container) is the inner content area and |
| 6 | + * is NOT intended as a standalone module – it only exists inside Dialog Modal. |
| 7 | + * |
| 8 | + * Open/close is CSS-only via the :target pseudo-class. No JavaScript required. |
| 9 | + * Trigger: <a href="#dialog-id">…</a> |
| 10 | + * Close: <a href="#">…</a> (close button and backdrop link inside the dialog) |
| 11 | + * |
| 12 | + * Structure: |
| 13 | + * .dialog-modal – full-screen overlay (hidden by default) |
| 14 | + * .dialog-modal__backdrop – invisible close link covering the overlay area |
| 15 | + * .dialog-modal__container – centred content card |
| 16 | + * .dialog-modal__header – title row + close link |
| 17 | + * .dialog-modal__title – heading text |
| 18 | + * .dialog-modal__close – dismiss link (×) |
| 19 | + * .dialog-modal__description – optional body text |
| 20 | + * .dialog-modal__buttons – primary / secondary action row |
| 21 | + * |
| 22 | + * Light/dark: all colour tokens are already theme-aware via semantics.css + themes.css. |
| 23 | + */ |
| 24 | + |
| 25 | +/* ============================================ |
| 26 | + DIALOG MODAL (full-screen overlay) |
| 27 | + ============================================ */ |
| 28 | +.dialog-modal { |
| 29 | + display: none; |
| 30 | + position: fixed; |
| 31 | + inset: 0; |
| 32 | + z-index: 10000; |
| 33 | + background-color: var(--color-surface-modal); |
| 34 | + align-items: center; |
| 35 | + justify-content: center; |
| 36 | +} |
| 37 | + |
| 38 | +.dialog-modal:target { |
| 39 | + display: flex !important; |
| 40 | +} |
| 41 | + |
| 42 | +/* ============================================ |
| 43 | + BACKDROP CLOSE LINK |
| 44 | + Fills the overlay; clicking outside the container closes the dialog. |
| 45 | + ============================================ */ |
| 46 | +.dialog-modal__backdrop { |
| 47 | + position: absolute; |
| 48 | + inset: 0; |
| 49 | + cursor: default; |
| 50 | + z-index: 0; |
| 51 | +} |
| 52 | + |
| 53 | +/* ============================================ |
| 54 | + DIALOG CONTAINER (inner content card) |
| 55 | + ============================================ */ |
| 56 | +.dialog-modal__container { |
| 57 | + position: relative; |
| 58 | + z-index: 1; |
| 59 | + display: flex; |
| 60 | + flex-direction: column; |
| 61 | + gap: var(--space-large, 16px); |
| 62 | + width: 695px; |
| 63 | + max-width: calc(100vw - 2 * var(--space-large)); |
| 64 | + background-color: var(--color-surface-page); |
| 65 | + border-radius: var(--border-radius-xl); |
| 66 | + overflow: hidden; |
| 67 | +} |
| 68 | + |
| 69 | +/* Mobile: full-width dialog with minimal margins */ |
| 70 | +@media (max-width: 767px) { |
| 71 | + .dialog-modal__container { |
| 72 | + width: 100%; |
| 73 | + max-width: calc(100vw - 2 * var(--space-default)); |
| 74 | + margin: 0 var(--space-default); |
| 75 | + border-radius: var(--border-radius-l); |
| 76 | + } |
| 77 | +} |
| 78 | + |
| 79 | +/* ============================================ |
| 80 | + HEADER (title + close link on the same row) |
| 81 | + ============================================ */ |
| 82 | +.dialog-modal__header { |
| 83 | + display: flex !important; |
| 84 | + flex-direction: row !important; |
| 85 | + align-items: flex-start; |
| 86 | + gap: var(--space-default); |
| 87 | + padding: var(--space-large); |
| 88 | + width: 100%; |
| 89 | + box-sizing: border-box; |
| 90 | + border-bottom: 1px solid var(--color-stroke-weak); |
| 91 | +} |
| 92 | + |
| 93 | +.dialog-modal__title { |
| 94 | + flex: 1 0 0 !important; |
| 95 | + min-width: 0; |
| 96 | + margin: 0 !important; |
| 97 | + padding: 0 !important; |
| 98 | + font-family: var(--font-display); |
| 99 | + font-size: var(--font-size-large); |
| 100 | + font-weight: var(--font-weight-medium); |
| 101 | + line-height: var(--line-height-tight); |
| 102 | + letter-spacing: var(--letter-spacing-display-regular); |
| 103 | + color: var(--color-text-primary); |
| 104 | + display: block !important; |
| 105 | +} |
| 106 | + |
| 107 | +/* ============================================ |
| 108 | + CLOSE LINK (×) |
| 109 | + ============================================ */ |
| 110 | +.dialog-modal__close { |
| 111 | + flex-shrink: 0; |
| 112 | + display: inline-flex; |
| 113 | + align-items: center; |
| 114 | + justify-content: center; |
| 115 | + width: 24px; |
| 116 | + height: 24px; |
| 117 | + color: var(--color-icon-primary); |
| 118 | + text-decoration: none; |
| 119 | +} |
| 120 | + |
| 121 | +.dialog-modal__close:hover { |
| 122 | + color: var(--color-icon-secondary); |
| 123 | +} |
| 124 | + |
| 125 | +.dialog-modal__close svg { |
| 126 | + display: block; |
| 127 | + width: 24px; |
| 128 | + height: 24px; |
| 129 | +} |
| 130 | + |
| 131 | +/* ============================================ |
| 132 | + DESCRIPTION (optional) |
| 133 | + ============================================ */ |
| 134 | +.dialog-modal__description { |
| 135 | + padding: 0 var(--space-large); |
| 136 | + width: 100%; |
| 137 | + box-sizing: border-box; |
| 138 | +} |
| 139 | + |
| 140 | +.dialog-modal__description p { |
| 141 | + margin: 0; |
| 142 | + font-family: var(--font-sans); |
| 143 | + font-size: var(--font-size-base); |
| 144 | + font-weight: var(--font-weight-regular); |
| 145 | + line-height: var(--line-height-default); |
| 146 | + letter-spacing: var(--letter-spacing-tight); |
| 147 | + color: var(--color-text-secondary); |
| 148 | +} |
| 149 | + |
| 150 | +/* ============================================ |
| 151 | + BUTTONS ROW |
| 152 | + ============================================ */ |
| 153 | +.dialog-modal__buttons { |
| 154 | + display: flex; |
| 155 | + flex-direction: row; |
| 156 | + gap: var(--space-default); |
| 157 | + padding: 0 var(--space-large) var(--space-large); |
| 158 | + width: 100%; |
| 159 | + box-sizing: border-box; |
| 160 | +} |
| 161 | + |
| 162 | +.dialog-modal__buttons .btn { |
| 163 | + flex: 1 0 0; |
| 164 | + min-width: 128px; |
| 165 | + width: auto; |
| 166 | + text-decoration: none; |
| 167 | +} |
| 168 | + |
| 169 | +.dialog-modal__buttons a.btn { |
| 170 | + text-decoration: none; |
| 171 | +} |
0 commit comments