/* =====================================================================
   Letterboxd Cover Maker styles
   1. Page & intro   2. Controls   3. Preview & download   4. Phones & tablets
   ===================================================================== */
/* ---------- 1. Page & intro ---------- */
.page{
  position:relative; z-index:3;
  width:100%; max-width:1280px; margin:0 auto;
  padding:calc(clamp(96px, 15vmin, 170px) + env(safe-area-inset-top,0px)) clamp(16px, 3.4vmin, 56px) calc(60px + env(safe-area-inset-bottom,0px));
  padding-left:calc(clamp(16px, 3.4vmin, 56px) + env(safe-area-inset-left,0px));
  padding-right:calc(clamp(16px, 3.4vmin, 56px) + env(safe-area-inset-right,0px));
}
.intro{ margin-bottom:clamp(22px, 3.4vmin, 44px); }
.intro h1{
  margin:0; font-weight:700; letter-spacing:-.03em; line-height:1;
  font-size:clamp(32px, 6vmin, 84px); cursor:default;
}
.intro p{ margin:12px 0 0; color:var(--text-dim); font-size:clamp(14px, 1.8vmin, 20px); }

.maker{ display:grid; grid-template-columns:minmax(300px, 360px) 1fr; gap:clamp(18px, 3vmin, 36px); align-items:start; }

/* ---------- 2. Controls ---------- */
.controls{ background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:18px; }
.group{ padding-bottom:16px; margin-bottom:16px; border-bottom:1px solid var(--border); }
.group:last-child{ border-bottom:none; margin-bottom:0; padding-bottom:0; }
.step{ font-size:10.5px; letter-spacing:.09em; color:var(--text-faint); margin:0 0 10px; }

.field{ margin-bottom:12px; }
.field:last-child{ margin-bottom:0; }
.field > label, .field > .lbl{ display:flex; justify-content:space-between; font-size:12px; color:var(--text-dim); margin-bottom:6px; }
.val{ color:var(--text); font-variant-numeric:tabular-nums; }
.opt{ color:var(--text-faint); }
input[type=text]{
  width:100%; background:var(--surface-2); border:1px solid var(--line); color:var(--text);
  border-radius:8px; padding:11px 12px; font-family:inherit; font-size:15px;
}
input[type=text]:focus{ outline:none; border-color:var(--accent); }
input[type=range]{ width:100%; accent-color:var(--accent); }
.row2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px; }
.row2 .field{ margin-bottom:0; }

.segmented{ display:flex; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.segmented button{
  flex:1; background:var(--surface-2); color:var(--text-dim); border:none; border-right:1px solid var(--line);
  padding:10px 4px; font-family:inherit; font-size:13px; cursor:pointer;
}
.segmented button:last-child{ border-right:none; }
.segmented button.active{ background:var(--text); color:var(--bg); font-weight:600; }

.swatches{ display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.swatch{ width:30px; height:30px; border-radius:50%; cursor:pointer; border:2px solid transparent; padding:0; }
.swatch.active{ border-color:var(--text); }
.swatch.bg{ border-radius:8px; width:38px; border:1.5px solid var(--line); }
.swatch.bg.active{ border-color:var(--text); }
.swatch.custom{ position:relative; overflow:hidden; background:conic-gradient(#ff8000,#ffd166,#00e054,#40bcf4,#9d8ec4,#ff4d6d,#ff8000); }
.swatch.custom input{ position:absolute; inset:0; opacity:0; cursor:pointer; width:100%; height:100%; border:none; padding:0; }

.toggle-row{ display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.toggle-row:last-child{ margin-bottom:0; }
.toggle-row span{ font-size:13px; }
.switch{
  width:36px; height:21px; background:var(--surface-2); border:1px solid var(--line);
  border-radius:20px; position:relative; cursor:pointer; flex-shrink:0; padding:0;
}
.switch::after{
  content:''; position:absolute; top:2px; left:2px; width:15px; height:15px; border-radius:50%;
  background:var(--text-faint); transition:transform .15s ease, background .15s ease;
}
.switch.on{ border-color:var(--accent); }
.switch.on::after{ transform:translateX(15px); background:var(--accent); }

details.fine{ margin-top:6px; }
details.fine summary{
  cursor:pointer; font-size:12.5px; color:var(--text-dim); list-style:none; padding:8px 0;
  display:flex; align-items:center; gap:8px;
}
details.fine summary::-webkit-details-marker{ display:none; }
details.fine summary::before{ content:'+'; width:14px; text-align:center; color:var(--text-faint); }
details.fine[open] summary::before{ content:'−'; }
details.fine .inner{ padding-top:8px; }
.ghost{
  width:100%; background:transparent; color:var(--text-dim); border:1px solid var(--line);
  border-radius:8px; padding:9px; font-family:inherit; font-size:12.5px; cursor:pointer; margin-top:4px;
}
.ghost:hover{ color:var(--text); border-color:var(--text-faint); }

/* ---------- 3. Preview & download ---------- */
.preview{ position:sticky; top:calc(clamp(80px, 12vmin, 130px) + env(safe-area-inset-top,0px)); display:flex; flex-direction:column; align-items:center; gap:14px; }
.frame{
  width:100%; background:var(--surface); border:1px solid var(--border); border-radius:14px;
  padding:clamp(12px, 2vmin, 22px); display:flex; justify-content:center;
}
#stage{ display:block; max-width:100%; height:auto; border-radius:6px; box-shadow:0 18px 44px rgba(0,0,0,.5); }
.frame.portrait #stage{ max-height:62vh; width:auto; }
.meta{ font-size:12px; color:var(--text-faint); }
.btn{
  display:inline-flex; align-items:center; gap:10px;
  background:var(--text); color:var(--bg); border:none; border-radius:999px;
  padding:15px 30px; font-family:inherit; font-size:15px; font-weight:600; cursor:pointer;
  box-shadow:0 14px 40px rgba(0,0,0,.45);
  transition:transform .18s ease, opacity .18s ease;
  -webkit-tap-highlight-color:transparent;
}
.btn svg{ width:1.1em; height:1.1em; }
.btn:active{ transform:scale(.97); }
@media (hover:hover){ .btn:hover{ transform:translateY(-2px); } }
.btn:focus-visible{ outline:3px solid var(--accent); outline-offset:4px; }

/* ---------- 4. Phones & tablets: preview pinned on top while you scroll the controls ---------- */
@media (max-width:900px){
  .maker{ grid-template-columns:1fr; }
  .preview{
    order:-1; z-index:4;
    top:calc(clamp(60px, 11vmin, 90px) + env(safe-area-inset-top,0px));
    background:linear-gradient(var(--bg) 82%, rgba(11,13,14,0));
    padding-bottom:16px; margin:0 -4px;
  }
  .frame{ padding:10px; }
  .frame.portrait #stage{ max-height:34vh; }
  .preview .meta{ display:none; }
  .btn{ padding:12px 24px; font-size:14px; }
}
@media (max-width:900px) and (max-height:520px){
  .preview{ position:static; }
}
