/* =========================================================
   Dr Benjamin Low — Rehabilitation & Pain Medicine
   Minimal single-viewport design
   ========================================================= */

:root {
  --bg: #FBF9F4;
  --surface: #FFFFFF;
  --surface-soft: #F6EFE3;

  --ink:    #1A1410;
  --ink-2:  #4A3F35;
  --ink-3:  #7E7166;
  --ink-4:  #AFA294;

  --accent:       #8B5E3C;
  --accent-deep:  #5F3F26;
  --accent-soft:  #EEDFCC;
  --accent-wash:  #F7EFE2;

  --line:       #ECE3D4;
  --line-soft:  #F4EBDA;

  --serif: "Fraunces", "Source Serif Pro", Georgia, serif;
  --sans:  "Inter", system-ui, -apple-system, sans-serif;

  --r-md: 10px;
  --r-pill: 999px;

  --container: 1100px;
  --gutter: clamp(20px, 4.5vw, 40px);

  --nav-h: 64px;
  --foot-h: 50px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg,
      rgba(251,249,244,1.00) 0%,
      rgba(251,249,244,0.88) 28%,
      rgba(251,249,244,0.78) 50%,
      rgba(251,249,244,0.88) 72%,
      rgba(251,249,244,1.00) 100%
    ),
    url('images/landscape-mountain.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Background-attachment: fixed has poor performance and broken behaviour on iOS — switch to scroll on small viewports */
@media (max-width: 800px) {
  body { background-attachment: scroll; }
}

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

a { color: var(--accent-deep); text-decoration: underline; text-decoration-color: rgba(139,94,60,0.25); text-underline-offset: 3px; transition: color .15s, text-decoration-color .15s; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }

::selection { background: var(--accent-soft); color: var(--ink); }

/* Typography ----------------------------------------------- */
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 380;
  color: var(--ink);
  letter-spacing: -0.018em;
  line-height: 1.12;
  margin: 0 0 0.5em;
  font-variation-settings: "SOFT" 50;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); }
h2 { font-size: clamp(1.3rem, 2.2vw, 1.7rem); }
h3 { font-size: 1.05rem; }

p { margin: 0 0 0.9em; color: var(--ink-2); }
.lead { font-size: 1.05rem; line-height: 1.55; color: var(--ink-2); max-width: 50ch; }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 14px;
  display: inline-block;
}

.muted { color: var(--ink-3); }

/* Layout --------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Header / Nav --------------------------------------------- */
.nav-wrap {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  position: relative;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  min-height: var(--nav-h);
}

.brand {
  font-family: var(--serif);
  font-size: 1.02rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 400;
}
.brand:hover { color: var(--accent-deep); text-decoration: none; }
.brand small {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--ink-3);
  font-weight: 400;
  margin-left: 4px;
}
@media (max-width: 600px) { .brand small { display: none; } }

.menu {
  display: flex;
  gap: 24px;
  align-items: center;
}
.menu a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 4px 0;
  position: relative;
}
.menu a:hover { color: var(--ink); }
.menu a.active { color: var(--ink); }
.menu a.active::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1px; background: var(--accent);
}

.menu-toggle {
  display: none;
  background: none; border: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink);
}
.menu-toggle svg { width: 20px; height: 20px; }

@media (max-width: 800px) {
  .menu { display: none; }
  .menu.open {
    display: flex;
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    padding: 6px var(--gutter) 18px;
    border-bottom: 1px solid var(--line);
    z-index: 10;
  }
  .menu.open a {
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 0.98rem;
  }
  .menu.open a:last-child { border-bottom: none; }
  .menu-toggle { display: inline-flex; }
}

/* Buttons -------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  font-family: var(--sans);
  font-size: 0.94rem;
  font-weight: 500;
  border-radius: var(--r-pill);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
  line-height: 1;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }

.btn-primary {
  background: var(--ink);
  color: #FBF9F4;
}
.btn-primary:hover { background: var(--accent-deep); color: #FBF9F4; }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink-2);
}
.btn-secondary:hover { background: var(--ink); color: #FBF9F4; }

.btn svg { width: 15px; height: 15px; transition: transform .15s; }
.btn:hover svg { transform: translateX(2px); }

/* PAGE (viewport-fitting) --------------------------------- */
.page {
  flex: 1;
  display: flex;
  align-items: center;
  padding: clamp(28px, 5vh, 60px) 0;
}
.page-inner {
  width: 100%;
}

/* Two-column hero / generic ------------------------------ */
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
@media (max-width: 800px) {
  .two { grid-template-columns: 1fr; gap: 32px; }
}

.two-text { max-width: 44ch; }

.eyebrow-row {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 12px;
  font-weight: 500;
}

.ctas { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* Portrait frame ------------------------------------------ */
.portrait {
  aspect-ratio: 4 / 5;
  background: var(--accent-wash);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  max-width: 380px;
  width: 100%;
  margin-left: auto;
}
.portrait::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(160deg, #E8D8C2 0%, #B89373 100%);
  z-index: 0;
}
.portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 20%;
  position: relative;
  z-index: 1;
}

/* Page header (small) ------------------------------------ */
.page-head {
  margin-bottom: 30px;
}
.page-head h1 { max-width: 18ch; margin-bottom: 12px; }
.page-head .lead { font-size: 1.05rem; max-width: 56ch; }

/* Inline credential / fact line --------------------------- */
.facts {
  list-style: none;
  padding: 0;
  margin: 22px 0 0;
  display: grid;
  gap: 8px;
}
.facts li {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 18px;
  font-size: 0.93rem;
}
@media (max-width: 600px) { .facts li { grid-template-columns: 1fr; gap: 2px; padding-bottom: 4px;} }
.facts .label {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-3);
}
.facts .value { color: var(--ink-2); }

/* Two-column lists --------------------------------------- */
.col-list {
  list-style: none;
  padding: 0; margin: 0;
  columns: 2;
  column-gap: 40px;
}
@media (max-width: 600px) { .col-list { columns: 1; } }
.col-list li {
  break-inside: avoid;
  font-size: 0.94rem;
  color: var(--ink-2);
  padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
}
.col-list li:last-child { border-bottom: none; }

/* Resource grid ------------------------------------------ */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 760px) { .resource-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .resource-grid { grid-template-columns: 1fr; } }

.resource-cat {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin: 36px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.resources-list > .resource-cat:first-child { margin-top: 0; }

.resource-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s, transform .15s, box-shadow .15s;
  display: block;
}
.resource-tile:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}
.resource-tile .name {
  font-family: var(--serif);
  font-size: 1.06rem;
  margin-bottom: 4px;
  color: var(--ink);
}
.resource-tile .url {
  font-size: 0.76rem;
  color: var(--accent-deep);
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}
.resource-tile .desc {
  font-size: 0.86rem;
  color: var(--ink-3);
  line-height: 1.5;
  margin: 0;
}

/* Contact ------------------------------------------------ */
.contact-info {
  display: grid;
  gap: 18px;
  max-width: 360px;
}
.contact-info .item .label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 2px;
  font-weight: 500;
}
.contact-info .item p,
.contact-info .item a {
  font-size: 1rem;
  color: var(--ink);
  margin: 0;
  text-decoration: none;
}
.contact-info .item a:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; }

.map-embed {
  margin-top: 24px;
  height: 220px;
  max-width: 380px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.map-embed iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  filter: saturate(0.85);
}

/* Form (compact) ----------------------------------------- */
form.contact {
  display: grid;
  gap: 14px;
}
.field { display: grid; gap: 5px; }
.field-row {
  display: grid; gap: 14px;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

.field label {
  font-size: 0.82rem;
  color: var(--ink-2);
  font-weight: 500;
}
.field label .req { color: var(--accent); margin-left: 3px; }
.field label .opt { color: var(--ink-4); margin-left: 5px; font-weight: 400; font-size: 0.76rem; }

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 13px;
  font-family: var(--sans);
  font-size: 0.96rem;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,94,60,0.10);
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }

.file-drop {
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  text-align: center;
  font-size: 0.86rem;
  color: var(--ink-3);
  cursor: pointer;
  position: relative;
  background: var(--surface);
  transition: border-color .15s, color .15s;
}
.file-drop:hover { border-color: var(--accent); color: var(--ink-2); }
.file-drop input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.file-list { list-style: none; padding: 0; margin: 6px 0 0; font-size: 0.82rem; color: var(--ink-3); }

.form-foot {
  display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
  margin-top: 4px;
}

.toast {
  display: none;
  padding: 12px 14px;
  border: 1px solid #C6D2BD;
  background: #ECF0E4;
  color: #3F5A33;
  border-radius: var(--r-md);
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.toast.show { display: block; }

/* Footer (minimal) --------------------------------------- */
footer {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  padding: 14px 0;
  font-size: 0.84rem;
  color: var(--ink-3);
  min-height: var(--foot-h);
}
footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
footer a { color: var(--ink-3); text-decoration: none; }
footer a:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; }
footer .foot-links {
  list-style: none; padding: 0; margin: 0;
  display: flex; gap: 18px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
