/* Phase 1 — student-first editing */
:root{--fenton-orange:#f58220;--fenton-black:#171717;--focus:#1e6cc7}
header{box-shadow:0 2px 12px #00000019}
.app{grid-template-columns:minmax(270px,345px) minmax(360px,1fr) minmax(270px,305px);gap:16px}
#editorCanvas{cursor:crosshair}
#editorCanvas.is-moving{cursor:grabbing}
#editorCanvas:focus-visible{outline:3px solid var(--focus);outline-offset:3px}
.studio-panel-title{margin-bottom:6px!important}
.template-section>h3,.quick-panel>h3{font-size:14px;margin:0 0 10px;color:#1c2a38}
.template-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.template-card{font-family:inherit;border:2px solid #d9e0e8;border-radius:12px;padding:10px 8px 8px;text-align:center;background:white;cursor:pointer;display:grid;justify-items:center;gap:6px;min-height:122px;color:#1c2a38;font-weight:700;font-size:12px;transition:border-color .15s,background .15s}
.template-card:hover{border-color:#f58220;background:#fff8ef}
.template-card[aria-pressed="true"]{border-color:#e87408;background:#fff5e9;box-shadow:0 0 0 2px #f5822033}
.template-card:focus-visible,.studio-tool:focus-visible,.quick-panel button:focus-visible,.quick-panel input:focus-visible{outline:3px solid #317fc7;outline-offset:2px}
.template-thumb{width:76px;height:76px;display:grid;place-items:center;border-radius:50%;box-shadow:0 1px 5px #00000020;overflow:hidden}
.template-thumb svg{width:100%;height:100%}
.template-card small{display:block;font-size:10px;font-weight:500;color:#697386}
.quick-panel{margin-top:16px;border:1px solid #f7c28b;background:#fffaf5;border-radius:13px;padding:13px}
.quick-panel [hidden]{display:none!important}
.quick-panel label{font-size:12px;margin-top:9px}
.quick-panel input:not([type="checkbox"]),.quick-panel select{padding:9px;background:white;width:100%}
.quick-panel input[type=range]{padding:0;accent-color:#ec7b16}
.quick-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:10px}
.quick-actions button,.studio-tool{background:#fff;border:1px solid #cfdae6;border-radius:9px;padding:9px 11px;font-size:12px;font-weight:700;color:#1a2f46;cursor:pointer}
.quick-actions button:hover,.studio-tool:hover{border-color:#f58220;background:#fff7ee}
.quick-panel p{font-size:12px;color:#596879;line-height:1.45;margin:6px 0 8px}
.quick-panel strong{font-size:13px}
.quick-field{margin-top:8px}
.quick-field output{font-size:11px;color:#687b8f;margin-left:5px}
.quick-panel .danger{color:#a82925;border-color:#eecccb}
#advancedTools{margin-top:15px;border-top:1px solid #e7ebf0;padding-top:13px}
#advancedTools summary{font-size:13px;color:#2b4863;padding:9px;background:#f2f5f8;border-radius:9px}
#advancedTools[open] summary{margin-bottom:16px}
.studio-toolbar{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;align-items:center;margin-bottom:12px}
.studio-toolbar .studio-tool:disabled{cursor:not-allowed;opacity:.4}
.studio-canvas-hint{font-size:12px;color:#687a90;margin:6px 0 12px}
#selectedName{font-size:12px;color:#3a526e;font-weight:600;min-height:18px}
.previewPanel{min-width:0}
#message{min-height:22px}
@media(max-width:1150px){.app{grid-template-columns:minmax(270px,345px) minmax(350px,1fr)}.right{grid-column:1/-1}}
@media(max-width:760px){.app{display:flex;flex-direction:column;padding:12px}.previewPanel{order:1}.app>section.panel:first-child{order:2}.right{order:3}.canvasWrap{max-width:520px}.template-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.template-card{min-height:105px;padding:6px 3px}.template-thumb{width:min(64px,100%);height:auto;aspect-ratio:1}}
@media(max-width:420px){.template-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.studio-toolbar{gap:5px}.studio-tool{padding:8px}}
@media(prefers-reduced-motion:reduce){.template-card{transition:none}}

/* Canvas-level image editing controls for mouse, touch and keyboard. */
.canvas-image-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:8px;margin:0 auto 12px;padding:10px;border:1px solid #e4b88b;background:#fff7ed;border-radius:12px;max-width:535px}
.canvas-image-actions[hidden]{display:none!important}
.canvas-image-actions span{font-size:12px;font-weight:750;color:#67421f;margin-right:4px}
.canvas-image-actions button{cursor:pointer;border:1px solid #bcc8db;background:#fff;padding:9px 12px;border-radius:8px;color:#172235;font-weight:700;min-height:40px}
.canvas-image-actions button.danger{border-color:#d32929;color:#aa2020}
.canvas-image-actions button:focus-visible{outline:3px solid #e66d08;outline-offset:2px}

/* Keep beginner text editing visible and stop selection-panel layout shifts. */
.studio-curved-text{margin-top:14px;padding:12px;border:1px solid #dde6ee;border-radius:12px;background:#f8fafc}
.studio-curved-text h3{margin:0 0 9px;font-size:14px;color:#1c2a38}
.studio-curved-text label{margin:7px 0 5px}
.studio-curved-text input{width:100%;min-height:42px}
.studio-curved-text output,.text-counter{display:block;text-align:right;margin-top:3px;font-size:11px;color:#56677e}
.quick-panel{min-height:300px}
#historyFeedback{min-height:30px;margin:0 auto 8px;max-width:535px;font-size:13px;font-weight:750;color:#2f4a69;background:#eef5fd;border-left:3px solid #6792c6;border-radius:6px;padding:5px 12px;visibility:hidden}
#historyFeedback:not(:empty){visibility:visible}
#selectedName{flex-basis:100%;font-weight:750;color:#243c59}
.design-warnings{font-size:12px;text-align:left;line-height:1.5;color:#714512;background:#fff6e5;border-radius:8px;min-height:0;margin-top:10px}
.design-warnings:not(:empty){padding:9px;border:1px solid #e9c98d}

/* Compact mobile header and preview-first canvas: the button stays above the fold.
   Editing controls remain accessible immediately below the preview. */
@media(max-width:700px){
 body>header{padding:8px 11px;gap:6px 9px}
 body>header b{font-size:16px;letter-spacing:-.3px}
 body>header small{display:none}
 body>header .edition-nav{gap:5px}
 body>header .edition-link{font-size:11px}
 body>header .btn{padding:7px 9px;min-height:34px;font-size:11px}
 body>header .install-app-btn{min-height:34px}
 .app{padding:6px 8px 12px}
 .editor-tabs{padding:3px 0 6px;gap:5px}
 .editor-tabs button{min-height:42px;padding:8px 4px}
 .app>.previewPanel{display:flex;flex-direction:column;align-items:stretch;padding:9px 10px;margin-bottom:10px}
 .previewPanel>h2{order:-2;font-size:14px;margin:0 0 5px}
 .previewPanel>.canvasWrap{
  order:-1;
  width:min(100%,max(150px,calc(100svh - 235px)));
  max-width:535px;
  padding:6px;
  margin:0 auto 6px;
 }
 .previewPanel #editorCanvas{width:100%;max-width:none;height:auto}
 .previewPanel .studio-toolbar{margin:5px 0 8px}
 .previewPanel #historyFeedback:empty{display:none}
 .previewPanel #selectedName{font-size:11px}
 .previewPanel .studio-canvas-hint{margin:6px 0 9px}
}

/* Above-the-fold editor at tablet, laptop and desktop widths.
   Mirrors the phone preview-first flow without changing artwork or print dimensions. */
@media(min-width:701px){
 body>header{padding:10px clamp(12px,2.2vw,26px);gap:8px}
 body>header b{font-size:clamp(17px,1.5vw,20px)}
 body>header small{font-size:11px;margin-top:1px}
 body>header .edition-nav{gap:7px}
 body>header .btn{padding:8px 10px;min-height:36px;font-size:12px}
 body>header .install-app-btn{min-height:36px}
 .app{padding-top:12px;row-gap:8px}
 .editor-tabs{padding:4px 0 7px}
 .editor-tabs button{padding:9px 12px;min-height:42px}
 .app>.previewPanel{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  padding:12px 14px;
  top:60px;
 }
 .previewPanel>h2{order:-2;font-size:14px;margin:0 0 6px}
 .previewPanel>.canvasWrap{
  order:-1;
  width:min(100%,535px,max(140px,calc(100svh - 235px)));
  padding:8px;
  margin:0 auto 7px;
 }
 .previewPanel #editorCanvas{width:100%;max-width:none;height:auto}
 .previewPanel .studio-toolbar{margin:5px 0 8px}
 .previewPanel #historyFeedback:empty{display:none}
 .previewPanel .studio-canvas-hint{margin:6px 0 9px}
}

/* 701–760px inherited a stacked layout from the older tablet stylesheet.
   Restore the actual two-column editor here, so the design panel does not
   push the preview down below the fold at this transitional breakpoint. */
@media(min-width:701px) and (max-width:760px){
 body[data-studio-edition="fenton"] .app{
  display:grid;
  grid-template-columns:minmax(245px,330px) minmax(0,1fr);
 }
 body[data-studio-edition="fenton"] .editor-tabs{
  grid-column:1/-1;
  grid-row:1;
  width:100%;
 }
 body[data-studio-edition="fenton"] .app>.previewPanel{
  grid-column:2;
  grid-row:2;
  order:0;
 }
 body[data-studio-edition="fenton"] #designTools,
 body[data-studio-edition="fenton"] #sideTools{
  grid-column:1;
  grid-row:2;
  order:0;
 }
}
