/* Theme variables (defaults). Overridden per event by JS via CSS variables */
:root {
  --bg: #0b0f1a;
  --bg-panel: rgba(14, 18, 30, 0.6);
  --bg-elev: rgba(21, 28, 48, 0.55);
  --text: #e6eefc;
  --muted: #94a3b8;
  --primary: #5b9dff;
  --primary-2: #22d3ee;
  --accent: #a855f7;
  --border: rgba(148, 163, 184, 0.18);
  --glow: 0 0 16px rgba(91, 157, 255, 0.35), 0 0 32px rgba(34, 211, 238, 0.18);
  --radius: 12px;
  /* Background composition tokens */
  --bg-gradient-1: rgba(34, 211, 238, 0.12);
  --bg-gradient-2: rgba(88, 28, 135, 0.18);
  --bg-base-1: #070b13;
  --bg-base-2: #0b0f1a;
  /* Canvas area radial */
  --canvas-radial-1: rgba(34, 211, 238, 0.1);
  --frame-picker-glow: var(--frame-picker-glow-default);
  --frame-picker-glow-default: #22d3ee;
}

* {
  box-sizing: border-box;
}

/*
 * Base reset.
 *
 * These declarations used to arrive via Tailwind's "preflight", which the page
 * pulled in through the Tailwind CDN runtime just for a handful of footer
 * utility classes. That CDN build is a development tool: it shipped a
 * render-blocking script and a full CSS generator on every page load. It was
 * removed, and this block vendors the preflight rules the layout actually
 * depends on, so nothing shifts.
 */
html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd,
pre,
hr {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: inherit;
}

b,
strong {
  font-weight: bolder;
}

small {
  font-size: 80%;
}

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  vertical-align: middle;
}

img,
video {
  max-width: 100%;
  height: auto;
}

button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
}

button,
select {
  text-transform: none;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
  background-color: transparent;
  background-image: none;
}

textarea {
  resize: vertical;
}

/* The `hidden` attribute must beat any component `display` declaration. */
[hidden] {
  display: none !important;
}

::-webkit-file-upload-button {
  -webkit-appearance: button;
  font: inherit;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(
      1200px 800px at 20% -10%,
      var(--bg-gradient-1),
      transparent 60%
    ),
    radial-gradient(
      1000px 700px at 120% 10%,
      var(--bg-gradient-2),
      transparent 60%
    ),
    linear-gradient(180deg, var(--bg-base-1), var(--bg-base-2));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header,
.app-footer {
  padding: 14px 7px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.02)
  );
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(120%) blur(6px);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}
.app-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(34, 211, 238, 0.03) 0%,
    transparent 70%
  );
  pointer-events: none;
}
.app-header h1 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.4px;
  font-size: 1.05rem;
  background: linear-gradient(
    135deg,
    var(--primary-2),
    var(--primary),
    var(--accent)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 20px rgba(34, 211, 238, 0.3);
  position: relative;
}
.app-header h1::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--primary-2),
    var(--primary),
    var(--accent),
    transparent
  );
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
}

/* The program title doubles as a link to the programme page (see theme.js) */
.program-title-link {
  color: inherit;
  text-decoration: none;
  border-radius: 4px;
}

.program-title-link:hover #program-title,
.program-title-link:focus-visible #program-title {
  filter: brightness(1.2);
}

.program-title-link:focus-visible {
  outline: 2px solid var(--primary-2);
  outline-offset: 3px;
}

/* Emphasized styling for the program title segment in the header */
#program-title {
  display: inline-block;
  background: linear-gradient(
    135deg,
    var(--primary-2),
    var(--primary),
    var(--accent)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 0 12px rgba(34, 211, 238, 0.25),
    0 0 24px rgba(91, 157, 255, 0.18);
}

.app-footer {
  border-top: 1px solid var(--border);
  border-bottom: none;
  color: var(--muted);
}

.app-main {
  display: grid;
  grid-template-columns: 340px 1fr;
  padding: 14px;
  flex: 1;
  width: 100%;
  max-width: 840px;
  margin: 0 auto; /* center horizontally */
  vertical-align: middle;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--glow);
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* .control-group label {
  color: var(--text);
  opacity: 0.9;
  font-size: 13px;
  letter-spacing: 0.3px;
} */
.buttons-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

/* Buttons in toolbar: pill, glass, neon accents */
.buttons-row button {
  border-radius: 999px;
  padding: 3px 8px;
  border-color: rgba(148, 163, 184, 0.28);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.02)
  );
  backdrop-filter: blur(4px);
}
.buttons-row button:hover {
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.25),
    var(--glow);
}
.buttons-row button:active {
  transform: translateY(0);
}
.buttons-row button:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(91, 157, 255, 0.3);
}

/* Accents per action */
#fitBtn {
  background: linear-gradient(
    180deg,
    rgba(34, 211, 238, 0.18),
    rgba(91, 157, 255, 0.14)
  );
  border-color: rgba(91, 157, 255, 0.45);
}
#fitBtn:hover {
  box-shadow:
    0 8px 26px rgba(34, 211, 238, 0.22),
    0 0 26px rgba(91, 157, 255, 0.25);
}

#resetBtn {
  background: linear-gradient(
    180deg,
    rgba(239, 68, 68, 0.1),
    rgba(255, 255, 255, 0.02)
  );
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}
#resetBtn:hover {
  box-shadow:
    0 8px 26px rgba(239, 68, 68, 0.2),
    0 0 22px rgba(239, 68, 68, 0.18);
}

#rotateLeftBtn,
#rotateRightBtn {
  background: linear-gradient(
    180deg,
    rgba(168, 85, 247, 0.16),
    rgba(34, 211, 238, 0.1)
  );
  border-color: rgba(168, 85, 247, 0.45);
}
#rotateLeftBtn:hover,
#rotateRightBtn:hover {
  box-shadow:
    0 8px 26px rgba(168, 85, 247, 0.24),
    0 0 22px rgba(34, 211, 238, 0.22);
}

/* Inputs */
select,
input[type="file"],
button,
.dropzone,
input[type="range"] {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
}

/* optional glow around the frame picker select */
#framePicker {
  transition: box-shadow 0.2s ease;
  box-shadow: 0 0 4px 1px rgba(255, 255, 255, 0.2);
  padding-left: 10px;
}

#framePicker.has-glow {
  box-shadow: 0 0 8px 2px var(--frame-picker-glow);
}

/* pulse animation for frame picker -- can be invoked via JS or class */
@keyframes framePickerPulse {
  0%,
  100% {
    box-shadow: 0 0 8px 2px var(--frame-picker-glow);
  }
  50% {
    box-shadow: 0 0 16px 4px var(--frame-picker-glow);
  }
}

/* example usage: JS may set animation property directly or add this class */
#framePicker.glow-anim {
  animation: framePickerPulse 2s ease-in-out infinite;
}
/*
 * `select` and `input[type="file"]` used to share one `padding: 8px 10px`
 * rule, but only the file input ever got it: the Tailwind CDN injected its
 * preflight (`select, input { padding: 0 }`) into <head> after this
 * stylesheet, and `select` — same specificity, declared earlier — lost, while
 * `input[type="file"]` — higher specificity — won. Now that preflight is
 * vendored at the top of this file, the two are split so each keeps the
 * padding it actually rendered with.
 */
input[type="file"] {
  padding: 8px 10px;
}
select:focus,
input[type="file"]:focus,
button:focus,
.dropzone:focus {
  outline: 2px solid rgba(91, 157, 255, 0.5);
  outline-offset: 2px;
}

button {
  padding: 7px 8px;
  cursor: pointer;
  transition:
    transform 0.06s ease,
    box-shadow 0.2s ease;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.02)
  );
}
button:hover {
  transform: translateY(-1px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.25),
    var(--glow);
}
button:active {
  transform: translateY(0);
}
.primary {
  background: linear-gradient(
    180deg,
    rgba(34, 211, 238, 0.22),
    rgba(91, 157, 255, 0.18)
  );
  border-color: rgba(91, 157, 255, 0.45);
}
.primary:hover {
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.3),
    0 0 24px rgba(34, 211, 238, 0.35);
}

/* Dropzone */
.dropzone {
  border: 1px dashed rgba(148, 163, 184, 0.35);
  padding: 12px;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.01)
  );
}
.dropzone.dragover {
  border-color: rgba(34, 211, 238, 0.65);
  background: rgba(34, 211, 238, 0.06);
  color: var(--primary-2);
  box-shadow: var(--glow);
}

/* Range slider */
input[type="range"] {
  height: 25px;
  appearance: none;
  padding: 0 6px;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: linear-gradient(
    90deg,
    rgba(91, 157, 255, 0.35),
    rgba(34, 211, 238, 0.35)
  );
  border-radius: 999px;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e2e8f0;
  border: 2px solid #60a5fa;
  margin-top: -3px;
  box-shadow: var(--glow);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  background: linear-gradient(
    90deg,
    rgba(91, 157, 255, 0.35),
    rgba(34, 211, 238, 0.35)
  );
  border-radius: 999px;
}
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid #60a5fa;
  background: #e2e8f0;
  border-radius: 50%;
  box-shadow: var(--glow);
}

/* Disabled/greyed out state for controls */
button:disabled,
input[type="range"]:disabled,
select:disabled,
input[type="file"]:disabled,
.dropzone.disabled {
  opacity: 0.4;
  background: rgba(255, 255, 255, 0.05);
  cursor: not-allowed;
}

/* LinkedIn share button style */
.linkedin-share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  text-decoration: none;
  color: #ffffff;
  background: #0a66c2;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 6px 18px rgba(10, 102, 194, 0.35);
  transition:
    transform 0.06s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}
.linkedin-share:hover {
  background: #0c74df;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(10, 102, 194, 0.45);
}
.linkedin-share:active {
  transform: translateY(0);
}

/* Disabled state for LinkedIn share link */
.linkedin-share[aria-disabled="true"],
.linkedin-share.disabled {
  opacity: 0.5;
  filter: grayscale(0.4);
  cursor: not-allowed !important;
  pointer-events: none;
  user-select: none;
  transform: none !important;
  box-shadow: none !important;
}

.linkedin-share[aria-disabled="true"]:hover,
.linkedin-share.disabled:hover {
  background: #0a66c2 !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Canvas area */
.canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  border-radius: var(--radius);
  background:
    radial-gradient(
      800px 500px at 70% 0%,
      var(--canvas-radial-1),
      transparent 60%
    ),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.03),
      rgba(255, 255, 255, 0.01)
    );
  border: 1px solid var(--border);
  box-shadow: var(--glow);
  aspect-ratio: 1 / 1; /* zawsze kwadratowy podgląd */
  max-width: 392px;
  justify-self: center; /* center within grid column */
  position: relative;
}

/* Loading swirl overlay */
.canvas-wrap.loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border: 3px solid rgba(34, 211, 238, 0.2);
  border-top: 3px solid var(--primary-2);
  border-radius: 50%;
  animation: swirl 1s linear infinite;
  z-index: 10;
}

.canvas-wrap.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  border: 2px solid rgba(91, 157, 255, 0.15);
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: swirl 1.5s linear infinite reverse;
  z-index: 10;
}

@keyframes swirl {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

#canvas {
  width: 100%;
  height: 100%;
  background: #030712;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08);
}
#canvas:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(91, 157, 255, 0.3);
}

.hint {
  color: var(--muted);
  opacity: 0.8;
  font-size: 10px;
}

.step {
  font-size: 14px;
}
@media (max-width: 786px) {
  .app-main {
    grid-template-columns: 1fr;
    height: auto;
  }

  .app-header h1 {
    font-size: 0.7rem;
    text-align: center;
  }

  .app-header h1::after {
    width: 80%;
  }
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary);
  color: var(--bg);
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
  font-weight: bold;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 6px;
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* LinkedIn post section */
.linkedin-post {
  padding: 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 20px;
  max-width: 392px;
  width: 392px;
}

.linkedin-post h2 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.1rem;
  color: var(--text);
}

.linkedin-textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.25;
  resize: vertical;
  margin-bottom: 12px;
  box-sizing: border-box;
  height: 170px;
}

.linkedin-textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.copy-btn {
  width: 100%;
  padding: 10px 16px;
  background: var(--primary);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: var(--primary-2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.3);
}

.copy-btn:active {
  transform: translateY(0);
}

.copy-btn.copied {
  background: #10b981;
}

.copy-btn.copied::after {
  content: "✓ Skopiowano!";
  margin-left: 5px;
}

/* Replaces the deprecated <div align="center"> attribute. */
.center-row {
  text-align: center;
}

/*
 * Preview column: canvas plus the suggested LinkedIn post.
 * Was an inline-styled <span> wrapping <section> elements, which is invalid
 * HTML; same box, valid element.
 */
.preview-column {
  display: flex;
  gap: 2px;
  flex-direction: column;
  align-items: center;
  margin-top: 0;
}
