/* Phone and tablet layouts; keep the desktop editorial design. */
.fields > *, .two > *, .grid > *, .location-grid > *, .chat-heading > div,
.chat-composer > *, .profile-hero > div { min-width: 0; }
main p, main li, main dd, main h2, main h3, .portal-project, .agenda-event {
  overflow-wrap: anywhere;
}
main dd { margin-left: 0; margin-bottom: 1rem; }
main dt { font-weight: 600; }
input[type=radio] { width: 20px; height: 20px; flex: none; accent-color: var(--accent); margin-top: 3px; }
.button { max-width: 100%; white-space: normal; }
.pwa-dialog { width: min(440px, calc(100% - 32px)); max-height: 85svh; overflow-y: auto; padding: 28px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.pwa-dialog::backdrop { background: #39291f99; }
.pwa-dialog [hidden] { display: none !important; }
.pwa-dialog h2 { font-size: 32px; }
.pwa-dialog .actions { margin-bottom: 0; }
.pwa-dialog ol { padding-left: 22px; }
.pwa-dialog li + li { margin-top: 12px; }
.pwa-footer-button { font: inherit; color: inherit; background: transparent; border: 1px solid currentColor; padding: 12px 16px; cursor: pointer; min-height: 44px; }
.account-signup { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; min-height: 64px; padding: 16px 20px; background: var(--rose); color: var(--ink); border: 1px solid var(--line); font-size: 16px; text-align: left; }
.account-signup strong { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.account-signup:hover { border-color: var(--accent); }
html[data-pwa-installed=true] [data-pwa-open] { display: none; }
.site-menu-panel { position: absolute; z-index: 30; right: 6%; top: 100%; width: min(650px, 88vw); }
.site-menu:not([open]) .site-menu-panel { display: none; }
.site-menu .site-menu-panel #nav { position: relative; top: auto; right: auto; width: 100%; }
.menu-scroll-hint { position: absolute; z-index: 31; bottom: 1px; left: 1px; right: 1px; height: 52px; display: flex; justify-content: center; align-items: flex-end; background: linear-gradient(transparent, var(--paper) 45%); border-radius: 0 0 20px 20px; pointer-events: none; }
.menu-scroll-hint[hidden] { display: none; }
.menu-scroll-hint button { width: 44px; height: 44px; padding: 10px; border: 0; background: var(--accent); color: var(--paper); border-radius: 50%; margin-bottom: 4px; cursor: pointer; pointer-events: auto; }
.menu-scroll-hint button:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.menu-scroll-hint svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.menu-scroll-hint button[data-direction=up] svg { transform: rotate(180deg); }
.home-scroll-hint { position: fixed; z-index: 20; bottom: max(18px, env(safe-area-inset-bottom)); left: calc(50% - 22px); width: 44px; height: 44px; display: grid; place-items: center; padding: 10px; border: 1px solid var(--paper); border-radius: 50%; background: var(--accent); color: var(--paper); box-shadow: 0 3px 12px #39291f33; cursor: pointer; }
.home-scroll-hint[hidden] { display: none; }
.home-scroll-hint svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.home-scroll-hint:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

@media (max-width: 800px) {
  .fields { gap: 18px; }
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px; min-width: 0; max-width: 100%; }
  input:not([type=checkbox]):not([type=radio]), select { min-height: 48px; }
  input[type=file] { padding: 10px 8px; }
  input[type=file]::file-selector-button { padding: 8px; margin-right: 8px; }
  .check { min-height: 44px; align-items: flex-start; padding: 8px 0; margin: 8px 0; }
  input[type=checkbox] { width: 22px; height: 22px; }
  .wizard-previews button, .chat-previews button, .chat-photo-button,
  .chat-message-actions button, .chat-new, .subnav a { min-height: 44px; }
  .chat-message-actions { flex-wrap: wrap; }
  .site-menu #nav { max-height: min(70svh, var(--menu-room, 70svh)); overflow-y: auto; overscroll-behavior: contain; padding-bottom: 52px; }
  .account-options { max-height: 70svh; overflow-y: auto; overscroll-behavior: contain; }
  .draft-tools .button { margin-top: 8px; }
}

@media (max-width: 700px) {
  header { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 16px 5% 8px; gap: 6px 12px; }
  .brand { font-size: 20px; }
  .brand span { font-size: 8px; }
  .header-tools { margin-left: 0; gap: 10px; }
  .site-menu > summary, .account-icon { width: 44px; height: 44px; padding: 10px; display: grid; place-items: center; }
  .languages { grid-column: 1 / -1; justify-content: flex-end; gap: 4px; }
  .languages button { min-width: 44px; min-height: 44px; font-size: 12px; padding: 10px; }
  .site-menu #nav { right: 5%; width: 90%; }
  .site-menu-panel { right: 5%; width: 90%; }
  .account-menu { position: static; }
  .account-options { right: 5%; top: 100%; width: min(300px, 90%); }
  .page { padding: 28px 5% 48px; }
  .page > h1 { font-size: clamp(34px, 9vw, 46px); margin-top: 18px; }
  .page h2 { font-size: clamp(28px, 7vw, 36px); }
  .page h3, legend { font-size: 26px; }
  .page .upcoming-project h2 { font-size: 24px; }
  fieldset { min-width: 0; margin: 28px 0; }
  legend { max-width: 100%; }
  .calendar, .empty, .success, .care-card, .first-story, .dossier-banner { padding: 20px; }
  .callout { padding: 16px; }
  .profile-hero > div:nth-child(2) { min-width: 0; }
  .profile-details { grid-template-columns: 1fr; gap: 4px; }
  .profile-details dd { margin-bottom: 12px; }
  .actions { gap: 12px; margin: 24px 0; }
  .page .actions > .button, .wizard-controls > .button { flex: 1 1 180px; }
  .wizard-controls { flex-wrap: wrap; gap: 10px; }
  .portal-photos { gap: 10px; }
  .portal-photos a { width: calc(50% - 5px); min-width: 0; }
  .portal-photos img { display: block; width: 100%; height: 160px; }
  .upcoming-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editorial-hero { min-height: 580px; height: auto; max-height: none; }
  .editorial-hero h1 { font-size: clamp(48px, 12vw, 80px); }
  .editorial-hero .actions > .button { flex: 1 1 150px; font-size: 12px; }
  .editorial-hero .actions { align-items: stretch; }
  .hero-bottom { flex-wrap: wrap; }
  footer { padding-bottom: max(28px, env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
  .site-menu #nav { grid-template-columns: 1fr; }
  .site-menu #nav a { min-height: 44px; font-size: 14px; }
  .wizard-progress { gap: 8px; }
  .wizard-progress button { min-height: 48px; padding: 10px; }
  .chat-composer { grid-template-columns: minmax(0, 1fr); }
  .chat-composer > .button { width: 100%; }
  .chat-bubble { max-width: 95%; }
  .chat-heading h2 { font-size: 24px; }
  .agenda-month-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agenda-month-controls .field { grid-column: 1 / -1; grid-row: 1; }
  .agenda-month-controls .button { width: 100%; }
  .agenda-day { min-height: 68px; min-width: 0; padding: 5px 1px; font-size: 14px; }
  .agenda-day small { font-size: 10px; line-height: 1.3; }
  .agenda-weekday { font-size: 11px; }
  .date { flex-wrap: wrap; gap: 8px; }
  .page form > .button, .artist-calendar form > .button { display: block; width: 100%; margin-top: 12px; }
  .hero-bottom { font-size: 8px; gap: 8px; }
  .hero-bottom a { max-width: 155px; padding: 9px; }
  .editorial-hero .actions { flex-direction: row; }
  .editorial-hero .actions > .button { flex-basis: 100%; }
  .editorial-hero-content > p { line-height: 1.5; }
  .intro-copy { margin: 44px auto; }
  .intro-copy h2 { font-size: 34px; }
  .pwa-dialog { padding: 20px; }
}

.tattoo-gallery img.tattoo-full { aspect-ratio: auto; height: auto; }

.portfolio-photo-dialog {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}
.portfolio-photo-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
.portfolio-photo-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--paper);
}
.portfolio-photo-back svg { width: 24px; height: 24px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; }
.portfolio-photo-dialog > img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
