/* QuaySai Surfaces — one stylesheet for the whole site.
   Colours carried over from the original design tokens. */

:root {
  --bg: #f8f6f2;
  --fg: #3a3025;
  --border: #d7d1c9;
  --card: #fcfaf7;
  --cardline: #e6e1da;
  --primary: #7fc1dd;
  --muted: #efeae3;
  --mutedfg: #857a6b;
  --accent: #c8ab7f;
  --sans: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --grid-size: 24px;
  --grid-pulse-sky: 197 55% 68%;   /* soft sky blue */
  --grid-pulse-sand: 40 50% 66%;   /* warm sand */
  --display: 'Baumans', 'Quicksand', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

/* ---------- Grid background ---------- */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image:
    linear-gradient(to right, rgba(215, 209, 201, 0.3) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(215, 209, 201, 0.3) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  pointer-events: none;
  z-index: 0;
}
.nav, main, .foot { position: relative; z-index: 1; }

/* Cells that fade in and out across the grid */
.grid-pulse-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.grid-pulse-cell {
  position: absolute;
  width: calc(var(--grid-size) - 1px);
  height: calc(var(--grid-size) - 1px);
  opacity: 0;
  animation: grid-pulse-fade var(--pulse-duration, 8s) ease-in-out forwards;
  will-change: opacity;
}
.grid-pulse-cell--sky { background-color: hsl(var(--grid-pulse-sky)); }
.grid-pulse-cell--sand { background-color: hsl(var(--grid-pulse-sand)); }

@keyframes grid-pulse-fade {
  0% { opacity: 0; }
  35% { opacity: var(--pulse-opacity, 0.3); }
  60% { opacity: var(--pulse-opacity, 0.3); }
  100% { opacity: 0; }
}

.brandfilm {
  width: 100%;
  aspect-ratio: 1860 / 1260;
  object-fit: cover;
  background: var(--muted);
  margin: 0 0 34px;
  border: 1px solid var(--cardline);
}
@media (min-width: 768px) { .brandfilm { margin-bottom: 44px; } }

@media (prefers-reduced-motion: reduce) {
  .grid-pulse-layer { display: none; }
}

a { color: inherit; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 820px; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(248, 246, 242, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.navrow { display: flex; align-items: stretch; gap: 0; height: 64px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.navrow::-webkit-scrollbar { display: none; }
.navrow > * { display: flex; align-items: center; flex: 0 0 auto; }
.brand {
  font-family: var(--display);
  font-size: 13px; letter-spacing: .09em;
  text-decoration: none; white-space: nowrap;
  padding: 8px 12px;
}
@media (min-width: 768px) { .brand { font-size: 15px; } }

.navdiv {
  width: 1px; align-self: stretch; background: var(--border);
  flex: 0 0 auto; margin: 8px 4px;
}
@media (min-width: 768px) { .navdiv { margin: 0 8px; } }
.tabs {
  display: flex; gap: 4px; margin-left: auto;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
/* Tabs use the display face, as the original did */
.tab {
  position: relative;
  padding: 8px 12px; text-decoration: none;
  font-family: var(--display);
  font-size: 12px; letter-spacing: .04em;
  color: var(--mutedfg); white-space: nowrap;
  transition: color .18s, background .18s;
}
@media (min-width: 768px) { .tab { font-size: 14px; padding: 8px 16px; } }
.tab:hover { color: var(--fg); background: var(--muted); }

/* Active tab — sky blue underline */
.tab.on { color: var(--fg); font-weight: 500; }
.tab.on::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--primary);
}
.ig { flex: 0 0 auto; }


/* ---------- Layout ---------- */
section { padding: 56px 0; }
@media (min-width: 768px) { section { padding: 84px 0; } }

h1 {
  font-size: clamp(34px, 7vw, 60px);
  line-height: 1.05; font-weight: 700; margin: 0 0 18px;
  letter-spacing: -.02em;
}
h2 { font-size: clamp(24px, 4vw, 34px); font-weight: 700; margin: 0 0 16px; letter-spacing: -.01em; }
h3 { font-size: 20px; font-weight: 700; margin: 0 0 8px; }
p { margin: 0 0 16px; }

.lead { font-size: clamp(17px, 2.4vw, 21px); color: var(--mutedfg); max-width: 62ch; }

/* Standfirst — identical treatment to .lead, so the site has exactly one
   intro-paragraph size and colour. */
.standfirst {
  font-size: clamp(17px, 2.4vw, 21px);
  line-height: 1.55;
  color: var(--mutedfg);
  max-width: 62ch;
  margin: 0 auto;   /* centres the block itself, not just the text inside it */
}

/* Paragraph set to a comfortable measure, matching .lead */
.measure { max-width: 62ch; }

/* Two form fields side by side */
.row2 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 560px) { .row2 { grid-template-columns: 1fr 1fr; } }
input::placeholder { color: var(--mutedfg); opacity: .7; }
.dim { color: var(--mutedfg); }
.sm { font-size: 13px; }
.mono { font-family: var(--sans); letter-spacing: .01em; }
.center { text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--cardline);
  padding: 26px;
  transition: transform .2s, box-shadow .2s;
}
@media (min-width: 768px) { .card { padding: 34px; } }
.card.lift:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(58,48,37,.07); }

.grid { display: grid; gap: 22px; }
.g2 { grid-template-columns: 1fr; }
.g3 { grid-template-columns: 1fr; }
@media (min-width: 760px) {
  .g2 { grid-template-columns: 1fr 1fr; gap: 30px; }
  .g3 { grid-template-columns: repeat(3, 1fr); gap: 26px; }
}

/* Hero — centred on phones, left-aligned once there is room for 3 columns */
.hero { text-align: center; }
.hero h2 {
  font-size: 48px;
  line-height: 1.03;
  letter-spacing: -.025em;
  font-weight: 700;
  margin: 0 0 8px;
}
.hero p { font-size: 14px; margin: 0; }
@media (min-width: 768px) {
  .hero h2 { font-size: 60px; }
  .hero p { font-size: 16px; }
}
@media (min-width: 1024px) {
  .hero h2 { font-size: 72px; }
}
@media (min-width: 760px) {
  .hero { text-align: left; gap: 40px; }
}

/* Capabilities grid on the About page */
.caps { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 32px; }
.caps p { margin: 0 0 3px; }
.capsh { font-weight: 600; font-size: 14px; margin-bottom: 5px !important; }

.btn {
  display: inline-block; padding: 13px 24px;
  background: var(--primary); color: var(--fg);
  text-decoration: none; font-weight: 600; border: none;
  font-family: var(--sans); font-size: 15px; cursor: pointer;
  transition: filter .18s, transform .18s;
}
.btn:hover { filter: brightness(.95); transform: translateY(-1px); }
.btn.ghost { background: var(--card); border: 1px solid var(--cardline); }
.btn.sand { background: var(--accent); }

.rule { border: none; border-top: 1px solid var(--border); margin: 0; }

/* Thin line separating each section, as the original had */
.sep { border-top: 1px solid var(--border); }
.secttl { font-size: clamp(22px, 3.6vw, 30px); margin-bottom: 40px; }
@media (min-width: 768px) { .secttl { margin-bottom: 56px; } }

/* Process flowchart — four steps with arrows between them */
.flow { display: grid; grid-template-columns: 1fr; gap: 34px; }
.step { position: relative; }
.stepcard { height: 100%; padding: 24px; }
.stepcard h3 { font-size: 19px; margin-bottom: 14px; }
.stepcard .pnum { margin: 0 0 14px; }
.stepp { font-size: 14px; margin-bottom: 0; }
.stepcard .btn { margin-top: 22px; }

.btn-sm {
  padding: 9px 16px; font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.bi { width: 15px; height: 15px; flex: 0 0 auto; }

.arw { color: var(--border); position: absolute; pointer-events: none; }
.arw svg { width: 17px; height: 17px; display: block; }
.arw-r { display: none; }
.arw-d { left: 50%; bottom: -26px; transform: translateX(-50%); }

@media (min-width: 860px) {
  .flow { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .stepcard { padding: 28px; }
  .arw-d { display: none; }
  .arw-r { display: block; top: 50%; right: -16px; transform: translateY(-50%); }
}

/* ---------- Forms ---------- */
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px; }
input, textarea {
  width: 100%; padding: 12px 14px;
  font-family: var(--sans); font-size: 16px;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--border); border-radius: 2px;
}
input:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
textarea { resize: vertical; min-height: 130px; }
.field { margin-bottom: 18px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.note { font-size: 12px; color: var(--mutedfg); margin-top: 12px; }
.msg { padding: 12px 14px; margin-top: 14px; font-size: 14px; border: 1px solid var(--cardline); background: var(--muted); }
.msg.bad { border-color: #c98b80; background: #f7e9e6; }

/* ---------- FAQ ---------- */
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 34px; padding-bottom: 26px; border-bottom: 1px solid var(--border); }
.jump a {
  padding: 8px 12px; font-size: 13px; text-decoration: none;
  background: var(--card); border: 1px solid var(--cardline); color: var(--mutedfg);
}
.jump a:hover { color: var(--fg); }
.faqcat { margin-bottom: 46px; scroll-margin-top: 78px; }
details {
  background: var(--card); border: 1px solid var(--cardline);
  padding: 0 22px; margin-bottom: 10px;
}
summary {
  cursor: pointer; padding: 18px 0; font-weight: 600; font-size: 16px;
  list-style: none; display: flex; justify-content: space-between; gap: 14px;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; color: var(--mutedfg); font-weight: 400; font-size: 20px; line-height: 1; }
details[open] summary::after { content: '\2212'; }
details .ans { padding: 0 0 20px; color: var(--mutedfg); }
details .ans ul { margin: 12px 0 0; padding-left: 18px; }
details .ans li { margin-bottom: 6px; }

/* ---------- Projects ---------- */
.pcard { text-decoration: none; display: block; }
.pcard .ph { background: var(--muted); overflow: hidden; aspect-ratio: 1; margin-bottom: 14px; }
.pcard .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.pcard:hover .ph img { transform: scale(1.03); }
.psec { border-top: 1px solid var(--border); padding-top: 34px; margin-top: 44px; }
.pnum { font-size: 12px; color: var(--mutedfg); letter-spacing: .08em; }
.placeholder {
  border: 1px dashed var(--border); aspect-ratio: 16/9;
  display: flex; align-items: center; justify-content: center;
  padding: 26px; text-align: center; color: var(--mutedfg); font-size: 14px;
}

/* ---------- Games ---------- */
.gamebox { background: var(--card); border: 1px solid var(--cardline); padding: 20px; }
@media (min-width: 768px) { .gamebox { padding: 34px; } }

.ttt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; background: #24100a; width: 100%; max-width: 400px; margin: 0 auto; }
.ttt button {
  position: relative; aspect-ratio: 1; border: 0; padding: 0; cursor: pointer;
  background: radial-gradient(120% 100% at 30% 18%, #57281580 0%, #3a190c 45%, #24100a 100%);
}
.ttt button:disabled { cursor: default; }
.ttt .mk { position: absolute; inset: 14%; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }

.sud { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; padding: 3px; background: #e3ded4; width: 100%; max-width: 460px; margin: 0 auto; }
.sud button {
  aspect-ratio: 1; border: 0; padding: 0; background: #f1eee8;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
  font-family: var(--sans); font-weight: 700; line-height: 1;
  font-size: clamp(12px, 3.2vw, 24px); color: #17130f; cursor: pointer;
}
.sud button.blue { background: linear-gradient(160deg, #5b93b8 0%, #4a7ca1 100%); color: #12212b; }
.sud button.fixed { cursor: default; }
.sud button.added { color: #6c635a; }
.sud button.sel { box-shadow: inset 0 0 0 2px #4a7ca1; }
.sud button.bad { color: #b23a2c; }
.sud button.mr { margin-right: 3px; }
.sud button.mb { margin-bottom: 3px; }

.pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; max-width: 460px; margin: 14px auto 0; }
.pad button {
  aspect-ratio: 1; border: 1px solid var(--cardline); background: var(--card);
  font-family: var(--sans); font-weight: 600; font-size: 15px; color: var(--fg); cursor: pointer;
}
.pad button:disabled { opacity: .4; cursor: default; }
.pad button:hover:not(:disabled) { background: var(--muted); }

.gbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; max-width: 460px; margin: 18px auto 0; }
.gbar .status { font-size: 14px; color: var(--mutedfg); margin: 0; }
.gbar .acts { display: flex; gap: 8px; }
.gbar button {
  padding: 9px 15px; font-size: 14px; font-family: var(--sans);
  background: var(--card); border: 1px solid var(--cardline); color: var(--fg); cursor: pointer;
}
.gbar button:hover { background: var(--muted); }

/* ---------- Footer ---------- */
.foot { border-top: 1px solid var(--border); margin-top: 60px; padding: 44px 0 26px; }
.footgrid { display: grid; gap: 26px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .footgrid { grid-template-columns: repeat(3, 1fr); } }
.brand2 { font-family: var(--display); font-size: 15px; letter-spacing: .04em; margin-bottom: 8px; }
.fh { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.fnav { display: flex; flex-direction: column; gap: 7px; }
.fnav a, .foot a { color: var(--mutedfg); text-decoration: none; font-size: 14px; }
.fnav a:hover, .foot a:hover { color: var(--fg); }
.fbot { display: flex; justify-content: space-between; align-items: center; gap: 14px; border-top: 1px solid var(--border); margin-top: 30px; padding-top: 20px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
