/* =========================================================
   Privnote — "basic" palette + "decrypt" logo preset.
   Terminal aesthetic. Single font family (Inter).
   ========================================================= */

:root{
  --bg:     #000000;
  --ink:    #ffffff;
  --dim:    #8c8c8c;
  --faint:  #3a3a3a;
  --rule:   #1c1c1c;
  --accent: #ffffff;
  --selection: rgba(255,255,255,.12);
  --err:    #ff6b5b;
}

*{ box-sizing: border-box }
::selection{ background: var(--selection); }
html, body{
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body{ overflow: hidden; }

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

.page{
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* ============ Header ============ */
header{
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 40px;
}

.wm{
  display: inline-flex; align-items: center;
  color: var(--ink);
  line-height: 1;
}

/* Prompt-style wordmark (with decrypt animation driven from JS) */
.wm--prompt{ display: inline-flex; align-items: baseline; gap: 10px; }
.wm--prompt .wm-arrow{
  font-weight: 700; font-size: 30px;
  color: var(--dim);
  line-height: 1;
}
.wm--prompt .wm-name{
  font-weight: 500; font-size: 30px;
  letter-spacing: -.028em;
  font-variant-numeric: tabular-nums; /* stable width during decrypt */
  min-width: 9ch;
  display: inline-block;
}

/* ============ Main / sections ============ */
main{
  position: relative;
  overflow: hidden;
  padding: 4vh 8vw 0;
  display: flex; flex-direction: column;
}
main > section{
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 0;
}
main > section[hidden]{ display: none; }

/* ============ Compose ============ */
.compose{
  display: flex; flex-direction: column;
  height: 100%; min-height: 0;
  gap: 18px;
}

textarea.note{
  flex: 1; width: 100%;
  background: transparent; border: 0; outline: none; resize: none;
  color: var(--ink); caret-color: var(--ink);
  padding: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 20px;
  line-height: 1.55;
  letter-spacing: .005em;
  transition: filter .5s ease, opacity .5s ease, transform .5s ease;
}
.compose.burning textarea.note{
  opacity: 0; filter: blur(8px); transform: translateY(-12px);
}
textarea.note::placeholder{ color: var(--faint); }

/* Focus accent — hairline */
.focus-line{
  position: relative;
  height: 1px;
  background: var(--rule);
  margin-top: 6px;
  overflow: hidden;
}
.focus-line::after{
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 0; background: var(--ink);
  transition: width .45s cubic-bezier(.2,.7,.2,1);
}
.compose.focused .focus-line::after{ width: 100%; }

/* ============ Result-style views ============ */
.result{
  display: flex; flex-direction: column; justify-content: center;
  height: 100%;
  gap: 24px;
  max-width: 920px; margin: 0 auto; width: 100%;
  animation: rise .55s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes rise{
  from{ opacity: 0; transform: translateY(14px); filter: blur(6px); }
  to{   opacity: 1; transform: none; filter: none; }
}
.result .kicker{
  font: 500 15px/1.3 "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  letter-spacing: 0;
  color: var(--dim);
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 -4px;
  white-space: nowrap;
}
.result .kicker .flame{ font-size: 17px; line-height: 1; }
.result h1{
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 400; font-style: italic;
  font-size: clamp(48px, 7vw, 96px); line-height: .92;
  margin: 0;
  color: var(--ink); letter-spacing: -.01em;
}
.result .sub{
  font: 400 15px/1.6 "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--dim); max-width: 58ch;
  margin: 0;
}
.result .sub b{ color: var(--ink); font-weight: 500; }
.result .sub-note{ margin-top: -10px; }

/* Link / input rows */
.link{
  display: flex; align-items: stretch;
  border-top: .5px solid var(--rule);
  border-bottom: .5px solid var(--rule);
  margin-top: 6px;
}
.link code,
.link input{
  flex: 1; min-width: 0;
  padding: 22px 0;
  font: 500 17px/1.4 "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  letter-spacing: .003em;
  background: transparent; border: 0; outline: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link code{ cursor: text; }
.link code:focus{ outline: none; }
.link input::placeholder{
  color: var(--faint);
  letter-spacing: .04em;
  font-size: 15px;
}
.link button{
  appearance: none; background: transparent; border: 0;
  padding: 0 0 0 24px;
  font: 500 11px/1 "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--dim); cursor: pointer;
  transition: color .15s ease;
  border-left: .5px solid var(--rule);
  margin-left: 24px;
}
.link button:hover{ color: var(--ink); }
.link button.copied{ color: var(--ink); }

/* Plain "← back" / link-style button */
.again{
  appearance: none; background: transparent; border: 0; padding: 0;
  align-self: flex-start;
  font: 500 11px/1 "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--dim); cursor: pointer;
  white-space: nowrap;
  transition: color .15s ease;
}
.again:hover{ color: var(--ink); }
.again.copied{ color: var(--ink); }

/* Inline pill (for confirm view) */
.send.send-inline{
  align-self: flex-start;
  margin-top: 8px;
}

/* Plaintext reveal */
pre.plaintext{
  background: transparent;
  border-top: .5px solid var(--rule);
  border-bottom: .5px solid var(--rule);
  padding: 22px 0;
  margin: 6px 0 0;
  font: 400 16px/1.6 "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 56vh;
  overflow: auto;
  outline: none;
}

.reveal-rail{
  display: flex; gap: 24px; flex-wrap: wrap;
  margin-top: 4px;
}

/* ============ Bottom rail ============ */
.rail{
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 28px;
  padding: 18px 40px;
  border-top: .5px solid var(--rule);
  font-size: 11.5px;
  letter-spacing: .005em;
}
.rail[hidden]{ display: none; }

/* TTL chips */
.ttl{ display: flex; align-items: baseline; gap: 0; }
.ttl .lbl{
  font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--dim); margin-right: 16px;
  white-space: nowrap;
}
.ttl button{
  appearance: none; background: transparent; border: 0; cursor: pointer;
  padding: 6px 10px;
  font: 500 12px/1 "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--dim);
  letter-spacing: .02em;
  transition: color .12s ease;
}
.ttl button:hover{ color: var(--ink); }
.ttl button[aria-checked="true"]{
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1.5px;
}

/* Counter */
.counter{
  justify-self: start;
  color: var(--dim);
  font-size: 11px; letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  padding-left: 12px;
  display: inline-flex; align-items: center; gap: 12px;
  opacity: 0;
  transition: opacity .25s ease, color .2s ease;
}
.counter.show{ opacity: 1; }
.counter.warn{ color: var(--ink); }
.counter .meter{
  width: 56px; height: 1px; background: var(--rule);
  position: relative; overflow: hidden;
  opacity: 0; transition: opacity .3s ease;
}
.counter.warn .meter{ opacity: 1; }
.counter .meter i{
  display: block; height: 100%; width: 0%;
  background: var(--ink); transition: width .25s ease;
}

/* Lock toggle */
.lock{
  appearance: none; background: transparent; border: 0;
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; padding: 6px 0;
  font: 500 10.5px/1 "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--dim);
  transition: color .15s ease;
  white-space: nowrap;
}
.lock:hover{ color: var(--ink); }
.lock[aria-pressed="true"]{ color: var(--ink); }
.lock svg{ width: 14px; height: 14px; }
.lock .i-lock-closed{ display: none; }
.lock[aria-pressed="true"] .i-lock-open{ display: none; }
.lock[aria-pressed="true"] .i-lock-closed{ display: inline-block; }

/* Submit pill — the only filled button */
.send{
  appearance: none; cursor: pointer;
  background: var(--ink); color: var(--bg);
  border: 0; border-radius: 999px;
  padding: 12px 22px;
  font: 500 11px/1 "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  letter-spacing: .22em; text-transform: uppercase;
  display: inline-flex; align-items: center;
  transition: transform .2s ease, opacity .2s ease, background .2s ease, color .2s ease;
  white-space: nowrap;
}
.send:disabled{
  background: transparent; color: var(--faint);
  box-shadow: inset 0 0 0 1px var(--rule);
  cursor: not-allowed;
}
.send:not(:disabled):hover{
  background: color-mix(in oklab, var(--ink) 88%, var(--bg));
}
.send:not(:disabled):active{ transform: translateY(1px); }

/* Password slide-out */
.pwd-row{
  grid-column: 1 / -1;
  overflow: hidden;
  max-height: 0;
  transition: max-height .25s ease, padding .25s ease, border-color .25s ease;
  border-top: .5px solid transparent;
  padding: 0;
}
.pwd-row.open{
  max-height: 64px;
  padding: 14px 0 4px;
  border-top-color: var(--rule);
}
.pwd-row input{
  width: 100%;
  background: transparent; border: 0; outline: none;
  color: var(--ink); caret-color: var(--ink);
  font: 400 16px/1 "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  letter-spacing: .08em;
  padding: 6px 0;
}
.pwd-row input::placeholder{
  color: var(--faint); letter-spacing: .04em;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 14px;
}

/* ============ Error ============ */
.error{
  font: 500 11px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  letter-spacing: .04em;
  color: var(--err);
}
.error-banner{
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: var(--bg);
  border: .5px solid var(--err);
  border-radius: 999px;
  color: var(--err);
  z-index: 100;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  animation: rise .35s ease both;
}

/* ============ Responsive ============ */
@media (max-width: 1024px){
  header{ padding: 22px 32px; }
  main{ padding: 4vh 6vw 0; }
  .rail{ padding: 16px 32px; gap: 22px; }
}

@media (max-width: 720px){
  header{ padding: 18px 20px; }
  main{ padding: 3vh 20px 0; }
  .rail{
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "ttl ttl"
      "lock send";
    padding: 14px 20px;
    gap: 16px 12px;
    row-gap: 14px;
  }
  .rail .ttl{ grid-area: ttl; flex-wrap: wrap; }
  .rail .lock{ grid-area: lock; justify-self: start; }
  .rail .send{ grid-area: send; justify-self: end; padding: 11px 18px; }
  .rail .counter{ display: none; }
  .ttl .lbl{ display: none; }
  .ttl button{ padding: 6px 8px; }

  textarea.note{ font-size: 18px !important; line-height: 1.5 !important; }

  .wm--prompt .wm-arrow{ font-size: 24px; }
  .wm--prompt .wm-name{ font-size: 24px; min-width: 8ch; }

  .result h1{ font-size: clamp(36px, 11vw, 56px); }
  .result .sub{ font-size: 14px; }
  .link code,
  .link input{ font-size: 13px; padding: 16px 0; }
  .link button{ padding-left: 14px; margin-left: 14px; font-size: 10px; letter-spacing: .18em; }

  pre.plaintext{ font-size: 14px; padding: 16px 0; }

  .pwd-row.open{ max-height: 56px; }
}

@media (max-width: 420px){
  header{ padding: 16px 16px; }
  main{ padding: 3vh 16px 0; }
  .rail{ padding: 12px 16px; }

  .wm--prompt .wm-arrow{ font-size: 22px; }
  .wm--prompt .wm-name{ font-size: 22px; }

  textarea.note{ font-size: 16px !important; }
  .ttl button{ font-size: 11px; padding: 6px 6px; }
  .send{ font-size: 10.5px; padding: 10px 14px; letter-spacing: .18em; }
  .lock{ font-size: 10px; letter-spacing: .18em; }
}

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
