/* sendnote styles, following the phib / bankosegger.me look. */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/fonts/PlusJakartaSans-Variable.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --canvas: #1c1c1c;
  --stone: #312c28;
  --sand: #25221f;
  --ink: #f5f3f0;
  --muted: #ada59c;
  --linen: #3d3732;
  --accent: #f2884b;
  --error: #ff6b5e;
  --box: #242424;
  --box-line: #303030;

  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,
    "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
  --hairline: inset 0 0 0 1px var(--stone);
  --ease: cubic-bezier(0.2, 0, 0, 1);

  color-scheme: dark;
}

/* Base ------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--linen) transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "calt", "rlig";
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding: 2.5rem 16px;
  padding-top: max(2.5rem, env(safe-area-inset-top));
  padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

::selection {
  background: #f2884b33;
}

:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

/* Forms ------------------------------------------------------------------ */

button {
  -webkit-appearance: none;
  appearance: none;
  background: var(--canvas);
  border: 0;
  box-shadow: var(--hairline);
  color: var(--muted);
  font: 700 0.91rem/1.2 var(--font);
  padding: 9px 16px;
  border-radius: 9999px;
  cursor: pointer;
  transition:
    transform 0.14s var(--ease),
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

button:hover {
  background: var(--sand);
  color: var(--ink);
}

button:active {
  transform: scale(0.96);
}

button[disabled],
input[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

button[disabled]:active {
  transform: none;
}

button.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

button.primary:hover:not(:disabled) {
  background: #f49a63;
  color: #fff;
}

button.ghost {
  background: transparent;
}

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

#compose .primary,
#result .ghost,
#reveal .primary {
  width: 100%;
}

input[type="text"],
input[type="password"],
textarea,
select {
  background: var(--canvas);
  border: 1px solid var(--stone);
  color: var(--ink);
  font-family: var(--font);
  font-size: 0.945rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 4px;
  min-height: 34px;
  transition: border-color 0.16s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  padding: 14px;
  line-height: 1.55;
}

textarea::placeholder,
input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

select {
  font-size: 0.875rem;
  cursor: pointer;
}

label {
  color: var(--muted);
  font-size: 0.875rem;
}

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

.wrap {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand h1 {
  margin: 0 0 0.4rem;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.brand h1 a {
  color: var(--ink);
}

.brand h1 a:hover {
  text-decoration: none;
}

.tag {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.compose-layout {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  background: var(--box);
  box-shadow: inset 0 0 0 1px var(--box-line);
  border-radius: 8px;
}

#compose {
  container-type: inline-size;
}

.options-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: min(480px, 60vh);
  overflow-y: auto;
}

.option-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--box-line);
}

.option-row:first-child {
  padding-top: 0;
}

.option-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.option-stack {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem;
}

.row > label {
  flex-shrink: 0;
}

.toggle-btn {
  min-width: 56px;
  padding: 6px 14px;
  font-size: 0.8125rem;
}

.toggle-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

.toggle-btn[aria-pressed="true"]:hover {
  background: #f49a63;
  color: #fff;
}

.password-field {
  display: flex;
  gap: 0.5rem;
}

.password-field input {
  flex: 1;
  min-width: 0;
}

.password-field button {
  flex-shrink: 0;
}

#reveal-gate,
#reveal-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* File input / image ----------------------------------------------------- */

input[type="file"] {
  font: inherit;
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 100%;
  direction: rtl;
  text-align: right;
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  -webkit-appearance: none;
  appearance: none;
  font: 700 0.8125rem/1.2 var(--font);
  color: var(--muted);
  background: var(--canvas);
  border: 1px solid var(--stone);
  border-radius: 9999px;
  padding: 6px 14px;
  margin-left: 10px;
  cursor: pointer;
  transition:
    background 0.16s ease,
    color 0.16s ease;
}

input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  background: var(--sand);
  color: var(--ink);
}

.image-preview {
  display: block;
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 4px;
}

.image-preview-wrap {
  position: relative;
  display: flex;
  height: 200px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--box-line);
}

.image-preview-wrap .image-preview {
  height: 100%;
  max-height: none;
  border-radius: 0;
}

.image-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(28 28 28 / 85%);
  font-size: 0.75rem;
  line-height: 1;
}

/* Result / reveal -------------------------------------------------------- */

.link-row {
  display: flex;
  gap: 0.5rem;
}

.link-row input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

#copy-btn {
  flex-shrink: 0;
}

#revealed-text {
  margin: 0;
  padding: 0.875rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.55;
  background: var(--canvas);
  border: 1px solid var(--stone);
  border-radius: 4px;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.small {
  font-size: 0.75rem;
}

.error {
  margin: 0;
  color: var(--error);
  font-size: 0.8125rem;
}

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 7px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: 0.7;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

.foot {
  width: 100%;
  max-width: 440px;
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.7;
}

.foot p {
  margin: 0 0 0.25rem;
}

.foot .sep {
  margin: 0 6px;
}

.foot a {
  color: var(--muted);
}

.foot a:hover {
  color: var(--ink);
}

/* How it works ----------------------------------------------------------- */

.page-how-it-works.wrap,
.page-how-it-works + .foot {
  max-width: 560px;
}

.page-how-it-works.wrap {
  gap: 0.75rem;
}

.page-how-it-works .brand {
  margin-bottom: 0.75rem;
}

.prose h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.006em;
  line-height: 1.25;
}

.prose p,
.prose ol,
.prose ul {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.65;
}

.prose ol,
.prose ul {
  padding-left: 18px;
}

.prose li + li {
  margin-top: 6px;
}

.prose li strong {
  color: var(--ink);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink);
  background: var(--canvas);
  box-shadow: var(--hairline);
  border-radius: 4px;
  padding: 1px 5px;
}

.url-sample {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink) !important;
  background: var(--canvas);
  box-shadow: var(--hairline);
  border-radius: 4px;
  padding: 10px 12px;
  overflow-x: auto;
  white-space: nowrap;
}

.back-link {
  align-self: flex-start;
  color: var(--muted);
  font-size: 0.875rem;
}

.back-link:hover {
  color: var(--ink);
}

/* Responsive ------------------------------------------------------------- */

/* 16px keeps iOS Safari from zooming in when a field gains focus. */
@media (max-width: 685px) {
  input,
  textarea,
  select {
    font-size: 16px;
  }
}

@media (max-width: 520px) {
  body {
    justify-content: flex-start;
    padding-top: max(1.5rem, env(safe-area-inset-top));
  }

  .brand h1 {
    font-size: 1.75rem;
  }

  textarea {
    min-height: 160px;
  }

  .row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  select,
  input[type="file"] {
    width: 100%;
  }

  .toggle-btn {
    align-self: flex-start;
  }

  .link-row {
    flex-direction: column;
  }
}

@media (min-width: 860px) {
  /* The compose view puts the textarea and options side by side. */
  .wrap:has(#compose:not([hidden])),
  body:has(#compose:not([hidden])) .foot {
    max-width: 820px;
  }

  .compose-layout {
    flex-direction: row;
    align-items: flex-start;
  }

  .compose-layout textarea {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 340px;
  }

  .compose-layout .card {
    flex: 0 0 320px;
  }
}

@container (max-width: 360px) {
  .row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  select,
  input[type="file"] {
    width: 100%;
  }

  .toggle-btn {
    align-self: flex-start;
  }
}
