/* Phone sizes (Mobile Phones thread, 16 October; review page "Mobile Phones Review").
   Only rules for screens up to 600 px wide, so desktop and tablet stay exactly as they are.
   Loaded last on the page, after atelier-header-nav.css, so these win on a phone. */
@media (max-width:600px){
  /* The shared header on ONE line (Nicolas, 16 October): 34 px icons 3 px apart; Timeline and A.I. are icon-sized too.
     Home, the chat page and Booking fit nine icons in one row. In the timeline the page icons sit centred on top and
     the timeline's own tools centred below (thirteen icons can't share one row). */
  header.atelier-brand-header{padding:8px 10px!important;column-gap:3px!important;row-gap:6px!important;min-height:0!important;flex-wrap:wrap!important}
  header.atelier-brand-header .header-identity{gap:3px!important;margin-left:0!important}
  header.atelier-brand-header .atelier-nav-icon,header.atelier-brand-header #atelier-account,header.atelier-brand-header .atelier-tl-icon,header.atelier-brand-header #trash{flex-basis:34px!important;width:34px!important;height:34px!important;min-width:34px!important;padding:0!important}
  header.atelier-brand-header .atelier-nav-icon svg,header.atelier-brand-header .atelier-tl-icon svg,header.atelier-brand-header #trash svg{width:21px!important;height:21px!important}
  html body header.atelier-brand-header .header-actions :is(.atelier-tl-icon,#trash,#timeline-settings){flex:0 0 34px!important;width:34px!important;min-width:34px!important;height:34px!important}
  html body header.atelier-brand-header .header-actions :is(.atelier-tl-icon,#trash,#timeline-settings) svg{width:21px!important;height:21px!important}
  header.atelier-brand-header #atelier-account svg,header.atelier-brand-header #header-listen svg{width:19px!important;height:19px!important}
  header.atelier-brand-header .header-actions{gap:3px!important;margin-left:auto!important;width:auto!important;flex:0 1 auto!important;max-width:100%!important}
  header.atelier-brand-header .header-actions>button{height:34px!important;min-width:34px}
  header.atelier-brand-header .header-actions #ai-events{width:34px;padding:0!important;font-size:13px!important}
  html body header.atelier-brand-header .header-actions :is(#book-session,#open-therapist-app){height:34px!important;padding:0!important;width:34px;min-width:34px}
  header.atelier-brand-header .header-actions #chat-to-timeline{width:34px;padding:0!important;font-size:0!important;display:inline-grid;place-items:center}
  header.atelier-brand-header .header-actions #chat-to-timeline.hidden{display:none!important}
  header.atelier-brand-header .header-actions #chat-to-timeline::before{content:"";width:22px;height:22px;background:currentColor;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M2.5 12h3.5M10 12h4M18 12h3.5'/%3E%3Ccircle cx='8' cy='12' r='2'/%3E%3Ccircle cx='16' cy='12' r='2'/%3E%3Cpath d='M8 6.5v1.5M16 16v1.5'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M2.5 12h3.5M10 12h4M18 12h3.5'/%3E%3Ccircle cx='8' cy='12' r='2'/%3E%3Ccircle cx='16' cy='12' r='2'/%3E%3Cpath d='M8 6.5v1.5M16 16v1.5'/%3E%3C/svg%3E") center/contain no-repeat}
  body:not(.atelier-dashboard-open) header.atelier-brand-header{justify-content:center!important}
  body:not(.atelier-dashboard-open) header.atelier-brand-header>.brand,body:not(.atelier-dashboard-open) header.atelier-brand-header>.header-actions{flex:1 1 100%!important;display:flex;justify-content:center!important;margin-left:0!important}
  body:not(.atelier-dashboard-open) header.atelier-brand-header .brand-title-row{justify-content:center}

  /* Report A Bug Or Idea: a round icon at the bottom left, so it no longer sits on top of the page. */
  .atelier-feedback-trigger.afb-float,body.atelier-dashboard-open.atelier-chat-open .atelier-feedback-trigger.afb-float{left:max(12px,env(safe-area-inset-left,0px))!important;right:auto!important;bottom:calc(12px + env(safe-area-inset-bottom,0px))!important;transform:none!important;width:40px;height:40px!important;padding:0!important;justify-content:center;border-radius:50%!important}
  .atelier-feedback-trigger.afb-float .afb-label{display:none}
  .atelier-feedback-trigger.afb-float svg{width:22px;height:22px}

  /* Text fields at 16 px: below that, iPhone zooms the whole page when one is tapped. */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]),textarea,select{font-size:16px!important}

  /* Home: less empty space above the Story Of Your Life card. */
  body.atelier-dashboard-open:not(.atelier-chat-open) #atelier-home{padding-top:14px!important}
  #atelier-dashboard-view #atelier-title{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);margin:0}
  #atelier-dashboard-view .atelier-stage{margin-top:8px}
  /* Cut empty space (Nicolas, 16 October): the Story card and the Past, Present and Future cards are as tall as their words. */
  #atelier-dashboard-view .atelier-stage,#atelier-dashboard-view .atelier-story-hero{height:auto!important;min-height:0!important}
  #atelier-dashboard-view .atelier-story-hero{padding:24px 26px!important;grid-template-columns:1fr!important}
  /* Its painting sat mostly off the card's right edge and kept the card 290 px tall. */
  #atelier-dashboard-view .atelier-story-hero .atelier-hero-art{display:none!important}
  #atelier-dashboard-view .atelier-tools{height:auto!important}
  #atelier-dashboard-view .atelier-tool-card{height:auto!important;min-height:0!important;padding:16px 20px!important}
  /* The 1 App and Coming Soon chips were 8 px, too small to read. */
  #atelier-dashboard-view .atelier-tool-status{font-size:11px!important}
  #atelier-dashboard-view .atelier-eyebrow{font-size:11px!important}
  /* A simpler background on phones: no paper plane, house, girl or sun (the sun now sat on the Past, Present And Future label). */
  #atelier-dashboard-view .atmosphere-girl{display:none!important}

  /* Account Settings: the page scrolls under the header, whatever the header's height (it was fixed at 130 px from the top). */
  #atelier-account-panel:has(> .mus-grid){position:relative!important;top:auto!important;bottom:auto!important;overflow:visible!important;padding:4px 0 72px!important}
  #atelier-account-panel .mus-beta .mus-btn{flex:none;height:36px}
  /* Notifications: the toggles stack in one column, so wrapping put the message in a second column off the screen. */
  #atelier-account-panel #settings-notifications .mus-togs{flex-wrap:nowrap;min-width:0}
  #atelier-account-panel #settings-notifications .mus-togs .mus-msg{flex:none;align-self:stretch;text-align:left}

  /* Getting Started (Onboarding): each step's button under its words, the full-height cards become one scrolling page. */
  #gs-root{top:56px}
  #gs-root .gs-top{flex-wrap:wrap;row-gap:8px}
  #gs-root .gs-who{flex:1 1 170px}
  #gs-root .gs-step{display:grid;grid-template-columns:30px minmax(0,1fr);column-gap:14px;row-gap:10px;align-items:center}
  #gs-root .gs-step>.gs-btn{grid-column:2;justify-self:start}
  #gs-root .gs-foot{flex-wrap:wrap;row-gap:4px}
  #gs-root .gs-card.wide{height:auto;display:block}
  #gs-root .gs-card.wide .gs-main{display:block}
  #gs-root .gs-card.wide .gs-text,#gs-root .gs-card.wide .gs-q{overflow:visible}
  #gs-root .gs-sign .gs-f{flex:1 1 100%}

  /* Booking: a close cross big enough for a thumb. */
  #book-close{width:36px!important;height:36px!important}

  /* Report A Bug Or Idea: Red Pen stays on one line. */
  .afb-tools{flex-wrap:wrap;gap:6px!important;min-width:0}
  .afb-tools .afb-sp{flex:1 1 0;min-width:0}
  .afb-tools button{white-space:nowrap;padding-left:10px!important;padding-right:10px!important}
  /* Bug Chat: a report with no screenshot no longer opens a 540 px empty box. A report with a picture keeps its fixed box, so the pens never move (Nicolas, 16 October). */
  .atelier-chat-panel #atelier-bugs.bg-stage:not(:has(.bg-pic)){height:auto!important;min-height:0!important}
  .atelier-chat-panel #atelier-bugs.bg-stage:not(:has(.bg-pic)) .bg-mid{flex:none!important;min-height:120px}

  /* Chat page: the Sessions, Sharing and Transcripts card grows to fit its tiles, and the page scrolls (in one column it was cut at 360 px). */
  .atelier-chat-panel .chat-body>.atelier-sharing-side{flex:none!important;height:auto!important;max-height:none!important;overflow:visible!important}
  .atelier-chat-panel .atelier-sessions-side .ss-hist{flex:none;overflow:visible}
  /* Close Payment History ran past the card's edge: on a phone it is the cross alone, the size of the tabs beside it. */
  .atelier-sessions-side .ss-btn[data-ss-close]{width:34px;padding:0;justify-content:center;font-size:0;gap:0}
  /* Phones have no Shift key: Send is the button and Enter makes a new line. The box already says how many words are left. */
  .chat-compose .chat-enter,.chat-compose .chat-tools .chat-intro{display:none!important}
}
/* Smaller phones (360 px Android): 31 px icons, so ten still fit in a row. */
@media (max-width:389px){
  header.atelier-brand-header .atelier-nav-icon,header.atelier-brand-header #atelier-account,header.atelier-brand-header .atelier-tl-icon,header.atelier-brand-header #trash,header.atelier-brand-header .header-actions #ai-events,header.atelier-brand-header .header-actions #chat-to-timeline,html body header.atelier-brand-header .header-actions :is(#book-session,#open-therapist-app),html body header.atelier-brand-header .header-actions :is(.atelier-tl-icon,#trash,#timeline-settings){flex:0 0 31px!important;width:31px!important;min-width:31px!important;height:31px!important}
  header.atelier-brand-header,header.atelier-brand-header .header-identity,header.atelier-brand-header .header-actions{column-gap:2px!important;gap:2px!important}
}
/* Timeline on phones: the side panel waits until it is tapped open (see the script at the end of /studio). */
@media (max-width:620px){body.tl-panel-closed #panel.sidebar{display:none!important}body.tl-panel-closed .timeline-wrap{height:max(420px,calc(100dvh - 200px))!important}}
/* Chat on phones (Nicolas, 16 October): the side panel moves above the chat, folded to its icons until one is tapped (script at the end of /studio). */
@media (max-width:600px){
  .atelier-chat-panel .chat-body>.atelier-sharing-side{order:-1!important}
  /* No ? beside the ear on phones (Nicolas, 16 October). */
  .atelier-chat-panel .chat-body:not(.ph-open)>.atelier-sharing-side>:not(.ss-head){display:none!important}
  .atelier-chat-panel .chat-body:not(.ph-open)>.atelier-sharing-side{padding-top:10px!important;padding-bottom:10px!important}
  .atelier-chat-panel .chat-body:not(.ph-open)>.atelier-sharing-side .ss-head{margin:0!important}
  /* Folded, the chat fills the rest of the screen. */
  .atelier-chat-panel .chat-body:not(.ph-open)>.chat-box{height:max(360px,calc(100dvh - 170px))!important}
  .atelier-chat-panel .chat-body:not(.ph-open)>.atelier-sharing-side .ss-ic.on:not(.ss-ear){background:#fff;border-color:#dfd3c6;color:#6b655e}
  html[data-theme="dark"] .atelier-chat-panel .chat-body:not(.ph-open)>.atelier-sharing-side .ss-ic.on:not(.ss-ear){background:#252c2e;border-color:var(--line);color:#efe9e2}
  /* Phones keep :hover on the button just tapped; in dark mode that greyed the selected icon. Open, it stays light. */
  html[data-theme="dark"] .atelier-chat-panel .chat-body.ph-open>.atelier-sharing-side .ss-ic.on:not(.ss-ear):hover{background:#efe9e2!important;color:#1d2224}
}
/* A taller header on phones (Nicolas, 22 October): the header and its icons half as tall again (51 px buttons, 30 px
   icons, 12 px above and below), the icons spread evenly across the whole width in one row. A session button with
   no room left in the row takes its own row under the header (Shared/atelier-header-call.js). */
@media (max-width:600px){
  html body header.atelier-brand-header.atelier-brand-header{height:auto!important;min-height:0!important;padding:12px 10px!important;flex-wrap:nowrap!important;justify-content:stretch!important;gap:4px!important;column-gap:4px!important}
  html body header.atelier-brand-header.atelier-brand-header :is(.brand,.brand-title-row,.header-identity,.header-actions){display:contents!important}
  html body header.atelier-brand-header.atelier-brand-header :is(.header-identity,.header-actions)>:is(button,a):not(#header-call){flex:1 1 0!important;width:auto!important;min-width:0!important;max-width:none!important;height:51px!important;padding:0!important;margin:0!important}
  html body header.atelier-brand-header.atelier-brand-header :is(.header-identity,.header-actions)>:is(button,a):not(#header-call) svg{width:min(30px,100%)!important;height:auto!important;max-height:30px}
  html body header.atelier-brand-header.atelier-brand-header #atelier-account svg{width:min(28px,100%)!important;max-height:28px}
  html body header.atelier-brand-header.atelier-brand-header #header-listen svg{width:auto!important;height:26px!important;max-width:90%}
  html body header.atelier-brand-header.atelier-brand-header .header-actions>#ai-events{font-size:18px!important;letter-spacing:0}
  /* The timeline's twelve icons are narrower, so A.I. gets smaller letters there. */
  html body:not(.atelier-dashboard-open) header.atelier-brand-header.atelier-brand-header .header-actions>#ai-events{font-size:13px!important}
  /* One row now, so the right-hand icons keep their order after the page icons. */
  html body header.atelier-brand-header.atelier-brand-header .header-actions>*{order:20!important}
  html body header.atelier-brand-header.atelier-brand-header .header-actions>#ai-events{order:19!important}
  html body header.atelier-brand-header.atelier-brand-header .header-actions>#trash{order:22!important}
  html body header.atelier-brand-header.atelier-brand-header .header-actions>#manage-timelines{order:23!important}
  html body header.atelier-brand-header.atelier-brand-header .header-actions>#guide{order:24!important}
  html body header.atelier-brand-header.atelier-brand-header .header-actions>#search-events{order:25!important}
  html body header.atelier-brand-header.atelier-brand-header .header-actions>#timeline-settings{order:26!important}
  html body header.atelier-brand-header.atelier-brand-header .header-actions>#chat-to-timeline{order:27!important}
  html body header.atelier-brand-header.atelier-brand-header .header-actions>:is(#book-session,#open-therapist-app){order:28!important}
  html body header.atelier-brand-header.atelier-brand-header .header-actions>#chat-to-timeline::before{width:min(33px,100%);height:33px}
}

/* Home's Story card on phones (Nicolas, 31 October): Genogram and Timeline Party sit inside the card, at its bottom,
   the card reaches down to New In Life Atelier, and it shows the painting it has on desktop. */
@media (max-width:600px){
  #atelier-dashboard-view .atelier-story-hero{padding:24px 22px 78px!important}
  #atelier-dashboard-view .atelier-story-hero .atelier-hero-art{display:block!important;width:86%!important;max-width:320px!important;margin:4px auto 0!important;justify-self:center}
  #atelier-dashboard-view .atelier-stage>.atelier-genogram-link{position:absolute!important;top:auto!important;bottom:18px;margin:0!important;z-index:2;padding:9px 14px;font-size:14px;gap:7px}
  #atelier-dashboard-view .atelier-stage>.atelier-genogram-link svg{width:19px;height:19px}
  #atelier-dashboard-view .atelier-stage>#open-genogram{left:18px;right:auto}
  #atelier-dashboard-view .atelier-stage>#open-party{right:18px;left:auto}
}
/* With the level panel under the Story card (phones), Genogram and Timeline Party stay at the bottom of the card,
   not of the whole stage, where they covered the panel (Design Review, 3 November). */
@media (max-width:600px){
  #atelier-dashboard-view .atelier-stage.lv-steps-on{display:grid!important;grid-template-columns:minmax(0,1fr)!important}
  #atelier-dashboard-view .atelier-stage.lv-steps-on>#open-story{grid-area:1/1}
  #atelier-dashboard-view .atelier-stage.lv-steps-on>.atelier-genogram-link{position:relative!important;inset:auto!important;grid-area:1/1;align-self:end;margin:0 18px 18px!important}
  #atelier-dashboard-view .atelier-stage.lv-steps-on>#open-genogram{justify-self:start}
  #atelier-dashboard-view .atelier-stage.lv-steps-on>#open-party{justify-self:end}
  #atelier-dashboard-view .atelier-stage.lv-steps-on>#lv-steps{grid-area:2/1}
}
