/* Promark · shared controls for the public site and the admin.
   Rules: 16px text in every control (iOS never zooms), 40px tall for inputs and chips, 46px for the
   main action; nothing smaller than 34px, visible focus, nothing depends on JavaScript to be usable. */
:root {
  --ctl-h: 40px; --ctl-h-sm: 34px; --ctl-h-lg: 46px; --ctl-r: 8px;
  --ctl-border: #d2dae1; --ctl-border-strong: #b9c4cd; --ctl-bg: #fff;
  --ctl-text: #223039; --ctl-placeholder: #9aa6ae; --ctl-label: #6a7781;
  --ctl-focus: #3d74aa; --ctl-focus-ring: rgba(61,116,170,.2); --ctl-selected: #3d74aa; --ctl-selected-text: #fff;
  --ctl-error: #d7542c; --ctl-error-bg: #fff1ec; --ctl-ok: #8bb224;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* fields */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lbl { font-size: 14px; font-weight: 600; color: var(--ctl-text); }
.hint { font-size: 13px; color: var(--ctl-label); margin: 0; line-height: 1.4; }
.field.is-error .lbl { color: var(--ctl-error); }
.field.is-error .input { border-color: var(--ctl-error); background: var(--ctl-error-bg); }
.err { display: inline-block; background: var(--ctl-error); color: #fff; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 4px; align-self: flex-start; }
.input, .select, .textarea {
  font: inherit; font-size: 16px; line-height: 1.25; color: var(--ctl-text);
  min-height: var(--ctl-h); width: 100%; min-width: 0; padding: 8px 12px;
  border: 1px solid var(--ctl-border); border-radius: var(--ctl-r); background: var(--ctl-bg);
  -webkit-appearance: none; appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--ctl-placeholder); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ctl-focus); box-shadow: 0 0 0 3px var(--ctl-focus-ring); }
.textarea { min-height: 76px; resize: vertical; }
.select { padding-right: 34px; cursor: pointer; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 14 9'><path d='M1 1l6 6 6-6' fill='none' stroke='%236a7781' stroke-width='2' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; }
input[type=date].input, input[type=time].input, input[type=datetime-local].input, input[type=month].input { padding-right: 8px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 0 var(--ctl-r) var(--ctl-r) 0; }
.input-group .addon { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--ctl-border); border-right: 0; border-radius: var(--ctl-r) 0 0 var(--ctl-r); background: #f4f7f9; color: var(--ctl-label); font-size: 15px; font-weight: 700; white-space: nowrap; }

/* segmented choice: real inputs, visually hidden but focusable (keyboard + validation bubbles still anchor) */
.choice { display: flex; flex-wrap: wrap; gap: 6px; }
.choice label { position: relative; flex: 1 1 auto; min-width: 0; }
.choice input { position: absolute; left: 50%; top: 50%; width: 1px; height: 1px; opacity: 0; margin: 0; }
.choice span { display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; min-height: var(--ctl-h); padding: 6px 12px; font-size: 15px; font-weight: 600; line-height: 1.2; color: var(--ctl-text); border: 1px solid var(--ctl-border); border-radius: var(--ctl-r); background: var(--ctl-bg); cursor: pointer; user-select: none; transition: background .12s, border-color .12s, color .12s; }
.choice span small { display: block; font-weight: 500; font-size: 12px; color: var(--ctl-label); }
.choice input:checked + span { background: var(--ctl-selected); border-color: var(--ctl-selected); color: var(--ctl-selected-text); }
.choice input:checked + span small { color: rgba(255,255,255,.85); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px var(--ctl-focus-ring); }
.choice input:disabled + span { color: #b3bcc3; background: #f4f6f8; cursor: not-allowed; text-decoration: line-through; }
.choice input:disabled + span small { color: #b3bcc3; }
/* joined: one row of equal segments that never wraps */
.choice.joined { gap: 0; flex-wrap: nowrap; }
.choice.joined label { flex: 1 1 0; }
.choice.joined span { border-radius: 0; flex-direction: column; gap: 0; height: 100%; }
.choice.joined label:not(:first-child) span { margin-left: -1px; }
.choice.joined label:first-child span { border-radius: var(--ctl-r) 0 0 var(--ctl-r); } .choice.joined label:last-child span { border-radius: 0 var(--ctl-r) var(--ctl-r) 0; }
.choice.joined input:checked + span { position: relative; z-index: 1; }
.choice.stack { flex-direction: column; } .choice.stack span { justify-content: flex-start; text-align: left; flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 12px; }
.choice.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.choice.grid span { flex-direction: column; gap: 0; padding: 4px 6px; }
.choice.grid span small { font-size: 11px; }
.choice.grid span small:empty { display: none; }

/* month calendar: days are radios; one month visible at a time */
.cal { max-width: 336px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.cal-title { font-size: 16px; font-weight: 800; color: var(--ctl-text); }
.cal-nav { width: 40px; height: 40px; border: 1px solid var(--ctl-border); border-radius: 50%; background: #fff; color: var(--ctl-text); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.cal-nav:hover { background: #f4f7f9; } .cal-nav:disabled { opacity: .3; cursor: default; background: #fff; }
.cal-nav:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ctl-focus-ring); }
.cal-month[hidden] { display: none; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-dow { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ctl-label); padding: 4px 0; }
.cal-day { position: relative; }
.cal-day input { position: absolute; left: 50%; top: 50%; width: 1px; height: 1px; opacity: 0; margin: 0; }
.cal-day span { display: flex; align-items: center; justify-content: center; width: 100%; max-width: 40px; aspect-ratio: 1; margin: 0 auto; border-radius: 50%; font-size: 15px; font-weight: 600; color: var(--ctl-text); cursor: pointer; user-select: none; transition: background .12s, color .12s; }
.cal-day span:hover { background: #e9f1f8; }
.cal-day.today span { box-shadow: inset 0 0 0 1.5px var(--ctl-border-strong); }
.cal-day input:checked + span { background: var(--ctl-selected); color: var(--ctl-selected-text); font-weight: 800; box-shadow: none; }
.cal-day input:disabled + span { color: #c3cbd1; font-weight: 400; cursor: default; background: none; }
.cal-day input:focus-visible + span { box-shadow: 0 0 0 3px var(--ctl-focus-ring); }
.cal-picked { margin: 6px 0 0; font-size: 14px; font-weight: 700; color: var(--ctl-text); min-height: 1.4em; }

/* checkbox */
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; font-size: 15px; cursor: pointer; position: relative; }
.check input { position: absolute; left: 0; top: 50%; width: 1px; height: 1px; opacity: 0; margin: 0; }
.check .box { width: 22px; height: 22px; border: 1px solid var(--ctl-border-strong); border-radius: 5px; background: #fff; flex: none; display: grid; place-items: center; }
.check input:checked + .box { background: var(--ctl-selected); border-color: var(--ctl-selected); }
.check input:checked + .box::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.check input:focus-visible + .box { box-shadow: 0 0 0 3px var(--ctl-focus-ring); }

/* number stepper: intrinsic width, never stretched by a grid or flex parent */
.stepper { display: inline-flex; width: fit-content; max-width: 100%; align-items: stretch; border: 1px solid var(--ctl-border); border-radius: var(--ctl-r); background: #fff; overflow: hidden; justify-self: start; }
.stepper button { font: inherit; font-size: 20px; line-height: 1; width: 40px; flex: 0 1 40px; min-width: 34px; min-height: calc(var(--ctl-h) - 2px); border: 0; background: #f4f7f9; color: var(--ctl-focus); cursor: pointer; display: grid; place-items: center; }
.stepper button:hover { background: #e9eff4; } .stepper button:disabled { color: #b9c4cd; cursor: not-allowed; background: #f4f7f9; }
.stepper input { font: inherit; font-size: 17px; font-weight: 700; width: 48px; min-width: 0; flex: 1 1 40px; text-align: center; border: 0; border-left: 1px solid var(--ctl-border); border-right: 1px solid var(--ctl-border); color: var(--ctl-text); -moz-appearance: textfield; appearance: textfield; min-height: calc(var(--ctl-h) - 2px); }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; background: #eef4fa; }

/* file drop */
.filebox { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 76px; padding: 14px; border: 2px dashed var(--ctl-border-strong); border-radius: 10px; background: #fafcfd; text-align: center; color: var(--ctl-label); font-size: 14px; cursor: pointer; }
.filebox strong { color: var(--ctl-focus); font-size: 15px; }
.filebox input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 16px; width: 100%; }
.filebox:focus-within { border-color: var(--ctl-focus); box-shadow: 0 0 0 3px var(--ctl-focus-ring); }
.filebox.has-file { border-style: solid; border-color: var(--ctl-ok); background: #f6fbe9; }
.filebox.has-file strong::before { content: "✓ "; color: var(--ctl-ok); }

/* form rows: label above on phones, label column on wide screens */
.frow { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 12px 0; border-bottom: 1px solid #edf1f4; }
.frow:last-child { border-bottom: 0; }
.frow .ctl { display: flex; flex-direction: column; gap: 8px; min-width: 0; align-items: flex-start; }
.frow .ctl > * { align-self: stretch; } .frow .ctl > .stepper, .frow .ctl > .btn { align-self: flex-start; }
.ctl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ctl-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ctl-grid.steppers { grid-template-columns: repeat(auto-fit, minmax(128px, max-content)); gap: 10px 16px; }
@media (min-width: 720px) { .frow { grid-template-columns: 170px minmax(0, 1fr); gap: 20px; padding: 14px 0; } .frow > .lbl { padding-top: 9px; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--ctl-h); max-width: 100%; padding: 6px 16px; border-radius: var(--ctl-r); border: 1px solid var(--ctl-border); background: #fff; color: var(--ctl-text); font: inherit; font-size: 15px; font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: #f4f7f9; text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ctl-focus-ring); }
.btn.primary { background: #3d74aa; border-color: #3d74aa; color: #fff; } .btn.primary:hover { background: #336494; }
.btn.go { background: #7da11c; border-color: #7da11c; color: #fff; } .btn.go:hover { background: #6d8d18; }
.btn.danger { background: #fff; border-color: #f2bfae; color: #c9491f; } .btn.danger:hover { background: #fff1ec; }
.btn.danger.solid { background: #e85d31; border-color: #e85d31; color: #fff; } .btn.danger.solid:hover { background: #d04f26; }
.btn.quiet { border-color: transparent; background: transparent; color: #3d74aa; } .btn.quiet:hover { background: #eef3f8; }
.btn.sm { min-height: var(--ctl-h-sm); padding: 4px 12px; font-size: 14px; }
.btn.lg { min-height: var(--ctl-h-lg); padding: 8px 22px; font-size: 16px; }
.btn.wide { width: 100%; }
.btn:disabled, .btn[aria-disabled=true] { opacity: .55; cursor: not-allowed; }
button.btn { -webkit-appearance: none; appearance: none; }
form.button_to { display: inline; max-width: 100%; }

/* messages */
.msg { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; border-radius: var(--ctl-r); font-size: 15px; line-height: 1.45; border-left: 4px solid; }
.msg.ok { background: #f1f8dc; border-color: #8bb224; color: #3f5410; }
.msg.warn { background: #fff5e0; border-color: #f5a623; color: #6b4300; }
.msg.bad { background: #fff1ec; border-color: #e85d31; color: #8a2f12; }
.msg.info { background: #e9f1f9; border-color: #3d74aa; color: #1f3f5e; }
.msg .x { margin-left: auto; background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; min-width: 32px; min-height: 32px; margin: -6px -8px -6px auto; }

/* confirm dialog (used by the Turbo confirm hook) */
dialog.confirm { border: 0; border-radius: 12px; padding: 0; max-width: 440px; width: calc(100% - 32px); box-shadow: 0 24px 60px rgba(20,30,40,.3); color: var(--ctl-text); }
dialog.confirm::backdrop { background: rgba(20,30,40,.45); }
dialog.confirm .body { padding: 20px 20px 4px; font-size: 16px; line-height: 1.5; }
dialog.confirm h3 { margin: 0 0 8px; font-size: 19px; }
dialog.confirm .foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px 20px; flex-wrap: wrap; }
@media (max-width: 480px) { dialog.confirm .foot .btn { flex: 1 1 100%; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

/* photo viewer: tap a photo for a full-screen, swipeable view */
dialog.lightbox { border: 0; padding: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: #0b1216; color: #fff; }
dialog.lightbox::backdrop { background: #0b1216; }
.lightbox .lb-track { display: flex; width: 100%; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.lightbox .lb-track::-webkit-scrollbar { display: none; }
.lightbox .lb-track figure { flex: 0 0 100%; margin: 0; height: 100%; display: grid; place-items: center; scroll-snap-align: center; padding: 56px 0; }
.lightbox .lb-track img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.lightbox .lb-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: max(8px, env(safe-area-inset-top)) 8px 8px 16px; font-size: 15px; font-weight: 700; z-index: 1; }
.lightbox .lb-close, .lightbox .lb-nav { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font: inherit; font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; display: none; } .lightbox .lb-nav.prev { left: 12px; } .lightbox .lb-nav.next { right: 12px; }
@media (hover: hover) and (min-width: 720px) { .lightbox .lb-nav { display: grid; } }

/* language switcher: one language's fields at a time */
.langs .choice { margin-bottom: 10px; }
.lang-pane { display: flex; flex-direction: column; gap: 10px; }
turbo-frame[busy] { opacity: .5; transition: opacity .15s; }
.input-group.trailing .input { border-radius: var(--ctl-r) 0 0 var(--ctl-r); }
.input-group.trailing .addon { border-left: 0; border-right: 1px solid var(--ctl-border); border-radius: 0 var(--ctl-r) var(--ctl-r) 0; }
