/* Digital Domination 2.0 - poster generator */

@font-face { font-family: "Montserrat"; font-weight: 500; font-display: swap; src: url("../fonts/montserrat-medium.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-display: swap; src: url("../fonts/montserrat-semibold.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 800; font-display: swap; src: url("../fonts/montserrat-extrabold.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 900; font-display: swap; src: url("../fonts/montserrat-black.woff2") format("woff2"); }

:root {
  --red: #e10600;
  --red-deep: #a30000;
  --red-tint: #fff1f0;
  --ink: #0e0e10;
  --ink-2: #34363d;
  --muted: #6b6e78;
  --line: #dcdee5;
  --bg: #eef0f4;
  --panel: #ffffff;
  --ok: #0f7b3f;
  --cut: 14px;              /* chamfer size */
  --radius: 6px;
  --shadow: 0 1px 2px rgba(14, 14, 16, .06), 0 12px 32px -12px rgba(14, 14, 16, .18);
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font: 500 15px/1.55 var(--font);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 50% -10%, rgba(225, 6, 0, .10), transparent 70%),
    linear-gradient(rgba(14, 14, 16, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 14, 16, .035) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
  padding: 0 16px env(safe-area-inset-bottom);
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

svg { flex: none; }

/* ---------- Header ---------- */

.masthead {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 0 28px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.slashes { color: var(--red); font-weight: 900; letter-spacing: -.05em; margin-right: .5em; }

.title {
  margin: 0;
  font-weight: 900;
  text-transform: uppercase;
  line-height: .92;
  letter-spacing: -.01em;
}
.title span { display: block; }
.title-1 { font-size: clamp(30px, 6.4vw, 56px); color: var(--ink); }
.title-2 {
  font-size: clamp(38px, 8.4vw, 76px);
  color: var(--red);
  text-shadow: 0 2px 0 var(--red-deep);
}
.title-3 {
  display: inline-flex !important;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
  font-size: clamp(18px, 3vw, 26px);
  color: var(--ink);
}
.title-3::before, .title-3::after {
  content: "";
  width: 56px; height: 3px;
  background: linear-gradient(90deg, transparent, var(--red));
}
.title-3::after { transform: scaleX(-1); }

.lede {
  max-width: 560px;
  margin: 18px auto 0;
  color: var(--ink-2);
}

/* ---------- Layout ---------- */

.layout {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  gap: 24px;
  align-items: start;
}

@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
  .preview { position: sticky; top: 24px; }
}

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.panel::before {           /* red corner accent, echoing the poster frame */
  content: "";
  position: absolute;
  top: -1px; left: -1px;
  width: 64px; height: 4px;
  background: var(--red);
  border-top-left-radius: var(--radius);
}

@media (max-width: 520px) {
  .panel { padding: 20px 16px; }
  .masthead { padding-top: 28px; }
}

/* ---------- Steps ---------- */

.step {
  border: 0;
  margin: 0 0 28px;
  padding: 0;
  min-width: 0;
}

.step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.step-num {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 24px;
  font-size: 12px;
  letter-spacing: 0;
  color: #fff;
  background: var(--red);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}

.hint { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- Photo stage ---------- */

.photo-stage { position: relative; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 20px 28px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: #fafbfc;
  transition: border-color .15s, background-color .15s;
}
.photo-stage.is-dragover .dropzone { border-color: var(--red); background: var(--red-tint); }

.dropzone-icon {
  width: 48px; height: 48px;
  fill: none; stroke: var(--red); stroke-width: 2.4; stroke-linejoin: round;
}
.dropzone-text { margin: 10px 0 18px; font-weight: 600; }

@media (hover: none) { .hint-drop { display: none; } }

/* Shared frame-shaped viewport for camera + cropper */
.viewport {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  aspect-ratio: 561 / 595;
  overflow: hidden;
  background: #11131a;
  border-radius: 2px;
}
.viewport video, .viewport canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
.viewport video { object-fit: cover; }
.viewport video.is-mirrored { transform: scaleX(-1); }

.frame-overlay, .face-guide {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.frame-mask { fill: var(--panel); }
.frame-line { fill: none; stroke: var(--red); stroke-width: 5; vector-effect: non-scaling-stroke; }
.face-guide ellipse {
  fill: none; stroke: rgba(255, 255, 255, .75); stroke-width: 2;
  stroke-dasharray: 8 8; vector-effect: non-scaling-stroke;
}

#crop-viewport { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
#crop-viewport.is-dragging { cursor: grabbing; }
#crop-viewport:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

.zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  margin: 16px auto 0;
}
.zoom-row svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }

input[type="range"] {
  flex: 1;
  height: 28px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--line); border-radius: 2px; }
input[type="range"]::-moz-range-track { height: 4px; background: var(--line); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px; margin-top: -8px;
  border-radius: 50%; background: var(--red); border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--red);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%; background: var(--red); border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--red);
}
input[type="range"]:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.cropper-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  max-width: 420px;
  margin: 6px auto 0;
}
.cropper-foot .hint { margin: 0; }

/* ---------- Form fields ---------- */

.fields {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}
.field-wide { grid-column: 1 / -1; }
@media (max-width: 520px) { .fields { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.field-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.req { color: var(--red); }

.field input {
  width: 100%;
  font: 600 16px/1.3 var(--font);   /* 16px stops iOS zooming on focus */
  color: var(--ink);
  padding: 12px 14px;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.field input::placeholder { color: #a3a6b0; font-weight: 500; }
.field input:focus {
  outline: none;
  background: #fff;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(225, 6, 0, .14);
}
.field input[aria-invalid="true"] { border-color: var(--red); background: var(--red-tint); }

.sample-line { font-weight: 600; letter-spacing: .12em; color: var(--ink-2); word-break: break-word; }

/* ---------- Buttons ---------- */

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn-row-center { align-items: center; margin-top: 16px; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  font: 800 13px/1 var(--font);
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: background-color .15s, color .15s, transform .1s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.btn:disabled { cursor: not-allowed; opacity: .6; }

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #f01a10, var(--red) 55%, #c70500);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #d10500, var(--red-deep)); }

.btn-ghost {
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--ink);
  border-radius: 2px;
}
.btn-ghost:hover:not(:disabled) { background: var(--ink); color: #fff; }

.btn-link {
  min-height: 36px;
  padding: 6px 2px;
  color: var(--red);
  background: none;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.btn-lg { width: 100%; min-height: 56px; font-size: 15px; }

.btn-shutter {
  width: 68px; height: 68px;
  padding: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 4px var(--red);
}
.btn-shutter span {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: var(--red);
  transition: transform .1s;
}
.btn-shutter:active span { transform: scale(.88); }

/* Loading state for the generate button */
.spinner {
  display: none;
  width: 20px; height: 20px;
  border: 3px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.is-busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Messages ---------- */

.msg { margin: 12px 0 0; font-size: 14px; font-weight: 600; }
.msg-error {
  padding: 10px 14px;
  color: var(--red-deep);
  background: var(--red-tint);
  border-left: 3px solid var(--red);
}
#form-error { margin: 0 0 14px; }
.msg-ok { color: var(--ok); text-align: center; }

.privacy {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
.privacy svg { width: 16px; height: 16px; margin-top: 2px; fill: none; stroke: var(--muted); stroke-width: 2; }

/* ---------- Preview ---------- */

.poster {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  background: #f5f6f8;
  line-height: 0;
  box-shadow: 0 18px 40px -18px rgba(14, 14, 16, .45);
}
.poster img { width: 100%; height: auto; display: block; }

.poster[data-state="sample"] img { filter: saturate(.85); opacity: .9; }
.poster.is-stale img { opacity: .55; }

.poster-badge {
  position: absolute;
  top: 12px; right: 12px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #fff;
  background: var(--ink);
}
.poster.is-stale .poster-badge { background: var(--red); }

.poster-busy {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(3px);
}
.poster-busy .spinner {
  display: inline-block;
  width: 36px; height: 36px;
  border-color: rgba(225, 6, 0, .2);
  border-top-color: var(--red);
}
.poster.is-busy .poster-busy { display: flex; }

.result-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-width: 480px;
  margin: 20px auto 0;
}
.result-actions:has(#btn-share:not([hidden])) { grid-template-columns: 2fr 1fr; }

/* Once the LinkedIn panel shows, the column is too tall to stay pinned. */
.preview.has-result { position: static; }

/* ---------- LinkedIn ---------- */

.linkedin {
  --li-blue: #0a66c2;
  max-width: 480px;
  margin: 24px auto 0;
  padding: 18px;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.linkedin-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.linkedin-logo { width: 34px; height: 34px; fill: var(--li-blue); }
.linkedin-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.linkedin-sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.linkedin textarea {
  display: block;
  width: 100%;
  min-height: 200px;
  resize: vertical;
  padding: 12px 14px;
  font: 500 14px/1.5 var(--font);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.linkedin textarea:focus {
  outline: none;
  border-color: var(--li-blue);
  box-shadow: 0 0 0 3px rgba(10, 102, 194, .16);
}
@media (pointer: coarse) { .linkedin textarea { font-size: 16px; } }

.linkedin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.linkedin-actions .btn { flex: 1 1 auto; white-space: nowrap; }
.linkedin-actions .btn-linkedin { flex-basis: 230px; }

.btn-linkedin {
  color: #fff;
  background: var(--li-blue);
  border-radius: 2px;
}
.btn-linkedin:hover { background: #004182; }
.btn svg.icon-fill { fill: currentColor; stroke: none; }

.linkedin .msg-ok { text-align: left; }
.linkedin .msg a, .text-link { color: var(--li-blue); font-weight: 700; text-underline-offset: 3px; }
.btn-linkedin:disabled { opacity: 1; background: #5b8fc7; }
.btn-linkedin.is-busy { background: var(--li-blue); }

/* ---------- LinkedIn sign-in pop-up ---------- */

.callback {
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.callback-panel { max-width: 420px; text-align: center; }
.callback-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.callback-panel p { color: var(--ink-2); }

/* ---------- Footer ---------- */

.footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 0 40px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 1.5s !important; }
}
