/* folder.auxfield.com, in the look of auxfield.com.
   Colors come from theme.css (the website's light / dark / system theme, copied from the website repo; keep the two
   in step). This file adds the type, the header, buttons, fields and cards both folder pages share: Geist and Geist
   Mono, uppercase mono labels and buttons, hairlines, and one 4px corner. */

@font-face { font-family: "Geist"; src: url("/static/fonts/Geist-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/static/fonts/Geist-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/static/fonts/GeistMono-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/static/fonts/GeistMono-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --corner: 4px;
  /* Status and entity colors, one shade per theme. */
  --warn: light-dark(#8A5300, #E3B062);
  --protein: var(--teal);
  --dna: light-dark(#2F5C9A, #7DA7DE);
  --rna: light-dark(#A2530F, #E3A066);
  --ligand: light-dark(#7A5C50, #C9A99A);
  --ion: light-dark(#475E86, #9BB2D6);
  /* Binding sites: one color per ligand, kept away from the teal of the trace. */
  --site-1: light-dark(#B7791F, #E3B062);
  --site-2: light-dark(#7C5CC4, #B39DF0);
  --site-3: light-dark(#C2416B, #F08AAE);
  --site-4: light-dark(#2F7FB8, #7CC1EE);
  --site-5: light-dark(#5C8A1E, #A6D36A);
}

* { box-sizing: border-box; }
/* The pages' scripts hide and show elements with the hidden attribute; a display rule must never override it. */
[hidden] { display: none !important; }
/* The auxfield.com sky, a mint wash in light and deep teal in dark, on the root so it covers the whole page however tall. */
html {
  min-height: 100%;
  background: linear-gradient(165deg, light-dark(#EDF3F0, #143431) 0%, light-dark(#E7EFEB, #0F2826) 42%, light-dark(#E2EAE6, #0C1F1D) 100%) no-repeat var(--paper);
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 15px/1.5 "Geist", ui-sans-serif, system-ui, sans-serif;
  /* A full-height column: header, the page's one main, then the footer resting at the bottom. */
  display: flex;
  flex-direction: column;
}
body > main { flex: 1 0 auto; }
.mono {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }
.bad { color: var(--bad); }
.ok { color: var(--ok); }
.grow { flex: 1; }
/* Read by screen readers, not shown. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* Header: the Auxfield lockup, the product name, then the account controls and the theme button. */
/* The header is a teal-tinted band, so the site nav in it reads apart from a page's own tabs on the plain ground. */
header.top {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--teal) 9%, var(--paper));
}
/* The Qiviut glyph and wordmark, the folder's own brand (auxfield.com is linked from the footer). A heavy logotype
   in the system face, as the folder had it, so it reads as a name rather than a link; it doesn't change on hover. */
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand img { width: 2rem; height: 2rem; display: block; }
.brand b { font: 650 1.3rem/1 "Segoe UI", system-ui, -apple-system, sans-serif; letter-spacing: -0.03em; }
.brand b span { color: var(--teal); }
.brand:hover, .brand:hover b span { color: inherit; }
.brand:hover b span { color: var(--teal); }
/* The CAMEO mark beside the logo (static/header.js): an icon, not a nav item or a pill. */
.cameo-mark { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem;
  margin-left: 0.35rem; border-radius: var(--corner); color: var(--muted); text-decoration: none; }
.cameo-mark svg { width: 1.3rem; height: 1.3rem; }
.cameo-mark:hover, .cameo-mark[aria-current="page"] { color: var(--teal-text); background: color-mix(in srgb, var(--teal) 10%, transparent); }
.cameo-dot { position: absolute; top: 0.3rem; right: 0.3rem; width: 0.45rem; height: 0.45rem; border-radius: 50%;
  background: var(--muted); box-shadow: 0 0 0 2px var(--site, var(--paper)); }
.cameo-mark[data-state="fresh"] .cameo-dot { background: var(--ok); }
.cameo-mark[data-state="stale"] .cameo-dot { background: var(--warn); }

/* Top navigation: the server and its about page, mono caps like auxfield.com's nav; the current page is underlined. */
/* Site nav: places, in sentence case; the current page is a filled square block. A page's own tabs keep the mono
   capitals and underline, so the two never read alike. */
.site-nav { display: flex; gap: 0.35rem; margin-left: clamp(0.25rem, 2.5vw, 1.6rem); }
.site-nav a {
  padding: 0.38rem 0.65rem;
  border-radius: var(--corner);
  color: var(--ink);
  font-size: 0.92rem;
  text-decoration: none;
}
.site-nav a:hover { background: color-mix(in srgb, var(--teal) 9%, transparent); }
.site-nav a[aria-current="page"] { background: color-mix(in srgb, var(--teal) 18%, transparent); color: var(--teal-text); font-weight: 500; }
/* On a phone the header wraps: logo and account controls on top, the nav on a row of its own beneath. */
@media (max-width: 40rem) {
  header.top { flex-wrap: wrap; row-gap: 0.55rem; }
  .site-nav { order: 10; flex-basis: 100%; margin-left: 0; padding-top: 0.55rem; border-top: 1px solid var(--line); }
  .brand b { font-size: 1.15rem; }
}

/* Footer: full width like the header, the app's frame, with the company link, the legal links and the year,
   aligned to the header's edges. */
/* Footer: copyright (linking to auxfield.com), the legal links centered, and the patent notice on the right.
   Three columns, so the middle stays centered whatever the sides hold; on a phone they stack. */
footer.site {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem 1.5rem;
  align-items: baseline;
  margin-top: clamp(2.5rem, 7vh, 4rem);
  flex: none;
  padding: 1.1rem clamp(1rem, 3vw, 2rem);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
footer.site a { color: var(--muted); text-decoration: none; }
footer.site > :last-child { justify-self: end; }
@media (max-width: 40rem) {
  footer.site { grid-template-columns: 1fr; }
  footer.site > :last-child { justify-self: start; }
  footer.site > :last-child:empty { display: none; }
}
footer.site a:hover { color: var(--teal-text); }

/* Buttons: as on auxfield.com, mono uppercase on teal; quiet is outlined. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  padding: 0.85rem 1.15rem;
  border: 1px solid var(--teal);
  border-radius: var(--corner);
  background: var(--teal);
  color: var(--on-teal);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn:hover { background: var(--teal-hover); border-color: var(--teal-hover); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.quiet:hover { border-color: var(--teal); color: var(--teal-text); }
.btn.small { padding: 0.55rem 0.85rem; font-size: 0.68rem; }
/* In the header a button is the avatar's height, so the bar doesn't change height between pages or when signed out. */
header.top .btn.small { height: 2rem; padding-top: 0; padding-bottom: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
/* A text button: mono, teal, no box. */
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--teal-text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

/* Fields. */
input, textarea, select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--corner);
  padding: 0.6rem 0.7rem;
}
input::placeholder, textarea::placeholder { color: var(--placeholder); }
/* Menus drop the platform's glossy look for a flat field with a drawn chevron. */
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235A6E6A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 0.9rem;
  cursor: pointer;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--teal); }
textarea { resize: vertical; font-family: "Geist Mono", ui-monospace, monospace; font-size: 0.88rem; }

/* Cards and panels: a lifted fill and a hairline, no shadow. */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--corner);
}

/* The credits badge is the one pill. */
.pill {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  background: color-mix(in srgb, var(--teal) 12%, transparent);
  color: var(--teal-text);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
}

/* Structure views: a field-colored ground; the line color comes from the theme in each page's script. */
canvas.structure {
  width: 100%;
  height: auto;
  display: block;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--corner);
  touch-action: pan-y;
  cursor: grab;
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}

/* The signed-in header (static/header.js): credits pill and avatar, each with a menu. Entity menus on the
   account page use the same .menu. */
.account-slot { display: flex; align-items: center; gap: 0.9rem; }
/* Signed out: Sign in and Start free, as on auxfield.com. On phones Sign in drops its border so both fit. */
.account-slot > .btn + .btn { margin-left: -0.4rem; }
@media (max-width: 30rem) { .account-slot > .btn.quiet { border-color: transparent; padding-left: 0.2rem; padding-right: 0.2rem; } }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 0.3rem); z-index: 20; min-width: 9.5rem; padding: 0.25rem; border: 1px solid var(--line); border-radius: var(--corner); background: var(--paper); box-shadow: 0 12px 32px -16px rgba(14, 15, 18, 0.45); }
.menu button, .menu a { display: block; box-sizing: border-box; text-decoration: none; width: 100%; padding: 0.5rem 0.6rem; border: 0; border-radius: 2px; background: none; color: var(--ink); text-align: left; font-family: "Geist Mono", ui-monospace, monospace; font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; cursor: pointer; }
.menu button:hover, .menu button:focus-visible, .menu a:hover, .menu a:focus-visible { background: color-mix(in srgb, var(--teal) 9%, transparent); outline: none; }
.menu button:disabled { opacity: 0.4; cursor: default; background: none; }
/* The credits pill opens the billing menu (Add credits, Billing). Low balance turns it amber. */
button.pill { display: inline-flex; align-items: center; gap: 0.4rem; border: 0; font-family: inherit; line-height: inherit; }
button.pill.has-menu { cursor: pointer; }
button.pill.has-menu::after { content: ""; width: 0.4rem; height: 0.4rem; margin-top: -0.2rem; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
button.pill.has-menu:hover, button.pill[aria-expanded="true"] { background: color-mix(in srgb, var(--teal) 20%, transparent); }
.pill.low { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
button.pill.low.has-menu:hover, button.pill.low[aria-expanded="true"] { background: color-mix(in srgb, var(--warn) 24%, transparent); }
/* Account: initials in a teal circle open the account menu (who is signed in, then actions). */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--teal);
  color: var(--on-teal);
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.avatar:hover, .avatar[aria-expanded="true"] { background: var(--teal-hover); }
.account-menu { min-width: 13rem; }
/* On a phone the header keeps one row: the pill drops its dollar figure (still in its label) and the brand its "Server". */
@media (max-width: 40rem) { .pill-held, .brand b span { display: none; } }
.menu-head { padding: 0.5rem 0.6rem 0.6rem; margin-bottom: 0.25rem; border-bottom: 1px solid var(--line); }
.menu-head b { display: block; font-weight: 500; font-size: 0.9rem; }
.menu-head span { display: block; color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }
