/* Linked with media="(min-width: 768px)" so mobile never fetches or applies this file. */

@property --tie-n {
  syntax: "<integer>";
  inherits: false;
  initial-value: 0;
}
@property --tie-d {
  syntax: "<integer>";
  inherits: false;
  initial-value: 0;
}
@property --tie-c {
  syntax: "<integer>";
  inherits: false;
  initial-value: 0;
}

body {
  background-image: linear-gradient(
    to bottom,
    transparent calc(2rem - 1px),
    color-mix(in oklab, var(--rule) 70%, transparent) calc(2rem - 1px)
  );
  background-size: 100% 2rem;
}

.glass {
  background: color-mix(in oklab, var(--card) 72%, transparent);
  border: 1px solid color-mix(in oklab, var(--foreground) 11%, transparent);
  box-shadow:
    inset 0 1px 0 color-mix(in oklab, var(--foreground) 7%, transparent),
    0 18px 40px -24px rgb(0 0 0 / 0.55);
}
.panel {
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--card) 94%, var(--foreground) 6%),
    var(--card) 3.5rem
  );
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 color-mix(in oklab, var(--foreground) 6%, transparent);
}
.panel-hover {
  transition:
    border-color 200ms var(--ease-ledger, cubic-bezier(0.2, 0.8, 0.2, 1)),
    box-shadow 200ms var(--ease-ledger, cubic-bezier(0.2, 0.8, 0.2, 1)),
    translate 200ms var(--ease-ledger, cubic-bezier(0.2, 0.8, 0.2, 1));
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .panel-hover:hover {
    border-color: color-mix(in oklab, var(--signal) 55%, var(--border));
    translate: 0 -4px;
    box-shadow:
      inset 0 1px 0 color-mix(in oklab, var(--foreground) 6%, transparent),
      0 1px 0 0 var(--signal),
      0 16px 36px -22px color-mix(in oklab, var(--signal) 45%, transparent);
  }
}
.eyebrow {
  font-family: var(--font-geist-mono), monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.kbd {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 0.375rem;
  padding: 0 0.35rem;
  font-family: var(--font-geist-mono), monospace;
  font-size: 0.7rem;
  line-height: 1.25rem;
  color: var(--muted-foreground);
  background: var(--muted);
}
.ledger-total {
  border-bottom: 3px double color-mix(in oklab, var(--primary) 70%, var(--border));
}
.reveal::before {
  content: "";
  display: block;
  height: 1px;
  margin-bottom: 1.5rem;
  background: linear-gradient(90deg, var(--primary), var(--signal) 45%, transparent);
  transform-origin: left;
}

.ph {
  border-radius: 0.3rem;
  padding: 0 0.15rem;
  color: var(--highlight-foreground);
  background: color-mix(in oklab, var(--highlight) 16%, var(--card));
  box-shadow: inset 0 -1px 0 color-mix(in oklab, var(--highlight) 60%, transparent);
}
input.ph {
  font: inherit;
  border: 0;
  outline-offset: 1px;
  min-width: 4ch;
  max-width: 100%;
  vertical-align: baseline;
}
input.ph::placeholder {
  color: var(--highlight-foreground);
  opacity: 1;
}
.ph[data-posted] {
  color: var(--primary);
  background: color-mix(in oklab, var(--primary) 12%, var(--card));
  box-shadow: inset 0 -1px 0 color-mix(in oklab, var(--primary) 70%, transparent);
}
.posting {
  position: relative;
}
.posting::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0;
  pointer-events: none;
}

.ledger {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.ledger th {
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
}
.ledger td {
  padding: 0.85rem 0.75rem;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.ledger tbody {
  counter-reset: ledger-row;
}
.ledger tbody tr {
  counter-increment: ledger-row;
}
.ledger td[data-col="num"]::before {
  content: "W-" counter(ledger-row, decimal-leading-zero);
  white-space: nowrap;
}
.ledger tbody tr:nth-child(even) td {
  background: color-mix(in oklab, var(--card) 55%, transparent);
}
@media (max-width: 1279px) {
  .ledger thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .ledger tr {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr) auto;
    column-gap: 0.5rem;
    padding: 0.9rem 0.25rem;
    border-bottom: 1px solid var(--border);
  }
  .ledger td {
    display: block;
    padding: 0;
    border: 0;
    background: none !important;
    box-shadow: none !important;
  }
  .ledger td[data-col="num"] {
    grid-row: 1;
    grid-column: 1;
  }
  .ledger td[data-col="workflow"] {
    grid-row: 1;
    grid-column: 2;
  }
  .ledger td[data-col="save"] {
    grid-row: 1;
    grid-column: 3;
  }
  .ledger td[data-col="category"],
  .ledger td[data-col="tools"],
  .ledger td[data-col="source"] {
    grid-column: 2 / 4;
    margin-top: 0.5rem;
  }
}

.tick path {
  stroke-dasharray: 16;
  stroke-dashoffset: 0;
}
.copy-link .copy-done {
  display: none;
}
.copy-link[data-copied] .copy-idle {
  display: none;
}
.copy-link[data-copied] .copy-done {
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.animate-spin {
  animation: spin 1s linear infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Desktop only: gradients, blur, aurora, tie-out motion. Never applied on mobile. */
@media (min-width: 768px) {
  h1.text-gradient,
  .text-gradient {
    background: linear-gradient(100deg, var(--foreground) 30%, var(--primary) 70%, var(--signal));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
  }
  @media (forced-colors: active) {
    h1.text-gradient,
    .text-gradient {
      background: none;
      -webkit-background-clip: unset;
      background-clip: unset;
      color: CanvasText;
      -webkit-text-fill-color: CanvasText;
    }
  }
  .glass {
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
  }
  .palette::backdrop {
    background: color-mix(in oklab, var(--background) 60%, transparent);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
  .hero {
    min-height: 28rem;
    background: radial-gradient(80% 50% at 50% 0%, color-mix(in oklab, var(--primary) 10%, transparent), transparent 70%);
  }
  .hero-aurora,
  .hero-grid {
    display: block !important;
    position: absolute;
    pointer-events: none;
  }
  .hero-aurora {
    inset: -30% -15% -10%;
    z-index: -2;
    background:
      radial-gradient(38% 46% at 18% 32%, color-mix(in oklab, var(--primary) 24%, transparent), transparent 70%),
      radial-gradient(34% 42% at 82% 22%, color-mix(in oklab, var(--signal) 22%, transparent), transparent 70%),
      radial-gradient(30% 36% at 62% 86%, color-mix(in oklab, var(--highlight) 9%, transparent), transparent 70%);
  }
  .hero-grid {
    inset: 0;
    z-index: -1;
    background-image:
      linear-gradient(to right, color-mix(in oklab, var(--border) 55%, transparent) 1px, transparent 1px),
      linear-gradient(to bottom, color-mix(in oklab, var(--border) 55%, transparent) 1px, transparent 1px);
    background-size: 4rem 2rem;
    -webkit-mask-image: radial-gradient(75% 70% at 50% 35%, #000 30%, transparent 85%);
    mask-image: radial-gradient(75% 70% at 50% 35%, #000 30%, transparent 85%);
  }
  .tieout {
    display: block !important;
    font-family: var(--font-geist-mono), monospace;
    font-size: 0.8rem;
  }
  .tieout [data-t]::before {
    content: attr(data-t);
  }
  .tieout-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 9.5ch 1.5rem 9.5ch minmax(0, 1fr);
    align-items: center;
    gap: 0.6rem;
    height: 2.25rem;
    padding: 0 0.75rem;
    border-bottom: 1px dashed var(--border);
  }
  .tieout-bar {
    height: 0.45rem;
    border-radius: 999px;
    background: color-mix(in oklab, var(--muted-foreground) 30%, transparent);
    width: var(--w, 70%);
  }
  .tieout-row .tieout-bar:first-child {
    justify-self: end;
  }
  .tieout-amt {
    text-align: right;
    color: var(--foreground);
  }
  .tieout-tick {
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    color: var(--primary);
    background: color-mix(in oklab, var(--primary) 14%, transparent);
  }
  .tieout-tick path {
    stroke-dasharray: 20;
    stroke-dashoffset: 0;
  }
  .tieout-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 0.75rem 0.25rem;
  }
  .tieout-diff {
    --tie-n: 0;
    --tie-d: calc((var(--tie-n) - 50) / 100);
    --tie-c: calc(var(--tie-n) - var(--tie-d) * 100);
    counter-reset: tie-d var(--tie-d) tie-c var(--tie-c);
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 5vw, 3.25rem);
    line-height: 1;
    color: var(--primary);
  }
  .tieout-diff::before {
    content: "$" counter(tie-d) "." counter(tie-c, decimal-leading-zero);
  }
  .tieout-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-weight: 600;
    color: var(--primary-foreground);
    background: var(--primary);
  }
  .entry-split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 14rem;
  }
}

@media (prefers-reduced-motion: no-preference) and (min-width: 768px) {
  .tieout-row {
    animation: tie-row 700ms var(--ease-ledger, cubic-bezier(0.2, 0.8, 0.2, 1)) both;
    animation-delay: calc(350ms + var(--i) * 260ms);
  }
  .tieout-tick {
    animation: tie-pop 420ms var(--ease-ledger, cubic-bezier(0.2, 0.8, 0.2, 1)) both;
    animation-delay: calc(350ms + var(--i) * 260ms);
  }
  .tieout-tick path {
    animation: tie-draw 420ms var(--ease-ledger, cubic-bezier(0.2, 0.8, 0.2, 1)) both;
    animation-delay: calc(450ms + var(--i) * 260ms);
  }
  .tieout-diff {
    animation:
      tie-count 1250ms cubic-bezier(0.4, 0, 0.2, 1) 350ms both,
      tie-settle 300ms var(--ease-ledger, cubic-bezier(0.2, 0.8, 0.2, 1)) 1600ms both;
  }
  .tieout-status {
    animation: tie-status 450ms var(--ease-ledger, cubic-bezier(0.2, 0.8, 0.2, 1)) 1650ms both;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
  :is(tr, article):hover .tick path {
    animation: tie-draw 320ms var(--ease-ledger, cubic-bezier(0.2, 0.8, 0.2, 1)) both;
  }
  .posting[data-copied]::after {
    animation: posting 900ms var(--ease-ledger, cubic-bezier(0.2, 0.8, 0.2, 1));
  }
  .hero-aurora {
    animation: hero-drift 22s ease-in-out infinite alternate;
  }
  .reveal-ready .reveal.is-inview::before {
    animation: rule-draw 400ms var(--ease-ledger, cubic-bezier(0.2, 0.8, 0.2, 1)) both;
  }
}

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

@keyframes tie-row {
  0% {
    background: transparent;
  }
  35% {
    background: color-mix(in oklab, var(--primary) 12%, transparent);
  }
  100% {
    background: transparent;
  }
}
@keyframes tie-pop {
  from {
    scale: 0.4;
    opacity: 0;
  }
}
@keyframes tie-draw {
  from {
    stroke-dashoffset: 20;
  }
}
@keyframes tie-count {
  from {
    --tie-n: 41218;
  }
  to {
    --tie-n: 0;
  }
}
@keyframes tie-settle {
  from {
    color: var(--highlight-foreground);
  }
}
@keyframes tie-status {
  from {
    opacity: 0;
    scale: 0.85;
  }
}
@keyframes posting {
  0% {
    opacity: 1;
    transform: scaleX(0);
    transform-origin: left;
  }
  70% {
    opacity: 1;
    transform: scaleX(1);
  }
  100% {
    opacity: 0;
  }
}
@keyframes hero-drift {
  from {
    transform: translate3d(-3%, 2%, 0);
  }
  to {
    transform: translate3d(3%, -2%, 0);
  }
}
@keyframes rule-draw {
  from {
    transform: scaleX(0);
  }
}
