/* BesaForge — studio site
   Calm and product-first: a quiet page, Geist type, and each app on the
   shelf in its own colors. The temper colors (straw, bronze, violet, blue)
   stay as small brand accents. */

:root {
  --bg: #f6f7f7;
  --surface: #ffffff;
  --surface-2: #e7eaec;
  --ink: #1f2429;
  --muted: #5b646c;
  --line: rgba(31, 36, 41, 0.12);
  --glass: rgba(237, 239, 240, 0.72);
  --straw: #c8a04a;
  --bronze: #9c5a2c;
  --violet: #5a3d78;
  --blue: #2d4e8a;
  --link: #2d4e8a;
  --ok: #2f6b3f;
  --err: #a33a2a;
  --temper: linear-gradient(90deg, var(--straw) 0%, var(--bronze) 33%, var(--violet) 66%, var(--blue) 100%);

  /* Each app's own colors for its shelf card; the same in light and dark */
  --sq-bg: #123b2e;  --sq-ink: #ecdcaa;  --sq-muted: #b9cdbf;  --sq-accent: #d9b35c;
  --rc-bg: #e6d8c2;  --rc-ink: #7a3a22;  --rc-muted: #6e4f40;  --rc-accent: #b5552f;
  --st-bg: #352a4a;  --st-ink: #ece3f7;  --st-muted: #bdb2d3;  --st-accent: #c9a8ee;
  --hc-bg: #20395a;  --hc-ink: #ffffff;  --hc-muted: #bccbde;  --hc-accent: #8fb4e8;

  --sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Palatino, Georgia, serif;

  --max: 76rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: 1.5rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1114;
    --surface: #161b20;
    --surface-2: #1d2329;
    --ink: #e8ebee;
    --muted: #9aa3ab;
    --line: rgba(232, 235, 238, 0.1);
    --glass: rgba(14, 17, 20, 0.7);
    --straw: #d9b35c;
    --bronze: #c07a45;
    --violet: #8a6bb0;
    --blue: #6a8fd1;
    --link: #8fb0e8;
    --ok: #7fc491;
    --err: #f08a78;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1114;
  --surface: #161b20;
  --surface-2: #1d2329;
  --ink: #e8ebee;
  --muted: #9aa3ab;
  --line: rgba(232, 235, 238, 0.1);
  --glass: rgba(14, 17, 20, 0.7);
  --straw: #d9b35c;
  --bronze: #c07a45;
  --violet: #8a6bb0;
  --blue: #6a8fd1;
  --link: #8fb0e8;
  --ok: #7fc491;
  --err: #f08a78;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
}
.skip:focus {
  left: var(--gutter);
  top: 0.75rem;
  background: var(--bg);
  padding: 0.25rem 0.5rem;
}

p, dd, li { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }

.wrap {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Serif italic accent for a single word in a page title */
.accent {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
  padding-right: 0.06em;
}

/* ---------- Header: sticky glass ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4rem;
}

.wordmark {
  font-size: 1.3rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
}
.wordmark .besa { font-family: var(--serif); font-style: italic; font-size: 1.1em; }
.wordmark .forge { font-weight: 600; }

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 3vw, 1.75rem);
  font-size: 0.95rem;
  font-weight: 500;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav .btn,
.site-nav .btn:hover,
.site-nav .btn[aria-current="page"] { color: var(--bg); }
@media (max-width: 30rem) {
  .site-nav .hide-sm { display: none; }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.7em 1.2em;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-weight: 500;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.sm { padding: 0.5em 0.95em; font-size: 0.9rem; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn.ghost:hover { background: var(--surface); }
.btn[disabled] { opacity: 0.55; cursor: progress; transform: none; }
.btn .arrow { transition: transform 0.15s ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Hero ---------- */

.hero {
  padding: clamp(3.5rem, 11vw, 7.5rem) 0 clamp(1rem, 3vw, 2rem);
}

.display {
  font-size: clamp(2.6rem, 7.2vw, 5.4rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.045em;
  margin: 0;
  max-width: 15ch;
}

.lede {
  font-size: clamp(1.15rem, 2.2vw, 1.35rem);
  line-height: 1.5;
  margin: 1.5rem 0 0;
  max-width: 36rem;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.25rem;
}

/* The temper band */
.temper {
  height: 4px;
  border-radius: 2px;
  background: var(--temper);
  transform-origin: left center;
  animation: heat 1.4s cubic-bezier(.2, .7, .2, 1) 0.2s both;
}
@keyframes heat {
  from { transform: scaleX(0); opacity: 0.4; }
  to   { transform: scaleX(1); opacity: 1; }
}

/* ---------- Sections ---------- */

.section { padding: clamp(4rem, 10vw, 7rem) 0 0; }
.section.tight { padding-top: clamp(2.5rem, 6vw, 4rem); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}
.kicker {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.h2 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.045em;
  margin: 0;
}
.section-head p {
  margin: 0;
  max-width: 24rem;
  color: var(--muted);
}

/* ---------- Apps: the shelf ---------- */

/* Fills as many columns as fit, so a new app is just one more card */
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
}

.app-card {
  --card-screen: color-mix(in srgb, var(--card-bg) 86%, black);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: clamp(1.25rem, 2.5vw, 1.6rem);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--card-ink);
  overflow: hidden;
  /* The phone art below reads these, so it takes on the card's colors */
  --bg: var(--card-screen);
  --surface: var(--card-screen);
  --surface-2: color-mix(in srgb, var(--card-ink) 22%, transparent);
  --ink: var(--card-ink);
  --muted: var(--card-muted);
  --line: color-mix(in srgb, var(--card-ink) 20%, transparent);
  --temper: var(--card-accent);
  --straw: var(--card-accent);
  --violet: color-mix(in srgb, var(--card-accent) 60%, var(--card-ink));
  --blue: color-mix(in srgb, var(--card-accent) 55%, var(--card-bg));
}
.app-card.sq { --card-bg: var(--sq-bg); --card-ink: var(--sq-ink); --card-muted: var(--sq-muted); --card-accent: var(--sq-accent); }
.app-card.rc { --card-bg: var(--rc-bg); --card-ink: var(--rc-ink); --card-muted: var(--rc-muted); --card-accent: var(--rc-accent); --card-screen: color-mix(in srgb, var(--rc-bg) 55%, white); }
.app-card.st { --card-bg: var(--st-bg); --card-ink: var(--st-ink); --card-muted: var(--st-muted); --card-accent: var(--st-accent); }
.app-card.hc { --card-bg: var(--hc-bg); --card-ink: var(--hc-ink); --card-muted: var(--hc-muted); --card-accent: var(--hc-accent); }

.app-card h3 {
  font-size: clamp(1.45rem, 2.2vw, 1.75rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0;
}
.app-card p { margin: 0; color: var(--card-muted); }
.app-card .pill { color: var(--card-muted); background: transparent; }

/* A card with its own page: the title's link covers the whole card */
.card-link { color: inherit; text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card-link:focus-visible { outline: none; }
.card-link:focus-visible::after { outline: 2px solid var(--card-accent); outline-offset: 3px; }
.app-card:has(.card-link) { transition: transform 0.15s ease; }
.app-card:has(.card-link:hover) { transform: translateY(-3px); }
.card-more { margin-top: 0.3rem; font-size: 0.95rem; font-weight: 500; }

/* Always its own full-width row under the cards, however many apps there are */
.shelf-note {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem clamp(1.25rem, 2.5vw, 1.6rem);
  border: 1px dashed color-mix(in srgb, var(--ink) 25%, transparent);
  border-radius: var(--radius);
}
.shelf-note p { margin: 0; font-size: 1.1rem; }

.pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.3em 0.75em;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.pill::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--temper);
}

/* App card artwork: an abstract phone hinting at each app */
.art {
  --art-h: clamp(14rem, 22vw, 17rem);
  position: relative;
  height: var(--art-h);
  margin: 0.75rem 0 1rem;
  display: grid;
  place-items: center;
}
.phone {
  position: relative;
  height: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 1.75rem;
  border: 1px solid var(--line);
  background: var(--bg);
  /* From the phone's height, not the tile's width, so the screen keeps its shape in any column width */
  padding: calc(var(--art-h) * 0.18) calc(var(--art-h) * 0.12);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.55rem;
}
.phone span {
  display: block;
  height: 0.4rem;
  border-radius: 1rem;
  background: var(--surface-2);
}
.phone span:nth-child(2) { width: 80%; }
.phone span:nth-child(4) { width: 90%; }
.phone span.verse {
  height: 0.6rem;
  margin: 0.6rem 0;
  background: var(--temper);
}
.phone span:last-child { width: 60%; }

/* Urge redirect: a timer ring over three redirect choices */
.phone.urge { gap: 0.5rem; }
.phone.urge .ring {
  display: block;
  width: 72%;
  aspect-ratio: 1;
  margin: 0 auto 0.9rem;
  border-radius: 50%;
  background: conic-gradient(var(--straw), var(--bronze), var(--violet), var(--blue) 68%, var(--surface-2) 68%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 0.55rem), #000 calc(100% - 0.5rem));
  mask: radial-gradient(farthest-side, transparent calc(100% - 0.55rem), #000 calc(100% - 0.5rem));
}
.phone.urge span,
.phone.urge span:nth-child(2),
.phone.urge span:nth-child(4),
.phone.urge span:last-child {
  width: 100%;
  height: 1.1rem;
  border-radius: 0.6rem;
}

/* Family: a day's tasks, color-coded per person */
.phone.family { justify-content: flex-start; padding-top: 22%; gap: 0.7rem; }
.phone.family b {
  display: block;
  width: 55%;
  height: 0.6rem;
  margin-bottom: 0.4rem;
  border-radius: 1rem;
  background: var(--ink);
  opacity: 0.8;
}
.phone.family span,
.phone.family span:nth-child(2),
.phone.family span:nth-child(4),
.phone.family span:last-child {
  width: 100%;
  height: 1.5rem;
  border-radius: 0.5rem;
  border-left: 0.3rem solid var(--straw);
}
.phone.family span.p2 { border-left-color: var(--violet); }
.phone.family span.p3 { border-left-color: var(--blue); }

/* Phone nap: a sleeping phone and a timer the kids can see, then an idea to do together */
.phone.nap { align-items: center; gap: 0.6rem; }
.phone.nap i {
  position: relative;
  display: block;
  width: 42%;
  aspect-ratio: 5 / 7;
  margin-bottom: 0.5rem;
  border: 0.18rem solid var(--ink);
  border-radius: 30% / 22%;
  background: var(--surface);
}
/* Closed eyes: the lower edge of an ellipse */
.phone.nap i::before,
.phone.nap i::after {
  content: "";
  position: absolute;
  top: 42%;
  left: 17%;
  width: 28%;
  aspect-ratio: 2 / 1;
  border: 0.14rem solid transparent;
  border-bottom-color: var(--ink);
  border-radius: 50%;
}
.phone.nap i::after { left: auto; right: 17%; }
.phone.nap em {
  position: absolute;
  top: -1.2rem;
  right: -1rem;
  font-style: normal;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
}
.phone.nap b {
  display: block;
  width: 76%;
  height: 1.1rem;
  border-radius: 1rem;
  background: var(--temper);
}
.phone.nap span { width: 45%; }
.phone.nap span:last-child {
  width: 100%;
  height: 1.5rem;
  margin-top: 0.6rem;
  border-radius: 0.5rem;
}

/* ---------- Principles ---------- */

.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.principles li {
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--line);
}
.principles h3 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}
.principles p { margin: 0; color: var(--muted); }

.name-note {
  margin: clamp(2.5rem, 6vw, 3.5rem) 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.name-note i { font-family: var(--serif); font-size: 1.15em; color: var(--ink); }

/* ---------- Closing call to action ---------- */

.cta {
  position: relative;
  margin-top: clamp(4rem, 10vw, 7rem);
  padding: clamp(2.5rem, 7vw, 5rem);
  border-radius: calc(var(--radius) * 1.25);
  background: var(--ink);
  color: var(--bg);
  overflow: hidden;
}
.cta .h2 { max-width: 14ch; }
.cta p { margin: 1rem 0 2rem; max-width: 30rem; opacity: 0.75; }
.cta .btn { background: var(--bg); color: var(--ink); }

/* ---------- Long-form pages ---------- */

.page-hero { padding: clamp(3.5rem, 10vw, 6rem) 0 0; }
.page-title {
  font-size: clamp(2.8rem, 9vw, 6rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.05em;
  margin: 0;
}
.page-hero .temper { width: 6rem; margin: 1.75rem 0 0; }
.page-hero .lede { margin-top: 1.5rem; }
.updated { color: var(--muted); margin: 1rem 0 0; font-size: 0.95rem; }

.prose { max-width: 42rem; padding-top: 1rem; }
.prose h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 2.75rem 0 0.75rem;
}
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.5rem; }
.prose li::marker { color: var(--muted); }

/* ---------- Contact form ---------- */

.form {
  display: grid;
  gap: 1.25rem;
  max-width: 40rem;
  margin-top: 2.5rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.field { display: grid; gap: 0.4rem; }
.field label { font-size: 0.9rem; font-weight: 500; }
.field .hint { font-weight: 400; color: var(--muted); }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
.field textarea { min-height: 10rem; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: 0;
  border-color: transparent;
}

/* Honeypot: off-screen for people, tempting for bots */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.form-note { margin: 0; font-size: 0.85rem; color: var(--muted); }
.status { margin: 0; font-weight: 500; }
.status:empty { display: none; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: clamp(4rem, 10vw, 7rem);
  border-top: 1px solid var(--line);
  padding: 2.5rem 0 3rem;
  color: var(--muted);
  font-size: 0.925rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.75rem;
}
.site-footer .wordmark { margin-right: auto; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.site-footer .wordmark { color: var(--ink); }

/* ---------- Scroll-driven reveal (progressive enhancement) ---------- */

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
  }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(2rem); }
  to   { opacity: 1; transform: none; }
}

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

/* ---------- Responsive ---------- */

@media (max-width: 56rem) {
  .principles { grid-template-columns: 1fr; gap: 0; }
  .principles li { padding-bottom: 1.5rem; }
}
@media (max-width: 36rem) {
  .form .row { grid-template-columns: 1fr; }
}
