/* Shared Lovable-inspired surface and interaction treatment across all pages. */
:root {
  --ui-action-glow: 0 10px 30px -10px oklch(0.7 0.18 27 / 55%);
  --ui-action-glow-hover: 0 14px 34px -10px oklch(0.7 0.18 27 / 65%);
  --ui-surface-shadow: 0 1px 2px oklch(0.33 0.032 257 / 6%), 0 8px 24px -12px oklch(0.33 0.032 257 / 18%);
}
body :is(button, .button, input[type="submit"]):not(:disabled),
body .page-sections > summary {
  box-shadow: var(--ui-button-shadow, none);
  transition: box-shadow 160ms ease, transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}
body :is(button, .button, input[type="submit"]):disabled,
body .button[aria-disabled="true"] {
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}
body :is(button, .button, input[type="submit"]):not(:disabled):active { transform: translateY(0); }
body .card { box-shadow: var(--ui-surface-shadow); transition: border-color 160ms ease, box-shadow 160ms ease; }
body button.card:not(:disabled) { box-shadow: var(--ui-surface-shadow); }
body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]), textarea, select) {
  box-shadow: 0 1px 2px oklch(0.33 0.032 257 / 5%);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
body :is(input, textarea)::placeholder { color: #718096; }
body input[type="file"]::file-selector-button {
  font: inherit;
  color: #334155;
  background: #fff3ef;
  border: 1px solid #e1ded8;
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  margin-right: 0.75rem;
  box-shadow: none;
  cursor: pointer;
}
@media (hover: hover) {
  body :is(button, .button, input[type="submit"]):not(:disabled):where(:not([aria-disabled="true"])):hover,
  body .page-sections > summary:hover {
    box-shadow: var(--ui-button-hover-shadow, none);
    background-color: var(--ui-button-hover-background, #fff0eb);
    color: #334155;
    transform: translateY(-1px);
  }
}
@media (prefers-reduced-motion: reduce) {
  body :is(button, .button, input, textarea, select, .card),
  body .page-sections > summary { transition: none; }
  body :is(button, .button, input[type="submit"]):not(:disabled):hover,
  body .page-sections > summary:hover { transform: none; }
}
@media (forced-colors: active) {
  body :is(button, .button, input[type="submit"]):not(:disabled),
  body .page-sections > summary { box-shadow: none; }
}

body :is(button, .button, input[type="submit"]):not(:disabled):hover:active { transform: translateY(0); }
body input[type="file"]:disabled::file-selector-button { box-shadow: none; cursor: not-allowed; }

/* Only controls already styled as primary colored actions receive coral glow. */
body .button-primary-glow,
body form > button:not(.button-secondary):not(#google-auth-button),
body .admin-shell .button:not(.button-secondary),
body .auth-panel .button:not(.button-secondary):not(#google-auth-button) {
  --ui-button-shadow: var(--ui-action-glow);
  --ui-button-hover-shadow: var(--ui-action-glow-hover);
  --ui-button-hover-background: oklch(0.7 0.18 27);
}
body #google-auth-button { --ui-button-hover-background: #f5f5f5; }

/* Large page surfaces use a local keyboard cue, not a rectangular focus frame. */
body :is(article, section, div).card:focus,
body button.card:focus { outline: none; }
body button.card:focus-visible h2 { text-decoration: underline; text-decoration-color: #b63830; text-underline-offset: 0.25rem; }
body :is(input, select, textarea) { --ui-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%2364758b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
body select { background-image: var(--ui-chevron); background-size: 18px 18px; }
@media (forced-colors: active) { body select { background-image: none; appearance: auto; } body button.card:focus-visible, .page-guide > summary:focus-visible { outline: 2px solid Highlight; } }
/* Disclosures share one chevron shape and rotate instead of swapping glyphs. */
:root { --ui-caret-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
body details:not(.page-guide):not(.admin-nav-tree) > summary { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; list-style: none; }
body details:not(.page-guide):not(.admin-nav-tree) > summary::-webkit-details-marker { display: none; }
body details:not(.page-guide):not(.admin-nav-tree) > summary::after,
body .admin-nav-chevron {
  content: ""; display: inline-block; width: 18px; height: 18px; flex: 0 0 18px;
  font-size: 0; background: currentColor;
  mask: var(--ui-caret-mask) center / contain no-repeat;
  -webkit-mask: var(--ui-caret-mask) center / contain no-repeat;
  transition: transform 180ms ease;
}
body details[open]:not(.page-guide):not(.admin-nav-tree) > summary::after,
body .admin-nav-tree[open] .admin-nav-chevron { transform: rotate(180deg); }
body .admin-nav-tree:not([open]) .admin-nav-chevron { transform: none; }
@media (prefers-reduced-motion: reduce) {
  body details:not(.page-guide):not(.admin-nav-tree) > summary::after,
  body .admin-nav-chevron { transition: none; }
}
/* Static page panels are surfaces, not interactive hover targets. */
body .card:not(button):not(a):hover {
  border-color: var(--border, var(--line, #e1ded8));
}
/* Text fields and selects use a compact neutral cue instead of a coral frame. */
body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]), select, textarea):focus {
  outline: none;
  border-color: #64748b;
  box-shadow: 0 0 0 1px #64748b;
}
@media (forced-colors: active) {
  body :is(input, select, textarea):focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
}
/* Use the browser's accessible, page-rendered picker instead of OS translucency. */
body select option { background-color: #fff; color: #334155; }
@supports (appearance: base-select) {
  body select:not([multiple]):not([size]),
  body select:not([multiple]):not([size])::picker(select) { appearance: base-select; }
  body select:not([multiple]):not([size]) { background-color: #fff; }
  body select:not([multiple]):not([size])::picker-icon { display: none; }
  body select:not([multiple]):not([size])::picker(select) {
    background: #fff;
    color: #334155;
    opacity: 1;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid #d5d1cb;
    border-radius: 10px;
    box-shadow: 0 8px 24px #26343e26;
    padding: 0.3rem;
    min-inline-size: anchor-size(width);
    max-inline-size: min(42rem, calc(100vw - 2rem));
    max-block-size: min(20rem, 60dvh);
    overflow: auto;
  }
  body select:not([multiple]):not([size]) option {
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body select:not([multiple]):not([size]) option:is(:hover, :focus, :checked) {
    background-color: #ffe8e2;
    color: #334155;
  }
}
@media (forced-colors: active) {
  body select option { background: Canvas; color: CanvasText; }
}
/* Consistent form scale; mobile controls retain readable text and touch targets. */
body form label { font-size: 0.875rem; line-height: 1.5; margin-block: 0.65rem; }
body form :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 0.55rem 0.7rem;
  min-height: 38px;
}
body form button { font-size: 0.875rem; line-height: 1.5; }
body form h2 { font-size: 1.125rem; line-height: 1.4; }
@media (max-width: 600px) {
  body form :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { font-size: 1rem; min-height: 44px; }
  body form button { min-height: 44px; }
}
/* Leave room for the shared select chevron after compacting control padding. */
body form select:not([multiple]):not([size]) { padding-inline-end: 2.75rem; }
/* Native summary elements otherwise keep their own browser-blue focus outline. */
body details:not(.page-guide) > summary:focus { outline: none; }
body details:not(.page-guide) > summary:focus-visible { text-decoration: underline; text-underline-offset: 0.25rem; }
