/* WORK 04. Screen writing is a view, never a print-size transformation. */
.editor-representation {
  display: none;
}
@media (max-width: 600px) {
  html {
    scroll-padding-bottom: 72px;
  }
  body {
    min-height: 100dvh;
  }
  .site-header {
    padding: 8px 14px;
  }
  .brand img {
    width: 48px;
    height: 38px;
  }
  .brand .restaurant-name {
    font-size: 19px;
    line-height: 1.1;
  }
  .brand small {
    margin-top: 3px;
    font-size: 11px;
  }
  .main-nav {
    margin-top: 5px;
    gap: 4px;
  }
  .main-nav button {
    flex-direction: row;
    gap: 6px;
    min-height: 42px;
    padding: 6px;
    font-size: 13px;
  }
  .main {
    padding: 16px 14px;
  }
  .section-head {
    gap: 8px;
    margin-bottom: 16px;
  }
  .section-head h1 {
    font-size: 23px;
  }
  .section-head p {
    font-size: 14px;
  }
  .section-head .actions {
    gap: 6px;
    flex-wrap: wrap;
  }
  .section-head .actions button {
    padding: 6px 10px;
    font-size: 13px;
  }
  .editor-mode .site-header {
    padding: 5px 12px;
  }
  .editor-mode .brand img {
    width: 34px;
    height: 28px;
  }
  .editor-mode .restaurant-name {
    font-size: 16px;
  }
  .editor-mode .brand {
    min-height: 32px;
  }
  .editor-main {
    padding: 0;
  }
  .editor-top {
    padding: 4px 10px;
    gap: 4px;
  }
  .editor-top .document-name {
    min-height: 40px;
    font-size: 16px;
  }
  .editor-top > .actions {
    width: 100%;
    justify-content: flex-end;
    gap: 6px;
  }
  .editor-top .actions button {
    min-height: 40px;
    padding: 6px 12px;
    font-size: 14px;
  }
  .editor-subbar {
    padding: 4px 10px;
  }
  .editor-subbar #zoom {
    display: none;
  }
  .editor-representation {
    display: flex;
    gap: 4px;
    margin: 6px 14px 10px;
    padding: 3px;
    background: var(--canvas);
    border-radius: var(--radius-control);
  }
  .editor-representation button {
    flex: 1;
    border: 0;
    min-height: 40px;
    background: transparent;
    font-size: 14px;
  }
  .editor-representation [aria-pressed="true"] {
    background: var(--paper);
    color: var(--accent-strong);
  }
  .page-strip {
    padding: 4px 12px;
  }
  .writing-mode .workspace,
  .writing-mode .canvas-area,
  .writing-mode .sheet-outer {
    display: block;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    background: transparent;
    padding: 0;
  }
  .writing-mode .canvas-area {
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
  }
  .writing-mode #sheet {
    position: static;
    width: auto;
    height: auto;
    min-height: 55dvh;
    margin: 0;
    padding: 6px 14px 24px;
    border: 0;
    box-shadow: none;
    background: var(--paper);
    transform: none;
  }
  .writing-hint {
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
    margin: 8px 0 16px;
  }
  .writing-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .writing-field {
    display: block;
    width: 100%;
    min-height: 44px;
    height: auto;
    max-height: none;
    margin: 0;
    padding: 9px 4px;
    border: 0;
    border-radius: 0;
    outline: none;
    resize: none;
    overflow: hidden;
    background: transparent;
    font-family: var(--font-editorial);
    font-size: 19px;
    line-height: 1.5;
    box-sizing: border-box;
    touch-action: auto;
    user-select: text;
    -webkit-user-select: text;
    -webkit-touch-callout: default;
    scroll-margin-block: 72px;
  }
  .writing-field.writing-heading {
    margin-top: 14px;
    font-size: 22px;
  }
  .writing-field:focus {
    outline: none;
    box-shadow: none;
    background: #68423707;
  }
  .writing-mode .sheet-caption {
    display: none;
  }
  .writing-mode .preflight {
    padding: 0 14px;
  }
  .writing-mode .block-handle,
  .phone-preview .block-handle {
    display: none;
  }
  .phone-preview .editable-block {
    outline: none;
    box-shadow: none;
    background: transparent;
    touch-action: pan-x pan-y pinch-zoom;
  }
  .phone-preview .editable-block:focus {
    outline: 1px solid var(--accent-soft);
    transform: none;
    font-size: var(--text-size);
  }
  .context-toolbar {
    position: fixed;
    z-index: 60;
    left: 0;
    right: 0;
    bottom: var(--keyboard);
    transform: none;
    width: 100%;
    min-height: 0;
    min-width: 0;
    padding: 0 4px env(safe-area-inset-bottom);
    border-radius: 0;
    background: var(--paper);
    box-shadow: 0 -2px 12px #30282110;
  }
  .context-toolbar[hidden] {
    display: none;
  }
  .mobile-typebar {
    display: flex;
    height: 48px;
    align-items: center;
    justify-content: space-around;
    gap: 0;
  }
  .mobile-typebar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    height: 44px;
    border: 0;
    padding: 4px;
    background: transparent;
    color: var(--ink);
    font-size: 16px;
  }
  .mobile-typebar button[aria-pressed="true"],
  .mobile-typebar button[aria-expanded="true"] {
    background: var(--accent-soft);
    color: var(--accent-strong);
  }
  .mobile-typebar small {
    font-size: 10px;
    margin-left: 1px;
  }
  .mobile-typebar .icon {
    width: 19px;
    height: 19px;
  }
  .mobile-type-panel {
    position: absolute;
    bottom: 100%;
    left: 8px;
    right: 8px;
    padding: 12px;
    max-height: min(240px, 35dvh);
    overflow-y: auto;
    background: var(--paper);
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -3px 14px #30282114;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
  }
  .mobile-type-panel[hidden] {
    display: none;
  }
  .mobile-type-panel label {
    font-size: 13px;
    margin: 0;
  }
  .mobile-type-panel input,
  .mobile-type-panel select {
    font-size: 16px;
    min-height: 44px;
    max-width: 180px;
  }
  .mobile-type-panel .alignment-buttons {
    width: 100%;
  }
  .mobile-type-panel .alignment-buttons button {
    width: 44px;
    height: 44px;
    padding: 8px;
  }
  .mobile-type-panel small {
    display: block;
    font-size: 12px;
    width: 100%;
    text-align: center;
  }
  .keyboard-open .site-header,
  .keyboard-open .editor-top,
  .keyboard-open .editor-subbar,
  .keyboard-open .editor-representation,
  .keyboard-open .page-strip {
    position: static;
  }
  .keyboard-open .context-toolbar {
    padding-bottom: 0;
  }
  .writing-mode {
    overflow-x: clip;
    overflow-y: auto;
  }
  .writing-mode .inspector {
    max-height: min(42dvh, 350px);
  }
  .editor-mode .site-footer {
    display: none;
  }
}
@media (max-width: 600px) {
  .editor-top #save-new {
    display: none;
  }
  .editor-top > .actions {
    width: auto;
    flex-wrap: nowrap;
  }
  .editor-top .actions button {
    padding-inline: 9px;
  }
  .editor-top {
    grid-template-columns: 36px minmax(0, 1fr) auto;
  }
  .writing-mode .workspace {
    grid-template-columns: none;
  }
}
@media (max-width: 600px) {
  /* Once the keyboard reduces the viewport, keep the writing surface in view. */
  .writing-mode.keyboard-open .site-header,
  .writing-mode.keyboard-open .editor-subbar,
  .writing-mode.keyboard-open .editor-representation,
  .writing-mode.keyboard-open .page-strip,
  .writing-mode.keyboard-open .writing-hint {
    display: none;
  }
  .writing-mode.keyboard-open #sheet {
    padding-top: 4px;
  }
}
