/* ============================================================
   COMPONENTS — reusable atoms.
   Section-specific composition lives in plates.css.
   ============================================================ */

/* ---- Vellum panel ------------------------------------------
   The base surface for anything raised off the graphite. */

.panel {
  position: relative;
  background: var(--vellum-01);
  border: var(--hair) solid var(--vellum-line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ---- Buttons ----------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  border-radius: var(--radius);
  border: var(--hair) solid transparent;
  transition: background var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out),
              color var(--dur) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}

.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--cyanotype);
  color: #fff;
  border-color: var(--cyanotype);
}

.btn--primary:hover {
  background: var(--cyanotype-bright);
  border-color: var(--cyanotype-bright);
}

.btn--ghost {
  color: var(--chalk);
  border-color: var(--vellum-line-strong);
  background: var(--vellum-01);
}

.btn--ghost:hover {
  border-color: var(--cyanotype);
  color: var(--cyanotype-bright);
  background: var(--cyanotype-wash-soft);
}

.btn__arrow {
  transition: transform var(--dur) var(--ease-out);
}

.btn:hover .btn__arrow { transform: translateX(3px); }

/* ---- Inline link ------------------------------------------- */

.link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--cyanotype);
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  padding-bottom: 2px;
  border-bottom: var(--hair) solid transparent;
  transition: border-color var(--dur) var(--ease-out),
              color var(--dur) var(--ease-out);
}

.link:hover {
  color: var(--cyanotype-bright);
  border-bottom-color: var(--cyanotype);
}

/* ---- Tag --------------------------------------------------- */

.tag {
  display: inline-block;
  padding: 3px var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate-500);
  background: var(--vellum-01);
  border: var(--hair) solid var(--vellum-line);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* ---- Status pill ------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 4px var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  border-radius: 100px;
  border: var(--hair) solid var(--vellum-line);
  background: var(--vellum-01);
  color: var(--slate-500);
}

.pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.pill--open { color: #4ec98a; border-color: rgba(78, 201, 138, 0.28); }
.pill--busy { color: #d9a13c; border-color: rgba(217, 161, 60, 0.28); }
.pill--closed { color: var(--slate-600); }

/* The live dot breathes so "open" reads as current rather than
   as something typed once and forgotten. */
.pill--open .pill__dot {
  animation: breathe 2.6s var(--ease-in-out) infinite;
}

@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(78, 201, 138, 0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(78, 201, 138, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .pill--open .pill__dot { animation: none; }
}

/* ---- Dimension callout ------------------------------------
   A measured value, drawn the way a drafter dimensions a part:
   witness ticks at each end of a leader line, value above,
   annotation below. Used for hero stats and project metrics. */

.callout {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.callout__dim {
  position: relative;
  height: 7px;
  width: 100%;
  max-width: 130px;
}

/* The leader line. Scales out from the left as --draw goes 0 → 1,
   which is a drafter drawing the dimension. JS drives --draw in
   the same loop that counts the figure, so the line and the number
   arrive together. Unset (no JS) falls back to fully drawn. */
.callout__dim::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: var(--hair);
  background: var(--cyanotype-dim);
  transform: scaleX(var(--draw, 1));
  transform-origin: 0 50%;
}

/* Witness ticks at both ends, drawn as two gradients so this needs
   only one pseudo-element. Because the box itself is only as wide
   as --draw, the right-hand tick rides along with the end of the
   line and caps it on arrival. */
.callout__dim::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(var(--draw, 1) * 100%);
  background:
    linear-gradient(var(--cyanotype) 0 0) 0 0 / var(--hair) 100% no-repeat,
    linear-gradient(var(--cyanotype) 0 0) 100% 0 / var(--hair) 100% no-repeat;
}

.callout__value {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 112, "wght" 700;
  font-size: var(--t-h3);
  line-height: 1;
  color: var(--chalk);
  letter-spacing: var(--track-display);
  /* Fixed-width digits, so a counting number does not jitter as it
     passes through wider and narrower glyphs. */
  font-variant-numeric: tabular-nums;
}

.callout__label {
  font-family: var(--font-mono);
  font-size: var(--t-caption);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  color: var(--slate-500);
}

.callout__note {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.08em;
  color: var(--slate-700);
}

/* Compact variant for inside project cards. */
.callout--sm .callout__value { font-size: var(--t-h4); }
.callout--sm .callout__dim { max-width: 64px; }

/* ---- Card -------------------------------------------------
   Tilt is driven by --rx/--ry, which JS writes on pointer move.
   With no JS, or under reduced motion, the card sits flat and
   nothing is lost. */

.card {
  perspective: 900px;
}

.card__inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--vellum-01);
  border: var(--hair) solid var(--vellum-line);
  border-radius: var(--radius);
  overflow: hidden;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform var(--dur-slow) var(--ease-out),
              border-color var(--dur) var(--ease-out),
              box-shadow var(--dur-slow) var(--ease-out);
  will-change: transform;
}

.card:hover .card__inner {
  border-color: var(--vellum-line-strong);
  box-shadow: var(--lift-3);
  transition-duration: var(--dur-fast);
}

/* Spotlight that follows the pointer across the card face. */
.card__spot {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 50%),
    var(--cyanotype-wash),
    transparent 62%);
  transition: opacity var(--dur) var(--ease-out);
}

.card:hover .card__spot { opacity: 1; }

.card__body {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-5);
  flex: 1;
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-top: var(--hair) solid var(--vellum-line);
  margin-top: auto;
}

.card__title {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 108, "wght" 700;
  font-size: var(--t-h4);
  text-transform: uppercase;
  letter-spacing: var(--track-display);
  color: var(--chalk);
  line-height: var(--lh-snug);
}

.card__blurb {
  color: var(--chalk-dim);
  font-size: var(--t-small);
  line-height: 1.55;
}

.card__desc {
  color: var(--slate-500);
  font-size: var(--t-small);
  line-height: 1.6;
}

.card__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--slate-600);
}

/* ---- Section hatching -------------------------------------
   In a technical drawing, hatch pattern denotes material. Here
   it stands in for a project screenshot when there isn't one —
   so an image-less card still looks deliberate rather than
   unfinished. Four patterns, assigned round-robin by index. */

.plate {
  position: relative;
  aspect-ratio: 16 / 9;
  border-bottom: var(--hair) solid var(--vellum-line);
  background-color: var(--graphite-850);
  overflow: hidden;
}

.plate--hatch-a {
  background-image: repeating-linear-gradient(45deg,
    var(--vellum-line) 0 var(--hair),
    transparent var(--hair) 9px);
}

.plate--hatch-b {
  background-image: repeating-linear-gradient(-45deg,
    var(--vellum-line) 0 var(--hair),
    transparent var(--hair) 9px);
}

.plate--hatch-c {
  background-image:
    repeating-linear-gradient(45deg, var(--vellum-line) 0 var(--hair), transparent var(--hair) 12px),
    repeating-linear-gradient(-45deg, var(--vellum-line) 0 var(--hair), transparent var(--hair) 12px);
}

.plate--hatch-d {
  background-image: radial-gradient(var(--vellum-line) 1px, transparent 1px);
  background-size: 10px 10px;
}

/* A single cyanotype arc over the hatch gives each plate a focal
   point and ties it to the accent. */
.plate::after {
  content: "";
  position: absolute;
  right: -22%;
  bottom: -55%;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: var(--hair) solid var(--cyanotype-dim);
  background: radial-gradient(circle at 30% 30%,
    var(--cyanotype-wash-soft), transparent 66%);
  transition: transform var(--dur-slow) var(--ease-out);
}

.card:hover .plate::after { transform: translate(-8px, -8px) scale(1.04); }

.plate__img {
  width: 100%;
  height: 100%;
}

/* Part number in the plate corner — the drawing-set detail that
   makes the whole conceit land. */
.plate__no {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
  z-index: 2;
  padding: 2px var(--s-2);
  background: rgba(18, 20, 26, 0.78);
  border: var(--hair) solid var(--vellum-line);
  border-radius: var(--radius-sm);
  color: var(--cyanotype);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.1em;
}

.plate__status {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  z-index: 2;
}

/* ---- Filter row -------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-6);
}

.filter {
  padding: var(--s-2) var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  letter-spacing: var(--track-mono);
  text-transform: uppercase;
  color: var(--slate-500);
  border: var(--hair) solid var(--vellum-line);
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}

.filter:hover {
  color: var(--chalk);
  border-color: var(--vellum-line-strong);
}

.filter.is-on {
  color: var(--cyanotype-bright);
  border-color: var(--cyanotype);
  background: var(--cyanotype-wash-soft);
}

.filters__label {
  color: var(--slate-700);
  margin-right: var(--s-2);
}

/* ---- Empty state ------------------------------------------
   An empty screen is an invitation to act, so it says what to
   do rather than just reporting nothing. */

.empty {
  padding: var(--s-7) var(--s-5);
  text-align: center;
  color: var(--slate-600);
  border: var(--hair) dashed var(--vellum-line);
  border-radius: var(--radius);
}

.empty code {
  font-family: var(--font-mono);
  font-size: var(--t-small);
  color: var(--cyanotype);
}

/* ---- Command palette --------------------------------------- */

.palette {
  position: fixed;
  inset: 0;
  z-index: var(--z-palette);
  display: grid;
  place-items: start center;
  padding-top: 14vh;
}

.palette[hidden] { display: none; }

.palette__scrim {
  position: absolute;
  inset: 0;
  background: rgba(9, 10, 14, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in var(--dur) var(--ease-out);
}

.palette__panel {
  position: relative;
  width: min(560px, calc(100vw - var(--s-6)));
  background: var(--graphite-800);
  border: var(--hair) solid var(--vellum-line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--lift-4);
  overflow: hidden;
  animation: palette-in var(--dur) var(--ease-out);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.palette__field {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: var(--hair) solid var(--vellum-line);
}

.palette__prompt { color: var(--cyanotype); }

.palette__input {
  flex: 1;
  font-size: var(--t-body);
  color: var(--chalk);
}

.palette__input::placeholder { color: var(--slate-700); }

.palette__esc {
  padding: 2px 6px;
  color: var(--slate-600);
  border: var(--hair) solid var(--vellum-line);
  border-radius: var(--radius-sm);
}

.palette__list {
  max-height: 44vh;
  overflow-y: auto;
  padding: var(--s-2);
}

.palette__item {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  width: 100%;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius);
  color: var(--slate-500);
  text-align: left;
}

.palette__item[aria-selected="true"] {
  background: var(--cyanotype-wash);
  color: var(--chalk);
}

.palette__item-no {
  font-family: var(--font-mono);
  font-size: var(--t-micro);
  color: var(--cyanotype);
  font-variant-numeric: tabular-nums;
}

.palette__empty {
  padding: var(--s-5);
  text-align: center;
  color: var(--slate-700);
}

/* ---- Custom cursor ----------------------------------------
   Removed outright on touch and under reduced motion — a lagging
   ring is worse than no ring. */

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-cursor);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
}

.cursor.is-live { opacity: 1; }

.cursor__dot,
.cursor__ring {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.cursor__dot {
  width: 5px;
  height: 5px;
  background: var(--cyanotype-bright);
}

.cursor__ring {
  width: 30px;
  height: 30px;
  border: var(--hair) solid var(--vellum-line-strong);
  transition: width var(--dur) var(--ease-out),
              height var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out),
              background var(--dur) var(--ease-out);
}

/* Over anything interactive the ring opens up and picks up the
   accent, so the cursor confirms the target before the click. */
.cursor.is-hot .cursor__ring {
  width: 46px;
  height: 46px;
  border-color: var(--cyanotype);
  background: var(--cyanotype-wash-soft);
}

.cursor.is-drag .cursor__ring {
  width: 56px;
  height: 56px;
  border-color: var(--cyanotype);
  border-style: dashed;
}

@media (hover: none), (prefers-reduced-motion: reduce) {
  .cursor { display: none; }
}

/* While the assembly is being dragged the whole document shows a
   grabbing cursor, so the gesture does not appear to break the
   moment the pointer leaves the plane it started on. */
body.is-grabbing,
body.is-grabbing * {
  cursor: grabbing !important;
}

body.is-grabbing {
  user-select: none;
  -webkit-user-select: none;
}
