@layer app {
/* isk-website's layout: the centred card frame of bee-ident's signed-out
   pages (a header with the brand, the display settings and the theme
   buttons, the card, a footer with the language form and the site's
   links), the display settings dialog, and the dictionary entry.
   Every colour is a token of the shared kit (tokens.css); this file has no
   raw colour values. */

:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, ui-serif, serif;
}

body { line-height: 1.5; }
.ui-icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-sprite { display: none; }
#main:focus { outline: none; }
#main:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Targets: 24 px, and 44 px on coarse pointers (WCAG 2.2, 2.5.8). */
a { min-block-size: 24px; }
@media (pointer: coarse) {
  /* Wins over the sizes of components such as the 34 px theme buttons. */
  a, button, input:not([type=hidden], [type=checkbox], [type=radio]), select { min-inline-size: 44px !important; min-block-size: 44px !important; }
  label.check, .choice { min-block-size: 44px; align-items: center; }
}

/* The frame */
.site-shell { display: flex; flex-direction: column; align-items: center; min-height: 100dvh; padding: 20px 16px 24px; }
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; width: 100%; max-width: 980px; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--text); font-size: 19px; font-weight: 700; letter-spacing: -.4px; line-height: 1.15; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px; background: var(--button); color: var(--on-button); }
.brand-mark .ui-icon { width: 20px; height: 20px; }
.theme-switcher { display: inline-flex; gap: 2px; margin: 0; padding: 2px; border: 1px solid var(--strong); border-radius: 9px; background: var(--bg); }
.theme-switcher .ui-btn { width: 34px; height: 34px; min-height: 34px; padding: 0; border-color: transparent; border-radius: 6px; background: transparent; color: var(--muted); }
.theme-switcher .ui-btn:hover { background: var(--hover); color: var(--text); }
.theme-switcher .ui-btn[aria-pressed=true] { color: var(--accent); background: var(--accent-bg); box-shadow: inset 0 -2px 0 var(--accent); }
/* The display settings sit left of the theme buttons. */
/* On the narrowest screens they wrap below the brand, at the end. */
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-inline-start: auto; }
.settings-button { width: 36px; height: 36px; min-height: 36px; padding: 0; border-color: transparent; background: transparent; color: var(--muted); }
.settings-button:hover { background: var(--hover); color: var(--text); }

/* The display settings dialog (app.js): the settings page's form. */
html:has(#settings-dialog[open]) { overflow: hidden; }
.settings-dialog { width: min(560px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain; padding: 20px 22px 22px; border: 1px solid var(--strong); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.settings-dialog::backdrop { background: var(--overlay); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.icon-button { width: 44px; height: 44px; min-height: 44px; padding: 0; flex-shrink: 0; }

.site-main { position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; flex: 1 0 auto; padding-block: clamp(20px, 7vh, 72px); }
/* A glow behind the card only: no text is drawn on the tint. */
.site-main::before { content: ""; position: absolute; z-index: -1; inset: 0; background: radial-gradient(closest-side, var(--accent-bg), transparent); pointer-events: none; }
.site-feedback { width: 100%; max-width: 640px; }
.site-feedback:empty { display: none; }
.site-feedback .ui-banner { margin: 0 0 16px; }
.site-feedback .ui-banner p:first-child { margin-top: 0; }
.ui-banner[data-tone=info] { color: var(--text); }

.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 22px; width: 100%; max-width: 640px; color: var(--muted); font-size: 12px; }
.site-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; }
.site-links a { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; color: var(--muted); }
.site-links a:hover { color: var(--text); }
.site-links a[aria-current=page] { color: var(--text); font-weight: 600; }
.site-footer .ui-icon { width: 15px; height: 15px; }
.language-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; }
.language-form label { display: inline-flex; align-items: center; gap: 6px; }
.language-form select { width: auto; min-height: 32px; padding: 4px 8px; border-radius: 8px; font-size: 13px; }
.language-form .ui-btn { min-height: 32px; padding: 4px 10px; font-size: 12px; }
/* app.js marks the page; a control for pages without script then goes. */
:root[data-script] [data-without-script] { display: none; }

/* The dictionary entry */
.entry { width: 100%; max-width: 640px; padding: clamp(28px, 6vw, 48px) clamp(22px, 6vw, 52px); box-shadow: 0 18px 44px -24px var(--overlay); }
.entry .ui-eyebrow { margin-bottom: 14px; text-transform: uppercase; }
.entry-word { font-family: var(--serif); font-size: clamp(38px, 9vw, 58px); font-weight: 700; letter-spacing: -.5px; line-height: 1.05; overflow-wrap: anywhere; }
.entry-word dfn { font-style: normal; }
.entry-forms { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-top: 12px; color: var(--muted); font-size: 17px; }
.entry-pronunciation { color: var(--text); letter-spacing: .02em; }
.entry-short { font-family: var(--serif); font-style: italic; }
.entry-short b { color: var(--text); font-style: normal; font-weight: 700; }
.entry-sense { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--border); font-family: var(--serif); font-size: clamp(19px, 3.4vw, 23px); line-height: 1.55; }

/* The settings and error cards */
.site-card { width: 100%; max-width: 560px; padding: 28px; box-shadow: 0 18px 44px -24px var(--overlay); }
.site-card h1 { font-size: 26px; letter-spacing: -.5px; overflow-wrap: anywhere; }
.site-card .ui-eyebrow { text-transform: uppercase; }
.page-description { margin-top: 6px; color: var(--muted); }
.settings-form { margin-top: 22px; }
.ui-field { gap: 6px; margin-bottom: 16px; }
.ui-label, label.ui-label { color: var(--text); font-size: 13px; font-weight: 600; }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; min-height: 40px; padding: 8px 11px; border-radius: 8px; font-size: 14px; }
:is(input, select, textarea):focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; flex: none; margin: 2px 0 0; }
.choices { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.choices legend { margin-bottom: 8px; padding: 0; font-size: 13px; font-weight: 600; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 24px; font-weight: 400; cursor: pointer; }
.choice { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .12s, background .12s; }
.choice:hover { border-color: var(--strong); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.choice:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.choice > span { display: flex; flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
.settings-form .ui-form-actions { padding-bottom: 0; }
.settings-form .ui-banner { margin-top: 0; }
.error-message { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; font-size: 15px; }
.error-message .ui-icon { margin-top: 2px; color: var(--danger); }
.error-card .ui-help { margin-top: 10px; overflow-wrap: anywhere; }
.error-actions { margin-top: 22px; }

.htmx-request button[type=submit], .htmx-request .ui-btn[type=submit] { opacity: .6; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media (max-width: 680px) {
  .site-shell { padding: 14px 12px 20px; }
  .brand { font-size: 17px; }
  .site-card { padding: 22px 18px; }
  .settings-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); padding: 16px; }
  .entry-forms { font-size: 16px; }
  input:not([type=checkbox]):not([type=radio]), select, textarea, .language-form select { font-size: 16px; }
}
@media (forced-colors: active) {
  .theme-switcher .ui-btn[aria-pressed=true], .site-links a[aria-current=page] { outline: 2px solid CanvasText; }
  .brand-mark { border: 1px solid CanvasText; }
}
}
