/* Store, account and admin pages. Builds on /style.css tokens (buttons live there too). */

:root {
  --bad: #B42318;   /* 5.6:1 on paper */
  --ok:  #1E7A46;   /* 4.5:1 on paper */
}
.dark { --bad: #FF8A7A; --ok: #7FD3A0; }

.page { padding-top: clamp(40px, 7vh, 80px); padding-bottom: 112px; }
.page-narrow > * { max-width: 700px; }
.page h1 { font-size: clamp(2.25rem, 5vw, 3.75rem); max-width: 18ch; margin-top: 0; }
.page > .label + h1 { margin-top: 14px; }
.page .lede { margin-top: 20px; max-width: 60ch; }
.page h2 { font: 700 1.5rem/1.2 var(--display); letter-spacing: -.015em; }
.page h3 { font: 700 1.125rem/1.3 var(--display); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 40px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.spread { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: baseline; }
[hidden] { display: none !important; }

/* Forms */
.form { display: grid; gap: 20px; }
.field { display: grid; gap: 8px; }
.field > label, .field > .field-label { font: 600 .9375rem/1.3 var(--sans); }
.hint { font-size: .875rem; color: var(--muted); }
.input, .form input:not([type=radio]):not([type=checkbox]):not([type=file]), .form select, .form textarea {
  width: 100%;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--control);
  border-radius: 8px;
  padding: 11px 13px;
  font: 400 1rem/1.4 var(--sans);
}
.form input::placeholder, .form textarea::placeholder { color: var(--muted); opacity: 1; }
.form textarea { min-height: 150px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(35, 71, 230, .2); }
.form input[aria-invalid=true], .form textarea[aria-invalid=true], .form select[aria-invalid=true] { border-color: var(--bad); }
.form input[type=file] { width: 100%; font: 400 .9375rem var(--sans); color: var(--muted); border: 2px dashed var(--control); border-radius: 8px; padding: 12px; background: var(--surface); }
.form input[type=file]::file-selector-button { font: 600 .875rem var(--sans); color: var(--bg); background: var(--ink); border: 0; border-radius: 6px; padding: 8px 14px; margin-right: 12px; cursor: pointer; }
.field-error { color: var(--bad); font-size: .875rem; }
.form-error { color: var(--bad); border-left: 3px solid var(--bad); padding: 4px 0 4px 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

/* Choice tiles (customer type, etc.) */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span {
  display: block;
  height: 100%;
  border: 2px solid var(--control);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s;
}
.choice span:hover { border-color: var(--ink); }
.choice strong { display: block; font-weight: 600; }
.choice small { display: block; margin-top: 4px; color: var(--muted); font-size: .875rem; line-height: 1.4; }
.choice input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #EEF1FD; }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons: base styles are in /style.css */
.btn:disabled { opacity: .5; cursor: progress; }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.btn-small { min-height: 36px; padding: 0 14px; font-size: .875rem; border-width: 1.5px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; font: inherit; }
.linkish:hover { color: var(--ink); }

/* Panels */
.panel { border: 1px solid var(--line); border-radius: 14px; padding: clamp(20px, 3vw, 28px); background: var(--surface); }
.panel-accent { border: 2px solid var(--accent); }
.notice { border-left: 3px solid var(--accent); padding: 4px 0 4px 14px; color: var(--ink); }
.notice-bad { border-left-color: var(--bad); }

/* Price display */
.price { font: 800 clamp(1.75rem, 4vw, 2.5rem)/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.price .to { color: var(--muted); margin: 0 .35ch; }
.includes { list-style: none; display: grid; gap: 6px; }
.includes li::before { content: '+'; color: var(--ok); font: 600 1rem var(--mono); margin-right: 1ch; }

/* Status chip */
.status { display: inline-block; font: 600 .8125rem/1 var(--sans); padding: 7px 12px; border-radius: 999px; border: 1.5px solid var(--control); color: var(--muted); background: var(--surface); white-space: nowrap; }
.status-live { color: var(--accent); border-color: var(--accent); }
.status-done { color: var(--ok); border-color: var(--ok); }
.status-dead { color: var(--muted); border-style: dashed; }

/* Order route: each status is a hop on the way to delivery */
.trace { list-style: none; position: relative; display: grid; gap: 0; font-size: .9375rem; }
.trace li { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding: 0 0 18px; color: var(--muted); }
.trace li::before { content: ''; position: absolute; left: 10px; top: 14px; bottom: -2px; width: 1px; background: var(--line); }
.trace li:last-child::before { display: none; }
.trace .node { width: 12px; height: 12px; margin: 4px 0 0 5px; border-radius: 50%; border: 2px solid var(--control); background: var(--surface); position: relative; z-index: 1; }
.trace .done { color: var(--ink); }
.trace .done .node { background: var(--ok); border-color: var(--ok); }
.trace .done::before { background: var(--ok); }
.trace .current { color: var(--ink); font-weight: 600; }
.trace .current .node { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(35, 71, 230, .18); }
@media (prefers-reduced-motion: no-preference) {
  .trace .current .node { animation: ping 2.4s ease-out infinite; }
  @keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(35, 71, 230, .45); } 70%, 100% { box-shadow: 0 0 0 9px rgba(35, 71, 230, 0); } }
}
@media (min-width: 900px) {
  .trace-wide { grid-auto-flow: column; grid-auto-columns: 1fr; }
  .trace-wide li { grid-template-columns: 1fr; grid-template-rows: 22px auto; gap: 8px; padding: 0 12px 0 0; }
  .trace-wide li::before { left: 16px; right: 0; top: 10px; bottom: auto; width: auto; height: 1px; }
  .trace-wide .node { margin: 5px 0 0 0; }
}

/* Store */
.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 40px; }
.listing { display: grid; grid-template-rows: auto 1fr; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-decoration: none; background: var(--surface); transition: border-color .15s, transform .15s; }
.listing:hover { border-color: var(--ink); }
.listing:hover h3 { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.listing-shot { aspect-ratio: 16 / 10; background: var(--navy); display: grid; place-items: center; color: #AEBBCB; font-family: var(--mono); font-size: .8125rem; }
.listing-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.listing-body { padding: 20px; display: grid; gap: 10px; align-content: start; }
.listing-body p { color: var(--muted); font-size: .9375rem; line-height: 1.5; }
.listing-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 6px; }
.listing-foot .price { font-size: 1.25rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }
.chips li { font: 500 .8125rem/1 var(--sans); padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.gallery { display: grid; gap: 10px; }
.gallery img { width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; }
.item-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; margin-top: 40px; }
.item-layout .panel { position: sticky; top: 24px; }
@media (max-width: 860px) { .item-layout { grid-template-columns: 1fr; } .item-layout .panel { position: static; } }
.prose { max-width: 68ch; white-space: pre-line; }
.empty { border: 2px dashed var(--control); border-radius: 14px; padding: 40px 24px; text-align: center; color: var(--muted); }

/* Order detail */
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: clamp(28px, 4vw, 56px); align-items: start; margin-top: 36px; }
@media (max-width: 960px) { .order-layout { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; font-size: .9375rem; }
.kv dt { color: var(--muted); }
.files { list-style: none; display: grid; gap: 8px; }
.files li { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: .9375rem; background: var(--surface); }
.files .meta { color: var(--muted); font: 400 .8125rem/1 var(--mono); }

/* Orders list */
.order-rows { list-style: none; border-top: 2px solid var(--ink); margin-top: 32px; }
.order-rows li { border-bottom: 1px solid var(--line); }
.order-rows a { display: grid; grid-template-columns: 9.5rem 1fr auto; gap: 16px; align-items: center; padding: 18px 0; text-decoration: none; }
.order-rows a:hover .t { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.order-rows .id { font: 400 .8125rem/1 var(--mono); color: var(--muted); }
@media (max-width: 640px) { .order-rows a { grid-template-columns: 1fr auto; } .order-rows .id { grid-column: 1 / -1; } }

/* Chat */
.chat { border: 1px solid var(--line); border-radius: 14px; display: grid; grid-template-rows: auto 1fr auto; max-height: 640px; min-height: 360px; background: var(--surface); }
.chat-head { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.chat-log { overflow-y: auto; padding: 18px; display: grid; gap: 14px; align-content: start; }
.msg { max-width: 82%; display: grid; gap: 4px; }
.msg .who { font: 400 .75rem/1 var(--mono); color: var(--muted); }
.msg .bubble { padding: 10px 14px; border-radius: 12px; background: var(--raise); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-mine { justify-self: end; }
.msg-mine .who { text-align: right; }
.msg-mine .bubble { background: var(--navy); color: #F8FAFB; }
.msg-system { justify-self: center; max-width: 100%; }
.msg-system .bubble { background: none; padding: 0; color: var(--muted); font-size: .8125rem; line-height: 1.4; text-align: center; }
.chat-form { border-top: 1px solid var(--line); padding: 12px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.chat-form textarea { min-height: 46px; max-height: 160px; resize: vertical; background: var(--surface); color: var(--ink); border: 2px solid var(--control); border-radius: 8px; padding: 11px 12px; font: 400 .9375rem/1.4 var(--sans); }
.chat-tools { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; font-size: .8125rem; color: var(--muted); }

/* Admin */
.admin-bar { background: var(--navy); }
.admin-bar .wrap { display: flex; flex-wrap: wrap; gap: 4px 22px; min-height: 44px; align-items: center; font: 500 .875rem/1 var(--sans); }
.admin-bar a { color: #AEBBCB; text-decoration: none; padding-block: 6px; }
.admin-bar a:hover { color: #F8FAFB; }
.admin-bar a[aria-current=page] { color: #F8FAFB; box-shadow: inset 0 -2px 0 #F8FAFB; }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th { text-align: left; font: 600 .8125rem/1.4 var(--sans); color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--ink); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:hover td { background: var(--surface); }
.badge { font: 600 .75rem/1 var(--sans); padding: 4px 8px; border-radius: 99px; background: #FBE4E1; color: var(--bad); }
.badge-quiet { background: var(--raise); color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.filters select { background: var(--surface); color: var(--ink); border: 2px solid var(--control); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: .875rem; }
.actions { display: grid; gap: 16px; }
.actions form { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; }
.preview-table { font-family: var(--mono); font-size: .8125rem; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); border: 1px solid var(--navy); color: #F8FAFB; padding: 12px 18px; border-radius: 10px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px -10px rgba(14, 26, 43, .5); }
.toast-bad { background: var(--bad); border-color: var(--bad); }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.order-layout > aside { position: sticky; top: 24px; display: grid; gap: 16px; }
@media (max-width: 960px) { .order-layout > aside { position: static; } }
.price .cur { font-size: .5em; color: var(--muted); margin-right: .4ch; vertical-align: .3em; letter-spacing: 0; }
.order-layout .price { font-size: clamp(1.75rem, 3vw, 2.125rem); }
.panel .choice span { padding: 10px 14px; }
.backlink { margin-bottom: 28px; }
#order > .spread + .panel { margin-top: 28px; }

/* "Order a project" call to action on the homepage and write-ups */
.cta-block { border-top: 1px solid var(--line); padding: clamp(48px, 8vw, 88px) 0; }
.cta-block h2 { font: 700 clamp(1.8rem, 3.6vw, 2.6rem)/1.05 var(--display); letter-spacing: -.025em; max-width: 20ch; }
.cta-block p { margin-top: 16px; color: var(--muted); max-width: 60ch; }
.cta-block .row { margin-top: 28px; }
.section .cta-block { border-top: 0; padding: 0; }
