/* ==========================================================================
   Ben Kandora DESIGN — design system
   Tokens → atoms → molecules → organisms. All values measured from the
   live site (see ../DESIGN_SYSTEM.md for sources).
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --c-accent: #f3852b;
  --c-ink: #454545;
  --c-ink-strong: #1f1f1f;
  --c-btn: #8a8a8a;
  --c-overlay: rgba(15, 15, 15, 0.7);
  --c-on-overlay: #ffffff;
  --c-bg: #ffffff;
  --c-field-bg: #fafafa;
  --c-field-border: #dddddd;
  --c-rule: #e5e5e5;

  --font-stack: "proxima-nova", "Mulish", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --w-thin: 200;      /* original uses 100; Mulish floor is 200 */
  --w-light: 300;
  --w-reg: 400;
  --w-semi: 600;

  --sp-gutter: 35px;
  --header-h: 193px;
  --content-max: 1140px;
}

/* ---------- reset-lite ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

html { background: var(--c-bg); }
body {
  font-family: var(--font-stack);
  font-size: 15px;
  line-height: 24px;
  font-weight: var(--w-reg);
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- atoms: type ---------- */
h1, .h1 {
  font-size: 42px;
  line-height: 1.2;
  font-weight: var(--w-thin);
  color: var(--c-accent);
  margin: 0 0 21px;
}
h3, .h3 {
  font-size: 31.5px;
  line-height: 1.2;
  font-weight: var(--w-thin);
  color: var(--c-accent);
  margin: 0 0 15.75px;
}
p { margin: 0 0 18.75px; }
a { color: inherit; }
.body-link { color: var(--c-ink); text-decoration: underline; }
.body-link:hover { color: var(--c-accent); }

@media (max-width: 640px) {
  h1, .h1 { font-size: 34px; }
  h3, .h3 { font-size: 27px; }
}

/* ---------- atoms: buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-stack);
  font-size: 15px;
  font-weight: var(--w-semi);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  border-radius: 0;
}
.btn--outline {
  color: var(--c-btn);
  background: transparent;
  border: 2px solid var(--c-btn);
  padding: 15px 37.5px;
  transition: color .2s, border-color .2s;
}
.btn--outline:hover { color: var(--c-accent); border-color: var(--c-accent); }
.btn--dark {
  color: #fff;
  background: var(--c-ink-strong);
  border: none;
  padding: 22px 40px;
}
.btn--dark:hover { background: var(--c-accent); }

/* ---------- atoms: form fields ---------- */
.field { margin-bottom: 22px; }
.field-label { display: block; font-size: 15px; color: var(--c-ink); margin-bottom: 4px; }
.field-sublabel { font-size: 13px; color: var(--c-ink); }
.field-req { font-size: 12px; color: #999; margin-left: 5px; }
input[type="text"], input[type="email"], input[type="url"], textarea {
  width: 100%;
  font-family: var(--font-stack);
  font-size: 15px;
  color: var(--c-ink);
  background: var(--c-field-bg);
  border: 1px solid var(--c-field-border);
  border-radius: 0;
  padding: 12px;
}
input:focus, textarea:focus { outline: 1px solid var(--c-btn); }
textarea { min-height: 96px; resize: vertical; }
.form-msg { color: var(--c-accent); font-size: 15px; margin-top: 14px; display: none; }
.form-msg.show { display: block; }
/* The submit failure line. It must be legible against the page, not decorative
   grey — a person who cannot see it will assume the message was sent. */
.form-err { color: #b3261e; font-size: 15px; margin-top: 14px; display: none; }
.form-err.show { display: block; }
/* Honeypot. Off-screen rather than display:none, because some bots skip
   fields that are explicitly hidden. */
.hp {
  position: absolute; left: -9999px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
}

/* ---------- atoms: misc ---------- */
.rule { border: 0; border-top: 1px solid var(--c-rule); margin: 40px 0; }
.social-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; background: var(--c-ink-strong);
}
.social-icon svg { width: 14px; height: 14px; fill: #fff; }
.social-icon:hover { background: var(--c-accent); }

/* ---------- organism: header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--c-bg);
  z-index: 300;
}
.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 25px;
  padding: 35px 0 25px;
  margin-left: var(--sp-gutter);
}
.main-nav a {
  font-size: 14px;
  line-height: 28px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--c-ink);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color .15s;
}
.main-nav a:hover,
.main-nav .active a {
  color: var(--c-accent);
  border-bottom-color: var(--c-accent);
}
.site-logo {
  position: absolute;
  top: 35px;
  right: var(--sp-gutter);
}
.site-logo img { width: 232px; height: auto; }
.menu-toggle { display: none; }

main { margin-top: var(--header-h); }

/* mobile header: centered MENU toggle above centered logo */
@media (max-width: 640px) {
  :root { --header-h: 228px; --sp-gutter: 20px; }
  .menu-toggle {
    display: block;
    width: 100%;
    background: none;
    border: none;
    font-family: var(--font-stack);
    font-size: 15px;
    line-height: 30px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--c-ink-strong);
    text-align: center;
    padding: 15px 0 0;
    cursor: pointer;
  }
  .site-logo {
    position: static;
    display: flex;
    justify-content: center;
    padding-top: 25px;
  }
  .main-nav { display: none; }
  .site-header.nav-open { height: auto; }
  .site-header.nav-open .main-nav { display: block; background: var(--c-bg); }
  .site-header.nav-open .main-nav ul {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 20px 0;
  }
}

/* ---------- organism: masonry portfolio grid ---------- */
#grid { position: relative; }
#grid .item { position: absolute; overflow: hidden; }
#grid .item a { display: block; position: relative; height: 100%; }
#grid .item img { width: 100%; height: 100%; object-fit: cover; }
#grid .overlay {
  position: absolute;
  inset: 0;
  background: var(--c-overlay);
  opacity: 0;
  transition: opacity .25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
#grid .item a:hover .overlay,
#grid .item a:focus .overlay { opacity: 1; }
.overlay h2 {
  font-size: 34px;
  line-height: 1.4;
  font-weight: var(--w-light);
  letter-spacing: -1px;
  color: var(--c-on-overlay);
  padding: 0 24px;
  margin: 0 0 10px;
}
.overlay h3 {
  font-size: 16px;
  line-height: 1.4;
  font-weight: var(--w-reg);
  letter-spacing: .8px;
  color: var(--c-on-overlay);
  padding: 0 24px;
  margin: 0 0 8px;
}
@media (max-width: 1000px) {
  .overlay h2 { font-size: 30px; }
}

/* ---------- organism: project detail (inline, above the grid) ----------
   Geometry mirrors the live site's own rules, measured from its site.css:
   `#project .project-item > .meta` and `#project .gallery`. The meta column
   is fixed and stays fixed on scroll — the live site never unpins it. */
.detail {
  display: none;
  position: relative;
  background: var(--c-bg);
}
.detail.open { display: block; }

/* clearfix, as on the live site — it also stops the gallery's 52px top
   margin from collapsing out through the wrapper. */
.detail-item::before, .detail-item::after { content: ''; display: table; }
.detail-item::after { clear: both; }

.detail-meta {
  position: fixed;
  box-sizing: content-box;   /* the live rule is content-box: 300 + 35 + 32 = 367 */
  width: 300px;
  padding: 47px 35px 47px 32px;
  z-index: 3;
}
.detail-title {
  font-size: 42px;
  line-height: 1.2em;
  font-weight: var(--w-thin);
  color: var(--c-accent);
  margin: 0 0 21px;
  text-wrap: balance;
}
.detail-body { color: var(--c-ink); font-size: 15px; }
.detail-body p {
  font-size: 15px;
  line-height: 1.6em;
  padding: 0;
  text-wrap: pretty;
}

.detail-gallery {
  margin: 52px 135px 50px 400px;
  max-width: 900px;
  min-width: 300px;
}
.detail-gallery img {
  display: block;
  margin: 0 auto 50px;
  max-width: 100%;
}
.detail-gallery img:last-child { margin-bottom: 0; }

/* ---------- organism: project switcher ---------- */
.switcher {
  display: none;
  position: fixed;
  top: calc(var(--header-h) + 35px);
  right: 32px;
  width: 78px;
  min-width: 78px;
  overflow: hidden;
  z-index: 2;
  transition: all .65s ease-in-out;
}
.switcher.active { display: block; }
.switcher-content { overflow: hidden; }
.projectPrev, .projectHome, .projectNext {
  display: block;
  float: left;
  width: 38px; height: 38px;
  line-height: 38px;
  text-align: center;
  font-size: 15px;
  background: #fff;
  color: #2e2e2e;
  text-decoration: none;
  cursor: pointer;
  opacity: 1;
  transition: opacity .2s;
}
.projectPrev, .projectHome { margin-right: 2px; }
.projectHome { display: none; }

/* The chevrons are DRAWN, not typed. The reference paints them with the
   proprietary `squarespace-ui-font`, which we cannot use, and no text
   guillemet has that shape or weight — U+2039 measured 2.75x5.5 of ink
   against the reference's 7.5x13.75. A rotated square with two 1px borders
   reproduces it exactly: a 45-degree chevron of side s spans s*sqrt(2)
   tip-to-tip and s/sqrt(2) deep, so s=9.72 gives 13.75 tall by 7.5 wide.
   Measured on the reference at 4x device scale, 2026-08-08. */
.projectPrev, .projectNext {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0; /* no text node renders; aria-label carries the name */
}
.projectPrev::before, .projectNext::before {
  content: '';
  display: block;
  box-sizing: border-box;
  width: 9.72px;
  height: 9.72px;
  border: 0 solid currentColor;
}
.projectPrev::before {
  border-top-width: 1px;
  border-left-width: 1px;
  transform: rotate(-45deg);
  margin-left: 3px;  /* the ink sits right of the box centre once rotated */
}
.projectNext::before {
  border-top-width: 1px;
  border-right-width: 1px;
  transform: rotate(45deg);
  margin-right: 3px;
}
.projectPrev:hover, .projectHome:hover, .projectNext:hover { opacity: .4; }

/* tablet and below: the meta column unpins, the gallery fills the width,
   the switcher centers under the project, and the grid collapses. */
@media (max-width: 1024px) {
  .detail-meta {
    position: relative;
    width: auto;
    margin: 0;
    padding: 40px;
  }
  .detail-gallery {
    position: static;
    width: auto;
    max-width: none;
    min-width: 0;
    margin: 0;
    padding: 0 20px;
  }
  .detail-gallery img { margin-bottom: 20px; }
  .switcher {
    position: static;
    width: 118px;
    margin: 30px auto;
    text-align: center;
  }
  .projectHome { display: block; }
  body.index-detail #grid { height: 0 !important; overflow: hidden; }
}

@media (max-width: 640px) {
  .detail-meta { padding: 20px 20px 0; margin: 20px 0; }
  .detail-gallery { padding: 20px 5px 0; }
  .detail-gallery img { margin-bottom: 5px; }
}

/* ---------- template: interior page ---------- */
.page {
  max-width: calc(var(--content-max) + 2 * var(--sp-gutter));
  margin: 0 auto;
  padding: 90px var(--sp-gutter) 80px;
}
.cols {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0 20px;
  align-items: start;
}
/* explicit column placements measured from the original @1440 */
.col-1-4 { grid-column: 1 / span 4; }
.col-1-5 { grid-column: 1 / span 5; }
.col-1-6 { grid-column: 1 / span 6; }
.col-1-8 { grid-column: 1 / span 8; }
.col-6-3 { grid-column: 6 / span 3; }
.col-7-6 { grid-column: 7 / span 6; }
.col-8-5 { grid-column: 8 / span 5; }
.col-9-4 { grid-column: 9 / span 4; }
@media (max-width: 640px) {
  .page { padding-top: 40px; }
  .cols { display: block; }
  .cols > * + * { margin-top: 34px; }
}

/* two-up name row inside forms */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; gap: 0; } }

/* ---------- organism: footer ---------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22.5px var(--sp-gutter) 10.5px;
  background: var(--c-bg);
}
.site-footer p { margin: 0; }
@media (max-width: 640px) {
  .site-footer { flex-direction: column; text-align: center; padding-bottom: 30px; }
}
