|
55 | 55 | gap: 0.5rem; |
56 | 56 | } |
57 | 57 |
|
58 | | -:where(.hamelp-ai-overview__input-row) { |
| 58 | +// Layout-critical, so scoped (0,2,0) for theme-override resistance: the absolute |
| 59 | +// send button depends on this positioning context, and a theme `.wp-block-*`/ |
| 60 | +// element rule at 0,0,0 could otherwise drop it, un-inset the button. |
| 61 | +.hamelp-ai-overview .hamelp-ai-overview__input-row { |
59 | 62 | // Positioning context for the send button, which is taken out of flow and |
60 | 63 | // floated inside the field's bottom-right corner (ChatGPT-style inset). The |
61 | 64 | // field's own border/background/radius stay driven by the textarea's theme |
|
77 | 80 |
|
78 | 81 | :where(.hamelp-ai-overview__input) { |
79 | 82 | flex: 1; |
80 | | - box-sizing: border-box; |
81 | | - // Reserve room on the right so typed text never runs under the inset send |
82 | | - // button (right = btn size + 1rem to clear the button plus a small gap). The |
83 | | - // vertical padding is SYMMETRIC (top/bottom both 0.75rem) so that, combined |
84 | | - // with align-content: center below, the single line centers cleanly in the |
85 | | - // content box regardless of the button size or the theme's line-height. |
86 | | - padding: 0.75rem calc(var(--hamelp-btn-size) + 1rem) 0.75rem 0.75rem; |
87 | 83 | border: 1px solid var(--hamelp-border); |
88 | 84 | border-radius: var(--hamelp-radius, 3px); |
89 | 85 | background: var(--hamelp-surface); |
|
93 | 89 | // content (field-sizing) up to a cap so long input stays fully visible. |
94 | 90 | font-family: inherit; |
95 | 91 | line-height: 1.5; |
| 92 | + max-height: 8lh; |
| 93 | +} |
| 94 | + |
| 95 | +// Box/layout props the inset depends on, scoped (0,2,0) for theme-override |
| 96 | +// resistance: a theme's `textarea`/`.wp-block-*` rule at 0,0,0 must not collapse |
| 97 | +// the reserved button space, the inflated min-height, or the centered line. |
| 98 | +.hamelp-ai-overview .hamelp-ai-overview__input { |
| 99 | + box-sizing: border-box; |
| 100 | + // Reserve room on the right so typed text never runs under the inset send |
| 101 | + // button (right = btn size + 1rem to clear the button plus a small gap). The |
| 102 | + // vertical padding is SYMMETRIC (top/bottom both 0.75rem) so that, combined |
| 103 | + // with align-content: center below, the single line centers cleanly in the |
| 104 | + // content box regardless of the button size or the theme's line-height. |
| 105 | + padding: 0.75rem calc(var(--hamelp-btn-size) + 1rem) 0.75rem 0.75rem; |
96 | 106 | field-sizing: content; |
97 | 107 | // Minimum height sized so the inset send button clears equal ~8px gaps on |
98 | 108 | // every side in the single-line state: button height + 2 × the button's |
99 | 109 | // corner inset (0.5rem each). field-sizing still grows the field past this |
100 | 110 | // as text wraps, at which point the top gap widens. |
101 | 111 | min-height: calc(var(--hamelp-btn-size) + 1rem); |
102 | | - max-height: 8lh; |
103 | 112 | resize: none; |
104 | 113 | // Vertically CENTER the single line of text within the inflated min-height. |
105 | 114 | // With symmetric vertical padding above, centering is metric-robust: the line |
|
135 | 144 | } |
136 | 145 | } |
137 | 146 |
|
138 | | -:where(.hamelp-ai-overview__button) { |
| 147 | +// Structural/box/layout props scoped (0,2,0) for theme-override resistance. |
| 148 | +// Theme button rules (`.wp-block-button__link`, `form button[type=submit]`, bare |
| 149 | +// `button`) at 0,0,0–0,1,1 otherwise win and inflate the button into a big |
| 150 | +// rectangle (and can push the arrow out). min-height:0 + padding:0 NEUTRALIZE |
| 151 | +// theme-injected values; max-height:none guards against theme height caps. |
| 152 | +// Cosmetics (background/gradient, color, transition, :hover, focus color) stay |
| 153 | +// low-specificity in :where() below so themes can still re-skin them. |
| 154 | +.hamelp-ai-overview .hamelp-ai-overview__button { |
139 | 155 | // Fixed-size circular icon button (ChatGPT-style), floated inside the field's |
140 | 156 | // bottom-right corner. The constant bottom offset keeps it pinned to the |
141 | 157 | // bottom as the textarea grows, instead of riding up with the content. |
142 | 158 | position: absolute; |
143 | 159 | right: 0.5rem; |
144 | 160 | bottom: 0.5rem; |
145 | 161 | display: flex; |
| 162 | + flex: none; |
146 | 163 | align-items: center; |
147 | 164 | justify-content: center; |
| 165 | + box-sizing: border-box; |
148 | 166 | width: var(--hamelp-btn-size); |
149 | 167 | height: var(--hamelp-btn-size); |
| 168 | + min-height: 0; |
| 169 | + max-height: none; |
150 | 170 | padding: 0; |
151 | | - border: 1px solid transparent; |
152 | 171 | border-radius: 50%; |
| 172 | + line-height: 1; |
| 173 | +} |
| 174 | + |
| 175 | +// Keep the icon size enforced at the same specificity so a theme `button svg` |
| 176 | +// rule can't resize the arrow or push it out of the circle. |
| 177 | +.hamelp-ai-overview .hamelp-ai-overview__button-icon { |
| 178 | + width: 20px; |
| 179 | + height: 20px; |
| 180 | +} |
| 181 | + |
| 182 | +:where(.hamelp-ai-overview__button) { |
| 183 | + border: 1px solid transparent; |
153 | 184 | background: var(--hamelp-button-bg, #1571da); |
154 | 185 | background: linear-gradient(135deg, var(--hamelp-button-bg, #1571da), var(--hamelp-accent-hover)); |
155 | 186 | color: var(--hamelp-on-accent); |
156 | 187 | cursor: pointer; |
157 | 188 | transition: opacity 0.2s ease; |
158 | 189 | } |
159 | 190 |
|
160 | | -:where(.hamelp-ai-overview__button-icon) { |
161 | | - width: 20px; |
162 | | - height: 20px; |
163 | | -} |
164 | | - |
165 | 191 | :where(.hamelp-ai-overview__button:hover) { |
166 | 192 | opacity: 0.9; |
167 | 193 | } |
|
0 commit comments