/* ============================================
   NOTEBOOK THEME — Phu Quoc Dental Guide
   Warm handwritten-notebook aesthetic
   Mobile-first with responsive breakpoints
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --paper: #fdf6e3;
  --paper-dark: #f5edd6;
  --paper-line: #c8dbbe;
  --ink: #2c1810;
  --ink-light: #5a4234;
  --ink-muted: #8b7355;
  --accent: #1a6b4a;
  --accent-light: #2d9b6e;
  --accent-bg: rgba(26, 107, 74, 0.08);
  --highlight: #e8a838;
  --highlight-bg: rgba(232, 168, 56, 0.12);
  --red: #c0392b;
  --red-bg: rgba(192, 57, 43, 0.08);
  --blue: #2471a3;
  --blue-bg: rgba(36, 113, 163, 0.08);
  --margin-line: #d4a5a5;
  --binding: #8b4513;
  --shadow: rgba(44, 24, 16, 0.1);
  --radius: 4px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-handwritten: 'Caveat', cursive;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ---- RESET ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: var(--font-body);
  background: #e8dcc8;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(139,69,19,0.04) 0%, transparent 70%),
    radial-gradient(ellipse at 80% 50%, rgba(139,69,19,0.03) 0%, transparent 70%);
  color: var(--ink);
  line-height: 1.75;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- NOTEBOOK WRAPPER ---- */
.notebook {
  max-width: 820px;
  margin: 0;
  background: var(--paper);
  position: relative;
  min-height: 100vh;
}

/* Spiral binding dots — hidden on mobile, shown on desktop */
.notebook::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  z-index: 2;
  display: none;
}

/* Lined paper effect */
.notebook-page {
  padding: 1.25rem 1rem 2rem;
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent,
      transparent 27px,
      var(--paper-line) 27px,
      var(--paper-line) 28px
    );
  background-size: 100% 28px;
  background-position: 0 12px;
  min-height: 100%;
}

/* ---- HEADER / NAV ---- */
.nb-header {
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--binding);
  background: var(--paper-dark);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nb-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.nb-header .site-title {
  font-family: var(--font-handwritten);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  line-height: 1.2;
  flex-shrink: 1;
  min-width: 0;
}

.nb-header .site-title:hover { color: var(--accent-light); }

.nb-header .site-subtitle {
  display: none;
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-top: 0.15rem;
}

/* Mobile hamburger */
.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
  color: var(--ink-light);
  -webkit-tap-highlight-color: transparent;
}

.menu-toggle svg { width: 22px; height: 22px; }

.nb-nav {
  display: none;
  flex-direction: column;
  gap: 0;
  padding: 0.5rem 1rem 0.75rem;
  border-bottom: 2px solid var(--binding);
  background: var(--paper-dark);
}

.nb-nav.open { display: flex; }

.nb-nav a {
  font-family: var(--font-handwritten);
  font-size: 1.2rem;
  color: var(--ink-light);
  text-decoration: none;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.nb-nav a:hover,
.nb-nav a.active {
  color: var(--accent);
  background: var(--accent-bg);
}

.nb-nav a.external {
  color: var(--blue);
  font-weight: 600;
}

/* ---- TYPOGRAPHY ---- */
h1, h2, h3, h4 {
  font-family: var(--font-handwritten);
  color: var(--ink);
  line-height: 1.3;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
  border-bottom: 3px solid var(--accent);
  padding-bottom: 0.5rem;
}

h2 {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink);
  margin: 2rem 0 0.75rem;
  padding-left: 0.5rem;
  border-left: 4px solid var(--highlight);
}

h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent);
  margin: 1.5rem 0 0.5rem;
}

h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--blue);
  margin: 1rem 0 0.5rem;
}

p { margin-bottom: 1rem; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(26, 107, 74, 0.3);
  text-underline-offset: 2px;
  transition: all 0.15s;
}

a:hover {
  color: var(--accent-light);
  text-decoration-color: var(--accent-light);
}

strong { color: var(--ink); font-weight: 600; }

ul, ol { margin: 0 0 1rem 1.25rem; }
li { margin-bottom: 0.35rem; }

blockquote {
  border-left: 3px solid var(--highlight);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: var(--highlight-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--ink-light);
}

blockquote p:last-child { margin-bottom: 0; }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--paper-dark);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--red);
}

pre {
  background: #2c1810;
  color: #fdf6e3;
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
  font-size: 0.85rem;
  border: 1px solid var(--binding);
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
}

hr {
  border: none;
  height: 1px;
  background: var(--paper-line);
  margin: 2rem 0;
}

/* ---- TABLES (responsive scroll wrapper) ---- */
.treatment-summary table,
article table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem -0.5rem;
  padding: 0 0.5rem;
  scrollbar-width: thin;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  overflow: hidden;
  white-space: nowrap;
}

thead {
  background: var(--accent);
  color: #fff;
}

th {
  padding: 0.55rem 0.65rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  padding: 0.5rem 0.65rem;
  border-top: 1px solid var(--paper-line);
  vertical-align: top;
}

tbody tr:nth-child(even) { background: var(--paper-dark); }
tbody tr:hover { background: var(--accent-bg); }

/* ---- CARDS ---- */
.nb-card {
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: 2px 2px 8px var(--shadow);
  position: relative;
}

.nb-card h3 { margin-top: 0; font-size: 1.3rem; }

.nb-card .meta {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}

/* ---- TAGS ---- */
.nb-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 500;
  white-space: nowrap;
  margin: 0 4px 4px 0;
}

.nb-tag-green { background: rgba(45, 155, 110, 0.12); color: var(--accent); }
.nb-tag-yellow { background: var(--highlight-bg); color: #b8860b; }
.nb-tag-red { background: var(--red-bg); color: var(--red); }
.nb-tag-blue { background: var(--blue-bg); color: var(--blue); }

/* ---- ALERT BOXES ---- */
.nb-alert {
  border-radius: var(--radius);
  padding: 1rem 1rem;
  margin: 1.25rem 0;
  border-left: 4px solid;
}

.nb-alert-tip { background: var(--accent-bg); border-color: var(--accent); }
.nb-alert-warning { background: var(--highlight-bg); border-color: var(--highlight); }
.nb-alert-important { background: var(--red-bg); border-color: var(--red); }
.nb-alert-info { background: var(--blue-bg); border-color: var(--blue); }

.nb-alert strong { display: block; margin-bottom: 0.25rem; }
.nb-alert p:last-child { margin-bottom: 0; }

/* ---- HANDWRITTEN NOTES ---- */
.nb-margin-note {
  font-family: var(--font-handwritten);
  font-size: 1rem;
  color: var(--red);
  transform: rotate(-2deg);
  display: inline-block;
  padding: 0.25rem 0.5rem;
  margin: 0.5rem 0;
}

.nb-underline {
  background-image: linear-gradient(transparent 60%, rgba(232, 168, 56, 0.35) 60%);
  padding: 0 2px;
}

/* ---- FAQ SECTION ---- */
.faq-section { margin: 2rem 0; }

.faq-item {
  border-bottom: 1px dashed var(--paper-line);
  padding: 1rem 0;
}

.faq-item:last-child { border-bottom: none; }

.faq-q {
  font-family: var(--font-handwritten);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
}

.faq-q::before {
  content: 'Q:';
  font-weight: 700;
  color: var(--red);
  min-width: 28px;
  flex-shrink: 0;
}

.faq-a {
  padding: 0.5rem 0 0 2.2rem;
  color: var(--ink-light);
  font-size: 0.92rem;
  line-height: 1.65;
}

.faq-a::before {
  content: 'A: ';
  font-weight: 600;
  color: var(--accent);
}

/* ---- STATS ROW ---- */
.nb-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.nb-stat {
  background: var(--paper-dark);
  border: 1px dashed var(--paper-line);
  border-radius: var(--radius);
  padding: 0.85rem 0.75rem;
  text-align: center;
}

.nb-stat-num {
  font-family: var(--font-handwritten);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.nb-stat-label {
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-top: 0.25rem;
  line-height: 1.3;
}

/* ---- POST LIST ---- */
.post-list { list-style: none; }

.post-list li {
  padding: 0.85rem 0;
  border-bottom: 1px dashed var(--paper-line);
}

.post-list li:last-child { border-bottom: none; }

.post-list a {
  text-decoration: none;
  display: block;
}

.post-list .post-title {
  font-family: var(--font-handwritten);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.3;
  display: block;
}

.post-list a:hover .post-title { color: var(--accent-light); }

.post-list .post-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
  display: block;
  margin-top: 0.15rem;
}

.post-list .post-summary {
  font-size: 0.88rem;
  color: var(--ink-light);
  margin-top: 0.25rem;
  display: block;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

/* ---- BREADCRUMB ---- */
.breadcrumb {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.breadcrumb a { color: var(--ink-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 0.35rem; }

/* ---- ARTICLE META ---- */
.article-meta {
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

/* ---- FOOTER ---- */
.nb-footer {
  padding: 1.25rem 1rem;
  border-top: 2px solid var(--binding);
  background: var(--paper-dark);
  font-size: 0.82rem;
  color: var(--ink-muted);
  text-align: center;
}

.nb-footer a { color: var(--accent); }

.nb-footer .backlinks {
  margin-top: 0.5rem;
  font-family: var(--font-handwritten);
  font-size: 1rem;
  line-height: 1.6;
}

/* ---- TOC ---- */
.toc {
  background: var(--paper-dark);
  border: 1px dashed var(--paper-line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.toc-title {
  font-family: var(--font-handwritten);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.toc ul {
  list-style: none;
  padding-left: 1rem;
  margin: 0;
}

.toc > nav > ul { padding-left: 0; }
.toc li { margin: 0.25rem 0; }

.toc a {
  color: var(--ink-light);
  text-decoration: none;
  font-size: 0.88rem;
  display: block;
  padding: 0.15rem 0;
}

.toc a:hover { color: var(--accent); }

/* ---- SMILEJET CTA ---- */
.smilejet-cta {
  background: var(--accent);
  color: #fff;
  padding: 1.25rem;
  border-radius: var(--radius);
  text-align: center;
  margin: 2rem 0;
  box-shadow: 2px 2px 8px var(--shadow);
}

.smilejet-cta a {
  color: #fff;
  font-weight: 700;
  text-decoration: underline;
}

.smilejet-cta .cta-title {
  font-family: var(--font-handwritten);
  font-size: 1.4rem;
  margin-bottom: 0.35rem;
}

.smilejet-cta p { margin-bottom: 0; }

/* ---- PAGINATION ---- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.pagination a,
.pagination .page-item {
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--ink-light);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pagination a:hover { background: var(--accent-bg); }
.pagination .active a { background: var(--accent); color: #fff; }

/* ============================================
   TABLET (640px+)
   ============================================ */
@media (min-width: 640px) {
  .notebook-page { padding: 1.75rem 1.5rem 2.5rem; }
  .nb-header { padding: 1rem 1.5rem; }
  .nb-footer { padding: 1.25rem 1.5rem; }

  h1 { font-size: 2.2rem; }
  h2 { font-size: 1.7rem; }
  h3 { font-size: 1.35rem; }

  .nb-stats { grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
  .nb-stat { padding: 1rem; }
  .nb-stat-num { font-size: 2.2rem; }
  .nb-stat-label { font-size: 0.78rem; }

  table { white-space: normal; font-size: 0.88rem; }
  th { padding: 0.6rem 0.75rem; font-size: 0.78rem; }
  td { padding: 0.55rem 0.75rem; }

  .faq-q { font-size: 1.25rem; }

  .post-list .post-title { font-size: 1.4rem; }
}

/* ============================================
   DESKTOP (860px+)
   ============================================ */
@media (min-width: 860px) {
  .notebook {
    margin: 2rem auto;
    border-radius: 2px 8px 8px 2px;
    box-shadow:
      -4px 0 0 var(--binding),
      -6px 0 0 #6d3510,
      4px 4px 16px var(--shadow),
      0 0 0 1px rgba(139,69,19,0.08);
    min-height: auto;
  }

  /* Spiral binding dots */
  .notebook::before {
    display: block;
    width: 48px;
    background:
      repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 28px,
        var(--binding) 28px,
        var(--binding) 32px,
        transparent 32px,
        transparent 36px
      );
    border-right: 2px solid var(--margin-line);
  }

  .notebook-page { padding: 2rem 2.5rem 2rem 4rem; }
  .nb-header { padding: 1.5rem 2.5rem 1rem 4rem; }
  .nb-footer { padding: 1.5rem 2.5rem 1.5rem 4rem; }

  /* Desktop nav — inline, no hamburger */
  .menu-toggle { display: none; }

  .nb-nav {
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0;
    margin-top: 0.75rem;
    border: none;
    background: none;
  }

  .nb-nav a {
    padding: 0.2rem 0.75rem;
    font-size: 1.15rem;
    border-bottom: 2px solid transparent;
  }

  .nb-nav a:hover,
  .nb-nav a.active {
    border-bottom-color: var(--accent);
  }

  .nb-header .site-subtitle { display: block; }

  h1 { font-size: 2.4rem; }
  h2 { font-size: 1.8rem; }
  h3 { font-size: 1.4rem; }
  h4 { font-size: 1.15rem; }

  table { font-size: 0.9rem; }

  .smilejet-cta .cta-title { font-size: 1.5rem; }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
  body { background: #fff; }
  .notebook { box-shadow: none; border: none; margin: 0; border-radius: 0; }
  .notebook::before { display: none; }
  .nb-header { position: static; }
  .menu-toggle, .nb-nav, .smilejet-cta { display: none; }
}
