/* Page-specific layout on top of tokens.css. No color/font overrides here —
   only composition. If you need a new token, add it to tokens.css. */

/* --- Site header ---------------------------------------------------- */
.site-header {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-4) var(--sp-2);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-4);
  border-bottom: 1px solid var(--color-border);
}
.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.01em;
}
.site-header .wordmark a { color: inherit; text-decoration: none; }
.site-header nav {
  display: flex;
  gap: var(--sp-4);
  margin-left: auto;
  font-size: var(--fs-sm);
}
.site-header nav a {
  color: var(--color-text-muted);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
}
.site-header nav a.active {
  color: var(--color-text-primary);
  background: var(--color-border);
}
.site-header .tagline {
  width: 100%;
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  font-style: italic;
}

/* --- Tabs (send page) ---------------------------------------------- */
.tabs {
  display: flex;
  gap: var(--sp-2);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}
.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-weight: 500;
}
.tabs button.active {
  color: var(--color-text-primary);
  border-bottom-color: var(--color-accent);
}
.tabs button:hover { color: var(--color-text-primary); }

/* Full-width rule above doesn't apply to tab buttons on mobile. */
@media (max-width: 640px) {
  .tabs button { width: auto; flex: 1; min-width: 0; }
}

/* --- Form grid: label above control on mobile, two-col on desktop -- */
.field { display: block; margin-bottom: var(--sp-4); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
}

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

/* --- Dropzone "has file" state ------------------------------------- */
.dropzone.filled {
  border-style: solid;
  border-color: var(--color-accent);
  background: #FFFBF5;
  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);
}

/* --- Collapsible encrypt-input region ------------------------------ */
/* Folds the message/file/options form away once the user hits
   Encrypt & Upload, so the progress and share URL get the full card. */
.enc-inputs {
  overflow: hidden;
  max-height: 2400px;
  opacity: 1;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s ease,
              margin 0.4s ease;
}
#sendCard.encrypting .enc-inputs {
  max-height: 0;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}

/* --- Share URL result block ---------------------------------------- */
.url-result .code-block { margin-bottom: var(--sp-3); }
.url-result .code-block .obj { color: #4A9CE8; }
.url-result .code-block .frag { color: #FF851B; }
.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, 8px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.url-result .qr-code svg { display: block; width: 100%; height: 100%; }
.url-result .qr-hint { margin: 0; font-size: var(--fs-sm); }

/* --- Tunnel file list ---------------------------------------------- */
table.filelist {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
table.filelist th, table.filelist td {
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
table.filelist th {
  font-weight: 500;
  color: var(--color-text-muted);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
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-sm);
  margin-left: var(--sp-2);
  width: auto;
}
table.filelist td.name {
  font-family: var(--font-mono);
  word-break: break-all;
}
@media (max-width: 640px) {
  table.filelist th:nth-child(2),
  table.filelist td:nth-child(2) { display: none; } /* hide size column */
  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);
}
.checkbox-row input[type="checkbox"] { width: auto; }
.checkbox-row label { margin: 0; }

/* --- FAQ ------------------------------------------------------------ */
.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: 500;
  color: var(--color-text-primary);
}
.faq p { margin: var(--sp-3) 0 0; font-size: var(--fs-sm); color: var(--color-text-muted); }

/* --- 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);
}

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

/* --- Progress flow ------------------------------------------------- */
/* A vertical step list with a rail down the left and a state icon
   next to each step. Shows what the app is doing (and did) so the
   user can see exactly where their data is in the pipeline. */
.progress-flow-container {
  background: #FAF6EE;
  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);
  /* left padding = icon width (20px at left:4px => right edge 24px) + gutter.
     Bumping from var(--sp-6) to (sp-6 + sp-3) gives a 12px gap between the
     tick circle and the label text. */
  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 .2s ease;
}
/* Vertical rail connecting the step icons. */
.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; }

/* The round state 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 .25s ease, background .25s ease, transform .25s ease;
  z-index: 1;
}

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

/* ---- state: 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.08);
}
.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.75s linear infinite;
}
@keyframes pf-spin { to { transform: rotate(360deg); } }

/* ---- state: 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, #2E7D5B);
  border-color: var(--color-success, #2E7D5B);
}
.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);
}

/* ---- state: 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.3s 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); }
  25%      { transform: translateY(-50%) translateX(-3px); }
  75%      { transform: translateY(-50%) translateX(3px); }
}

/* --- Image zoom modal --------------------------------------------- */
.image-modal {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 24, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  cursor: zoom-out;
  animation: pf-fadein .2s ease;
}
@keyframes pf-fadein { from { opacity: 0; } to { opacity: 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: 95vw;
  max-height: 90vh;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  display: block;
  object-fit: contain;
}
.image-modal-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 22px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}
.image-modal-close:hover { background: var(--color-border); }

/* Make the preview image a clickable affordance. */
img.preview { cursor: zoom-in; transition: transform .15s ease; }
img.preview:hover { transform: translateY(-1px); }

/* --- "Fork me on GitHub" corner ribbon ----------------------------- */
/* Classic 45-degree ribbon in the top-right corner, ported from the
   original site. Uses the brand tokens: dark terminal bg with brand
   red on hover. Hidden on narrow screens so it never crowds the nav. */
#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-sm);
  line-height: 2rem;
  padding: 4px 0;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: background .2s ease, color .2s ease;
}
#forkongithub a::before,
#forkongithub a::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.4);
}
#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; }
}
