/* =========================================================
   IEH / AWSHE LinkedIn Sharing Page
   Responsive desktop and mobile stylesheet
   Card format: 1200 × 1200 square
   ========================================================= */

:root {
  --page-background: #eef2f6;
  --panel-background: #ffffff;
  --panel-border: #dce3ea;

  --text-primary: #172033;
  --text-secondary: #5c6778;
  --text-muted: #758093;

  --primary: #225b9f;
  --primary-hover: #194a85;

  --linkedin: #0a66c2;
  --linkedin-hover: #084f96;

  --secondary-background: #edf2f7;
  --secondary-hover: #dde5ee;

  --download: #166534;
  --download-hover: #14532d;

  --danger: #b42318;
  --warning: #9a6700;
  --success: #16794a;

  --border-radius-large: 20px;
  --border-radius-medium: 12px;
  --border-radius-small: 8px;

  --shadow:
    0 18px 50px rgba(20, 34, 52, 0.11);

  --card-design-width: 1200;
  --card-design-height: 1200;
}

/* =========================================================
   Reset
   ========================================================= */

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

html {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}

body {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;

  background:
    linear-gradient(
      180deg,
      #f7f9fc 0%,
      var(--page-background) 100%
    );

  color: var(--text-primary);

  font-family:
    Arial,
    Helvetica,
    sans-serif;

  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

/* =========================================================
   Main layout
   ========================================================= */

.page-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 56px;

  display: grid;
  grid-template-columns:
    minmax(360px, 0.85fr)
    minmax(480px, 1.15fr);
  gap: 28px;
  align-items: start;
}

.intro-panel,
.preview-panel {
  min-width: 0;

  background: var(--panel-background);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow);
}

.intro-panel {
  padding: 34px;
}

.preview-panel {
  padding: 28px;
  position: sticky;
  top: 24px;
}

/* =========================================================
   Intro content
   ========================================================= */

.eyebrow {
  margin: 0 0 10px;

  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

h1 {
  margin: 0;

  color: var(--text-primary);
  font-size: clamp(2rem, 4vw, 3.15rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.06;
}

.intro-copy {
  margin: 18px 0 0;

  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.65;
}

/* =========================================================
   Connection buttons
   ========================================================= */

.connection-row {
  margin-top: 26px;

  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  min-height: 46px;
  padding: 12px 18px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  border: 0;
  border-radius: var(--border-radius-small);

  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;

  transition:
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(10, 102, 194, 0.24);
  outline-offset: 2px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.button-linkedin,
.button-linkedin-share {
  background: var(--linkedin);
  color: #ffffff;
}

.button-linkedin:hover,
.button-linkedin-share:hover {
  background: var(--linkedin-hover);
}

.button-primary {
  background: var(--primary);
  color: #ffffff;
}

.button-primary:hover {
  background: var(--primary-hover);
}

.button-secondary {
  background: var(--secondary-background);
  color: var(--text-primary);
}

.button-secondary:hover {
  background: var(--secondary-hover);
}

.button-download {
  background: var(--download);
  color: #ffffff;
}

.button-download:hover {
  background: var(--download-hover);
}

/* =========================================================
   Form
   ========================================================= */

.form-grid {
  margin-top: 28px;

  display: grid;
  gap: 10px;
}

.field-label {
  margin-top: 8px;

  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 700;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input[type="text"],
input[type="file"],
textarea {
  width: 100%;

  border: 1px solid #cdd6df;
  border-radius: var(--border-radius-small);

  background: #ffffff;
  color: var(--text-primary);

  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

input[type="text"] {
  min-height: 46px;
  padding: 11px 13px;
}

input[type="file"] {
  min-height: 46px;
  padding: 9px;
}

textarea {
  min-height: 180px;
  padding: 13px 14px;
  resize: vertical;
  line-height: 1.55;
}

input[type="text"]:focus,
input[type="file"]:focus,
textarea:focus {
  border-color: var(--linkedin);
  box-shadow:
    0 0 0 3px rgba(10, 102, 194, 0.11);
}

.photo-actions {
  margin-top: 14px;

  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* =========================================================
   Photo adjustment controls
   ========================================================= */

.photo-controls {
  margin-top: 14px;
  padding: 15px;

  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-medium);

  background: #f7f9fb;
}

.control-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.control-group + .control-group {
  margin-top: 9px;
}

.control-group button {
  min-height: 40px;
  padding: 9px 13px;

  border: 1px solid #cdd6df;
  border-radius: 7px;

  background: #ffffff;
  color: var(--text-primary);

  font-weight: 700;

  transition:
    background-color 150ms ease,
    border-color 150ms ease;
}

.control-group button:hover {
  background: #edf2f7;
  border-color: #aebbc8;
}

/* =========================================================
   LinkedIn message
   ========================================================= */

.share-message-section {
  margin-top: 28px;
}

.share-message-section textarea {
  margin-top: 9px;
}

.message-note {
  margin: 8px 0 0;

  color: var(--text-muted);
  font-size: 0.85rem;
}

/* =========================================================
   Download/share controls
   ========================================================= */

.download-row {
  margin-top: 24px;

  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.download-row .button {
  width: 100%;
}

/* =========================================================
   Status
   ========================================================= */

.status-message {
  margin-top: 16px;
  padding: 12px 14px;

  border: 1px solid #d7dee7;
  border-radius: var(--border-radius-small);

  background: #f5f7fa;
  color: var(--text-secondary);

  font-size: 0.91rem;
  line-height: 1.45;
}

.status-success {
  border-color: #a8ddc3;
  background: #ecf8f1;
  color: var(--success);
}

.status-error {
  border-color: #f1b4ae;
  background: #fff0ef;
  color: var(--danger);
}

.status-warning {
  border-color: #efd498;
  background: #fff8e7;
  color: var(--warning);
}

.status-working {
  border-color: #a9c9ec;
  background: #edf5fd;
  color: #18588f;
}

/* =========================================================
   Card preview wrapper
   ========================================================= */

.card-stage {
  position: relative;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;

  aspect-ratio: 1 / 1;

  border-radius: 14px;
  background: #dfe5eb;
}

/*
  The card remains square and fills the preview container.
  html2canvas will render it at the displayed aspect ratio,
  while scale: 2 in app.js creates a sharper output.
*/

.personalised-card {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  overflow: hidden;
  isolation: isolate;

  background: #ffffff;
}

/* =========================================================
   Certificate/card background
   ========================================================= */

.card-background {
  position: absolute;
  inset: 0;
  z-index: 1;

  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;

  user-select: none;
  pointer-events: none;
}

/* =========================================================
   Profile photograph
   ========================================================= */

/*
  These values reproduce the approximate layout of the
  original attending-card design.

  Change left/top/width only when the artwork itself changes.
*/

.profile-photo-area {
  position: absolute;
  left: 21.5%;
  top: 42%;
  z-index: 3;

  width: 25%;
  aspect-ratio: 1 / 1;

  overflow: hidden;

  border-radius: 50%;
  background: #e3e8ed;

  box-shadow:
    0 0 0 0.8vw rgba(255, 255, 255, 0.97),
    0 8px 24px rgba(0, 0, 0, 0.17);

  transform: translate(-50%, -50%);

  cursor: grab;
  touch-action: none;
}

.profile-photo-area.is-dragging {
  cursor: grabbing;
}

.profile-photo-area img,
#profile-picture {
  position: absolute;
  left: 50%;
  top: 50%;

  width: 100%;
  height: 100%;
  max-width: none;

  object-fit: cover;
  object-position: center;

  transform:
    translate(-50%, -50%)
    translate(0, 0)
    scale(1);

  transform-origin: center;
  user-select: none;
  pointer-events: none;
}

.photo-placeholder {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  color: #697585;
  font-size: clamp(0.7rem, 1.6vw, 1.2rem);
  font-weight: 800;
  letter-spacing: 0.08em;

  background:
    radial-gradient(
      circle at 50% 38%,
      #f1f4f7 0%,
      #dbe2e8 72%
    );
}

/* =========================================================
   Participant name
   ========================================================= */

.attendee-name {
  position: absolute;
  left: 5%;
  top: 58%;
  z-index: 4;

  width: 33%;

  color: #172033;

  font-size: clamp(13px, 2.3vw, 34px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.08;
  text-align: center;

  overflow-wrap: anywhere;
  text-wrap: balance;
}

/* =========================================================
   Hidden elements
   ========================================================= */

[hidden] {
  display: none !important;
}

/* =========================================================
   Tablet
   ========================================================= */

@media (max-width: 1080px) {
  .page-shell {
    width: min(900px, calc(100% - 32px));
    grid-template-columns: 1fr;
    gap: 22px;
    padding-top: 26px;
  }

  .preview-panel {
    position: static;
    order: -1;
  }

  .card-stage {
    max-width: 720px;
  }

  .intro-panel,
  .preview-panel {
    padding: 26px;
  }

  .attendee-name {
    font-size: clamp(16px, 3.1vw, 34px);
  }
}

/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 640px) {
  body {
    background: #eef2f6;
  }

  .page-shell {
    width: 100%;
    margin: 0;
    padding: 0 0 30px;

    gap: 0;
  }

  .intro-panel,
  .preview-panel {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .preview-panel {
    padding: 14px;
    border-top: 0;
  }

  .intro-panel {
    padding: 24px 18px 30px;
  }

  .card-stage {
    width: 100%;
    max-width: none;

    border-radius: 12px;
  }

  h1 {
    font-size: clamp(2rem, 11vw, 2.7rem);
  }

  .intro-copy {
    font-size: 0.95rem;
  }

  .connection-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .connection-row .button {
    width: 100%;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .input-row .button {
    width: 100%;
  }

  .photo-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .photo-actions .button {
    width: 100%;
  }

  .control-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-group button {
    width: 100%;
    min-width: 0;
  }

  .download-row {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 200px;
  }

  /*
    Mobile card overlay sizing remains percentage-based,
    so it stays aligned with the original 1200 × 1200 artwork.
  */

  .profile-photo-area {
    box-shadow:
      0 0 0 4px rgba(255, 255, 255, 0.97),
      0 5px 14px rgba(0, 0, 0, 0.16);
  }

  .attendee-name {
    font-size: clamp(11px, 3.7vw, 20px);
  }
}

/* =========================================================
   Very small phones
   ========================================================= */

@media (max-width: 380px) {
  .intro-panel {
    padding-right: 14px;
    padding-left: 14px;
  }

  .preview-panel {
    padding-right: 8px;
    padding-left: 8px;
  }

  .button {
    padding-right: 13px;
    padding-left: 13px;
    font-size: 0.91rem;
  }

  .control-group {
    grid-template-columns: 1fr;
  }

  .attendee-name {
    font-size: clamp(10px, 3.6vw, 16px);
  }
}

/* =========================================================
   Reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* =========================================================
   Print
   ========================================================= */

@media print {
  body {
    background: #ffffff;
  }

  .intro-panel {
    display: none;
  }

  .page-shell {
    width: 100%;
    padding: 0;
    display: block;
  }

  .preview-panel {
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .card-stage {
    width: 100%;
    max-width: none;
    border-radius: 0;
  }
}