/* ===========================================================================
   LIFE by Dr. Pat — article site theme
   Palette and shapes taken from the live Canva site (article.lifebydrpat.com).
   =========================================================================== */

:root {
  /* Brand palette */
  --coral:        #e9a28e;
  --coral-deep:   #d97f66;
  --blush:        #e5c7b9;
  --mint:         #c3dbd8;
  --mint-deep:    #9cc3bd;
  --cream:        #f0e9df;
  --ink:          #233d4d;
  --ink-soft:     #3d5c6f;
  --brown:        #a47764;
  --wine:         #a33b30;
  --sea:          #2e6f7e;

  /* Semantic tokens */
  --bg:           var(--cream);
  --bg-alt:       var(--mint);
  --surface:      #ffffff;
  --text:         var(--ink);
  --text-muted:   #5d7280;
  --heading:      var(--ink);
  --accent:       var(--coral);
  --accent-text:  var(--wine);
  --border:       rgba(35, 61, 77, .14);
  --shadow:       0 2px 8px rgba(35, 61, 77, .08), 0 12px 32px rgba(35, 61, 77, .07);
  --shadow-lift:  0 4px 14px rgba(35, 61, 77, .12), 0 20px 48px rgba(35, 61, 77, .12);

  /* Type */
  /* Cloud is the typeface the live site is set in; the files are self-hosted
     from the original export. Noto covers the Chinese and Vietnamese glyphs
     Cloud does not carry. */
  --font-sans: "Cloud", "Noto Sans Thai", "Noto Sans SC", "Be Vietnam Pro",
               -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Cloud", "Noto Sans Thai", "Noto Sans SC", "Be Vietnam Pro",
                  -apple-system, BlinkMacSystemFont, sans-serif;

  /* Metrics */
  --wrap: 1120px;
  --wrap-narrow: 760px;
  --gutter: 20px;
  --radius: 14px;
  --arch: 999px 999px 18px 18px;   /* the arch-topped card shape */
}

/* The live site is light-only; keep a readable dark variant rather than
   inverting the brand photography. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:         #16242c;
    --bg-alt:     #1d2f38;
    --surface:    #1f333d;
    --text:       #e6eef1;
    --text-muted: #a8bcc5;
    --heading:    #f2f7f8;
    --accent-text:#f0b3a3;
    --border:     rgba(230, 238, 241, .16);
    --shadow:     0 2px 8px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.35);
    --shadow-lift:0 4px 14px rgba(0,0,0,.5), 0 20px 48px rgba(0,0,0,.45);
  }
}

:root[data-theme="dark"] {
  --bg:         #16242c;
  --bg-alt:     #1d2f38;
  --surface:    #1f333d;
  --text:       #e6eef1;
  --text-muted: #a8bcc5;
  --heading:    #f2f7f8;
  --accent-text:#f0b3a3;
  --border:     rgba(230, 238, 241, .16);
  --shadow:     0 2px 8px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.35);
  --shadow-lift:0 4px 14px rgba(0,0,0,.5), 0 20px 48px rgba(0,0,0,.45);
}

/* --------------------------------------------------------------- base --- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.75;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--sea); text-underline-offset: .18em; }
a:hover { color: var(--coral-deep); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--heading);
  line-height: 1.25;
  margin: 0 0 .5em;
  font-weight: 800;
  overflow-wrap: break-word;
}
h1 { font-size: clamp(1.9rem, 5.2vw, 3.1rem); }
h2 { font-size: clamp(1.45rem, 3.6vw, 2.15rem); }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.45rem); }
p  { margin: 0 0 1.1em; }

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

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

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow);
}
.skip-link:focus { top: 8px; }

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

/* ------------------------------------------------------------- header --- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex; align-items: center; gap: 16px;
  min-height: 62px; padding-block: 8px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--heading); }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.brand strong { font-family: var(--font-display); font-size: 1.12rem; font-weight: 800; letter-spacing: .01em; }

.site-nav { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.site-nav a {
  text-decoration: none; color: var(--text); font-size: .93rem; font-weight: 600;
  padding: 7px 12px; border-radius: 999px;
}
.site-nav a:hover { background: color-mix(in srgb, var(--accent) 26%, transparent); color: var(--heading); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  background: var(--coral); color: #4a1c14;
  font-weight: 800; text-decoration: none;
  padding: 11px 22px; border-radius: 999px; border: 0;
  box-shadow: var(--shadow); cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { background: var(--coral-deep); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.btn--ghost { background: transparent; color: var(--text); border: 2px solid var(--border); box-shadow: none; }
.btn--ghost:hover { background: var(--surface); color: var(--heading); }

/* language switcher */
.langs { display: flex; gap: 4px; align-items: center; }
.langs a {
  font-size: .82rem; font-weight: 700; text-decoration: none;
  padding: 5px 10px; border-radius: 999px; color: var(--text-muted);
}
.langs a[aria-current="true"] { background: var(--accent); color: #4a1c14; }
.langs a:hover { background: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--heading); }

/* --------------------------------------------------------------- hero --- */

.hero {
  position: relative; isolation: isolate;
  display: grid; place-items: center; text-align: center;
  min-height: clamp(320px, 52vh, 520px);
  padding: 72px 0 84px;
  color: #fff;
}
.hero__bg {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; object-fit: cover;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(10,45,60,.45) 0%, rgba(10,45,60,.28) 45%, rgba(10,45,60,.55) 100%);
}
.hero h1 { color: #fff; text-shadow: 0 2px 22px rgba(0,0,0,.4); margin-bottom: .2em; }
.hero__eyebrow {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1rem, 2.6vw, 1.5rem);
  color: #fff; opacity: .95; margin: 0 0 .1em;
  text-shadow: 0 2px 16px rgba(0,0,0,.45);
}
.hero__sub {
  max-width: 62ch; margin: .6em auto 0; color: #fff; opacity: .95;
  font-size: clamp(.98rem, 1.9vw, 1.12rem); text-shadow: 0 1px 14px rgba(0,0,0,.5);
}
.hero__byline {
  margin-top: 1.4em; font-size: .92rem; opacity: .95;
  text-shadow: 0 1px 12px rgba(0,0,0,.5);
}
.hero__byline strong { display: block; font-size: 1.02rem; }
.hero__actions { margin-top: 1.6em; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero__actions .btn--ghost { color: #fff; border-color: rgba(255,255,255,.6); }
.hero__actions .btn--ghost:hover { background: rgba(255,255,255,.16); color: #fff; }

/* ------------------------------------------------------------ section --- */

.section { padding: clamp(44px, 7vw, 76px) 0; }
.section--alt { background: var(--bg-alt); }
.section--cream { background: var(--cream); }
.section__head { text-align: center; margin-bottom: clamp(28px, 4vw, 44px); }
.section__head p { color: var(--text-muted); max-width: 60ch; margin-inline: auto; }

/* --------------------------------------------------- arch card (grid) --- */

.cards {
  display: grid; gap: clamp(18px, 2.6vw, 28px);
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.card {
  display: flex; flex-direction: column;
  background: var(--coral); color: #4a1c14;
  border-radius: var(--arch);
  overflow: hidden; text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
  min-height: 300px;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); color: #4a1c14; }
.card__media {
  aspect-ratio: 4 / 3; width: 100%; object-fit: cover;
  border-radius: var(--arch);
  background: color-mix(in srgb, var(--coral) 70%, #fff);
}
.card__body { padding: 16px 20px 22px; text-align: center; }
.card__title {
  font-family: var(--font-display); font-weight: 800;
  font-size: 1.03rem; line-height: 1.35; margin: 0 0 .25em; color: #57211a;
}
.card__sub { font-size: .88rem; line-height: 1.45; margin: 0; color: #6d3428; opacity: .95; }

/* ------------------------------------------------------- list section --- */

.list { display: grid; gap: 14px; }
.list__item {
  display: grid; grid-template-columns: 132px 1fr; gap: 18px; align-items: center;
  background: var(--surface); border-radius: var(--radius);
  padding: 12px 18px 12px 12px; text-decoration: none;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
}
.list__item:hover { transform: translateX(3px); box-shadow: var(--shadow-lift); }
.list__thumb { width: 132px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; }
.list__title { font-family: var(--font-display); font-weight: 800; color: var(--sea); margin: 0 0 .15em; font-size: 1.02rem; line-height: 1.35; }
.list__sub { margin: 0; font-size: .9rem; color: var(--text-muted); }

@media (max-width: 560px) {
  .list__item { grid-template-columns: 92px 1fr; gap: 12px; padding: 10px; }
  .list__thumb { width: 92px; }
}

/* ------------------------------------------------------ article prose --- */

.article { padding: clamp(32px, 5vw, 56px) 0 clamp(48px, 7vw, 80px); }
.prose { max-width: 72ch; margin-inline: auto; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 {
  margin-top: 1.9em; padding-bottom: .28em;
  border-bottom: 3px solid var(--accent);
}
.prose h3 { margin-top: 1.5em; color: var(--sea); }
.prose ul, .prose ol { padding-inline-start: 1.35em; margin-block: 0; }
.prose li + li { margin-top: .4em; }
.prose figure { margin: 1.8em 0; }
.prose figure img { border-radius: var(--radius); box-shadow: var(--shadow); width: 100%; }
.prose figcaption { margin-top: .6em; font-size: .88rem; color: var(--text-muted); text-align: center; }
.prose blockquote {
  margin: 1.6em 0; padding: 4px 0 4px 20px;
  border-inline-start: 4px solid var(--accent); color: var(--text-muted); font-style: italic;
}

.callout {
  background: var(--surface); border: 1px solid var(--border);
  border-inline-start: 5px solid var(--accent);
  border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow);
}
.callout h3 { margin-top: 0; color: var(--accent-text); }
.callout > :last-child { margin-bottom: 0; }

/* pros / cons pair used across the clinical articles */
.proscons { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.proscons__col { background: var(--surface); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); border-top: 5px solid var(--mint-deep); }
.proscons__col--con { border-top-color: var(--coral-deep); }
.proscons__col h4 { margin: 0 0 .5em; font-family: var(--font-display); font-size: 1rem; }
.proscons__col ul { margin: 0; padding-inline-start: 1.2em; }

/* simple data table */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--border); }
th { background: color-mix(in srgb, var(--mint) 60%, var(--surface)); font-weight: 800; color: var(--heading); }
tr:last-child td { border-bottom: 0; }

/* chips for keyword lists */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.chips li { background: color-mix(in srgb, var(--mint) 70%, var(--surface)); color: var(--heading);
            border-radius: 999px; padding: 5px 13px; font-size: .84rem; font-weight: 600; }

/* byline block carrying the author's credentials */
.byline {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border-radius: var(--radius);
  padding: 14px 18px; box-shadow: var(--shadow); margin-bottom: 1.6em;
}
.byline__name { font-family: var(--font-display); font-weight: 800; margin: 0; color: var(--heading); }
.byline__creds { margin: 0; font-size: .87rem; color: var(--text-muted); }

/* machine-translation notice */
.mt-notice {
  background: color-mix(in srgb, var(--coral) 24%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--coral-deep) 40%, transparent);
  border-radius: var(--radius); padding: 12px 18px; margin-bottom: 1.8em;
  font-size: .9rem; color: var(--text); display: flex; gap: 10px; align-items: flex-start;
}
.mt-notice span:first-child { font-size: 1.1rem; line-height: 1.4; }
.mt-notice p { margin: 0; }

/* table of contents */
.toc { background: var(--surface); border-radius: var(--radius); padding: 16px 22px; box-shadow: var(--shadow); }
.toc h2 { font-size: 1rem; margin: 0 0 .5em; border: 0; padding: 0; }
.toc ol { margin: 0; padding-inline-start: 1.3em; }
.toc a { text-decoration: none; font-weight: 600; }
.toc a:hover { text-decoration: underline; }

/* -------------------------------------------------------------- footer --- */

.site-footer { background: var(--ink); color: #dce8ec; padding: clamp(40px, 6vw, 64px) 0 28px; margin-top: 8px; }
.site-footer a { color: #cfe3e8; }
.site-footer__grid { display: grid; gap: 30px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.site-footer h3 { color: #fff; font-size: 1rem; margin-bottom: .6em; }
.site-footer p, .site-footer li { font-size: .92rem; line-height: 1.7; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.footer-contact li { margin-bottom: .2em; }
.socials { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.socials a { display: inline-flex; width: 36px; height: 36px; border-radius: 50%;
             background: rgba(255,255,255,.12); align-items: center; justify-content: center; }
.socials a:hover { background: rgba(255,255,255,.24); }
.socials img { width: 20px; height: 20px; object-fit: contain; }
.site-footer__bottom {
  margin-top: 30px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.16);
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: space-between;
  font-size: .86rem; color: #adc4cc;
}

/* ------------------------------------------------------------- utility --- */

.back-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 700; font-size: .92rem; }
.back-link:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .site-footer, .hero__actions, .langs { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ------------------------------------------------- responsive header --- */

@media (max-width: 900px) {
  .site-header__inner { gap: 10px; flex-wrap: nowrap; }
  .site-nav { gap: 4px; flex-wrap: nowrap; }
  .site-nav > a:not(.btn) { display: none; }      /* text links live in the footer too */
  .brand strong { font-size: 1rem; white-space: nowrap; }
  .langs a { padding: 5px 7px; font-size: .78rem; }
  .btn { padding: 9px 14px; font-size: .86rem; white-space: nowrap; }
}

@media (max-width: 620px) {
  .brand strong { display: none; }                 /* logo alone carries the brand */
  .brand img { width: 30px; height: 30px; }
  .site-header__inner { min-height: 54px; }
  .langs { gap: 2px; }
  .langs a { padding: 4px 6px; font-size: .75rem; }
  .btn { padding: 8px 12px; font-size: .82rem; }
  .hero { padding: 56px 0 64px; }
  .cards { grid-template-columns: 1fr; }
  :root { --gutter: 16px; }
}

@media (max-width: 400px) {
  .site-nav .btn { display: none; }                /* booking CTA stays in the hero */
}

/* ------------------------------------------------ media: video & grid --- */

.prose video { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); background: #000; display: block; }

.gallery {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 1.8em 0;
}
.gallery__cell { margin: 0; }
.gallery__cell img {
  width: 100%; border-radius: var(--radius); box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--mint) 45%, var(--surface));
}
.gallery__cell figcaption {
  margin-top: .5em; font-size: .86rem; color: var(--text-muted);
  text-align: center; font-weight: 600;
}

/* A video with preload="none" has no frame to size itself from until it is
   played. The width/height attributes give the browser the aspect ratio, so the
   player reserves the right space instead of collapsing to a bar. */
.prose video { height: auto; max-height: 80vh; object-fit: contain; }
.prose video:not([width]) { aspect-ratio: 16 / 9; }

/* Link to the clinic's own page on the same topic, where one exists. */
.official-link {
  background: color-mix(in srgb, var(--mint) 55%, var(--surface));
  border-inline-start: 4px solid var(--sea);
  border-radius: var(--radius);
  padding: 11px 18px; margin-bottom: 1.6em; font-size: .93rem;
}
.official-link a { font-weight: 700; text-decoration: none; }
.official-link a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- tools
   A tool page frames a self-contained app. The iframe keeps the app's own
   stylesheet away from this one — it sets :root variables and a .card class
   that would otherwise fight with the theme. */
.hero--plain {
  min-height: 0;
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
  background: linear-gradient(160deg, var(--sea), var(--ink));
}
.hero--plain::after { display: none; }

.app-frame {
  max-width: var(--wrap);
  margin: 0 auto clamp(2rem, 5vw, 4rem);
  padding-inline: var(--gutter);
}
.app-frame__bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: .75rem;
}
.app-frame iframe {
  display: block;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-lift);
}
.prose p.muted {
  color: var(--text-muted);
  font-size: .95rem;
}
