/* ============================================================
   drmattjones.com styles
   Colors and fonts live in :root. Change them there and the
   whole site updates.
   ============================================================ */

:root {
  color-scheme: only light;

  --mist: #F4F5F2;       /* page background */
  --fog: #E7EAE5;        /* soft panels */
  --paper: #FBFBFA;      /* inputs, raised surfaces */
  --sage: #9FAEA1;       /* quiet accent lines */
  --ink: #25302B;        /* main text and buttons */
  --stone: #56615C;      /* secondary text */
  --rule: #D6DBD4;       /* hairlines */

  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --sans: "Jost", "Avenir Next", "Avenir", "Segoe UI", sans-serif;

  --wrap: 74rem;
  --gutter: clamp(1.25rem, 5vw, 3.5rem);
  --space: clamp(5rem, 11vw, 9rem);
  --radius-lg: clamp(1.25rem, 3vw, 2rem);
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.menu-open { overflow: hidden; }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }

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

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

[id] { scroll-margin-top: 6rem; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 50;
  background: var(--ink); color: var(--mist);
  padding: 0.6rem 1.1rem; border-radius: 999px; text-decoration: none; font-size: 0.95rem;
}
.skip:focus { top: 0.75rem; }

/* ---------- Type ---------- */

h1, h2, h3 { margin: 0; font-weight: 500; }

h1, h2 {
  font-family: var(--serif);
  line-height: 1.02;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

h2 { font-size: clamp(2.6rem, 5vw, 4rem); }

h3 {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

p { margin: 0 0 1.1em; max-width: 34rem; }
p:last-child { margin-bottom: 0; }

.muted { color: var(--stone); }

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

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.8rem 1.75rem;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--mist);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease;
}
.btn:hover { background: #111814; }

.text-link {
  font-size: 1rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--sage);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35em;
  transition: text-decoration-color 200ms ease;
}
.text-link:hover { text-decoration-color: var(--ink); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 245, 242, 0.92);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.75rem;
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.625rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  position: relative;
  z-index: 2;
}

.nav-list {
  display: flex;
  gap: clamp(1.25rem, 2.6vw, 2.5rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  font-size: 0.975rem;
  text-decoration: none;
  color: var(--stone);
  transition: color 200ms ease;
}
.nav-list a:hover { color: var(--ink); }

.menu-button {
  display: none;
  position: relative;
  z-index: 2;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
}

.menu-icon { position: relative; width: 22px; height: 10px; }
.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute; left: 0; right: 0; height: 1.5px;
  background: var(--ink);
  transition: transform 300ms ease, top 300ms ease;
}
.menu-icon::before { top: 0; }
.menu-icon::after { top: 8.5px; }

.menu-open .menu-icon::before { top: 4.25px; transform: rotate(45deg); }
.menu-open .menu-icon::after { top: 4.25px; transform: rotate(-45deg); }

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

.hero { padding-block: clamp(3rem, 8vw, 6rem) var(--space); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: clamp(2.5rem, 6vw, 6rem);
}

.hero-name {
  font-size: clamp(3.6rem, 8.2vw, 7rem);
  line-height: 0.98;
  margin-bottom: 1.75rem;
}

.hero-lede {
  font-size: clamp(1.125rem, 1.6vw, 1.3rem);
  line-height: 1.65;
  color: var(--stone);
  max-width: 29rem;
}

.portrait {
  position: relative;
  margin: 0;
  width: 100%;
  max-width: 28rem;
  justify-self: center;
  aspect-ratio: 1;
}

.portrait::before {
  content: "";
  position: absolute;
  inset: -1.1rem;
  border-radius: 50%;
  border: 1px solid var(--sage);
}

.portrait img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy { animation: rise 1200ms cubic-bezier(0.22, 0.61, 0.36, 1) 100ms both; }
  .portrait img { animation: settle 1400ms cubic-bezier(0.22, 0.61, 0.36, 1) both; }
  .portrait::before { animation: halo 1800ms cubic-bezier(0.22, 0.61, 0.36, 1) 300ms both; }

  @keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  @keyframes settle { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
  @keyframes halo { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
}

/* ---------- Book ---------- */

.book-panel {
  background: var(--fog);
  border-radius: var(--radius-lg);
  padding: clamp(2.5rem, 7vw, 6rem) clamp(1.75rem, 7vw, 6rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
}

.book-title {
  font-size: clamp(3rem, 6.5vw, 5.5rem);
  font-style: italic;
  font-weight: 500;
  line-height: 0.98;
}

.book-sub {
  margin-top: 1.25rem;
  font-size: 1.0625rem;
  color: var(--stone);
  max-width: 22rem;
}

.book .fine { font-size: 0.925rem; color: var(--stone); }

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

.section { padding-block: var(--space); }
.section + .section { padding-top: 0; }

.section-head { max-width: 40rem; margin-bottom: clamp(2.5rem, 5vw, 3.75rem); }
.section-head h2 { margin-bottom: 1.25rem; }
.section-head p { color: var(--stone); }

/* ---------- Things I use ---------- */

.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.375rem;
  margin-bottom: 1.5rem;
  background: var(--fog);
  border-radius: 999px;
}

.tab {
  border: 0;
  background: transparent;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  font-size: 0.975rem;
  color: var(--stone);
  cursor: pointer;
  transition: background-color 250ms ease, color 250ms ease, box-shadow 250ms ease;
}
.tab:hover { color: var(--ink); }
.tab-short { display: none; }
.tab[aria-selected="true"] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(37, 48, 43, 0.08);
}

.shop-group h3 {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: 0;
  padding-block: 2rem 0.5rem;
}

/* when tabs are active, the tab already names the group */
.tabs-ready .shop-group h3 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); padding: 0; }

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

.product {
  position: relative;
  display: grid;
  grid-template-columns: minmax(10rem, 15rem) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.5rem 2rem;
  padding-block: 1.6rem;
  border-bottom: 1px solid var(--rule);
}

.product-link {
  font-family: var(--serif);
  font-size: 1.625rem;
  font-weight: 500;
  line-height: 1.15;
  text-decoration: none;
}

.product-link::after { content: ""; position: absolute; inset: 0; }

.product-note { margin: 0; color: var(--stone); font-size: 1rem; line-height: 1.55; }
.product .code { grid-column: 3; }
.product .go { grid-column: 4; }

.go {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--rule);
  display: grid;
  place-items: center;
  transition: background-color 250ms ease, border-color 250ms ease, color 250ms ease;
}
.go svg { width: 14px; height: 14px; }
.product:hover .go { background: var(--ink); border-color: var(--ink); color: var(--mist); }

.code {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.5rem 0.45rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 200ms ease;
}
.code:hover { border-color: var(--sage); }

.code-text { font-size: 0.9rem; color: var(--stone); }
.code-text strong { color: var(--ink); font-weight: 500; letter-spacing: 0.04em; }

.code-action {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--fog);
  color: var(--ink);
}

/* ---------- Supplements + newsletter ---------- */

.duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--fog);
  border-radius: var(--radius-lg);
}

.duo-col { padding: clamp(2.25rem, 6vw, 4.5rem); }
.duo-col + .duo-col { border-left: 1px solid var(--rule); }
.duo-col h2 { font-size: clamp(2.4rem, 4.2vw, 3.4rem); margin-bottom: 1.25rem; }
.duo-col p { color: var(--stone); }

/* ---------- About ---------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(2.5rem, 7vw, 7rem);
  align-items: start;
}

.about-grid h2 { margin-bottom: 2rem; }

.statement {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3vw, 2.4rem);
  font-weight: 500;
  font-style: italic;
  line-height: 1.25;
  max-width: 32rem;
  margin-bottom: 1.75rem;
}

.about-grid p:not(.statement) { color: var(--stone); }

.facts { margin: 0; padding-top: 0.5rem; }

.facts div { padding-block: 1.1rem; border-top: 1px solid var(--rule); }
.facts div:last-child { border-bottom: 1px solid var(--rule); }

.facts dt { font-size: 0.875rem; color: var(--stone); margin-bottom: 0.2rem; }
.facts dd { margin: 0; font-size: 1.0625rem; line-height: 1.5; }

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

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(2.5rem, 7vw, 7rem);
}

.contact-grid h2 { margin-bottom: 1.25rem; }
.contact-grid > div > p { color: var(--stone); }

.note {
  font-size: 0.95rem;
  margin-top: 2rem;
  padding: 1.1rem 1.25rem;
  background: var(--fog);
  border-radius: 1rem;
}

.form { display: grid; gap: 1.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.field { display: grid; gap: 0.45rem; }
.field label { font-size: 0.925rem; color: var(--stone); }

.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 0.875rem;
  padding: 0.85rem 1rem;
  transition: border-color 200ms ease;
  -webkit-appearance: none;
  appearance: none;
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2356615C' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.field textarea { min-height: 9.5rem; resize: vertical; }

.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--sage); }

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); border-radius: 0.875rem; }

.form .btn { justify-self: start; }
.form-status { margin: 0; min-height: 1.5em; font-size: 0.95rem; }
.honey { display: none; }

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

.site-footer {
  background: var(--fog);
  padding-block: clamp(4rem, 8vw, 6rem) 2.5rem;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 2rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}

.footer-name {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  font-weight: 500;
  line-height: 1;
}

.social { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; list-style: none; margin: 0; padding: 0; }
.social a { text-decoration: none; font-size: 1rem; color: var(--ink); }
.social a:hover { text-decoration: underline; text-underline-offset: 0.3em; text-decoration-color: var(--sage); }

.disclaimer {
  font-size: 0.875rem;
  line-height: 1.7;
  color: #4C5752;
  max-width: 50rem;
  margin-top: 2.5rem;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.25rem;
  font-size: 0.9rem;
  color: #4C5752;
}
.footer-bottom a { color: var(--ink); text-underline-offset: 0.3em; }

/* ---------- Tablet ---------- */

@media (max-width: 1000px) {
  .product { grid-template-columns: minmax(0, 1fr) auto; }
  .product-link { grid-column: 1; }
  .product-note { grid-column: 1; }
  .product .code { grid-column: 1; justify-self: start; margin-top: 0.4rem; }
  .product .go { grid-column: 2; grid-row: 1 / span 3; }
}

/* ---------- Phone ---------- */

@media (max-width: 780px) {
  body { font-size: 1.0625rem; }
  [id] { scroll-margin-top: 5.5rem; }

  .site-header { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--mist); }
  .header-inner { min-height: 4.25rem; }
  .menu-button { display: inline-flex; }

  .site-nav {
    position: fixed;
    inset: 0;
    background: var(--mist);
    padding: 7rem var(--gutter) 3rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 350ms ease, visibility 0s linear 350ms;
  }
  .menu-open .site-nav { opacity: 1; visibility: visible; transition: opacity 350ms ease; }

  .nav-list { flex-direction: column; gap: 0; }
  .nav-list li { border-bottom: 1px solid var(--rule); }
  .nav-list a {
    display: block;
    padding-block: 1rem;
    font-family: var(--serif);
    font-size: 2.1rem;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.1;
  }

  .hero { padding-top: 2rem; }
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { order: -1; justify-self: start; max-width: 13.5rem; margin: 1.1rem 0 1.5rem 1.1rem; }

  .book-panel,
  .about-grid,
  .contact-grid,
  .duo { grid-template-columns: 1fr; }

  .duo-col + .duo-col { border-left: 0; border-top: 1px solid var(--rule); }

  .tabs { display: flex; flex-wrap: nowrap; }
  .tab { flex: 1 1 auto; padding-inline: 0.75rem; white-space: nowrap; }
  .tab-long { display: none; }
  .tab-short { display: inline; }

  .product { padding-block: 1.35rem; gap: 0.35rem 1rem; }
  .product-link { font-size: 1.5rem; }
  .go { width: 2.5rem; height: 2.5rem; }

  .form-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
