/* ============================================================================
   Photlin Docs — luxury editorial documentation theme
   Matches the main Photlin site: warm ivory paper (#F6F5F1), deep ink (#141413),
   crisp white cards, subtle architectural hairlines, and calm botanical flora
   in the margins (zero fish so reading stays serene).
   ========================================================================== */

:root {
  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --surface-2: #EFECE5;
  --ink: #141413;
  --ink-2: #5F5E5A;
  --accent: #0A8FB0;
  --accent-bright: #00B8DE;
  --accent-ink: #087894;
  --line: rgba(20, 20, 19, 0.13);
  --line-soft: rgba(20, 20, 19, 0.08);
  --hilite: rgba(10, 143, 176, 0.09);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Noto Serif", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 14px 36px rgba(20, 20, 19, 0.06);
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- minimal luxury top bar ---------- */
.docs-topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246, 245, 241, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.docs-topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.docs-brand {
  display: inline-flex; align-items: baseline; gap: 10px;
  color: var(--ink); text-decoration: none;
}
.docs-brand:hover { text-decoration: none; }
.docs-brand-word {
  font-family: var(--serif); font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em;
}
.docs-brand-tag {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2);
  padding-left: 10px; border-left: 1px solid var(--line);
}
.docs-top-links {
  display: flex; align-items: center; gap: 20px; font-size: 14px;
}
.docs-top-links a { color: var(--ink-2); font-weight: 500; }
.docs-top-links a:hover, .docs-top-links a.is-here { color: var(--ink); text-decoration: none; }
.docs-top-cta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: 999px;
  background: var(--ink); color: #fff !important; font-size: 13px; font-weight: 600;
  transition: opacity .15s ease, transform .1s ease;
}
.docs-top-cta:hover { opacity: 0.88; text-decoration: none; }

/* ---------- flora background (seeded plants, no fish) ---------- */
.docs-flora {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.docs-flora .flora { position: absolute; opacity: 0.42; }
.docs-flora .flora.l { left: -10px; }
.docs-flora .flora.r { right: -10px; }
.docs-flora .f-1 { top: 10vh; }
.docs-flora .f-2 { top: 40vh; transform: scaleX(-1); }
.docs-flora .f-3 { top: 72vh; }
.docs-flora .f-4 { top: 54vh; transform: scaleX(-1); }
.docs-flora .m-only { display: none; }

.flora { z-index: 1; pointer-events: none; }
.flora svg { display: block; overflow: visible; }
.flora .bob { transform-origin: 50% 90%; animation: flora-bob 7s ease-in-out infinite; }
.flora .sway { animation: flora-sway 4s ease-in-out infinite; }
@keyframes flora-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(-1.2deg); } }
@keyframes flora-sway { 0%, 100% { transform: rotate(-1.6deg); } 50% { transform: rotate(1.6deg); } }

/* ---------- docs shell / 3-column layout ---------- */
.docs-shell {
  position: relative; z-index: 1;
  display: flex; align-items: flex-start; gap: 48px;
  max-width: 1200px; margin: 0 auto; padding: 36px 24px 96px;
}

/* left nav */
.docs-nav {
  width: 256px; flex: 0 0 256px; position: sticky; top: 82px; align-self: flex-start;
  max-height: calc(100vh - 104px); overflow-y: auto; padding-right: 10px;
  font-size: 14px;
}
.docs-nav-home {
  display: inline-block; font-family: var(--serif); font-size: 1.05rem; font-weight: 600;
  color: var(--ink); margin: 0 0 14px 4px;
}
.nav-topics { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.nav-topic { margin: 0; }
.nav-topic-link {
  display: block; padding: 7px 14px; color: var(--ink-2); border-left: 2px solid transparent;
  margin-left: -1px; line-height: 1.35; transition: color .15s ease, border-color .15s ease;
}
.nav-topic-link:hover { color: var(--ink); text-decoration: none; }
.nav-topic.active > .nav-topic-link { color: var(--ink); font-weight: 600; border-left-color: var(--ink); }
.nav-subs { list-style: none; margin: 2px 0 8px; padding: 0 0 0 12px; }
.nav-subs a { display: block; padding: 4px 12px; color: var(--ink-2); font-size: 13px; line-height: 1.35; }
.nav-subs a:hover { color: var(--ink); text-decoration: none; }
.nav-subs a.active { color: var(--accent-ink); font-weight: 600; }

/* main column */
.docs-main { flex: 1 1 auto; min-width: 0; max-width: 720px; }
.doc-breadcrumb { font-size: 13px; color: var(--ink-2); margin: 0 0 12px; letter-spacing: 0.01em; }
.doc-breadcrumb a { color: var(--ink-2); }
.doc-head { margin: 0 0 34px; padding-bottom: 22px; border-bottom: 1px solid var(--line-soft); }
.doc-head h1 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(28px, 3.6vw, 38px);
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 10px;
}
.doc-summary { font-size: 17px; color: var(--ink-2); margin: 0; line-height: 1.55; }

/* headings inside content */
.doc-content h2 {
  font-family: var(--serif); font-weight: 600; font-size: 23px; line-height: 1.25;
  margin: 48px 0 14px; padding-top: 8px; scroll-margin-top: 82px;
}
.doc-content h3 {
  font-weight: 600; font-size: 17px; line-height: 1.3; margin: 28px 0 10px; scroll-margin-top: 82px;
}
.doc-content p { margin: 0 0 15px; }
.doc-content ul, .doc-content ol { margin: 0 0 18px; padding-left: 22px; }
.doc-content li { margin: 7px 0; }
.doc-content li > ul { margin: 6px 0 4px; }

/* right "on this page" */
.docs-onthis {
  width: 204px; flex: 0 0 204px; position: sticky; top: 82px; align-self: flex-start;
  font-size: 13px; border-left: 1px solid var(--line-soft); padding-left: 16px;
  max-height: calc(100vh - 104px); overflow-y: auto;
}
.onthis-title {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-2); margin: 0 0 10px; font-weight: 600;
}
.docs-onthis ul { list-style: none; margin: 0; padding: 0; }
.docs-onthis li { margin: 0 0 7px; }
.docs-onthis a { color: var(--ink-2); }
.docs-onthis a:hover, .docs-onthis a.active { color: var(--ink); font-weight: 500; text-decoration: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  font: 600 14px/1 var(--sans); cursor: pointer; text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:hover { text-decoration: none; border-color: var(--ink); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-accent:hover { background: #2c2c2a; border-color: #2c2c2a; color: #fff; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }

/* ---------- callouts ---------- */
.callout {
  border-left: 3px solid var(--ink); background: var(--surface);
  border-top: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  padding: 14px 18px; margin: 0 0 20px; border-radius: 0 12px 12px 0;
}
.callout-title {
  font-weight: 700; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  margin: 0 0 5px; color: var(--ink);
}
.callout p { margin: 0; font-size: 15px; }
.callout p + p { margin-top: 6px; }
.callout-tip { border-left-color: var(--accent); background: rgba(10, 143, 176, 0.05); }
.callout-tip .callout-title { color: var(--accent-ink); }
.callout-note { border-left-color: #7c7a74; background: var(--surface); }
.callout-careful { border-left-color: #C93A3A; background: #FDF4F4; }
.callout-careful .callout-title { color: #A62828; }

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface);
}
.doc-content table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc-content th, .doc-content td {
  border-bottom: 1px solid var(--line-soft); padding: 11px 13px; text-align: left; vertical-align: top;
}
.doc-content thead th {
  background: var(--surface-2); font-weight: 600; font-size: 12px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2);
}
.doc-content tbody tr:last-child td { border-bottom: 0; }
.doc-content tbody tr:nth-child(even) td { background: rgba(246, 245, 241, 0.45); }

/* ---------- kbd / UI button names ---------- */
kbd.ui {
  display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px;
  font: 500 13.5px/1.35 var(--sans); background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 0 rgba(20, 20, 19, 0.06);
}

/* ---------- term links (hard words -> Google) ---------- */
a.term { color: var(--ink); border-bottom: 1px dotted var(--accent); text-decoration: none; }
a.term:hover { border-bottom-style: solid; }
a.term .term-ext { color: var(--accent); font-size: 11px; margin-left: 1px; vertical-align: super; }

/* ---------- inline code ---------- */
code {
  font-family: var(--mono); font-size: 0.87em;
  background: var(--surface-2); padding: 2px 6px; border-radius: 5px;
}

/* ---------- screenshot phone frame ---------- */
.shot-fig { margin: 0 0 24px; text-align: center; }
.phone-frame {
  position: relative; width: 320px; max-width: 100%; margin: 0 auto;
  border: 10px solid #141413; border-radius: 28px; background: #141413;
  overflow: hidden; aspect-ratio: 320 / 624; box-shadow: 0 18px 40px rgba(20, 20, 19, 0.14);
}
.phone-frame .ph-screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 24px;
  background: linear-gradient(180deg, #faf9f6, #eeece5); color: var(--ink-2);
}
.phone-frame .ph-glyph {
  width: 54px; height: 54px; border-radius: 50%;
  border: 3px solid #c9c7c0; position: relative;
  box-shadow: inset 0 0 0 6px #faf9f6, inset 0 0 0 8px #dfddd6;
}
.phone-frame .ph-glyph::after {
  content: ""; position: absolute; inset: 16px; border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #cfcDC6, #aba9a2);
}
.phone-frame .ph-label {
  font: 400 13px/1.4 var(--mono); letter-spacing: .02em; text-align: center;
  color: #7a7872; max-width: 240px;
}
.phone-frame img.ph-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  object-position: top center; background: #0E1318; display: block;
}
.shot-fig figcaption { font-size: 13.5px; color: var(--ink-2); margin-top: 10px; }

/* ---------- diagram visuals ---------- */
.pd-visual {
  max-width: 440px; margin: 26px auto; background: #101214; border-radius: 16px;
  padding: 14px; color: #fff; box-shadow: 0 18px 40px rgba(20, 20, 19, 0.14);
}
.pd-visual svg { border-radius: 10px; display: block; }
.pd-caption { font-size: 13px; line-height: 1.5; color: rgba(255, 255, 255, 0.82); padding: 10px 4px 2px; }
.pd-bar { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.pd-bar::-webkit-scrollbar { display: none; }
.pd-chip {
  flex: none; background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px; padding: 6px 13px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.pd-chip.on { background: #fff; border-color: #fff; color: #101214; font-weight: 600; }

/* ---------- previous / next + stuck ---------- */
.doc-pager { display: flex; gap: 16px; margin: 44px 0 28px; }
.pager {
  flex: 1 1 0; min-width: 0; border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; background: var(--surface); transition: border-color .15s ease, transform .12s ease;
}
.pager span {
  display: block; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-2); margin-bottom: 3px;
}
.pager b { font-family: var(--serif); font-size: 17px; color: var(--ink); font-weight: 600; }
.pager:hover { text-decoration: none; border-color: var(--ink); transform: translateY(-1px); }
.pager-next { text-align: right; }
.pager.is-empty { visibility: hidden; }

.doc-stuck {
  border: 1px solid var(--line); border-radius: 16px; padding: 24px 26px;
  background: var(--surface); margin: 36px 0 30px;
}
.doc-stuck-title { font-family: var(--serif); font-size: 19px; font-weight: 600; margin: 0 0 6px; }
.doc-stuck p { margin: 0 0 16px; color: var(--ink-2); font-size: 15px; }

/* search highlight */
mark.doc-hl { background: var(--hilite); color: var(--accent-ink); padding: 0 3px; border-radius: 3px; }
.doc-sub.doc-flash { animation: docFlash 1.5s ease-out; border-radius: 10px; }
@keyframes docFlash { 0% { background: var(--hilite); } 100% { background: transparent; } }

/* ---------- docs home ---------- */
.docs-home { position: relative; z-index: 1; }
.docs-hero { max-width: 780px; margin: 0 auto; padding: 68px 24px 32px; text-align: center; }
.docs-kicker {
  font-size: 11.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-2); font-weight: 600; margin: 0 0 12px;
}
.docs-hero h1 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(2.1rem, 4.8vw, 3.1rem);
  line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 14px;
}
.docs-hero-sub {
  font-size: 17px; color: var(--ink-2); margin: 0 auto 28px; max-width: 540px; line-height: 1.55;
}

.doc-search { position: relative; max-width: 560px; margin: 0 auto; text-align: left; }
.doc-search-input {
  width: 100%; height: 54px; padding: 0 20px; font-size: 16px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  box-shadow: var(--shadow);
}
.doc-search-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(20, 20, 19, 0.07); }
.doc-results {
  position: absolute; left: 0; right: 0; top: 62px; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 50px rgba(20, 20, 19, 0.12); max-height: 60vh; overflow-y: auto; padding: 8px;
}
.doc-results[hidden] { display: none; }
.doc-result { display: block; padding: 11px 14px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.doc-result:hover, .doc-result.active { background: var(--bg); text-decoration: none; }
.doc-result .r-title { font-weight: 600; font-size: 15px; }
.doc-result .r-topic { font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.doc-result .r-text { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.doc-result .r-text b { color: var(--ink); }
.doc-no-results { padding: 14px 12px; color: var(--ink-2); font-size: 14px; }

.docs-quick {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin-top: 20px;
}
.docs-quick a {
  display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.72);
  color: var(--ink); font-size: 13px; font-weight: 500;
  transition: border-color .15s ease, background .15s ease;
}
.docs-quick a:hover { border-color: var(--ink); background: var(--surface); text-decoration: none; }

.docs-home-main { max-width: 1080px; margin: 0 auto; padding: 24px 24px 88px; }
.docs-section-label {
  font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-2); font-weight: 600; margin: 0 0 18px;
}

/* topic grid (architectural editorial cards) */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.doc-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 24px 22px 22px; color: var(--ink); text-decoration: none;
  transition: border-color .18s ease, transform .16s ease, box-shadow .18s ease;
}
.doc-card:hover {
  border-color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none;
}
.doc-card-num {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; color: var(--ink-2);
  margin-bottom: 10px;
}
.doc-card h3 {
  font-family: var(--serif); font-weight: 600; font-size: 20px; line-height: 1.2;
  margin: 0 0 8px; letter-spacing: -0.01em;
}
.doc-card p { font-size: 14px; color: var(--ink-2); margin: 0; line-height: 1.55; flex: 1; }
.doc-card-go {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 16px;
  font-size: 13px; font-weight: 600; color: var(--ink);
}

/* ---------- footer ---------- */
.site-footer { position: relative; z-index: 1; border-top: 1px solid var(--line); background: var(--surface-2); }
.footer-inner { max-width: 1100px; margin: 0 auto; padding: 34px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; }
.footer-actions { display: flex; gap: 10px; }
.footer-brand { display: flex; flex-direction: column; margin-right: auto; }
.footer-brand .name { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.footer-brand .tag { font-size: 12px; color: var(--ink-2); }
.footer-lines { display: flex; flex-wrap: wrap; gap: 16px; width: 100%; font-size: 13px; }
.footer-lines a { color: var(--ink-2); }
.footer-lines a:hover { color: var(--ink); }
.legal { width: 100%; font-size: 12px; color: var(--ink-2); }

/* ---------- mobile Docs bar + panel ---------- */
.docs-mobilebar { display: none; }
.docs-panel { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .docs-onthis { display: none; }
  .docs-shell { gap: 36px; max-width: 980px; }
}
@media (max-width: 960px) {
  .docs-shell { display: block; padding: 18px 16px 80px; max-width: 720px; }
  .docs-nav { display: none; }
  .docs-main { max-width: 100%; }
  .docs-hero { padding: 48px 16px 20px; }
  .docs-home-main { padding: 18px 16px 70px; }

  .docs-mobilebar {
    position: sticky; top: 60px; z-index: 20; display: flex; gap: 10px; align-items: center;
    padding: 10px 14px; background: rgba(246, 245, 241, 0.94); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line); margin: -18px -16px 20px;
  }
  .docs-menu-btn {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 10px;
    background: var(--surface); color: var(--ink); cursor: pointer;
  }
  .docs-menu-btn .docs-menu-ico { display: block; }
  .docs-mobilebar .doc-search-input { height: 40px; border-radius: 10px; }

  .docs-panel { display: block; position: fixed; inset: 0; z-index: 60; background: var(--bg); padding: 18px; overflow-y: auto; }
  .docs-panel[hidden] { display: none; }
  .docs-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
  .docs-panel-head b { font-family: var(--serif); font-size: 1.15rem; }
  .docs-panel-close { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font: 600 13px/1 var(--sans); }
  .docs-panel ul { list-style: none; margin: 0 0 14px; padding: 0; }
  .docs-panel > ul > li { border-bottom: 1px solid var(--line-soft); }
  .docs-panel .p-topic { display: block; padding: 12px 4px; font-weight: 600; color: var(--ink); }
  .docs-panel .p-sub { display: block; padding: 7px 4px 7px 18px; font-size: 14px; color: var(--ink-2); }
  .doc-breadcrumb { display: none; }
  .doc-head h1 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .flora .bob, .flora .sway { animation: none !important; }
  .pd-visual * { transition: none !important; }
}
@media (max-width: 560px) {
  .docs-topbar-inner { padding: 0 16px; }
  .docs-brand-tag { display: none; }
  .docs-top-links { gap: 12px; font-size: 13px; }
  .docs-flora { display: block; }
  .docs-main { background: var(--surface); border-radius: 16px; padding: 22px 18px; box-shadow: var(--shadow); }
  .docs-flora .flora { opacity: 0.36; transform: scale(0.6); }
  .docs-flora .flora.l { left: -8px; }
  .docs-flora .flora.r { right: -8px; }
  .docs-flora .f-1 { top: 4vh; }
  .docs-flora .f-2 { top: 27vh; transform: scaleX(-1) scale(0.6); }
  .docs-flora .f-3 { top: 46vh; }
  .docs-flora .f-4 { top: 66vh; transform: scaleX(-1) scale(0.6); }
  .docs-flora .m-only { display: block; opacity: 0.34; }
  .docs-flora .m-1 { top: 15vh; left: -6px; transform: scale(0.5); }
  .docs-flora .m-2 { top: 35vh; right: -6px; transform: scaleX(-1) scale(0.5); }
  .docs-flora .m-3 { top: 55vh; left: -6px; transform: scale(0.52); }
  .docs-flora .m-4 { top: 82vh; right: -6px; transform: scaleX(-1) scale(0.52); }
}
