/* Page-specific layout on top of tokens.css. No color/font overrides here —
   only composition. New tokens go in tokens.css. */

/* ============================================================
   Site header
   ============================================================ */
.site-header {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
}

/* Wordmark */
.site-header .wordmark {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--color-accent);
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1;
}
.site-header .wordmark a {
  color: inherit;
  text-decoration: none;
}

/* Nav */
.site-header nav {
  display: flex;
  gap: var(--sp-1);
  margin-left: auto;
}
.site-header nav a {
  color: var(--color-text-muted);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: color var(--t-fast), background var(--t-fast);
}
.site-header nav a:hover {
  color: var(--color-text-primary);
  background: var(--color-surface-alt);
  text-decoration: none;
}
.site-header nav a.active {
  color: var(--color-text-primary);
  background: var(--color-border);
}

/* Tagline — full-width row below wordmark + nav */
.site-header .tagline {
  width: 100%;
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  font-style: italic;
  padding-top: var(--sp-1);
}

/* ============================================================
   Tabs (send page)
   ============================================================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--sp-6);
}
.tabs button {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: var(--sp-3) var(--sp-4);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  min-height: unset;
  margin-bottom: -1px; /* sit on the border */
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tabs button:hover {
  color: var(--color-text-primary);
  background: transparent;
  border-color: transparent;
}
.tabs button.active {
  color: var(--color-text-primary);
  border-bottom-color: var(--color-accent);
}
.tabs button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

@media (max-width: 640px) {
  .tabs button { width: auto; flex: 1; min-width: 0; font-size: var(--fs-xs); padding: var(--sp-2) var(--sp-2); }
}

/* ============================================================
   Form helpers
   ============================================================ */
/* Label-above + control block */
.field { display: block; margin-bottom: var(--sp-4); }

/* Two columns on desktop, stacked on mobile */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
}

/* Textarea */
textarea {
  min-height: 140px;
  resize: vertical;
  font-family: var(--font-ui);
  line-height: 1.55;
}

/* Password inputs — prevent browser badge clipping */
input[type="password"] { padding-right: var(--sp-8); }

/* Select arrow reset (webkit hides the native arrow) */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6A66' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: var(--sp-8);
  cursor: pointer;
}

/* ============================================================
   Dropzone states
   ============================================================ */

/* Has-file (filled) */
.dropzone.filled {
  border-style: solid;
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
  color: var(--color-text-primary);
}
.dropzone p { margin: 0 0 var(--sp-2); }
.dropzone .file-info {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--color-text-primary);
}

/* Locked (upload in progress) */
.dropzone.locked {
  pointer-events: none;
  opacity: 0.45;
  cursor: not-allowed;
  user-select: none;
}
.dropzone-locked-overlay {
  pointer-events: none;
  opacity: 0.5;
}

/* Done */
.dropzone.done {
  position: relative;
  overflow: hidden;
  border-style: solid;
  border-color: var(--color-success);
  background: var(--color-success-subtle);
  color: var(--color-text-primary);
  cursor: default;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  padding: var(--sp-6);
}
/* Large semi-transparent watermark tick behind the text */
.dropzone.done::before {
  content: '✓';
  position: absolute;
  font-size: 9rem;
  line-height: 1;
  color: var(--color-success);
  opacity: 0.08;
  pointer-events: none;
  user-select: none;
  /* Nudge slightly so the tick optical centre aligns with the box centre */
  transform: translateY(4px);
}
.dropzone.done #dzDoneContent {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
}
.dropzone.done .dz-done-label {
  font-weight: 700;
  color: var(--color-success);
  font-size: var(--fs-lg);
  margin: 0;
  letter-spacing: -0.01em;
}
.dropzone.done .dz-done-name {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin: 0;
}

/* "Upload another file" link-style button */
#btnUploadAnother {
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
}

/* ============================================================
   Share URL / result block
   ============================================================ */
.url-result .code-block { margin-bottom: var(--sp-3); }
.url-result .code-block .obj  { color: var(--color-code-syntax); }
.url-result .code-block .frag { color: var(--color-code-frag); }
.url-result .qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.url-result .qr-code {
  width: 220px;
  height: 220px;
  padding: var(--sp-2);
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}
.url-result .qr-code svg { display: block; width: 100%; height: 100%; }
.url-result .qr-hint {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}

/* ============================================================
   Tunnel file list table
   ============================================================ */
table.filelist {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
table.filelist th,
table.filelist td {
  text-align: left;
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
table.filelist th {
  font-weight: 600;
  color: var(--color-text-subtle);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
table.filelist tbody tr:last-child td { border-bottom: none; }
table.filelist tbody tr:hover td { background: var(--color-surface-alt); }

table.filelist td.actions {
  text-align: right;
  white-space: nowrap;
}
table.filelist td.actions button {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--fs-xs);
  min-height: 30px;
  margin-left: var(--sp-2);
  width: auto;
}
table.filelist td.name {
  font-family: var(--font-mono);
  word-break: break-all;
  color: var(--color-text-primary);
}
table.filelist td.size {
  color: var(--color-text-muted);
  white-space: nowrap;
}

@media (max-width: 640px) {
  table.filelist th:nth-child(2),
  table.filelist td:nth-child(2) { display: none; }
  table.filelist td.actions button { margin-left: var(--sp-1); }
}

/* ============================================================
   Inline checkbox row
   ============================================================ */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--color-accent);
  flex-shrink: 0;
}
.checkbox-row label { margin: 0; font-weight: 400; cursor: pointer; }

/* ============================================================
   FAQ accordion
   ============================================================ */
.faq {
  padding-top: var(--sp-4);
  padding-bottom: var(--sp-2);
}
.faq h2 { margin-bottom: var(--sp-4); }
.faq details {
  border-top: 1px solid var(--color-border);
  padding: var(--sp-3) 0;
}
.faq details:last-child { border-bottom: 1px solid var(--color-border); }
.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--color-text-primary);
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%236B6A66' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform var(--t-base);
}
details[open] .faq summary::before,
.faq details[open] summary::before {
  transform: rotate(180deg);
}
.faq p {
  margin: var(--sp-3) 0 0 var(--sp-6);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  line-height: 1.65;
}

/* ============================================================
   Decrypted image preview
   ============================================================ */
img.preview {
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  display: block;
  margin-top: var(--sp-3);
  box-shadow: var(--shadow-xs);
}

/* ============================================================
   Busy overlay (minimal)
   ============================================================ */
body.busy { cursor: progress; }
body.busy button { pointer-events: none; opacity: 0.6; }

/* ============================================================
   Progress flow
   A vertical step list with a left rail and state-driven icons.
   ============================================================ */
.progress-flow-container {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-3);
  margin-top: var(--sp-3);
}
.progress-flow {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.progress-flow .step {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) 0 var(--sp-2) calc(var(--sp-6) + var(--sp-3));
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  min-height: 28px;
  transition: color var(--t-base);
}

/* Vertical rail */
.progress-flow .step::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}
.progress-flow .step:first-child::before { top: 50%; }
.progress-flow .step:last-child::before  { bottom: 50%; }
.progress-flow .step:only-child::before  { display: none; }

/* Round icon */
.progress-flow .step-icon {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: border-color var(--t-slow), background var(--t-slow), transform var(--t-slow);
  z-index: 1;
}

/* pending */
.progress-flow .step[data-state="pending"] .step-icon::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-border);
}

/* active (spinner) */
.progress-flow .step[data-state="active"] {
  color: var(--color-text-primary);
  font-weight: 500;
}
.progress-flow .step[data-state="active"] .step-icon {
  border-color: var(--color-accent);
  background: var(--color-surface);
  transform: translateY(-50%) scale(1.1);
}
.progress-flow .step[data-state="active"] .step-icon::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--color-accent);
  border-top-color: transparent;
  animation: pf-spin 0.65s linear infinite;
}
@keyframes pf-spin { to { transform: rotate(360deg); } }

/* done (checkmark) */
.progress-flow .step[data-state="done"] {
  color: var(--color-text-primary);
}
.progress-flow .step[data-state="done"] .step-icon {
  background: var(--color-success);
  border-color: var(--color-success);
}
.progress-flow .step[data-state="done"] .step-icon::after {
  content: '';
  display: block;
  width: 5px;
  height: 10px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* error (cross) */
.progress-flow .step[data-state="error"] {
  color: var(--color-danger);
}
.progress-flow .step[data-state="error"] .step-icon {
  background: var(--color-danger);
  border-color: var(--color-danger);
  animation: pf-shake 0.35s ease;
}
.progress-flow .step[data-state="error"] .step-icon::before,
.progress-flow .step[data-state="error"] .step-icon::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 2px;
  background: #fff;
}
.progress-flow .step[data-state="error"] .step-icon::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
.progress-flow .step[data-state="error"] .step-icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}
@keyframes pf-shake {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  20%       { transform: translateY(-50%) translateX(-4px); }
  60%       { transform: translateY(-50%) translateX(4px); }
  80%       { transform: translateY(-50%) translateX(-2px); }
}

/* ============================================================
   Multipart upload progress bar
   ============================================================ */
.upload-progress-wrap { margin-top: var(--sp-3); }

.upload-progress-track {
  width: 100%;
  height: 8px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width 0.35s ease, background 0.25s ease;
}
.upload-progress-fill--done  { background: var(--color-success); }
.upload-progress-fill--error { background: var(--color-danger); }

.upload-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}
@media (max-width: 480px) {
  .upload-progress-meta { flex-direction: column; gap: var(--sp-1); }
}

/* ============================================================
   Image zoom modal
   ============================================================ */
.image-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 18, 0.88);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  cursor: zoom-out;
  animation: pf-fadein 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
@keyframes pf-fadein {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}
.image-modal-content {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.image-modal-content img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: block;
  object-fit: contain;
}
.image-modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 20px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: unset;
  width: 36px;
}
.image-modal-close:hover {
  background: var(--color-border);
}

/* Clickable affordance for preview images */
img.preview { cursor: zoom-in; transition: transform var(--t-base), box-shadow var(--t-base); }
img.preview:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ============================================================
   "Fork me on GitHub" corner ribbon
   ============================================================ */
#forkongithub {
  position: fixed;
  top: 0;
  right: 0;
  width: 150px;
  height: 150px;
  overflow: hidden;
  pointer-events: none;
  z-index: 900;
}
#forkongithub a {
  pointer-events: auto;
  position: absolute;
  top: 34px;
  right: -54px;
  width: 220px;
  transform: rotate(45deg);
  background: var(--color-code-bg);
  color: #fff;
  text-align: center;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: var(--fs-xs);
  line-height: 2rem;
  padding: 4px 0;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: background var(--t-base), color var(--t-base);
  letter-spacing: 0.03em;
}
#forkongithub a::before,
#forkongithub a::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background: rgba(255,255,255,0.25);
}
#forkongithub a::before { top: 3px; }
#forkongithub a::after  { bottom: 3px; }
#forkongithub a:hover {
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
}
@media (max-width: 640px) {
  #forkongithub { display: none; }
}

/* ============================================================
   Section intro text (cards with descriptive lead paragraphs)
   ============================================================ */
.card-lead {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  margin-top: calc(-1 * var(--sp-2));
  margin-bottom: var(--sp-5);
  line-height: 1.65;
}

/* ============================================================
   Info / callout strip
   ============================================================ */
.callout {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  line-height: 1.65;
}
.callout.success { border-left-color: var(--color-success); }
.callout.warning { border-left-color: var(--color-warning); }
