:root {
  color-scheme: light;
  --paper: #f6f2ea;
  --ink: #171512;
  --line: #e2dbce;
}

* {
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--paper);
  color: var(--ink);
  font-feature-settings: 'ss01' on, 'cv02' on, 'cv03' on, 'cv04' on;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(56rem 34rem at 82% -8%, rgba(222, 78, 42, 0.09), transparent 66%),
    radial-gradient(48rem 30rem at -12% 28%, rgba(44, 74, 62, 0.07), transparent 64%),
    linear-gradient(180deg, #f8f4ed 0%, var(--paper) 46%, #f2eee5 100%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.16'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

::selection {
  background: #f2c9b8;
  color: var(--ink);
}

a,
button,
input,
textarea,
label,
summary {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

input,
textarea {
  font-family: inherit;
}

input::placeholder,
textarea::placeholder {
  color: #a39a8c;
}

/* A soft, papery scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #cdc4b4 transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: #cdc4b4;
  border-radius: 999px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}

.grain-card {
  background-image: radial-gradient(rgba(23, 21, 18, 0.035) 0.6px, transparent 0.6px);
  background-size: 5px 5px;
}

.dot-pulse {
  animation: dot-pulse 1.4s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.spin {
  animation: spin 0.8s linear infinite;
}

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

.reveal {
  animation: reveal 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.tab[aria-selected='true'] {
  background: #fffdf8;
  color: #171512;
  box-shadow:
    0 1px 0 rgba(23, 21, 18, 0.04),
    0 3px 10px -4px rgba(23, 21, 18, 0.16);
}

.tab[aria-selected='false']:hover {
  color: #171512;
  background: rgba(255, 253, 248, 0.55);
}

.confirm-dialog::backdrop {
  background: rgba(23, 21, 18, 0.32);
  backdrop-filter: blur(3px);
}

.app-dialog::backdrop {
  background: rgba(23, 21, 18, 0.32);
  backdrop-filter: blur(3px);
}

.app-dialog[open] {
  animation: dialog-in 0.28s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


.result-link {
  font-family: 'SFMono-Regular', ui-monospace, 'Cascadia Mono', 'Roboto Mono', Menlo, monospace;
  font-size: 12.5px;
  letter-spacing: -0.01em;
}

.recent-card {
  transition:
    transform 0.25s ease,
    border-color 0.25s ease,
    background-color 0.25s ease,
    box-shadow 0.25s ease;
}

.recent-card:hover {
  transform: translateY(-2px);
  border-color: #cfc5b4;
  background: #fffdf8;
  box-shadow: 0 18px 40px -30px rgba(23, 21, 18, 0.4);
}


@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal-slow {
  animation: reveal 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.caret-accent {
  caret-color: #de4e2a;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.underline-grow {
  position: relative;
}
.underline-grow::after {
  content: '';
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -3px;
  height: 1px;
  background: currentColor;
  transition: right 0.25s ease;
}
.underline-grow:hover::after {
  right: 0;
}

/* Notepad canvas */
.note-canvas {
  background-image: linear-gradient(to bottom, transparent calc(100% - 1px), #e7e0d3 1px);
  background-size: 100% 2.25rem;
  line-height: 2.25rem;
}

.note-canvas:focus {
  background-image: linear-gradient(to bottom, transparent calc(100% - 1px), #d8cfbf 1px);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
